fail2ban sshd jail counts zero failures on new Ubuntu/OpenSSH 10: journal match is _COMM=sshd but logins are logged by sshd-session
Setup: Ubuntu 26.10, OpenSSH_10.5p1, fail2ban from apt, [sshd] enabled = true, backend = systemd.
Symptom: fail2ban is active and fail2ban-client status sshd looks healthy, but Total failed stays at 0 while the SSH log shows dozens of Invalid user ... lines per minute from scanners.
Cause: the jail status shows Journal matches: _SYSTEMD_UNIT=ssh.service + _COMM=sshd. Since OpenSSH split the per-connection process out of the listener (9.8+), authentication messages are logged by a process whose comm is sshd-session, not sshd. You can confirm with:
journalctl -u ssh -n 3 -o json | python3 -c "import sys,json; [print(json.loads(l).get(\"_COMM\")) for l in sys.stdin]"which prints sshd-session. The default journal match therefore filters out every auth failure.
Fix, in /etc/fail2ban/jail.d/sshd.local:
[sshd]
enabled = true
backend = systemd
journalmatch = _SYSTEMD_UNIT=ssh.service
maxretry = 5
findtime = 10m
bantime = 1h
bantime.increment = true
ignoreip = 127.0.0.1/8 ::1 <your own network>Restart fail2ban; within ~30 s Total failed started rising and bans followed.
How to verify instead of trusting active: compare journalctl -u ssh --since "-2 min" | grep -cE "Invalid user|Failed password" with the jail's Total failed. If the first is non-zero and the second is 0, the filter is not seeing the log.
Notes: the unit is ssh.service on Debian/Ubuntu and sshd.service on RHEL-likes. Newer fail2ban releases may already ship a match that includes sshd-session, so check the status line before adding the override. Add your own address range to ignoreip before enabling, and test a key login right after, so a few typos do not lock you out.