fail2ban

Reduce automated login attacks with Fail2ban, a Linux security tool that monitors service logs and temporarily bans offending IPs.
DownloadActiveSelect a version to download a specific release.

About fail2ban1.1.1

Last updated on

Fail2ban is an open-source intrusion prevention tool that watches service logs and temporarily bans IP addresses responsible for repeated failures or other configured abuse. Linux administrators commonly use it to reduce automated password guessing against SSH, web authentication, and mail services. Its filters and actions can also be adapted to applications that record useful security events in their logs.

From log entries to temporary bans

Fail2ban organizes protection into jails. Each jail connects a filter, a log source, and one or more response actions. The filter recognizes relevant events, while the jail defines how many matches are allowed within a time window and how long a ban lasts. This lets an administrator give an SSH login service different rules from a public website.

The response usually updates firewall rules so the offending address cannot make new connections to the protected ports. Available actions cover firewall systems including nftables, iptables, and firewalld. Actions can also run other configured responses, making Fail2ban useful when blocking needs to fit an existing server setup.

Useful controls for everyday administration

Fail2ban includes filters for many common services, including OpenSSH and Apache. Administrators can enable the relevant jails and adjust their settings, or write custom regular expressions for an application with a different log format. Both IPv4 and IPv6 addresses are supported.

Ban duration, detection windows, and retry thresholds are configurable. Trusted addresses can be excluded, and repeat offenders can receive progressively longer bans when incremental banning is enabled. These controls let administrators distinguish an occasional mistyped password from persistent automated attempts.

The fail2ban-client command provides access to running jails, status information, and manual ban or unban operations. Configuration overrides belong in local files such as jail.local or files under jail.d, allowing packaged defaults to be updated without overwriting local choices.

Using Fail2ban on Linux

Fail2ban is written in Python and is packaged by many Linux distributions. Depending on the selected backend, it can monitor log files or read service events from the systemd journal. Distribution packages are a practical starting point because they handle dependencies and service integration, although available versions and enabled defaults vary.

A useful installation needs more than a running daemon: the enabled jail must read the right events, extract the real client IP address, and apply an action that actually blocks traffic. This deserves particular attention when services sit behind a reverse proxy or run in containers.

Strengths and things to consider

Fail2ban is a good fit when the requirement is clear: recognize repeated events in local logs and apply a controlled response. Its service-specific settings and editable filters give administrators direct control over what triggers a ban.

Protection depends on the quality of those rules and logs. Attackers using many addresses or staying below the thresholds may avoid a ban, and the initial requests must reach the service before Fail2ban can react. Strong authentication and timely security updates remain necessary.

For website scraping, Fail2ban is most useful when logs expose a reliable abuse signal, such as repeated rate-limit violations. Successful page requests alone do not tell it whether a visitor is an unwanted scraper. CrowdSec is worth considering for reusable behavioral detection scenarios and shared threat intelligence; SSHGuard is another option for log-driven protection against brute-force attacks.

Fail2ban suits Linux administrators who want configurable, local log-based banning and are prepared to verify that their filters and firewall actions work together.

Supported platforms

Latest version

1.1.1
  • https://github.com/fail2ban/fail2ban/releases/download/1.1.1/1.1.1.tar.gz.asc
  • https://github.com/fail2ban/fail2ban/releases/download/1.1.1/fail2ban_1.1.1-1.upstream2_all.deb
  • https://github.com/fail2ban/fail2ban/releases/download/1.1.1/fail2ban_1.1.1-1.upstream2_all.deb.asc
  • https://api.github.com/repos/fail2ban/fail2ban/tarball/1.1.1
  • https://api.github.com/repos/fail2ban/fail2ban/zipball/1.1.1

Requirements

  • Python and a supported log-monitoring backend.
  • Blocking requires permissions to execute the selected firewall or other response action plus access to the relevant log files or systemd journal.

Rate this app

No ratings yet

No comment yet

Be the first to share your thoughts.

License

Open sourceOpen source

Latest version

1.1.1
Report incorrect information

Recently updated software