Fail2Ban: a free guard that bans IP addresses after too many failed logins
Fail2Ban reads your server's log files and blocks, through the firewall, the addresses that keep failing to log in. Free and open source. Based on the official README and the default configuration file, not tested by us: what it does, how its defaults work, its limits and what we could not confirm.
Free. Free software under the GNU GPL, version 2 or later, according to the README
Anyone who runs their own Linux or Unix server with SSH, a web server or a mail server open to the internet and wants the constant password guessing to stop filling the logs and hitting the login page.
It slows down guessing, it does not make a weak password safe: the README itself says to use two-factor or key-based login if you want to protect a service. A wrong setting can also ban you from your own server.
← All tool profilesNo. 20 / 21
In one sentence
Fail2Ban is a guard that watches your server's logs: when the same address fails to log in too many times, it changes the firewallFirewall A filter that decides which network traffic may reach a device or service and which is blocked. Tap again to open the glossary so that address cannot connect for a while.
Who it is for
People who manage their own Linux or Unix server and see hundreds of failed logins a day on SSH, on a web login or on a mail server. It is not for a laptop or for services you do not control, and it does not replace strong passwords.
What the official documentation says
Everything below comes from the README and the default configuration file, read on 2 December 2026.
- What it is: the README defines it as a tool to "ban hosts that cause multiple authentication errors". It scans log files such as
/var/log/auth.logand bans addresses with too many failed login attempts, by updating the system firewall rules to reject new connections from them for a configurable time. - Ready-made and flexible: it comes ready to read many standard logs, such as those of sshd and Apache, and can be set up to read any log file for any error you choose. The default file defines about a hundred ready-made "jails" (one per service or kind of failure), among them sshd, Apache, nginx, Postfix and a "recidive" jail for repeat offenders.
- Default numbers: an address is banned if it produces 5 failures (
maxretry) within 10 minutes (findtime), and the ban lasts 10 minutes (bantime). The file also describes an option to make the ban longer each time the same address returns (bantime.increment), which is commented out by default. - Nothing is switched on by default in that file: the
enabledsetting is false for the defaults, and the file says you should not edit it but put your changes injail.localor in thejail.d/folder, so that updates do not overwrite them. - Never ban yourself: the file has an
ignoreipsetting, commented out in the default file, for addresses that must never be banned. - IPv6 addresses are supported since version 0.10, and the README says it needs Python 3.5 or later.
- Installing: the README says it is likely already packaged for your Linux distribution, with a short command, and lists installing from source as the alternative. It also says to use
fail2ban-client, never the server program directly. - Licence: GNU GPL version 2, or at your option any later version.
- Honest warning in the README: Fail2Ban can reduce the rate of incorrect login attempts, but "it cannot eliminate the risk presented by weak authentication". It recommends two-factor or public/private key login for services you really want to protect.
The good
- Free and open source, and the README says it is likely already packaged for your distribution.
- It works from the logs, so you can protect services that have no built-in limit on login attempts.
- Ready-made jails for common services: you enable the ones you use.
- Cuts the noise: far fewer failed attempts in the logs.
The limits it admits
- It reduces the rate of attempts but does not remove the risk of weak passwords (the README).
- By default it is off until you enable jails, and the ban is short (10 minutes) unless you change it.
- It reacts after failures have happened, so it does not stop a first successful guess.
When not to use it
- As your only protection for a login. Use keys or two-factor first. This is the advice of the README itself.
- If you cannot test a change safely: a bad setting can lock you out of your own server. This is our advice.
- On a shared or cloud service where you cannot change the firewall.
What it costs you
A few minutes to install from your distribution and enable the jails you need, then an occasional look at what it banned. We did not measure resource use.
Typical setup mistakes
- Editing
jail.confdirectly. The file says updates may overwrite it; usejail.localorjail.d/. - Forgetting your own address. Add the addresses you connect from to
ignoreip, and keep a second way in. This is our advice. - Enabling a jail for a service whose logs it cannot read, so nothing is ever banned. Check the
logpathof each jail. This is our advice. - Relying on it instead of keys or two-factor.
How to check that it works
Our approach, not something we ran: on a test server, enable the sshd jail, make a few failed logins from a second test machine, then ask Fail2Ban for the status of that jail with fail2ban-client status sshd and check that the address appears as banned and is released after the ban time.
Where to start
We did not install or run it, so we offer no tutorial for now. Start with the README and the manual pages of fail2ban-client and jail.conf: httpsHTTPS The secure version of the web address protocol: it encrypts what travels between a visitor and your site and checks that the site is the real one. Tap again to open the glossary://github.com/fail2ban/fail2ban
What we could not confirm
We did not install or test Fail2Ban. We read the README, the default configuration file and the licence text, not the wiki, the manual pages or the release notes, so we do not know what changed in version 1.1.1 or how it behaves on a particular distribution. We do not know how much it helps against modern attacks that spread over many addresses, or how it compares with CrowdSec in practice.
Related
Sources
- Fail2Ban on GitHub: README.md (master branch; read 2 Dec 2026) (opens in a new tab)
- Fail2Ban on GitHub: config/jail.conf, the default configuration with the settings and the list of ready-made jails (master branch; read 2 Dec 2026) (opens in a new tab)
- Fail2Ban on GitHub: COPYING, the licence text (master branch; read 2 Dec 2026) (opens in a new tab)
- Fail2Ban on GitHub: releases page and repository data, latest release 1.1.1 of 15 Aug 2026 (read 2 Dec 2026) (opens in a new tab)
Follow us
New profiles and security news: YouTube (@safet2ship) and Instagram (@safet2ship).
More tool profiles
Same topic first, then the newest.
Canarytokens
Free decoy files and keys that email you when someone touches them
Best forSmall teams that want a cheap early warning if someone is inside a repo, laptop, mailbox or cloud account where nobody should be looking.
Zero Breach Toolkit
A free offline check for traces of known mercenary spyware on your computer or phone backup
Best forA person at real risk of targeted spyware, such as a journalist, an activist or someone who handles sensitive data, who wants a first offline check, or a small team that wants to look over a few devices. It does not replace expert help.
CrowdSec
A free, open source engine that reads your logs, spots attackers and blocks them, with a shared community blocklist
Best forAnyone who runs their own server, with a public web service, SSH or similar, and wants automatic blocking of brute force and scanning without writing their own rules.
Our own free checks
Small tools we built: they run in your browser and store nothing.
Website security check
Paste your site address and get a grade, a plain-language report and copy-paste fixes for HTTPS, security headers and cookies.
Keys-in-your-code check
Find API keys and secrets that your app exposes in public files. Built for apps made with AI.
Metadata check
See what hidden data your photos, PDFs and Office files carry (author, software, dates, GPS location) before you share them. Runs in your browser.
Exposure check
A self-check of what your company leaks in public (files, email records, accounts, repositories), with links to the tool for each point.