Expand description
SSH to a server’s own system (a Proxmox VE node, say): with a key the caller keeps at a path
it chooses (ensure_key), the server’s host keys trusted on first use (known_hosts) and
checked strictly from then on. Every ssh, ssh-keygen and ssh-keyscan runs through the
context’s ProcessRunner.
Which keys a user is shown and how they confirm them is the caller’s: known_hosts::offered
reads what a server offers, known_hosts::confirm writes the ones confirmed.
Modules§
- known_
hosts - A server’s SSH host keys, trusted on first use: the keys it offers are read (
ssh-keyscan) and given to the caller with their SHA-256 fingerprints, asssh-keygen -lfand the server’s own console show them; once the caller confirms them (a user who compared them, say), they are written to aknown_hostsfile the caller names, and everyTargetchecks them strictly. A server offering other keys is refused until the new ones are confirmed.
Structs§
- Password
- A password ssh is answered with, through its askpass hook: a script written into
askpass_dir(the caller’s own folder, never a shared temporary one) that prints the password ssh is given in its environment. Never shown byDebug. - Target
- Where to SSH, and as whom.
Enums§
- SshError
- Why an SSH step failed.
Functions§
- batch_
options - The
-ovalues of an SSH that runs unattended: only the host keys inknown_hostsare accepted (a host with none or another is refused, never pinned silently), no prompt, a short connect timeout, and keepalives, so a server that stops answering mid-command ends it in under a minute. - config_
path - A path as the value of an ssh
-o Key=valueoption. OpenSSH splits option values into words (on whitespace, honouring quotes and backslash escapes) and expands%tokens in file paths: unescaped, a path with a space (~/Library/Application Support/…) became two files. Escaped here so ssh reads the path back verbatim (a tab can’t be escaped this way). - ensure_
key - The key at
path, made when there is none (ssh-keygen -t ed25519, no passphrase,commentas its comment), and its public half, one line. A key already there is kept as it is: servers that trust it keep working. - public_
half - Where the public half of the key at
pathis (<path>.pub). - sh_
quote ssingle-quoted for a POSIX shell (the remote command’s).