server

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChannelSession refers to a type of SSH channel that is established between a client and a server for interactive
	// shell sessions or command execution. SSH channels are used to multiplex multiple logical communication channels
	// over a single SSH connection.
	//
	// Check www.ietf.org/rfc/rfc4254.txt at section 6.1 for more information.
	ChannelSession string = "session"
	// ChannelDirectTcpip is the channel type in SSH is used to establish a direct TCP/IP connection between the SSH
	// client and a target host through the SSH server. This channel type allows the client to initiate a connection to
	// a specific destination host and port, and the SSH server acts as a bridge to facilitate this connection.
	//
	// Check www.ietf.org/rfc/rfc4254.txt at section 7.2 for more information.
	ChannelDirectTcpip string = "direct-tcpip"
)

SSH channels supported by the SSH server.

An SSH channel refers to a communication link established between a client and a server. SSH channels are multiplexed over a single encrypted connection, facilitating concurrent and secure communication for various purposes.

SSH_MSG_CHANNEL_OPEN

Check www.ietf.org/rfc/rfc4254.txt for more information.

View Source
const (
	// RequestTypeShell is the request type for shell.
	RequestTypeShell = "shell"
	// RequestTypeExec is the request type for exec.
	RequestTypeExec = "exec"
	// RequestTypeSubsystem is the request type for any subsystem.
	RequestTypeSubsystem = "subsystem"
	// RequestTypeUnknown is the request type for unknown.
	//
	// It is not a valid request type documentated by SSH's RFC, but it can be useful to identify the request type when
	// it is not known.
	RequestTypeUnknown = "unknown"
)

List of request types that are supported by SSH.

Once the session has been set up, a program is started at the remote end. The program can be a shell, an application program, or a subsystem with a host-independent name. Only one of these requests can succeed per channel.

Check www.ietf.org/rfc/rfc4254.txt at section 6.5 for more information.

View Source
const (
	// SFTPSubsystemName is the name of the SFTP subsystem.
	SFTPSubsystemName = "sftp"
)

List of SSH subsystems names supported by the agent.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Sessions sync.Map
	// contains filtered or unexported fields
}

func NewServer

func NewServer(api client.Client, authData *models.DeviceAuthResponse, privateKey string, keepAliveInterval uint, singleUserPassword string, mode modes.Mode) *Server

NewServer creates a new server SSH agent server.

func (*Server) CloseSession

func (s *Server) CloseSession(id string)

func (*Server) HandleConn

func (s *Server) HandleConn(conn net.Conn)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) SetContainerID added in v0.13.0

func (s *Server) SetContainerID(id string)

func (*Server) SetDeviceName

func (s *Server) SetDeviceName(name string)

type Type added in v0.13.0

type Type string

Type is the type of SSH session.

const (
	// SessionTypeShell is the session's type returned when the SSH client requests a shell.
	SessionTypeShell Type = "shell"
	// SessionTypeHeredoc is the session's type returned when the SSH client requests a command execution with a heredoc.
	// "heredoc" is a format that does not require a TTY, but attaches the client input to the command's stdin.
	// It is used to execute a sequence of commands in a single SSH connection without the need to open a shell.
	SessionTypeHeredoc Type = "heredoc"
	// SessionTypeExec is the session's type returned when the SSH client requests a command execution.
	SessionTypeExec Type = "exec"
	// SessionTypeSubsystem is the session's type returned when the SSH client requests a subsystem.
	SessionTypeSubsystem Type = "subsystem"
	// SessionTypeUnknown is the session's type returned when the SSH client requests an unknown session type.
	SessionTypeUnknown Type = "unknown"
)

func GetSessionType added in v0.13.0

func GetSessionType(session gliderssh.Session) (Type, error)

GetSessionType returns the session's type based on the SSH client session.

Directories

Path Synopsis
Package mode defines the interfaces used by the server to determine how to handle authentication and sessions.
Package mode defines the interfaces used by the server to determine how to handle authentication and sessions.
connector
Package connector defines methods for authentication and sessions handles to SSH when it is running in connector mode.
Package connector defines methods for authentication and sessions handles to SSH when it is running in connector mode.
host
Package host defines authentication and sessions handles to SSH when it is running in host mode.
Package host defines authentication and sessions handles to SSH when it is running in host mode.

Jump to

Keyboard shortcuts

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