mirror of https://github.com/fail2ban/fail2ban
Added in while loop to process the Fail Manager after the requested banned IP was added to its queue. This solves the issue of needing to touch the log file that is being monitored to get the IP to be banned accordingly. Added in import of FailManagerEmpty exception class.
parent
f14c7ae401
commit
2d672d1c81
|
@ -27,6 +27,7 @@ __date__ = "$Date$"
|
||||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||||
__license__ = "GPL"
|
__license__ = "GPL"
|
||||||
|
|
||||||
|
from failmanager import FailManagerEmpty
|
||||||
from failmanager import FailManager
|
from failmanager import FailManager
|
||||||
from ticket import FailTicket
|
from ticket import FailTicket
|
||||||
from jailthread import JailThread
|
from jailthread import JailThread
|
||||||
|
@ -224,6 +225,14 @@ class Filter(JailThread):
|
||||||
for i in xrange(self.failManager.getMaxRetry()):
|
for i in xrange(self.failManager.getMaxRetry()):
|
||||||
self.failManager.addFailure(FailTicket(ip, unixTime))
|
self.failManager.addFailure(FailTicket(ip, unixTime))
|
||||||
|
|
||||||
|
# Perform the banning of the IP now.
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
ticket = self.failManager.toBan()
|
||||||
|
self.jail.putFailTicket(ticket)
|
||||||
|
except FailManagerEmpty:
|
||||||
|
self.failManager.cleanup(MyTime.time())
|
||||||
|
|
||||||
return ip
|
return ip
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Reference in New Issue