Repeated failed logins are not blocked
- Check
auth.bruteforce_protection- Severity
- info
- Runs
- on the server, in the daily run of the agent
- Looks at
- fail2ban or CrowdSec active (matters while SSH accepts passwords)
What the check looks at
The agent checks whether fail2ban or the CrowdSec security engine is running. When neither runs and SSH accepts passwords (the check ssh.password_auth), it warns. When SSH accepts keys only, the check is skipped, because guessing cannot succeed.
Why it matters
Bots try user names and passwords on every public SSH server, around the clock. fail2ban and CrowdSec read the logs, see addresses that fail again and again, and block them in the firewall for a while. Each address then gets only a few guesses per ban period.
With key-only SSH, guessing cannot succeed. Blocking then mainly keeps the logs readable. OpenSSH 9.8 and
later also refuse addresses for a while after repeated failures (PerSourcePenalties, on by default); of
the releases we tested, Debian 13, Rocky Linux 9.9 and 10.3 and Alpine 3.24 have it, Debian 12 and Ubuntu
24.04 do not.
How to fix it
The first choice is to turn off SSH passwords (key-only login). Then decide whether you still want blocking. To install fail2ban with an SSH jail:
Debian and Ubuntu
sudo apt install fail2ban python3-systemd
Debian 13 and Ubuntu 24.04 enable the SSH jail with the systemd journal as log source. On Debian 12, add
backend = systemd to the [sshd] section of /etc/fail2ban/jail.local, because Debian 12 does not write
/var/log/auth.log without rsyslog.
RHEL, Rocky Linux and AlmaLinux
fail2ban comes from EPEL, and the SSH jail is off after installation:
sudo dnf install epel-release
sudo dnf install fail2ban-server fail2ban-firewalld python3-systemd
printf '[sshd]\nenabled = true\nbackend = systemd\n' | sudo tee /etc/fail2ban/jail.local
sudo systemctl enable --now fail2ban
Alpine
sudo apk add fail2ban
sudo rc-update add fail2ban
sudo rc-service fail2ban start
The Alpine package enables an SSH jail that reads /var/log/messages, so syslog must run.
Add your own fixed address to ignoreip in jail.local so a typo does not ban you. The
fail2ban or CrowdSec guide has a full configuration and covers CrowdSec.
How to check the fix
sudo fail2ban-client status sshd
The output lists the failed attempts and the banned addresses. For CrowdSec: sudo cscli metrics and
sudo cscli decisions list.
When a warning is fine
When SSH accepts keys only, and either OpenSSH 9.8 or later runs with its default penalties or the SSH port is only reachable from a VPN or a few fixed addresses. Then there is little left for fail2ban to do.
Sources
- fail2ban jail.conf — defaults and the use of
jail.local - OpenSSH 9.8 release notes —
PerSourcePenalties - CrowdSec documentation