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.
What fail2ban actually does (and does not do) at install time
/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.
How to check which jails are actually running
BASH
sudo fail2ban-client statusTEXT
Status
|- Number of jail: 1
`- Jail list: sshdsshd (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 sshdEnabling jails your stack actually needs
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:
| Service | Jail name (typical) | Log it watches |
|---|---|---|
| SSH | sshd | /var/log/auth.log or journal |
| Postfix SMTP | postfix | /var/log/mail.log or journal |
| Dovecot IMAP/POP3 | dovecot | /var/log/mail.log or journal |
| Pure-FTPd | pure-ftpd | depends on config |
| ProFTPD | proftpd | /var/log/proftpd/proftpd.log |
| Apache auth | apache-auth | Apache error log |
| Nginx auth | nginx-http-auth | Nginx error log |
| Roundcube webmail | roundcube-auth | Roundcube log file |
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 = trueBASH
sudo systemctl restart fail2bansudo fail2ban-client status again. You should now see three jails listed.
Why services slip through: the filter and log path problem
/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:
-
Log path matches reality. Check the
logpathdirective injail.conffor 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 setbackend = systemdfor that jail. - 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.confScheduling a weekly check so jails do not silently die
BASH
# Add to root's crontab: crontab -e
0 9 * * 1 /usr/bin/fail2ban-client status | mail -s 'fail2ban weekly status' [email protected]fail2ban is one layer, not the whole defense
- 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.
The one thing to do right now
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.