mirror of https://github.com/fail2ban/fail2ban
- Fixed bug with "<failures>" tag
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@264 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
f248c460f2
commit
d4c9d92ae1
|
@ -134,7 +134,7 @@ class Actions(JailThread):
|
|||
aInfo = dict()
|
||||
bTicket = BanManager.createBanTicket(ticket)
|
||||
aInfo["ip"] = bTicket.getIP()
|
||||
aInfo["failures"] = bTicket.getTime()
|
||||
aInfo["failures"] = bTicket.getAttempt()
|
||||
logSys.info("Ban %s" % aInfo["ip"])
|
||||
for action in self.actions:
|
||||
action.execActionBan(aInfo)
|
||||
|
|
|
@ -101,7 +101,9 @@ class BanManager:
|
|||
ip = ticket.getIP()
|
||||
#lastTime = ticket.getTime()
|
||||
lastTime = time.time()
|
||||
return BanTicket(ip, lastTime)
|
||||
banTicket = BanTicket(ip, lastTime)
|
||||
banTicket.setAttempt(ticket.getAttempt())
|
||||
return banTicket
|
||||
|
||||
##
|
||||
# Add a ban ticket.
|
||||
|
|
|
@ -97,7 +97,10 @@ class FailManager:
|
|||
if data.getRetry() >= self.maxRetry:
|
||||
self.delFailure(ip)
|
||||
self.lock.release()
|
||||
return FailTicket(ip, data.getLastTime())
|
||||
# Create a FailTicket from BanData
|
||||
failTicket = FailTicket(ip, data.getLastTime())
|
||||
failTicket.setAttempt(data.getRetry())
|
||||
return failTicket
|
||||
self.lock.release()
|
||||
raise FailManagerEmpty
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ class Ticket:
|
|||
def __init__(self, ip, time):
|
||||
self.ip = ip
|
||||
self.time = time
|
||||
self.attempt = 0
|
||||
|
||||
def setIP(self, value):
|
||||
self.ip = value
|
||||
|
@ -46,4 +47,10 @@ class Ticket:
|
|||
|
||||
def getTime(self):
|
||||
return self.time
|
||||
|
||||
def setAttempt(self, value):
|
||||
self.attempt = value
|
||||
|
||||
def getAttempt(self):
|
||||
return self.attempt
|
||||
|
Loading…
Reference in New Issue