Insights

Thinking fail2ban Covers All Services by Default? Check Which Jails Are Active

November 10, 2026
0:00
Most server owners install fail2ban, start the service, and assume every login surface on the box is now protected. SSH, Dovecot, Postfix, WordPress admin pages, FTP — all covered, right? Wrong. On most distributions, fail2ban ships with only one jail enabled: sshd. Everything else sits in config files as disabled examples, waiting for you to turn them on. If you never check, brute-force attempts against your mail server or web application login pages go completely unmonitored.
fail2ban is reactive. It reads log files (or systemd journal entries) produced by other services, matches lines against regex patterns called "filters," and bans source IPs that exceed a threshold. It does not inspect network traffic directly, and it cannot protect a service whose logs it is not watching. When you install fail2ban from your distribution's package manager, it drops a main config file at /etc/fail2ban/jail.conf. That file contains dozens of jail definitions — one per service — but nearly all of them have enabled = false or are simply not activated. The package maintainers do this on purpose: they cannot know which services run on your machine, so they enable only the most universally relevant one (SSH) and leave the rest to you. This means apt install fail2ban or yum install fail2ban does not automatically secure your web server, database, mail stack, or FTP daemon. Installed does not equal protected.
Before enabling anything new, see what is active right now:
BASH
sudo fail2ban-client status
Sample output format:
TEXT
Status
|- Number of jail:      1
`- Jail list:   sshd
If you see only sshd (or even zero jails on some minimal setups), every other service on that server is unprotected by fail2ban. You can drill into a specific jail for details:
BASH
sudo fail2ban-client status sshd
This shows currently banned IPs, total failed attempts, and total bans since the service started. Run the same command substituting any jail name to inspect it.
Never edit jail.conf directly — package updates overwrite it. Create or edit /etc/fail2ban/jail.local instead. fail2ban reads jail.conf first, then jail.local overrides whatever you set there. Which jails to enable depends entirely on what runs on your server. Common ones for a typical hosting or VPS setup:
ServiceJail name (typical)Log it watches
SSHsshd/var/log/auth.log or journal
Postfix SMTPpostfix/var/log/mail.log or journal
Dovecot IMAP/POP3dovecot/var/log/mail.log or journal
Pure-FTPdpure-ftpddepends on config
ProFTPDproftpd/var/log/proftpd/proftpd.log
Apache authapache-authApache error log
Nginx authnginx-http-authNginx error log
Roundcube webmailroundcube-authRoundcube log file
Log paths vary by distribution and server configuration. Always confirm the actual path before enabling a jail, or fail2ban will silently fail to monitor it. A minimal jail.local enabling Postfix and Dovecot alongside SSH looks like this:
INI
[DEFAULT]
bantime  = 3600
findtime = 600
maxretry = 5

[sshd]
enabled = true

[postfix]
enabled = true

[dovecot]
enabled = true
After saving, restart fail2ban:
BASH
sudo systemctl restart fail2ban
Then run sudo fail2ban-client status again. You should now see three jails listed.
Enabling a jail is not enough if the filter does not match what the service actually writes to its log. fail2ban ships with pre-built filters in /etc/fail2ban/filter.d/, and they work well for standard log formats. But if your service logs to a non-default path, uses a custom log format, or writes to the systemd journal while fail2ban expects a file (or vice versa), the jail will start without errors yet catch nothing. Two things to verify after enabling a jail:
  1. Log path matches reality. Check the logpath directive in jail.conf for that jail, then confirm the file exists and contains recent entries. If your system uses the systemd journal instead of flat log files (common on newer Debian and CentOS/RHEL systems), you may need to set backend = systemd for that jail.
  2. Filter regex matches log lines. You can test a filter against a log file without restarting anything:
BASH
sudo fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/postfix.conf
This prints how many lines matched and how many failed attempts were detected. If the match count is zero but you know there are failed login attempts in that log, the filter needs adjustment or the log format changed.
fail2ban can stop watching a jail if the log file rotates and the file handle breaks, or if a service update changes the log format. You will not get an alert — the jail just quietly stops banning. A simple cron job that emails you the jail status once a week catches this early:
BASH
# Add to root's crontab: crontab -e
0 9 * * 1 /usr/bin/fail2ban-client status | mail -s 'fail2ban weekly status' [email protected]
Replace the email address with your own. If the output suddenly shows fewer jails than expected, or if a jail shows zero bans over a long period on a public-facing server, investigate. Either the jail stopped working or (less likely) nobody is attacking that service. For servers without a working local mail setup, redirect output to a file and check it manually, or integrate it into whatever monitoring you already use.
Even with every relevant jail enabled, fail2ban is reactive by design. It bans an IP only after that IP has already made several failed attempts. Distributed attacks using thousands of source IPs — each trying only once or twice — stay below the threshold and never trigger a ban. fail2ban works best as one layer in a broader setup:
  • Key-based SSH authentication eliminates password brute-force entirely. fail2ban still helps by reducing log noise and resource waste from connection attempts.
  • Firewall rules (iptables, nftables, or a front-end like ufw) can restrict access to sensitive ports by source IP before fail2ban even needs to act.
  • Web application firewalls or rate-limiting at the reverse proxy level handle HTTP-layer attacks that fail2ban's log-based approach is slower to catch.
If your server runs cPanel/WHM, note that tools like cPHulk and CSF/LFD overlap with fail2ban's role. Running multiple brute-force protection tools simultaneously can cause conflicts — double-banning, or one tool unbanning what another banned. Pick one approach per service and disable the others. For more on that trade-off, see cPHulk or CSF/LFD: Which Should Block SSH Brute-Force on a WHM Server?.
SSH into your server and run sudo fail2ban-client status. Count the jails. Compare that list against every service on the box that accepts authentication — SSH, mail, FTP, web login pages, control panels. If there is a gap, create or update /etc/fail2ban/jail.local, enable the missing jails, verify the log paths and filters, and restart fail2ban. Then set up a recurring check so you catch it when a jail silently stops working. The protection you assumed you had might not exist until you explicitly turn it on.

Join My Newsletter & Get Updates!

Get notified whenever a new technical guide, server infrastructure breakdown, or personal reflection goes live, plus a curated weekly digest.