From 90d46d177d28fc0a75d1e7ad5c1cfe4629d7c688 Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Wed, 6 Sep 2006 17:41:07 +0000 Subject: [PATCH] - 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-b1dcaea8d605 --- server/filter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/filter.py b/server/filter.py index 7a1fd776..9f81bc8d 100644 --- a/server/filter.py +++ b/server/filter.py @@ -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 ##