Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEncoder ¶
NewEncoder creates a new audit log encoder of the specified format.
func NewStorage ¶
NewStorage creates a new audit log storage of the specified type and with the specified configuration.
Types ¶
type Channel ¶
type Channel interface {
// OnRequestUnknown creates an audit log message for a channel request that is not supported.
OnRequestUnknown(requestType string)
// OnRequestDecodeFailed creates an audit log message for a channel request that is supported but could not be
// decoded.
OnRequestDecodeFailed(requestType string, reason string)
// OnRequestSetEnv creates an audit log message for a channel request to set an environment variable.
OnRequestSetEnv(name string, value string)
// OnRequestExec creates an audit log message for a channel request to execute a program.
OnRequestExec(program string)
// OnRequestPty creates an audit log message for a channel request to create an interactive terminal.
OnRequestPty(columns uint, rows uint)
// OnRequestExec creates an audit log message for a channel request to execute a shell.
OnRequestShell()
// OnRequestExec creates an audit log message for a channel request to send a signal to the currently running
// program.
OnRequestSignal(signal string)
// OnRequestExec creates an audit log message for a channel request to execute a well-known subsystem (e.g. SFTP)
OnRequestSubsystem(subsystem string)
// OnRequestWindow creates an audit log message for a channel request to resize the current window.
OnRequestWindow(columns uint, rows uint)
// GetStdinProxy creates an intercepting audit log reader proxy for the standard input.
GetStdinProxy(stdin io.Reader) io.Reader
// GetStdinProxy creates an intercepting audit log writer proxy for the standard output.
GetStdoutProxy(stdout io.Writer) io.Writer
// GetStdinProxy creates an intercepting audit log writer proxy for the standard error.
GetStderrProxy(stderr io.Writer) io.Writer
}
Channel is an audit logger for one specific hannel
type Config ¶
type Config struct {
// Format audit format
Format Format `json:"format" yaml:"format" default:"none"`
// Storage audit storage type
Storage Storage `json:"storage" yaml:"storage" default:"none"`
// File audit logger configuration
File file.Config `json:"file" yaml:"file"`
// S3 configuration
S3 s3.Config `json:"s3" yaml:"s3"`
// Intercept configures what should be intercepted
Intercept InterceptConfig `json:"intercept" yaml:"intercept"`
}
Config is the configuration structure for audit logging.
type Connection ¶
type Connection interface {
// OnDisconnect creates an audit log message for a disconnect event.
OnDisconnect()
// OnAuthPassword creates an audit log message for an authentication attempt.
OnAuthPassword(username string, password []byte)
// OnAuthPasswordSuccess creates an audit log message for a successful authentication.
OnAuthPasswordSuccess(username string, password []byte)
// OnAuthPasswordFailed creates an audit log message for a failed authentication.
OnAuthPasswordFailed(username string, password []byte)
// OnAuthPasswordBackendError creates an audit log message for an auth server (backend) error during password
// verification.
OnAuthPasswordBackendError(username string, password []byte, reason string)
// OnAuthPubKey creates an audit log message for an authentication attempt with public key.
OnAuthPubKey(username string, pubKey []byte)
// OnAuthPubKeySuccess creates an audit log message for a successful public key authentication.
OnAuthPubKeySuccess(username string, pubKey []byte)
// OnAuthPubKeyFailed creates an audit log message for a failed public key authentication.
OnAuthPubKeyFailed(username string, pubKey []byte)
// OnAuthPubKeyBackendError creates an audit log message for a failure while talking to the auth server (backend)
// during public key authentication.
OnAuthPubKeyBackendError(username string, pubKey []byte, reason string)
// OnGlobalRequestUnknown creates an audit log message for a global request that is not supported.
OnGlobalRequestUnknown(requestType string)
// OnNewChannel creates an audit log message for a new channel request.
OnNewChannel(channelType string)
// OnNewChannelFailed creates an audit log message for a failure in requesting a new channel.
OnNewChannelFailed(channelType string, reason string)
// OnNewChannelSuccess creates an audit log message for successfully requesting a new channel and returns a
// channel-specific audit logger.
OnNewChannelSuccess(channelType string) Channel
}
Connection is an audit logger for a specific connection
type Format ¶
type Format string
Format describes the audit log format in use.
const ( // FormatNone signals that no audit logging should take place. FormatNone Format = "none" // FormatBinary signals that audit logging should take place in CBOR+GZIP format // (see https://containerssh.github.io/advanced/audit/format/ ) FormatBinary Format = "binary" // FormatAsciinema signals that audit logging should take place in Asciicast v2 format // (see https://github.com/asciinema/asciinema/blob/develop/doc/asciicast-v2.md ) FormatAsciinema Format = "asciinema" )
type InterceptConfig ¶
type InterceptConfig struct {
// Stdin signals that the standard input from the user should be captured.
Stdin bool `json:"stdin" yaml:"stdin" default:"false"`
// Stdout signals that the standard output to the user should be captured.
Stdout bool `json:"stdout" yaml:"stdout" default:"false"`
// Stderr signals that the standard error to the user should be captured.
Stderr bool `json:"stderr" yaml:"stderr" default:"false"`
// Passwords signals that passwords during authentication should be captured.
Passwords bool `json:"passwords" yaml:"passwords" default:"false"`
}
InterceptConfig configures what should be intercepted by the auditing facility.
type Logger ¶
type Logger interface {
// OnConnect creates an audit log message for a new connection and simultaneously returns a connection object for
// connection-specific messages
OnConnect(connectionID message.ConnectionID, ip net.TCPAddr) (Connection, error)
// Shutdown triggers all failing uploads to cancel, waits for all currently running uploads to finish, then returns.
// When the shutdownContext expires it will do its best to immediately upload any running background processes.
Shutdown(shutdownContext context.Context)
}
Logger is a top level audit logger.
type Storage ¶
type Storage string
Storage describes the storage backend to use.
const ( // StorageNone signals that no storage should be used. StorageNone Storage = "none" // StorageFile signals that audit logs should be stored in a local directory. StorageFile Storage = "file" // StorageS3 signals that audit logs should be stored in an S3-compatible object storage. StorageS3 Storage = "s3" )
Click to show internal directories.
Click to hide internal directories.