mirror of
https://github.com/fail2ban/fail2ban.git
synced 2025-11-26 14:20:19 +08:00
- Fixed rebanned bug
- Clarified available tags git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@455 a942ae1a-1317-0410-a47c-b1dcaea8d605
This commit is contained in:
@@ -134,11 +134,15 @@ class Actions(JailThread):
|
||||
bTicket = BanManager.createBanTicket(ticket)
|
||||
aInfo["ip"] = bTicket.getIP()
|
||||
aInfo["failures"] = bTicket.getAttempt()
|
||||
logSys.warn("[%s] Ban %s" % (self.jail.getName(), aInfo["ip"]))
|
||||
for action in self.__actions:
|
||||
action.execActionBan(aInfo)
|
||||
self.__banManager.addBanTicket(bTicket)
|
||||
return True
|
||||
aInfo["time"] = bTicket.getTime()
|
||||
if self.__banManager.addBanTicket(bTicket):
|
||||
logSys.warn("[%s] Ban %s" % (self.jail.getName(), aInfo["ip"]))
|
||||
for action in self.__actions:
|
||||
action.execActionBan(aInfo)
|
||||
return True
|
||||
else:
|
||||
logSys.warn("[%s] %s already banned" % (self.jail.getName(),
|
||||
aInfo["ip"]))
|
||||
return False
|
||||
|
||||
##
|
||||
@@ -148,11 +152,7 @@ class Actions(JailThread):
|
||||
|
||||
def __checkUnBan(self):
|
||||
for ticket in self.__banManager.unBanList(MyTime.time()):
|
||||
aInfo = dict()
|
||||
aInfo["ip"] = ticket.getIP()
|
||||
logSys.warn("[%s] Unban %s" % (self.jail.getName(), aInfo["ip"]))
|
||||
for action in self.__actions:
|
||||
action.execActionUnban(aInfo)
|
||||
self.__unBan(ticket)
|
||||
|
||||
##
|
||||
# Flush the ban list.
|
||||
@@ -162,11 +162,23 @@ class Actions(JailThread):
|
||||
def __flushBan(self):
|
||||
logSys.debug("Flush ban list")
|
||||
for ticket in self.__banManager.flushBanList():
|
||||
aInfo = dict()
|
||||
aInfo["ip"] = ticket.getIP()
|
||||
logSys.warn("[%s] Unban %s" % (self.jail.getName(), aInfo["ip"]))
|
||||
for action in self.__actions:
|
||||
action.execActionUnban(aInfo)
|
||||
self.__unBan(ticket)
|
||||
|
||||
##
|
||||
# Unbans host corresponding to the ticket.
|
||||
#
|
||||
# Executes the actions in order to unban the host given in the
|
||||
# ticket.
|
||||
|
||||
def __unBan(self, ticket):
|
||||
aInfo = dict()
|
||||
aInfo["ip"] = ticket.getIP()
|
||||
aInfo["failures"] = ticket.getAttempt()
|
||||
aInfo["time"] = ticket.getTime()
|
||||
logSys.warn("[%s] Unban %s" % (self.jail.getName(), aInfo["ip"]))
|
||||
for action in self.__actions:
|
||||
action.execActionUnban(aInfo)
|
||||
|
||||
|
||||
##
|
||||
# Get the status of the filter.
|
||||
@@ -176,7 +188,7 @@ class Actions(JailThread):
|
||||
# @return a list with tuple
|
||||
|
||||
def status(self):
|
||||
ret = [("Currently banned", self.__banManager.size()),
|
||||
ret = [("Currently banned", self.__banManager.size()),
|
||||
("Total banned", self.__banManager.getBanTotal())]
|
||||
return ret
|
||||
|
||||
Reference in New Issue
Block a user