Checks / SSH

Repeated failed logins are not blocked

Check
auth.bruteforce_protection
Severity
info
Runs
on the server, in the daily run of the collector
Looks at
fail2ban or CrowdSec running; checked while SSH accepts passwords
Updated 27 Nov 2026

What the check looks at

Whether fail2ban or the CrowdSec security engine runs. When neither runs and SSH accepts passwords (the check ssh.password_auth), the check warns. When SSH accepts keys only, it is skipped: guessing cannot succeed.

Risk

Bots try user names and passwords on every public SSH server. fail2ban and CrowdSec read the logs and block addresses that fail again and again in the firewall for a while, so each address gets a few guesses per ban period. OpenSSH 9.8 and later also refuse an address for a while after repeated failures (PerSourcePenalties, on by default). Of the releases we checked, 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

Turn off SSH passwords first (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, read the systemd journal and ban with nftables. Debian 12 reads /var/log/auth.log, which it does not write without rsyslog, so fail2ban does not start (Have not found any log file for sshd jail). Its default ban action calls iptables, and apt installs nftables with fail2ban, not iptables. On Debian 12, set the journal and nftables in jail.local and restart fail2ban:

printf '[DEFAULT]\nbanaction = nftables\nbanaction_allports = nftables[type=allports]\n\n[sshd]\nbackend = systemd\n' | sudo tee /etc/fail2ban/jail.local
sudo systemctl restart fail2ban

RHEL, Rocky Linux and AlmaLinux

fail2ban comes from EPEL, and the SSH jail is off after installation. Rocky Linux and AlmaLinux have the package epel-release in their repositories. On RHEL, install it from the Fedora project instead: sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm (latest-8 on RHEL 8).

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

fail2ban-firewalld bans through firewalld. If sudo firewall-cmd --state does not print running, fail2ban runs but every ban fails. Do not start firewalld for this alone: its default zone blocks the services it does not list, such as a web server or SSH on another port. Ban with nftables instead (jail.local overrides the setting of fail2ban-firewalld):

printf '[DEFAULT]\nbanaction = nftables\nbanaction_allports = nftables[type=allports]\n\n[sshd]\nenabled = true\nbackend = systemd\n' | sudo tee /etc/fail2ban/jail.local
sudo systemctl restart 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 has to run.

Add your own fixed address to ignoreip in jail.local, so that a typo does not ban you. The fail2ban or CrowdSec guide has a full configuration and the steps for CrowdSec.

How to check the fix

sudo fail2ban-client status sshd

The output lists the failed attempts and the banned addresses. To see that bans reach the firewall, ban a documentation address, look for it with the command of the ban action (sudo fail2ban-client get sshd actions names it), and unban it:

sudo fail2ban-client set sshd banip 192.0.2.1
sudo nft list ruleset | grep 192.0.2.1                  # nftables
sudo firewall-cmd --list-rich-rules | grep 192.0.2.1    # firewallcmd-rich-rules
sudo iptables -n -L f2b-sshd | grep 192.0.2.1           # iptables-multiport (Alpine)
sudo fail2ban-client set sshd unbanip 192.0.2.1

The address must show up. For CrowdSec, run sudo cscli metrics and sudo cscli decisions list.

When a warning is fine

When only a VPN or a few fixed addresses can reach the SSH port, or OpenSSH 9.8 or later slows guessing down with its default penalties. With passwords off, the check is skipped.

Sources

  • fail2ban jail.conf (the defaults, and why changes go into jail.local)
  • OpenSSH 9.8 release notes (PerSourcePenalties)
  • Test runs on 2026-11-26 with sshd -T (PerSourcePenalties on in Rocky Linux 9.9 with OpenSSH 9.9p1, Debian 13 and Alpine 3.24; rejected by the sshd of Debian 12 and Ubuntu 24.04), and the Rocky Linux 10 package list (OpenSSH 9.9p1)
  • Test runs on 2026-11-27 in containers: Debian 12 (fail2ban 1.0.2-2: Have not found any log file for sshd jail, then iptables: not found on a ban; with the jail.local above the ban lands in nftables), Debian 13 (1.1.0-8) and Ubuntu 24.04 (1.0.2-3ubuntu0.1) with their defaults, Rocky Linux 9.9 (EPEL 1.1.0-6.el9: bans through firewalld fail while it does not run; with the nftables jail.local they land in nftables), Rocky Linux 8.10 (EPEL 1.0.2-3.el8) and Alpine 3.24 (1.1.0-r3, bans in the iptables chain f2b-sshd)
  • EPEL documentation (epel-release on RHEL from dl.fedoraproject.org)
  • CrowdSec documentation