Skip to content

fail2ban

Log-scanning daemon that bans IPs after repeated failed logins on Linux and macOS servers

Copyleft (OSI) · GPL-2.0
  • macOS
  • Linux
  • CLI

Listed by , founder & editor

59

Health

Active

Overview

Stars

19,096

Last commit

today

Nov 2026

Repository age

15 years

since Sep 2011

Latest version

1.1.1

Aug 2026

Contributors

–

7 active in 90 days

Releases

1

last 12 months

Language

Python

Fail2Ban reads log files such as /var/log/auth.log and finds IP addresses with too many failed login attempts. It then updates the system firewall to reject new connections from those addresses for a set time. It supports IPv6 since version 0.10.

It ships ready to read common logs, including sshd and Apache, and you can point it at any other log file and error pattern. Configuration lives in /etc/fail2ban, and the fail2ban-client command controls the running server. It is written in Python and licensed GPL-2.0. It runs on Linux, macOS and BSD systems, and most Linux distributions package it.

It reduces the volume of brute-force attempts but does not fix weak authentication. The project itself advises two-factor or key-based login for real protection.

Fail2Ban is a self-run intrusion prevention tool. It is an alternative to commercial host intrusion prevention and managed brute-force protection services.

Who it's for

Sysadmins running SSH or web servers exposed to the internet

It blocks repeat offenders automatically using logs you already have.

Skip if: you need network-wide inspection rather than per-host log-based bans.

Small teams hosting their own services on Linux

Packages exist for most distributions, and defaults cover sshd and Apache.

Skip if: you prefer a managed cloud firewall with no host software.

The problem it solves

Servers facing the internet get constant password guessing against SSH and web logins. Fail2Ban watches your logs and blocks offending addresses at the firewall.

Strengths

  • Ready-made handling of common logs like sshd and Apache
  • Any log file can be monitored with your own patterns
  • IPv6 address matching since v0.10
  • Controlled through fail2ban-client and config files in /etc/fail2ban
  • Around 19,000 GitHub stars and development since 2011

Trade-offs

  • Does not replace strong authentication such as keys or 2FA
  • Needs Python 3.5 or newer
  • Source install does not set up the init service automatically
  • Only one release in the last year

Self-host fail2ban

Self-hostable
No (desktop or local app)
Hosted plan
From $4/month · pricing

Quick start

git clone https://github.com/fail2ban/fail2ban.git
cd fail2ban
sudo python setup.py install

From the project's own install instructions. Check the docs for production settings.

Frequently asked questions

Is Fail2Ban free?

Yes. It is free software under the GPL-2.0 license.

Which platforms does it run on?

Linux, macOS and BSD systems.

What does it need to run?

Python 3.5 or newer, or PyPy3. Optional extras include pyinotify, systemd bindings and dnspython.

How do I check the install?

Run fail2ban-client -h, or fail2ban-client version to see the installed version.

Similar tools in Threat detection and monitoring

Canary Tokens

Threat detection and monitoring

Python network honeypot that alerts you when someone probes a private network

3.1k 430 yesterday Active BSD-3-Clause

suricata

Threat detection and monitoring

Network IDS, IPS and monitoring engine for teams that inspect traffic on their own

6.9k 1.8k today Thriving GPL-2.0

Mobile Verification Toolkit

Threat detection and monitoring

Command-line forensic toolkit for checking Android and iOS devices for spyware traces

16k 1.6k today Thriving GPL-3.0

snort3

Threat detection and monitoring

Network intrusion detection and prevention engine for security teams, in C++

3.5k 699 18 days ago Active GPL-2.0

Strix

Threat detection and monitoring

Finds working RTSP and other stream URLs for IP cameras and writes Frigate configs

952 48 3 months ago Slowing MIT

Wazuh

Threat detection and monitoring

Self-hosted XDR and SIEM platform for security teams monitoring endpoints and cloud

18k 2.6k today Thriving AGPL-3.0

Replaces NessusSplunk