Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed issue with crashing on wrong log file

added a cleanup of firewall on emergency exit
  • Loading branch information...
commit 51d453a3d29b726d33e23708eb0ef9abbac5d1b8 1 parent e9792f9
@yarikoptic yarikoptic authored
Showing with 19 additions and 7 deletions.
  1. +5 −1 debian/changelog
  2. +6 −0 fail2ban
  3. +8 −6 logreader/logreader.py
View
6 debian/changelog
@@ -1,4 +1,4 @@
-fail2ban (0.5.4-5.13) unstable; urgency=low
+fail2ban (0.5.4-5.14) unstable; urgency=low
* Added a notification regarding the importance of 0.5.4-5 change of
failregex in the config file.
@@ -20,6 +20,10 @@ fail2ban (0.5.4-5.13) unstable; urgency=low
within sections.
* Added -e command line parameter to provide enabled sections from command
line.
+ * Added a cleanup of firewall rules on emergency shutdown when unknown
+ exception is catched.
+ * Fail2ban should not crash now if a wrong file name is specified in
+ config.
-- Yaroslav Halchenko <debian@onerussian.com> Mon, 3 Oct 2005 22:26:28 -1000
View
6 fail2ban
@@ -55,6 +55,12 @@ except Exception, e:
logSys.error("Type: " + `type.__name__` + "\n" +
"Value: " + `e.args` + "\n" +
"TB: " + `tbStack`)
+ # Try to clean up after ourselves
+ # just for extreme caution - wrapping with try
+ try:
+ fail2ban.restoreFwRules()
+ except Exception:
+ pass
# Remove the PID lock file. Should close #1239562
pidLock.remove()
logging.shutdown()
View
14 logreader/logreader.py
@@ -97,15 +97,17 @@ def isModified(self):
"""
try:
self.logStats = os.stat(self.logPath)
+
+ if self.lastModTime == self.logStats.st_mtime:
+ return False
+ else:
+ logSys.debug(self.logPath+" has been modified")
+ self.lastModTime = self.logStats.st_mtime
+ return True
except OSError:
logSys.error("Unable to get stat on "+self.logPath)
-
- if self.lastModTime == self.logStats.st_mtime:
return False
- else:
- logSys.debug(self.logPath+" has been modified")
- self.lastModTime = self.logStats.st_mtime
- return True
+
def setFilePos(self, file):
""" Sets the file position. We must take care of log file rotation
Please sign in to comment.
Something went wrong with that request. Please try again.