Software:Fail2ban

From HandWiki
Short description: Intrusion prevention software framework
Fail2ban
Fail2ban logo.png
Original author(s)Cyril Jaquier
Initial releaseOctober 7, 2004; 19 years ago (2004-10-07)
Written inPython
PlatformPOSIX
TypeIntrusion prevention
LicenseGNU GPL v2

Fail2ban is an intrusion prevention software framework. Written in the Python programming language, it is designed to prevent brute-force attacks.[1] It is able to run on POSIX systems that have an interface to a packet-control system or firewall installed locally, such as iptables or TCP Wrapper.[2]

Functionality

A screenshot of Fail2ban, demonstrating its ability to ban IP addresses

Fail2ban operates by monitoring log files (e.g. /var/log/auth.log, /var/log/apache/access.log, etc.) for selected entries and running scripts based on them.[3] Most commonly this is used to block selected IP addresses that may belong to hosts that are trying to breach the system's security. It can ban any host IP address that makes too many login attempts or performs any other unwanted action within a time frame defined by the administrator. It includes support for both IPv4 and IPv6.[4][5] Optionally longer bans can be custom-configured for "recidivist" abusers that keep coming back.[1] Fail2ban is typically set up to unban a blocked host within a certain period, so as to not "lock out" any genuine connections that may have been temporarily misconfigured. However, an unban time of several minutes is usually enough to stop a network connection being flooded by malicious connections, as well as reducing the likelihood of a successful dictionary attack.

Fail2ban can perform multiple actions whenever an abusive IP address is detected:[6] update Netfilter/iptables or PF firewall rules, TCP Wrapper's hosts.deny table, to reject an abuser's IP address; email notifications; or any user-defined action that can be carried out by a Python script.

The standard configuration ships with popular filters, including Apache, Lighttpd, sshd, vsftpd, qmail, Postfix and Courier Mail Server.[7][8] Filters are defined by Python regexes, which may be conveniently customized by an administrator familiar with regular expressions.[1] A combination of a filter and an action is known as a "jail" and is what causes a malicious host to be blocked from accessing specified network services.[1] As well as the examples that are distributed with the software, a "jail" may be created for any network-facing process that creates a log file of access.[9]

Fail2ban is similar to DenyHosts [...] but unlike DenyHosts which focuses on SSH, fail2ban can be configured to monitor any service that writes login attempts to a log file, and instead of using /etc/hosts.deny only to block IP addresses/hosts, fail2ban can use Netfilter/iptables and TCP Wrappers /etc/hosts.deny.

Integrations

Fail2ban can be integrated with many APIs, including blocklist.de and AbuseIPDB.[10][11]

Shortcomings

  • Fail2ban fails to protect against a distributed brute-force attack. However, tools exist to distribute ban/unban events among servers using zmq.
  • There is no interaction with application-specific APIs.

See also

  • DenyHosts, a log-based intrusion-prevention security tool
  • Stockade, a rate-limiting approach to spam mitigation.
  • OSSEC, an open-source host-based intrusion-detection system.

References

  1. 1.0 1.1 1.2 1.3 Bledsoe, Greg (2016-01-14). "Server Hardening | Linux Journal" (in en). https://www.linuxjournal.com/content/server-hardening. 
  2. Jordan, Jeff (2015-06-16). "How to protect your GNU/Linux computer from remote attacks with Fail2ban" (in en). http://freesoftwaremagazine.com/articles/how_to_protect_your_linux_computer_from_remote_attacks_with_fail2ban/. 
  3. Van Impe, Koen (2015-12-09). "Defending Against Apache Web Server DDoS Attacks" (in en-US). IBM's Security Intelligence. https://securityintelligence.com/defending-against-apache-web-server-ddos-attacks/. 
  4. G. Brester, Sergey (2017-08-09). "0.10.0 (2017/08/09) - long-awaited 0.10th version" (in en). https://github.com/fail2ban/fail2ban/releases/tag/0.10.0. 
  5. Aleksandersen, Daniel (2016-05-31). "IPv6 support finally arrive in Fail2Ban 0.10" (in en). Ctrl blog. https://www.ctrl.blog/entry/fail2ban-ipv6. 
  6. ducea.com (2006-07-03). "Using Fail2Ban to Block Brute Force Attacks". http://www.ducea.com/2006/07/03/using-fail2ban-to-block-brute-force-attacks/. 
  7. "fail2ban/config/filter.d". https://github.com/fail2ban/fail2ban/tree/master/config/filter.d. 
  8. Wallen, Jack (2016-12-23). "How to protect secure shell on CentOS 7 with Fail2ban" (in en). TechRepublic. https://www.techrepublic.com/article/how-to-protect-secure-shell-on-centos-7-with-fail2ban/. 
  9. Casey, Brad (2016-02-17). "Three server security tools you might not know" (in en-US). TechTarget. https://searchdatacenter.techtarget.com/tip/Three-server-security-tools-you-might-not-know. 
  10. "Integrating AbuseIPDB with Fail2Ban". AbuseIPDB. https://www.abuseipdb.com/fail2ban.html. 
  11. "www.blocklist.de -- Fail2Ban-Reporting Service (we sent Reports from Attacks on Postfix, SSH, Apache-Attacks, Spambots, irc-Bots, Reg-Bots, DDos and more) from Fail2Ban via X-ARF". https://www.blocklist.de/en/index.html. 

External links