message

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelID

type ChannelID *uint64

ChannelID is the ID of an SSH channel

func MakeChannelID added in v0.9.1

func MakeChannelID(n uint64) ChannelID

type ConnectionID

type ConnectionID string

ConnectionID is an opaque, globally unique identifier for a connection made to the SSH server

type Message

type Message struct {
	// ConnectionID is an opaque ID of the connection
	ConnectionID ConnectionID `json:"connectionId" yaml:"connectionId"`
	// Timestamp is a nanosecond timestamp when the message was created
	Timestamp int64 `json:"timestamp" yaml:"timestamp"`
	// Type of the Payload object
	MessageType Type `json:"type" yaml:"type"`
	// Payload is always a pointer to a payload object.
	Payload Payload `json:"payload" yaml:"payload"`
	// ChannelID is a identifier for an SSH channel, if applicable. -1 otherwise.
	ChannelID ChannelID `json:"channelId" yaml:"channelId"`
}

Message is a basic element of audit logging. It contains the basic records of an interaction.

func (Message) Equals

func (m Message) Equals(other Message) bool

Equals is a method to compare two messages with each other

type Payload

type Payload interface {
	// Equals compares if the current payload is identical to the provided other payload.
	Equals(payload Payload) bool
}

Payload is an interface that makes sure all payloads with Message have a method to compare them.

type PayloadAuthPassword

type PayloadAuthPassword struct {
	Username string `json:"username" yaml:"username"`
	Password []byte `json:"password" yaml:"password"`
}

PayloadAuthPassword is a payload for a message that indicates an authentication attempt, successful, or failed

authentication.

func (PayloadAuthPassword) Equals

func (p PayloadAuthPassword) Equals(other Payload) bool

Equals compares two PayloadAuthPassword payloads.

type PayloadAuthPasswordBackendError

type PayloadAuthPasswordBackendError struct {
	Username string `json:"username" yaml:"username"`
	Password []byte `json:"password" yaml:"password"`
	Reason   string `json:"reason" yaml:"reason"`
}

PayloadAuthPasswordBackendError is a payload for a message that indicates a backend failure during authentication.

func (PayloadAuthPasswordBackendError) Equals

Equals compares two PayloadAuthPasswordBackendError payloads.

type PayloadAuthPubKey

type PayloadAuthPubKey struct {
	Username string `json:"username" yaml:"username"`
	Key      string `json:"key" yaml:"key"`
}

PayloadAuthPubKey is a payload for a public key based authentication

func (PayloadAuthPubKey) Equals

func (p PayloadAuthPubKey) Equals(other Payload) bool

Equals compares two PayloadAuthPubKey payloads

type PayloadAuthPubKeyBackendError

type PayloadAuthPubKeyBackendError struct {
	Username string `json:"username" yaml:"username"`
	Key      string `json:"key" yaml:"key"`
	Reason   string `json:"reason" yaml:"reason"`
}

PayloadAuthPubKeyBackendError is a payload for a message indicating that there was a backend error while

authenticating with public key.

func (PayloadAuthPubKeyBackendError) Equals

func (p PayloadAuthPubKeyBackendError) Equals(other Payload) bool

Equals compares two PayloadAuthPubKeyBackendError payloads

type PayloadChannelRequestDecodeFailed

type PayloadChannelRequestDecodeFailed struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	RequestType string `json:"requestType" yaml:"requestType"`
	Payload     []byte `json:"payload" yaml:"payload"`
	Reason      string `json:"reason" yaml:"reason"`
}

PayloadChannelRequestDecodeFailed is a payload that signals a supported request that the server was unable to decode.

func (PayloadChannelRequestDecodeFailed) Equals

Equals compares two PayloadChannelRequestDecodeFailed payloads.

type PayloadChannelRequestExec

type PayloadChannelRequestExec struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Program string `json:"program" yaml:"program"`
}

PayloadChannelRequestExec is a payload signaling the request to execute a program.

func (PayloadChannelRequestExec) Equals

func (p PayloadChannelRequestExec) Equals(other Payload) bool

Equals compares two PayloadChannelRequestExec payloads.

type PayloadChannelRequestPty

type PayloadChannelRequestPty struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Term     string `json:"term" yaml:"term"`
	Columns  uint32 `json:"columns" yaml:"columns"`
	Rows     uint32 `json:"rows" yaml:"rows"`
	Width    uint32 `json:"width" yaml:"width"`
	Height   uint32 `json:"height" yaml:"height"`
	ModeList []byte `json:"modelist" yaml:"modelist"`
}

PayloadChannelRequestPty is a payload signaling the request for an interactive terminal.

func (PayloadChannelRequestPty) Equals

func (p PayloadChannelRequestPty) Equals(other Payload) bool

Equals compares two PayloadChannelRequestPty payloads.

type PayloadChannelRequestSetEnv

type PayloadChannelRequestSetEnv struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Name  string `json:"name" yaml:"name"`
	Value string `json:"value" yaml:"value"`
}

PayloadChannelRequestSetEnv is a payload signaling the request for an environment variable.

func (PayloadChannelRequestSetEnv) Equals

func (p PayloadChannelRequestSetEnv) Equals(other Payload) bool

Equals compares two PayloadChannelRequestSetEnv payloads.

type PayloadChannelRequestShell

type PayloadChannelRequestShell struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`
}

PayloadChannelRequestShell is a payload signaling a request for a shell.

func (PayloadChannelRequestShell) Equals

func (p PayloadChannelRequestShell) Equals(other Payload) bool

Equals compares two PayloadChannelRequestShell payloads.

type PayloadChannelRequestSignal

type PayloadChannelRequestSignal struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Signal string `json:"signal" yaml:"signal"`
}

PayloadChannelRequestSignal is a payload signaling a signal request to be sent to the currently running program.

func (PayloadChannelRequestSignal) Equals

func (p PayloadChannelRequestSignal) Equals(other Payload) bool

Equals compares two PayloadChannelRequestSignal payloads.

type PayloadChannelRequestSubsystem

type PayloadChannelRequestSubsystem struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Subsystem string `json:"subsystem" yaml:"subsystem"`
}

PayloadChannelRequestSubsystem is a payload requesting a well-known subsystem (e.g. sftp)

func (PayloadChannelRequestSubsystem) Equals

Equals compares two PayloadChannelRequestSubsystem payloads.

type PayloadChannelRequestUnknownType

type PayloadChannelRequestUnknownType struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	RequestType string `json:"requestType" yaml:"requestType"`
	Payload     []byte `json:"payload" yaml:"payload"`
}

PayloadChannelRequestUnknownType is a payload signaling that a channel request was not supported.

func (PayloadChannelRequestUnknownType) Equals

Equals compares two PayloadChannelRequestUnknownType payloads.

type PayloadChannelRequestWindow

type PayloadChannelRequestWindow struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`
	Columns   uint32 `json:"columns" yaml:"columns"`
	Rows      uint32 `json:"rows" yaml:"rows"`
	Width     uint32 `json:"width" yaml:"width"`
	Height    uint32 `json:"height" yaml:"height"`
}

PayloadChannelRequestWindow is a payload requesting the change in the terminal window size.

func (PayloadChannelRequestWindow) Equals

func (p PayloadChannelRequestWindow) Equals(other Payload) bool

Equals compares two PayloadChannelRequestWindow payloads.

type PayloadConnect

type PayloadConnect struct {
	// RemoteAddr contains the IP address of the connecting user.
	RemoteAddr string `json:"remoteAddr" yaml:"remoteAddr"`
	// Country contains the country code looked up from the IP address. Contains "XX" if the lookup failed.
	Country string `json:"country" yaml:"country"`
}

PayloadConnect is the payload for TypeConnect messages.

func (PayloadConnect) Equals

func (p PayloadConnect) Equals(other Payload) bool

Equals compares two PayloadConnect datasets.

type PayloadExit added in v0.9.1

type PayloadExit struct {
	ExitStatus uint32 `json:"exitStatus" yaml:"exitStatus"`
}

PayloadExit is the payload for a message that is sent when a program exits.

func (PayloadExit) Equals added in v0.9.1

func (p PayloadExit) Equals(other Payload) bool

Equals compares two PayloadExit payloads.

type PayloadGlobalRequestUnknown

type PayloadGlobalRequestUnknown struct {
	RequestType string `json:"requestType" yaml:"requestType"`
}

PayloadGlobalRequestUnknown Is a payload for the TypeGlobalRequestUnknown messages.

func (PayloadGlobalRequestUnknown) Equals

func (p PayloadGlobalRequestUnknown) Equals(other Payload) bool

Equals Compares two PayloadGlobalRequestUnknown payloads.

type PayloadHandshakeFailed added in v0.9.2

type PayloadHandshakeFailed struct {
	Reason string `json:"reason" yaml:"reason"`
}

PayloadHandshakeFailed is a payload for a failed handshake

func (PayloadHandshakeFailed) Equals added in v0.9.2

func (p PayloadHandshakeFailed) Equals(other Payload) bool

Equals compares two PayloadHandshakeFailed payloads

type PayloadHandshakeSuccessful added in v0.9.2

type PayloadHandshakeSuccessful struct {
	Username string `json:"username" yaml:"username"`
}

PayloadAuthPubKey is a payload for a successful handshake

func (PayloadHandshakeSuccessful) Equals added in v0.9.2

func (p PayloadHandshakeSuccessful) Equals(other Payload) bool

Equals compares two PayloadHandshakeSuccessful payloads

type PayloadIO

type PayloadIO struct {
	Stream Stream `json:"stream" yaml:"stream"`
	Data   []byte `json:"data" yaml:"data"`
}

PayloadIO The payload for I/O message types containing the data stream from/to the application.

func (PayloadIO) Equals

func (p PayloadIO) Equals(other Payload) bool

Equals Compares two PayloadIO objects

type PayloadNewChannel

type PayloadNewChannel struct {
	ChannelType string `json:"channelType" yaml:"channelType"`
}

PayloadNewChannel is a payload that signals a request for a new SSH channel

func (PayloadNewChannel) Equals

func (p PayloadNewChannel) Equals(other Payload) bool

Equals compares two PayloadNewChannel payloads.

type PayloadNewChannelFailed

type PayloadNewChannelFailed struct {
	ChannelType string `json:"channelType" yaml:"channelType"`
	Reason      string `json:"reason" yaml:"reason"`
}

PayloadNewChannelFailed is a payload that signals that a request for a new channel has failed.

func (PayloadNewChannelFailed) Equals

func (p PayloadNewChannelFailed) Equals(other Payload) bool

Equals compares two PayloadNewChannelFailed payloads.

type PayloadNewChannelSuccessful

type PayloadNewChannelSuccessful struct {
	ChannelType string `json:"channelType" yaml:"channelType"`
}

PayloadNewChannelSuccessful is a payload that signals that a channel request was successful.

func (PayloadNewChannelSuccessful) Equals

func (p PayloadNewChannelSuccessful) Equals(other Payload) bool

Equals compares two PayloadNewChannelSuccessful payloads.

type PayloadRequestFailed added in v0.9.1

type PayloadRequestFailed struct {
	RequestID uint64 `json:"requestId" yaml:"reason"`
	Reason    string `json:"reason" yaml:"reason"`
}

PayloadRequestFailed is the payload for the TypeRequestFailed messages.

func (PayloadRequestFailed) Equals added in v0.9.1

func (p PayloadRequestFailed) Equals(other Payload) bool

Equals compares two PayloadRequestFailed datasets.

type Stream

type Stream uint

Stream The stream type corresponds to the file descriptor numbers common in UNIX systems for standard input, output,

and error.
const (
	// StreamStdin Is the ID of the standard input that accepts data from the user.
	StreamStdin Stream = 0
	// StreamStdout Is the ID for the output stream containing normal messages or TTY-encoded data from the application.
	StreamStdout Stream = 1
	// StreamStderr Is the ID for the standard error containing the error messages for the application in non-TTY mode.
	StreamStderr Stream = 2
)

type Type

type Type int32

Type Is the ID for the message type describing which payload is in the message.

const (
	// TypeConnect describes a message that is sent when the user connects on a TCP level.
	TypeConnect Type = 0
	// TypeDisconnect describes a message that is sent when the user disconnects on a TCP level.
	TypeDisconnect Type = 1
	// TypeAuthPassword describes a message that is sent when the user submits a username and password.
	TypeAuthPassword Type = 100
	// TypeAuthPasswordSuccessful describes a message that is sent when the submitted username and password were valid.
	TypeAuthPasswordSuccessful Type = 101
	// TypeAuthPasswordFailed describes a message that is sent when the submitted username and password were invalid.
	TypeAuthPasswordFailed Type = 102
	// TypeAuthPasswordBackendError describes a message that is sent when the auth server failed to respond to a request
	//                              with username and password
	TypeAuthPasswordBackendError Type = 103
	// TypeAuthPubKey describes a message that is sent when the user submits a username and public key.
	TypeAuthPubKey Type = 104
	// TypeAuthPubKeySuccessful describes a message that is sent when the submitted username and public key were invalid.
	TypeAuthPubKeySuccessful Type = 105
	// TypeAuthPubKeyFailed describes a message that is sent when the submitted username and public key were invalid.
	TypeAuthPubKeyFailed Type = 106
	// TypeAuthPubKeyBackendError describes a message that is sent when the auth server failed to respond with username
	//                            and password.
	TypeAuthPubKeyBackendError Type = 107
	// TypeHandshakeFailed indicates that the handshake has failed.
	TypeHandshakeFailed Type = 198
	// TypeHandshakeSuccessful indicates that the handshake and authentication was successful.
	TypeHandshakeSuccessful Type = 199
	// TypeGlobalRequestUnknown describes a message when a global (non-channel) request was sent that was not recognized.
	TypeGlobalRequestUnknown Type = 200
	// TypeNewChannel describes a message that indicates a new channel request
	TypeNewChannel Type = 300
	// TypeNewChannelSuccessful describes a message when the new channel request was successful
	TypeNewChannelSuccessful Type = 301
	// TypeNewChannelFailed describes a message when the channel request failed for the reason indicated
	TypeNewChannelFailed Type = 302
	// TypeChannelRequestUnknownType describes an in-channel request from the user that is not supported
	TypeChannelRequestUnknownType Type = 400
	// TypeChannelRequestDecodeFailed describes an in-channel request from the user that is supported but the payload
	//                                could not be decoded.
	TypeChannelRequestDecodeFailed Type = 401
	// TypeChannelRequestSetEnv describes an in-channel request to set an environment variable
	TypeChannelRequestSetEnv Type = 402
	// TypeChannelRequestExec describes an in-channel request to run a program
	TypeChannelRequestExec Type = 403
	// TypeChannelRequestPty describes an in-channel request to create an interactive terminal
	TypeChannelRequestPty Type = 404
	// TypeChannelRequestShell describes an in-channel request to start a shell
	TypeChannelRequestShell Type = 405
	// TypeChannelRequestSignal describes an in-channel request to send a signal to the currently running program
	TypeChannelRequestSignal Type = 406
	// TypeChannelRequestSubsystem describes an in-channel request to start a well-known subsystem (e.g. SFTP)
	TypeChannelRequestSubsystem Type = 407
	// TypeChannelRequestWindow describes an in-channel request to resize the current interactive terminal
	TypeChannelRequestWindow Type = 408
	// TypeExit describes a message that is sent when the program exited. The payload contains the exit status.
	TypeExit Type = 499
	// TypeIO describes the data transferred to and from the currently running program on the terminal.
	TypeIO Type = 500
	// TypeRequestFailed describes that a request has failed.
	TypeRequestFailed Type = 501
)

func (Type) ToName

func (messageType Type) ToName() string

ToName converts the numeric message type to a string representation for human consumption.

Jump to

Keyboard shortcuts

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