Commit Graph

3 Commits (master)

Author SHA1 Message Date
John Safranek 49b90dc0a6 examples: match [host]:port known_hosts names
ClientPublicKeyCheck() takes a ClientHostCtx with the port as well as
the host. Off port 22 it looks up [host]:port, as OpenSSH writes it,
and takes a bare host line only when no [host]:port line has a key of
that type. The refusal prints the [host]:port line to add.

- a name field may be a comma list or a hashed |1|salt|hash name
- client, scpclient, sftpclient, portfwd and tpmcertclient pass the port
- client-hostkey.test covers port, fallback, comma and hashed names
2026-11-21 15:33:37 -06:00
John Safranek e08d96dad9 portfwd: check the host key against known_hosts
portfwd links the example client's common code and registers its host
key check, with the SSH server's host name as the context. -Y accepts
any key, with a warning.

- Pass -Y in fwd.test and fwd-bulk.test
- Cover a refused unknown key in client-hostkey.test

Issue: F-10587
2026-11-21 15:33:37 -06:00
John Safranek 799b9f38ca examples: check host keys against known_hosts
The client, scpclient and sftpclient accept a plain host key only when
a "host type key" line of ~/.ssh/known_hosts holds it. An unknown or
changed key is refused, printing its fingerprint and the line to add.
-Y accepts any key, with a warning.

- Check that an x509v3 host certificate names the host by DNS or IP
  subjectAltName, or by common name without one; -X waives a mismatch
- Pass -Y in the tests and CI jobs that connect to a throwaway server
- Seed known_hosts for openssh-interop.test from sshd's host keys
- Add client-hostkey.test for unknown, known, stale and changed keys

Issue: F-7620
2026-11-21 15:33:37 -06:00