host

package
v0.13.5-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package host defines authentication and sessions handles to SSH when it is running in host mode.

Host mode means that the SSH's server runs in the host machine, using the host "/etc/passwd", "/etc/shadow", redirecting the SSH's connection to the device sdin, stdout and stderr and other things needed to run the SSH's server in the host machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

Authenticator implements the Authenticator interface when the server is running in host mode.

func NewAuthenticator

func NewAuthenticator(api client.Client, authData *models.DeviceAuthResponse, singleUserPassword string, deviceName *string) *Authenticator

NewAuthenticator creates a new instance of Authenticator for the host mode. It receives the api client to perform requests to the ShellHub's API, the authentication data received by the agent when started the communication between it and the agent, the singleUserPassword, what indicates is is running at this mode and the deviceName.

The deviceName is a pointer to a string because when the server is created, we don't know the device name yet, that is set later.

func (*Authenticator) Password

func (a *Authenticator) Password(ctx gliderssh.Context, _ string, pass string) bool

Password handles the server's SSH password authentication when server is running in host mode.

func (*Authenticator) PublicKey

func (a *Authenticator) PublicKey(ctx gliderssh.Context, _ string, key gliderssh.PublicKey) bool

PublicKey handles the server's SSH public key authentication when server is running in host mode.

type Sessioner

type Sessioner struct {
	// contains filtered or unexported fields
}

Sessioner implements the Sessioner interface when the server is running in host mode.

func NewSessioner

func NewSessioner(deviceName *string, cmds map[string]*exec.Cmd) *Sessioner

NewSessioner creates a new instance of Sessioner for the host mode. The device name is a pointer to a string because when the server is created, we don't know the device name yet, that is set later.

func (*Sessioner) Exec

func (s *Sessioner) Exec(session gliderssh.Session) error

Exec handles the SSH's server exec session when server is running in host mode.

func (*Sessioner) Heredoc

func (s *Sessioner) Heredoc(session gliderssh.Session) error

Heredoc handles the server's SSH heredoc session when server is running in host mode.

heredoc is special block of code that contains multi-line strings that will be redirected to a stdin of a shell. It request a shell, but doesn't allocate a pty.

func (*Sessioner) SFTP

func (s *Sessioner) SFTP(session gliderssh.Session) error

SFTP handles the SSH's server sftp session when server is running in host mode.

sftp is a subsystem of SSH that allows file operations over SSH.

func (*Sessioner) Shell

func (s *Sessioner) Shell(session gliderssh.Session) error

Shell manages the SSH shell session of the server when operating in host mode.

Jump to

Keyboard shortcuts

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