Documentation ¶
Index ¶
- Constants
- Variables
- func AssignUser(database db.DB, externalAddress url.URL) func(next ssh.Handler) ssh.Handler
- func BlockIfNoPublicKey(next ssh.Handler) ssh.Handler
- func WithAuthorizedKeys(authorizedKeys []ssh.PublicKey) func(next ssh.Handler) ssh.Handler
- func WithLogger(next ssh.Handler) ssh.Handler
- func WithRequestID(next ssh.Handler) ssh.Handler
- func WithSessionMetrics(next ssh.Handler) ssh.Handler
- type Confirm
- type DeleteFlags
- type Notification
- type Service
- type SessionHandler
- func (h *SessionHandler) DeleteFile(sesh *UserSession, file *snips.File)
- func (h *SessionHandler) DownloadFile(sesh *UserSession, file *snips.File)
- func (h *SessionHandler) FileRequest(sesh *UserSession)
- func (h *SessionHandler) HandleFunc(_ ssh.Handler) ssh.Handler
- func (h *SessionHandler) Interactive(sesh *UserSession)
- func (h *SessionHandler) SignFile(sesh *UserSession, file *snips.File)
- func (h *SessionHandler) Upload(sesh *UserSession)
- type SignFlags
- type UploadFlags
- type UserSession
- func (sesh *UserSession) Error(err error, title string, f string, v ...interface{})
- func (sesh *UserSession) IsFileRequest() bool
- func (sesh *UserSession) IsPTY() bool
- func (sesh *UserSession) PublicKeyFingerprint() string
- func (sesh *UserSession) RequestID() string
- func (sesh *UserSession) RequestedFileID() string
- func (sesh *UserSession) UserID() string
Constants ¶
View Source
const ( UploadBufferSize = 1 * 1024 // 1KB LoggerContextKey = "logger" RequestIDContextKey = "request_id" FingerprintContextKey = "fingerprint" UserIDContextKey = "user_id" FileRequestPrefix = "f:" )
Variables ¶
View Source
var ( ErrFileNotFound = errors.New("file not found") ErrFileTooLarge = errors.New("file too large") ErrNilProgram = errors.New("nil program") ErrPrivateFileAccess = errors.New("private file access") ErrUnknownCommand = errors.New("unknown command") ErrSignPublicFile = errors.New("unable to sign public file") ErrOpOnNonOwnedFile = errors.New("operation on non-owned file") )
View Source
var ( ErrFlagRequired = errors.New("flag required") ErrFlagParse = errors.New("parse error") )
Functions ¶
func AssignUser ¶
AssignUser will attempt to match a user with a public key fingerprint. If a user is not found, one will be created with the current fingerprint attached.
func BlockIfNoPublicKey ¶
BlockIfNoPublicKey will stop any SSH connections that aren't using public key authentication. If blocked, it will print a helpful message to the user.
func WithAuthorizedKeys ¶ added in v0.3.0
WithAuthorizedKeys will block any SSH connections that aren't using a public key in the authorized key list. If authorizedKeys is empty, this middleware will be a no-op.
func WithLogger ¶
WithLogger will create a logger for each SSH session.
func WithRequestID ¶
WithRequestID will generate a unique request ID for each SSH session.
Types ¶
type DeleteFlags ¶
type Notification ¶
type Notification struct { Color lipgloss.TerminalColor Title string Message string WithStyle func(s *lipgloss.Style) }
func (*Notification) Messagef ¶
func (n *Notification) Messagef(format string, v ...interface{})
func (*Notification) Render ¶
func (n *Notification) Render(sesh ssh.Session)
func (*Notification) Titlef ¶
func (n *Notification) Titlef(format string, v ...interface{})
type SessionHandler ¶
func (*SessionHandler) DeleteFile ¶
func (h *SessionHandler) DeleteFile(sesh *UserSession, file *snips.File)
func (*SessionHandler) DownloadFile ¶
func (h *SessionHandler) DownloadFile(sesh *UserSession, file *snips.File)
func (*SessionHandler) FileRequest ¶
func (h *SessionHandler) FileRequest(sesh *UserSession)
func (*SessionHandler) HandleFunc ¶
func (h *SessionHandler) HandleFunc(_ ssh.Handler) ssh.Handler
func (*SessionHandler) Interactive ¶
func (h *SessionHandler) Interactive(sesh *UserSession)
func (*SessionHandler) SignFile ¶
func (h *SessionHandler) SignFile(sesh *UserSession, file *snips.File)
func (*SessionHandler) Upload ¶
func (h *SessionHandler) Upload(sesh *UserSession)
type UploadFlags ¶
type UserSession ¶
func (*UserSession) Error ¶
func (sesh *UserSession) Error(err error, title string, f string, v ...interface{})
func (*UserSession) IsFileRequest ¶
func (sesh *UserSession) IsFileRequest() bool
func (*UserSession) IsPTY ¶
func (sesh *UserSession) IsPTY() bool
func (*UserSession) PublicKeyFingerprint ¶
func (sesh *UserSession) PublicKeyFingerprint() string
func (*UserSession) RequestID ¶
func (sesh *UserSession) RequestID() string
func (*UserSession) RequestedFileID ¶
func (sesh *UserSession) RequestedFileID() string
func (*UserSession) UserID ¶
func (sesh *UserSession) UserID() string
Click to show internal directories.
Click to hide internal directories.