From: <los...@us...> - 2009-09-01 21:21:40
|
Revision: 752 http://fail2ban.svn.sourceforge.net/fail2ban/?rev=752&view=rev Author: lostcontrol Date: 2009-09-01 21:21:30 +0000 (Tue, 01 Sep 2009) Log Message: ----------- - Check the inode number for rotation in addition to checking the first line of the file. Thanks to Jonathan Kamens. - Red Hat Bugzilla - Bug 503852 - SF.net Bug #2800279. Modified Paths: -------------- branches/FAIL2BAN-0_8/server/filter.py Modified: branches/FAIL2BAN-0_8/server/filter.py =================================================================== --- branches/FAIL2BAN-0_8/server/filter.py 2009-09-01 20:25:32 UTC (rev 751) +++ branches/FAIL2BAN-0_8/server/filter.py 2009-09-01 21:21:30 UTC (rev 752) @@ -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") @@ -449,6 +449,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. @@ -470,10 +472,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) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <los...@us...> - 2009-12-15 22:58:02
|
Revision: 757 http://fail2ban.svn.sourceforge.net/fail2ban/?rev=757&view=rev Author: lostcontrol Date: 2009-12-15 22:57:54 +0000 (Tue, 15 Dec 2009) Log Message: ----------- - Patch to make log file descriptors cloexec to stop leaking file descriptors on fork/exec. Thanks to Jonathan Underwood. https://bugzilla.redhat.com/show_bug.cgi?id=230191#c24 Modified Paths: -------------- branches/FAIL2BAN-0_8/server/filter.py Modified: branches/FAIL2BAN-0_8/server/filter.py =================================================================== --- branches/FAIL2BAN-0_8/server/filter.py 2009-12-15 22:54:57 UTC (rev 756) +++ branches/FAIL2BAN-0_8/server/filter.py 2009-12-15 22:57:54 UTC (rev 757) @@ -31,7 +31,7 @@ from mytime import MyTime from failregex import FailRegex, Regex, RegexException -import logging, re, os +import logging, re, os, fcntl # Gets the instance of the logger. logSys = logging.getLogger("fail2ban.filter") @@ -469,6 +469,9 @@ def open(self): self.__handler = open(self.__filename) + # Set the file descriptor to be FD_CLOEXEC + fd = self.__handler.fileno() + fcntl.fcntl(fd, fcntl.F_SETFD, fd | fcntl.FD_CLOEXEC) firstLine = self.__handler.readline() # Computes the MD5 of the first line. myHash = md5.new(firstLine).digest() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bu...@us...> - 2010-03-04 17:15:18
|
Revision: 758 http://fail2ban.svn.sourceforge.net/fail2ban/?rev=758&view=rev Author: buanzo Date: 2010-03-04 17:15:12 +0000 (Thu, 04 Mar 2010) Log Message: ----------- added time module. bug reported in buanzo's blog at http://blogs.buanzo.com.ar/2009/04/fail2ban-patch-ban-ip-address-manually.html Modified Paths: -------------- branches/FAIL2BAN-0_8/server/filter.py Modified: branches/FAIL2BAN-0_8/server/filter.py =================================================================== --- branches/FAIL2BAN-0_8/server/filter.py 2009-12-15 22:57:54 UTC (rev 757) +++ branches/FAIL2BAN-0_8/server/filter.py 2010-03-04 17:15:12 UTC (rev 758) @@ -31,7 +31,7 @@ from mytime import MyTime from failregex import FailRegex, Regex, RegexException -import logging, re, os, fcntl +import logging, re, os, fcntl, time # Gets the instance of the logger. logSys = logging.getLogger("fail2ban.filter") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yar...@us...> - 2010-09-21 17:52:51
|
Revision: 763 http://fail2ban.svn.sourceforge.net/fail2ban/?rev=763&view=rev Author: yarikoptic Date: 2010-09-21 17:52:44 +0000 (Tue, 21 Sep 2010) Log Message: ----------- debug entry for lines ignored due to falling below findtime (v2) Modified Paths: -------------- branches/FAIL2BAN-0_8/server/filter.py Modified: branches/FAIL2BAN-0_8/server/filter.py =================================================================== --- branches/FAIL2BAN-0_8/server/filter.py 2010-06-29 01:38:05 UTC (rev 762) +++ branches/FAIL2BAN-0_8/server/filter.py 2010-09-21 17:52:44 UTC (rev 763) @@ -268,7 +268,11 @@ for element in self.processLine(line): ip = element[0] unixTime = element[1] + logSys.debug("Processing line with time:%s and ip:%s" + % (unixTime, ip)) if unixTime < MyTime.time() - self.getFindTime(): + logSys.debug("Ignore line since time %s < %s - %s" + % (unixTime, MyTime.time(), self.getFindTime())) break if self.inIgnoreIPList(ip): logSys.debug("Ignore %s" % ip) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |