mirror of https://github.com/fail2ban/fail2ban
- Set the jail to idle state if file path is wrong or file is unreadable
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@328 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
4306c23c0f
commit
90d46d177d
|
@ -77,6 +77,7 @@ class Filter(JailThread):
|
|||
self.logStats = None
|
||||
self.dateDetector = DateDetector()
|
||||
self.dateDetector.addDefaultTemplate()
|
||||
self.fileNotFoundCnt = 0
|
||||
logSys.info("Created Filter")
|
||||
|
||||
##
|
||||
|
@ -288,6 +289,7 @@ class Filter(JailThread):
|
|||
def isModified(self):
|
||||
try:
|
||||
self.logStats = os.stat(self.logPath)
|
||||
self.fileNotFoundCnt = 0
|
||||
if self.lastModTime == self.logStats.st_mtime:
|
||||
return False
|
||||
else:
|
||||
|
@ -296,6 +298,11 @@ class Filter(JailThread):
|
|||
return True
|
||||
except OSError:
|
||||
logSys.error("Unable to get stat on " + self.logPath)
|
||||
self.fileNotFoundCnt = self.fileNotFoundCnt + 1
|
||||
if self.fileNotFoundCnt > 2:
|
||||
logSys.warn("Too much read error. Set the jail idle")
|
||||
self.jail.setIdle(True)
|
||||
self.fileNotFoundCnt = 0
|
||||
return False
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in New Issue