bastion

package
v1.31.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAdmin      = "admin"
	UserDefault    = "default"
	CommentDefault = "created by sshportal"
)
View Source
const (
	Reset   = "\033[0m"
	Bold    = "\033[1m"
	FgGreen = "\033[32m"
	FgRed   = "\033[31m"
	FgMag   = "\033[35m"
)
View Source
const (
	FlagCommentName  = "comment"
	FlagCommentUsage = "Adds a comment"
	FlagLatestName   = "latest"
	FlagQuietUsage   = "Only display IDs"
	FlagQuietName    = "quiet"
	FlagInspectName  = "inspect"
	UserAdminName    = "admin"
	FlagLimitName    = "limit"
	FlagLimitUsage   = "Limit the number of item to display (0 for no limit)"
	FlagLimitDefault = 250
)
View Source
const ACLHookTimeout = 2 * time.Second

ACLHookTimeout is timeout for external ACL hook execution

Variables

View Source
var DefaultChannelHandler gliderssh.ChannelHandler = func(srv *gliderssh.Server, conn *ssh.ServerConn, newChan ssh.NewChannel, ctx gliderssh.Context) {}

Functions

func ChannelHandler

func ChannelHandler(srv *gliderssh.Server, conn *ssh.ServerConn, newChan ssh.NewChannel, ctx gliderssh.Context)

func DBInit

func DBInit(db *gorm.DB, aesKey string) error

func FetchPaginated added in v1.31.0

func FetchPaginated[T any](
	queryBuilder *gorm.DB,
	limit int,
	batchSize int,
	getID func(T) uint,
) ([]T, error)

FetchPaginated retrieves records in batches, using cursor-based pagination on the ID (avoids costly OFFSETs on large tables). limit == 0 will fetch all data (with batchSize). limit > 0 will stop as soon as `limit` results are fetched.

func FormatCount added in v1.31.0

func FormatCount(fetched int, total int64) string

func MigrateToGCMCipher

func MigrateToGCMCipher(db *gorm.DB, aesKey string) error

func NewLogChannel

func NewLogChannel(channel ssh.Channel, writer io.WriteCloser) *logChannel

func PasswordAuthHandler

func PasswordAuthHandler(db *gorm.DB, logsLocation, aclCheckCmd, aesKey, dbDriver, dbURL, bindAddr string, demo bool) gliderssh.PasswordHandler

func PrivateKeyFromDB

func PrivateKeyFromDB(db *gorm.DB, aesKey string) func(*gliderssh.Server) error

func PublicKeyAuthHandler

func PublicKeyAuthHandler(db *gorm.DB, logsLocation, aclCheckCmd, aesKey, dbDriver, dbURL, bindAddr string, demo bool) gliderssh.PublicKeyHandler

func ShellHandler

func ShellHandler(s gliderssh.Session, version, gitSha, gitTag string)

func StartSessionCleanupJob added in v1.31.0

func StartSessionCleanupJob(db *gorm.DB, interval time.Duration, retentionDuration time.Duration)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL