diff --git a/fail2ban-0.8.3-inodecheck.patch b/fail2ban-0.8.3-inodecheck.patch new file mode 100644 index 0000000..3938c22 --- /dev/null +++ b/fail2ban-0.8.3-inodecheck.patch @@ -0,0 +1,35 @@ +--- fail2ban-0.8.3/server/filter.py.inodecheck 2009-08-27 20:50:22.000000000 +0200 ++++ fail2ban-0.8.3/server/filter.py 2009-08-27 20:50:22.000000000 +0200 +@@ -31,7 +31,7 @@ + from mytime import MyTime + from failregex import FailRegex, Regex, RegexException + +-import logging, re ++import logging, re, os + + # Gets the instance of the logger. + logSys = logging.getLogger("fail2ban.filter") +@@ -438,6 +438,8 @@ + self.__handler = None + # Try to open the file. Raises an exception if an error occured. + handler = open(filename) ++ stats = os.fstat(handler.fileno()) ++ self.__ino = stats.st_ino + try: + firstLine = handler.readline() + # Computes the MD5 of the first line. +@@ -464,10 +466,12 @@ + firstLine = self.__handler.readline() + # Computes the MD5 of the first line. + myHash = md5.new(firstLine).digest() +- # Compare hash. +- if not self.__hash == myHash: ++ stats = os.fstat(self.__handler.fileno()) ++ # Compare hash and inode ++ if self.__hash != myHash or self.__ino != stats.st_ino: + logSys.info("Log rotation detected for %s" % self.__filename) + self.__hash = myHash ++ self.__ino = stats.st_ino + self.__pos = 0 + # Sets the file pointer to the last position. + self.__handler.seek(self.__pos) diff --git a/fail2ban-0.8.3-log2syslog.patch b/fail2ban-0.8.3-log2syslog.patch new file mode 100644 index 0000000..5ee11f6 --- /dev/null +++ b/fail2ban-0.8.3-log2syslog.patch @@ -0,0 +1,11 @@ +--- fail2ban-0.8.3/config/fail2ban.conf~ 2008-02-27 22:44:55.000000000 +0100 ++++ fail2ban-0.8.3/config/fail2ban.conf 2009-08-27 20:48:25.000000000 +0200 +@@ -22,7 +22,7 @@ + # Only one log target can be specified. + # Values: STDOUT STDERR SYSLOG file Default: /var/log/fail2ban.log + # +-logtarget = /var/log/fail2ban.log ++logtarget = SYSLOG + + # Option: socket + # Notes.: Set the socket file. This is used to communicate with the daemon. Do diff --git a/fail2ban-logrotate b/fail2ban-logrotate new file mode 100644 index 0000000..4d7a6c9 --- /dev/null +++ b/fail2ban-logrotate @@ -0,0 +1,9 @@ +/var/log/fail2ban.log { + missingok + notifempty + size 30k + create 0600 root root + postrotate + /usr/bin/fail2ban-client set logtarget SYSLOG 2> /dev/null || true + endscript +} diff --git a/fail2ban.spec b/fail2ban.spec index 4327710..bb9dd2c 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -4,7 +4,7 @@ Summary: Ban IPs that make too many password failures Name: fail2ban Version: 0.8.3 -Release: 20%{?dist} +Release: 21%{?dist} License: GPLv2+ Group: System Environment/Daemons URL: http://fail2ban.sourceforge.net/ @@ -15,6 +15,8 @@ Patch1: fail2ban-0.8.1-sshd.patch #Patch2: fail2ban-0.8.1-sock.patch Patch3: fail2ban-0.8.2-fd_cloexec.patch Patch4: 0001-BF-anchoring-regex-for-IP-with-at-the-end.patch +Patch5: fail2ban-0.8.3-inodecheck.patch +Patch6: fail2ban-0.8.3-log2syslog.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: python-devel >= 2.3 BuildArch: noarch @@ -35,6 +37,8 @@ failures. It updates firewall rules to reject the IP address. #patch2 -p1 -b .sock %patch3 -p1 -b .fd_cloexec %patch4 -p1 -b .CVE-2009-0362 +%patch5 -p1 -b .inodecheck +%patch6 -p1 -b .log2syslog %build python setup.py build @@ -84,11 +88,9 @@ fi %dir %{_localstatedir}/run/fail2ban %changelog -* Fri Jul 24 2009 Fedora Release Engineering - 0.8.3-20 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Tue Feb 24 2009 Fedora Release Engineering - 0.8.3-19 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild +* Thu Aug 27 2009 Axel Thimm - 0.8.3-21 +- Log to syslog (RH bug #491983). Also deals with RH bug #515116. +- Check inodes of log files (RH bug #503852). * Sat Feb 14 2009 Axel Thimm - 0.8.3-18 - Fix CVE-2009-0362 (Fedora bugs #485461, #485464, #485465, #485466). diff --git a/sources b/sources index 2ff5ed3..6a75478 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -1c87078f2c50497951ec46583020d723 fail2ban-logrotate b438d7e2ce77a469fb0cca2a5cc0b81c fail2ban-0.8.3.tar.bz2