connector

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package connector defines methods for authentication and sessions handles to SSH when it is running in connector mode.

Connector mode means that the SSH's server runs in the host machine, but redirect the IO to a specific docker container, maning its authentication through the container's "/etc/passwd", "/etc/shadow" and etc.

Index

Constants

This section is empty.

Variables

View Source
var ErrUserNotFound = errors.New("user not found on context")

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 connector mode.

func NewAuthenticator

func NewAuthenticator(api client.Client, docker dockerclient.APIClient, authData *models.DeviceAuthResponse, container *string) *Authenticator

NewAuthenticator creates a new instance of Authenticator for the connector mode.

func (*Authenticator) Password

func (a *Authenticator) Password(ctx gliderssh.Context, username string, password string) bool

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

func (*Authenticator) PublicKey

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

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

type Mode added in v0.14.0

type Mode struct {
	Authenticator
	Sessioner
}

type Sessioner

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

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

func NewSessioner

func NewSessioner(container *string, docker dockerclient.APIClient) *Sessioner

NewSessioner creates a new instance of Sessioner for the connector mode. The container 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 connector 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 connector 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(_ gliderssh.Session) error

SFTP handles the SSH's server sftp session when server is running in connector 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 handles the server's SSH shell session when server is running in connector mode.

Jump to

Keyboard shortcuts

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