Documentation
¶
Overview ¶
Package sshclient runs commands with the system OpenSSH client, using explicit identities and pinned host keys.
Index ¶
- func Fingerprint(ctx context.Context, id Identity, tempRoot string) (string, error)
- func HostFingerprint(key string) (string, error)
- func ScanHostKey(ctx context.Context, host string, port int) (string, error)
- func Validate(c *Config) error
- func ValidateAddress(c *Config) error
- type Config
- type Identity
- type Session
- type Shell
- type System
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fingerprint ¶
Fingerprint validates an imported private key using OpenSSH without putting its passphrase in argv.
func HostFingerprint ¶
func ScanHostKey ¶
ScanHostKey fetches the host's public key for trust on first use, preferring ed25519, then ECDSA, then RSA.
func ValidateAddress ¶
ValidateAddress checks everything except the host key, for hosts whose key is trusted on first connection.
Types ¶
type Session ¶
type Session struct {
Config Config
// contains filtered or unexported fields
}
type Shell ¶
type Shell struct {
Stdin io.WriteCloser
Stdout io.Reader
// contains filtered or unexported fields
}
Shell is an interactive login shell with a pseudo-terminal, for the browser console. Scripted work keeps using Run with the OpenSSH client.
type System ¶
type System struct {
Host string
Port int // 0 uses ~/.ssh/config or 22
User string // "" uses ~/.ssh/config or the local user name
// ConfigFile replaces ~/.ssh/config, for example in CI.
ConfigFile string
// IdentityFile is the only private key offered when set. A key with a
// passphrase must be loaded into ssh-agent: Korta never prompts.
IdentityFile string
}
System connects with the user's own OpenSSH setup: ~/.ssh/config, ssh-agent and ~/.ssh/known_hosts. Unknown or changed host keys are refused rather than trusted, and it never asks for passwords.