feat: the managing client and sshd's per-source penalties (NetOrk/netork#1800) #63

Merged
christianmanivong merged 1 commits from feat/ssh-penalties-1800 into main 2026-10-31 23:29:09 +00:00
1 Commits
Author SHA1 Message Date
christianmanivong 5fffb3b886 feat: the managing client and sshd's per-source penalties (NetOrk/netork#1800)
driver / standard (pull_request) Failing after 9s
driver / lint (pull_request) Successful in 22s
driver / types (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / test (3.13) (pull_request) Successful in 1m7s
driver / lowest (pull_request) Successful in 33s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Failing after 2m24s
driver / publish (pull_request) Skipped
OpenSSH 9.8+ penalises a source whose connections do not authenticate --
a scanner's probes -- and then drops every connection from it, the
managing client's included.

- OpenSshServerMixin.exempt_from_ssh_penalties puts the address the host
  sees the client at ($SSH_CONNECTION) into PerSourcePenaltyExemptList,
  next to the host's own exemptions, in its own drop-in. Only where sshd
  has the penalties (an older one refuses the directive) and includes the
  drop-in directory; checked with sshd -t, sshd -T and a new session, and
  taken back on any failure. The check-and-restore step of
  harden_ssh_server is shared for it.
- retry_refused tries a connection again after 1, 3, 7 and 15 s while
  sshd closes it before its banner; HostKeyCheck.connect uses it.
2026-11-01 00:24:11 +01:00