mirror of https://github.com/fail2ban/fail2ban
* Applied post-release changes to resolve issues with gamin and not closed on reload log filepull/3/head
parent
ee3f91176c
commit
d345865621
@ -0,0 +1,34 @@
|
||||
#! /bin/sh /usr/share/dpatch/dpatch-run
|
||||
## 00_close_log.dpatch by Yaroslav Halchenko <debian@onerussian.com>
|
||||
##
|
||||
## All lines beginning with `## DP:' are a description of the patch.
|
||||
## DP: post release patches
|
||||
|
||||
@DPATCH@
|
||||
|
||||
Index: server/server.py
|
||||
===================================================================
|
||||
--- server/server.py (revision 562)
|
||||
+++ server/server.py (revision 563)
|
||||
@@ -326,15 +326,18 @@
|
||||
else:
|
||||
# Target should be a file
|
||||
try:
|
||||
- open(target, "a")
|
||||
+ open(target, "a").close()
|
||||
hdlr = logging.FileHandler(target)
|
||||
except IOError:
|
||||
logSys.error("Unable to log to " + target)
|
||||
logSys.info("Logging to previous target " + self.__logTarget)
|
||||
return False
|
||||
self.__logTarget = target
|
||||
- # Remove previous handler
|
||||
- logging.getLogger("fail2ban").handlers = []
|
||||
+ # Removes previous handlers
|
||||
+ for handler in logging.getLogger("fail2ban").handlers:
|
||||
+ # Closes the handler.
|
||||
+ handler.close()
|
||||
+ logging.getLogger("fail2ban").removeHandler(handler)
|
||||
# set a format which is simpler for console use
|
||||
formatter = logging.Formatter("%(asctime)s %(name)-16s: %(levelname)-6s %(message)s")
|
||||
# tell the handler to use this format
|
@ -0,0 +1,26 @@
|
||||
#! /bin/sh /usr/share/dpatch/dpatch-run
|
||||
## 00_gamin_cleanup.dpatch by Yaroslav Halchenko <debian@onerussian.com>
|
||||
##
|
||||
## All lines beginning with `## DP:' are a description of the patch.
|
||||
## DP: No description.
|
||||
|
||||
@DPATCH@
|
||||
|
||||
--- server/filtergamin.py (revision 563)
|
||||
+++ server/filtergamin.py (revision 565)
|
||||
@@ -117,5 +117,15 @@
|
||||
time.sleep(self.getSleepTime())
|
||||
else:
|
||||
time.sleep(self.getSleepTime())
|
||||
+ # Cleanup Gamin
|
||||
+ self.__cleanup()
|
||||
logSys.debug(self.jail.getName() + ": filter terminated")
|
||||
return True
|
||||
+
|
||||
+ ##
|
||||
+ # Desallocates the resources used by Gamin.
|
||||
+
|
||||
+ def __cleanup(self):
|
||||
+ for path in Filter.getLogPath(self):
|
||||
+ self.monitor.stop_watch(path)
|
||||
+ del self.monitor
|
@ -1,2 +1,4 @@
|
||||
00_mail-whois-lines
|
||||
10_dbts_manpages
|
||||
00_close_log
|
||||
00_gamin_cleanup
|
||||
|
Loading…
Reference in new issue