Skip to main content

Module ssh_config

Module ssh_config 

Source
Expand description

The hosts this machine’s ssh already knows how to reach.

Everything here reads what OpenSSH reads, and nothing here decides how to connect. The transport is ssh <host> -s sftp, so authentication, ProxyJump, User, Port and the rest are OpenSSH’s to resolve and this daemon’s only job is to name the host. Reimplementing any of that would produce a second, worse copy of a file the user has already got right.

Two separate things live here for that reason. Parsing the file answers “which hosts exist”, which is a question about names and is worth doing locally. Answering “what does this host resolve to” is ssh -G’s job, because the resolution rules — first match wins, Match blocks, Include, canonicalisation — are not something to reimplement for the sake of a line in a popup.

Structs§

Found
What a parse found: the hosts that can be served, and the ones that cannot.
Host
A host named in ssh_config, and the alias it would be served under.
Settings
What OpenSSH resolves a host to, for showing beside it.
Unusable
A host that exists but cannot be served, and why.

Functions§

default_path
~/.ssh/config, wherever this user’s home is.
describe
Ask OpenSSH what a host resolves to.
parse
The hosts named by an ssh_config’s text.
parse_settings
Read ssh -G output into the handful of fields worth showing.
read
Read the user’s ssh_config and every file it includes.
read_from
The same, from a named file. Split out so tests have a way in.