sshlib

package
v0.0.0-db80831 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidConfig is returned when the configuration is invalid
	ErrInvalidConfig = errors.New("invalid configuration")
	// ErrAuthenticationFailed is returned when authentication fails
	ErrAuthenticationFailed = errors.New("authentication failed")
)

Functions

func DefaultAuthorizedKeysPath

func DefaultAuthorizedKeysPath() string

DefaultAuthorizedKeysPath returns the default path to authorized_keys

Types

type Config

type Config struct {
	ListenAddr           string
	HostKeyPath          string // Path to host key file (command line arg)
	HostKeyContent       string // Host key content (from env SSHDEV_HOST_KEY)
	HostKeyBuiltin       bool   // Use built-in host key (from env SSHDEV_HOST_KEY_BUILTIN)
	Password             string // Password for authentication (from env SSHDEV_PASSWORD)
	AuthorizedKeysFiles  string // Authorized keys file paths, colon-separated (from env SSHDEV_AUTHORIZED_KEYS_FILES)
	AuthorizedKeys       string // Authorized keys content, newline-separated (from env SSHDEV_AUTHORIZED_KEYS)
	Shell                string // Shell to use (from env SSHDEV_SHELL, empty = current user's default)
	DisablePortForward   bool   // Disable local port forwarding (direct-tcpip), default: enabled
	DisableRemoteForward bool   // Disable remote port forwarding (tcpip-forward), default: enabled
}

Config holds the server configuration

func (*Config) HasPasswordAuth

func (c *Config) HasPasswordAuth() bool

HasPasswordAuth returns true if password authentication is enabled

func (*Config) HasPublicKeyAuth

func (c *Config) HasPublicKeyAuth() bool

HasPublicKeyAuth returns true if public key authentication is enabled

func (*Config) Validate

func (c *Config) Validate(ctx context.Context) error

Validate validates the configuration

type Server

type Server interface {
	// Start starts the SSH server
	Start(ctx context.Context) error
	// Stop stops the SSH server gracefully
	Stop()
}

Server represents an SSH server

func NewServer

func NewServer(ctx context.Context, cfg *Config) (Server, error)

NewServer creates a new SSH server with the given configuration

Jump to

Keyboard shortcuts

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