Documentation
¶
Overview ¶
Package sshserver provides the shared SSH transport, SFTP, and loopback forwarding used by userland and service hosts. Shell execution belongs to the embedding host; this package contains no interpreter.
Index ¶
- func AuthorizedKeyAllowed(name string, offered ssh.PublicKey) bool
- func ListenAndServe(ctx context.Context, address string, cfg Config) error
- func Serve(ctx context.Context, ln net.Listener, cfg Config) error
- func ServeConn(ctx context.Context, conn net.Conn, config *ssh.ServerConfig, ...) error
- type Config
- type Handlers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorizedKeyAllowed ¶
AuthorizedKeyAllowed reloads the file for every authentication. This makes removal take effect immediately and keeps the key material out of process state and logs.
func ListenAndServe ¶
ListenAndServe accepts host:port or a bare port, and owns its listener.
Types ¶
type Config ¶
type Config struct {
AuthorizedKeysPath string
HostKey ssh.Signer
// Execute runs a command using the embedding host's shell. A nil callback
// disables exec; SFTP and loopback forwarding remain available.
Execute func(context.Context, string, io.Reader, io.Writer, io.Writer) uint32
}
Config supplies a standalone key-authenticated SSH listener. Only the current OS user can authenticate. AuthorizedKeysPath defaults to ~/.ssh/authorized_keys.
type Handlers ¶
type Handlers struct {
AllowRemoteForward bool
Session func(context.Context, *ssh.ServerConn, ssh.Channel, <-chan *ssh.Request)
Channel func(context.Context, ssh.NewChannel)
}
Handlers lets service hosts reuse the SSH connection and forwarding lifecycle with their existing authentication, session, and destination policies.