About fail2ban
Fail2Ban is an intrusion prevention daemon that watches log files, such as the authentication log, for repeated failed login attempts. When an address crosses a configured threshold, it adds firewall rules to reject new connections from that IP for a set period, which reduces brute-force noise against services.
It works out of the box with many standard logs, including those of sshd and Apache, and can be configured to read any log file for any error pattern you choose. IPv6 address matching has been supported since version 0.10. The README is frank about the limits: banning reduces the rate of failed attempts but cannot remove the risk of weak authentication, so you should still use two-factor or key-based authentication for important services.
Fail2Ban is written in Python and runs on Linux, macOS and BSD systems. Its license is listed as 'Other' on GitHub, and topics mention GPLv2, so confirm the terms. Documentation includes a manpage, wiki and developer guides. It is a long-standing, lightweight tool on self-managed servers, favored by sysadmins protecting SSH, web and mail services.
Key features
- Scans logs for repeated failed logins
- Bans offending IPs through firewall rules
- Ready-made filters for sshd and Apache
- Configurable ban durations and patterns
- IPv6 address support
- Works with any log file you point it at
Good fit for
- Blocking SSH brute-force attempts
- Protecting web and mail servers from abuse
- Adding a lightweight intrusion-prevention layer
fail2ban: questions and answers
- What is fail2ban used for?
- fail2ban is a Python daemon that reads log files and temporarily bans IP addresses with too many failed login attempts by updating firewall rules. It is a good fit for blocking SSH brute-force attempts, protecting web and mail servers from abuse, and adding a lightweight intrusion-prevention layer.
- Is fail2ban open source?
- Yes. fail2ban is open source under a custom licence. Its source code is on GitHub at fail2ban/fail2ban and is written mainly in Python.
- Is fail2ban free?
- Yes. fail2ban is open source, so the software itself is free to use under the terms of its own licence.
- Can I self-host fail2ban?
- Yes. fail2ban can be self-hosted on your own server or infrastructure; there is no official hosted version.
- What is fail2ban an alternative to?
- fail2ban is an open-source alternative to DataDome. Other open-source alternatives to DataDome include SafeLine, CrowdSec and Suricata.
- Is fail2ban actively maintained?
- Yes. The most recent commit to fail2ban was on 12 November 2026, and the latest release is 1.1.1, published on 15 August 2026. The project has 19k stars on GitHub, with 219 added in the last 30 days.
Open-source alternatives to fail2ban
See all
SafeLine
Security
CyberServal open-source WAF is a self-hosted WAF with 20.9K GitHub stars. Block SQL inject
GPL-3.0vs Cloudflare★ 23k
CrowdSec
Security
Open-source IDS/IPS, WAF and bot detection for Linux, Windows, Docker and Kubernetes, with
MITvs Cloudflare★ 16k
Suricata
Security
Suricata is a network Intrusion Detection System, Intrusion Prevention System and Network
GPL-2.0vs Palo Alto Networks★ 6.9k
ModSecurity
Security
ModSecurity is an open source, cross platform web application firewall (WAF) engine for Ap
Apache-2.0vs Cloudflare★ 9.9k
BunkerWeb
Security
🛡️ Open-source and cloud-native Web Application Firewall (WAF)
AGPL-3.0vs Cloudflare★ 11k
NGINX
Networking & VPN
The official NGINX Open Source repository.
BSD-2-Clausevs Cloudflare★ 32k
SaaS alternatives to fail2ban
See all
DataDome
Security
Bot protection and online fraud prevention platform
SaaS
HealthCAPTCHA
Security
CAPTCHA that asks users to do a physical exercise to prove they are human on forms and checkouts
SaaS
Portreeve
Security
API that screens SaaS signups, trials and checkouts for abuse and returns allow, review or block
SaaS
Arkose Labs
Security
Protects account integrity and builds customer trust with adaptive defenses
SaaS
Kasada
Security
Stops automated threats, bots, scrapers, and fraud across web and API interactions
SaaS
Fingerprint
Security
Device identification API for fraud detection
SaaS

