From 61e23f45f70eaf510a05e5720cd586e65c1d7078 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 13 Jul 2005 10:01:01 +0000 Subject: [PATCH] Merged with 0.5.0 upstream release --- CHANGELOG | 31 +- Makefile | 8 +- PKG-INFO | 4 +- README | 39 +- config/fail2ban.conf.default | 168 ++++++- config/gentoo-initd | 4 +- config/redhat-initd | 78 ++++ confreader/configreader.py | 45 +- debian/README.Debian | 11 +- debian/TODO | 5 +- debian/changelog | 7 + firewall/iptables.py => fail2ban | 48 +- fail2ban.py | 590 ++++++++---------------- firewall/firewall.py | 75 +-- firewall/ipfw.py | 72 --- logreader/logreader.py | 62 +-- setup.py | 10 +- utils/dns.py | 26 +- utils/mail.py | 71 +++ utils/process.py | 158 +++++++ firewall/ipfwadm.py => utils/strings.py | 38 +- version.py | 8 +- 22 files changed, 884 insertions(+), 674 deletions(-) create mode 100644 config/redhat-initd rename firewall/iptables.py => fail2ban (54%) mode change 100644 => 100755 delete mode 100644 firewall/ipfw.py create mode 100644 utils/mail.py create mode 100644 utils/process.py rename firewall/ipfwadm.py => utils/strings.py (55%) diff --git a/CHANGELOG b/CHANGELOG index 6cbe1675..b4acc6d9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,10 +4,25 @@ |_| \__,_|_|_/___|_.__/\__,_|_||_| ============================================================= -Fail2Ban (version 0.4.1) 06/30/2005 +Fail2Ban (version 0.5.0) 2005/07/12 ============================================================= -ver. 0.4.1 (06/30/2005) - stable +ver. 0.5.0 (2005/07/12) - beta +---------- +- Added support for CIDR mask in ignoreip +- Added mail notification support +- Fixed bug #1234699 +- Added tags replacement in rules definition. Should allow a + clean solution for Feature Request #1229479 +- Removed "interface" and "firewall" options +- Added start and end commands in the configuration file. + Thanks to Yaroslav Halchenko +- Added firewall rules definition in the configuration file +- Cleaned fail2ban.py +- Added an initd script for RedHat/Fedora. Thanks to Andrey + G. Grozin + +ver. 0.4.1 (2005/06/30) - stable ---------- - Fixed textToDNS method which generated wrong matches for "rhost=12-xyz...". Thanks to Tom Pike @@ -16,19 +31,19 @@ ver. 0.4.1 (06/30/2005) - stable - Changed default PID lock file location from /tmp to /var/run -ver. 0.4.0 (04/24/2005) - stable +ver. 0.4.0 (2005/04/24) - stable ---------- - Fixed textToDNS which did not recognize strings like "12-345-67-890.abcd.mnopqr.xyz" -ver. 0.3.1 (03/31/2005) - beta +ver. 0.3.1 (2005/03/31) - beta ---------- - Corrected level of messages - Added DNS lookup support - Improved parsing speed. Only parse the new log messages - Added a second verbose level (-vv) -ver. 0.3.0 (02/24/2005) - beta +ver. 0.3.0 (2005/02/24) - beta ---------- - Re-writting of parts of the code in order to handle several log files with different rules @@ -39,7 +54,7 @@ ver. 0.3.0 (02/24/2005) - beta - Added ipfw-start-rule option (thanks to Robert Edeker) - Added -k option which kills a currently running Fail2Ban -ver. 0.1.2 (11/21/2004) - beta +ver. 0.1.2 (2004/11/21) - beta ---------- - Add ipfw and ipfwadm support. The rules are taken from BlockIt. Thanks to Robert Edeker @@ -47,7 +62,7 @@ ver. 0.1.2 (11/21/2004) - beta Robert Edeker who reminded me this - Small code cleaning -ver. 0.1.1 (10/23/2004) - beta +ver. 0.1.1 (2004/10/23) - beta ---------- - Add SIGTERM handler in order to exit nicely when in daemon mode @@ -61,6 +76,6 @@ ver. 0.1.1 (10/23/2004) - beta - Code documentation -ver. 0.1.0 (10/12/2004) - alpha +ver. 0.1.0 (2004/10/12) - alpha ---------- - Initial release diff --git a/Makefile b/Makefile index 4ba8e561..dc413c07 100644 --- a/Makefile +++ b/Makefile @@ -2,15 +2,11 @@ # DESTDIR=debian/fail2ban -all:: fail2ban fail2ban.1x +all:: fail2ban.1x fail2ban.1x: fail2ban fail2ban.h2m help2man --include fail2ban.h2m --section=1x --no-info --output $@ ./fail2ban - -fail2ban: fail2ban.py - cp fail2ban.py fail2ban - install:: all mkdir -p $(DESTDIR)/etc/default @@ -18,7 +14,7 @@ install:: all cp config/fail2ban.conf.default $(DESTDIR)/etc/fail2ban.conf cp config/gentoo-confd $(DESTDIR)/etc/default/fail2ban mkdir -p $(DESTDIR)/usr/lib/fail2ban/ - cp log4py.py $(DESTDIR)/usr/lib/fail2ban/ +# cp log4py.py $(DESTDIR)/usr/lib/fail2ban/ clean:: rm -rf changelog.gz fail2ban{,.1x} build* `find -iname '*.pyc' ` diff --git a/PKG-INFO b/PKG-INFO index 8f5e3a57..025b5dba 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,8 +1,8 @@ Metadata-Version: 1.0 Name: fail2ban -Version: 0.4.1 +Version: 0.5.0 Summary: Ban IPs that make too many password failure -Home-page: http://www.sourceforge.net/projects/fail2ban +Home-page: http://fail2ban.sourceforge.net Author: Cyril Jaquier Author-email: lostcontrol@users.sourceforge.net License: UNKNOWN diff --git a/README b/README index 7882c60d..bf9e1809 100644 --- a/README +++ b/README @@ -4,14 +4,14 @@ |_| \__,_|_|_/___|_.__/\__,_|_||_| ============================================================= -Fail2Ban (version 0.4.1) 06/30/2005 +Fail2Ban (version 0.5.0) 2005/07/12 ============================================================= Fail2Ban scans log files like /var/log/pwdfail and bans IP that makes too many password failures. It updates firewall -rules to reject the IP address. Currently iptables, ipfw and -ipfwadm are supported. Fail2Ban can read multiple log files -such as sshd or Apache web server ones. It needs log4py. +rules to reject the IP address. These rules can be defined by +the user. Fail2Ban can read multiple log files such as sshd +or Apache web server ones. It needs log4py. This is my first Python program. Moreover, English is not my mother tongue... @@ -36,18 +36,19 @@ tries to find lines which match the failregex. Then it retrieves the message time using timeregex and timepattern. It finally gets the ip and if it has already done 3 or more password failures in the last banTime, the ip is banned for -banTime using a firewall rule. After banTime, the rule is -deleted. Notice that if no "plain" ip is available, Fail2Ban -try to do DNS lookup in order to found one or several ip's to -ban. +banTime using a firewall rule. This rule is set by the user +in the configuration file. Thus, Fail2Ban can be adapted for +lots of firewall. After banTime, the rule is deleted. Notice +that if no "plain" ip is available, Fail2Ban try to do DNS +lookup in order to found one or several ip's to ban. Sections can be freely added so it is possible to monitor several daemons at the same time. Runs on my server and does its job rather well :-) The idea is to make fail2ban usable with daemons and services that -require a login (sshd, telnetd, ...). It should also support -others firewalls than iptables. +require a login (sshd, telnetd, ...) and with different +firewalls. Installation: @@ -58,14 +59,15 @@ Require: python-2.3 (http://www.python.org) To install, just do: -> tar xvfj fail2ban-0.4.1.tar.bz2 -> cd fail2ban-0.4.1 +> tar xvfj fail2ban-0.5.0.tar.bz2 +> cd fail2ban-0.5.0 > python setup.py install This will install Fail2Ban into /usr/lib/fail2ban. The fail2ban.py executable is placed into /usr/bin. -For Gentoo users, an ebuild is available on the website. +Gentoo: an ebuild is available on the website. +Debian: a package is available on the website. Fail2Ban should now be correctly installed. Just type: @@ -93,18 +95,16 @@ options: -b start fail2ban in background -d start fail2ban in debug mode - -e ban IP on the INTF interface -c read configuration file FILE -p create PID lock in FILE -h display this help message -i IP(s) to ignore -k kill a currently running Fail2Ban instance - -l log message in FILE + -l log messages in FILE -r allow a max of VALUE password failure -t