parent
76b0794474
commit
41c8d5a4f2
@ -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)
|
@ -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
|
@ -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
|
||||
}
|
Loading…
Reference in new issue