fail2ban
Daemon to ban hosts that cause multiple authentication errors
What is fail2ban?
Daemon to ban hosts that cause multiple authentication errors
Overview of fail2ban
What it is
Fail2Ban is a daemon that scans log files such as /var/log/auth.log and bans IP addresses that cause multiple authentication errors. It updates system firewall rules to reject new connections from those IPs for a configurable amount of time. It is designed to reduce the rate of incorrect authentication attempts but cannot eliminate the risk of weak authentication.
Key features
- Scans log files for failed login attempts and bans offending IP addresses.
- Updates system firewall rules to block connections from banned IPs.
- Configurable ban duration.
- Comes pre-configured for many standard log files, including sshd and Apache.
- Easily configurable to monitor any log file for any error.
- Supports IPv6 addresses since version 0.10.
Use cases
- Protecting SSH servers from brute-force attacks.
- Securing web servers (Apache, Nginx) against repeated authentication failures.
- Monitoring any service that logs authentication errors and automatically blocking malicious IPs.
Getting started
Install from source using the following commands:
tar xvfj fail2ban-master.tar.bz2
cd fail2ban-master
sudo python setup.py install
Alternatively, clone from GitHub:
git clone https://github.com/fail2ban/fail2ban.git
cd fail2ban
sudo python setup.py install
After installation, verify with:
fail2ban-client -h
To enable as a service, copy the init script from the files directory to /etc/init.d (example for Debian-based systems):
cp files/debian-initd /etc/init.d/fail2ban
update-rc.d fail2ban defaults
service fail2ban start
License and pricing
Fail2Ban is free software licensed under the GNU General Public License version 2 or later (GPL-2.0-or-later). It is open source and free to use.
Based on the project's public README and repository metadata.