mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
fix actions problem
Give the BanManager a new method returning a list of banned ips, which can be used to check if a specific ip is currently banned. All testcases pass again.
This commit is contained in:
parent
fffa65c249
commit
be6885d82d
2 changed files with 4 additions and 1 deletions
|
|
@ -288,7 +288,7 @@ class Actions(JailThread, Mapping):
|
|||
if not isinstance(ip, IPAddr):
|
||||
ipa = IPAddr(ip)
|
||||
if not ipa.isSingle: # subnet (mask/cidr) or raw (may be dns/hostname):
|
||||
ips = list(filter(ipa.contains, self.banManager.getBanList()))
|
||||
ips = list(filter(ipa.contains, self.banManager.getBannedIPs()))
|
||||
if ips:
|
||||
return self.removeBannedIP(ips, db, ifexists)
|
||||
# not found:
|
||||
|
|
|
|||
|
|
@ -115,6 +115,9 @@ class BanManager:
|
|||
) for t in lst]
|
||||
return [t[0].getID() for t in lst]
|
||||
|
||||
def getBannedIPs(self):
|
||||
return list(sorted(ticket.getIP() for ticket in self.__banList.values()))
|
||||
|
||||
##
|
||||
# Returns a iterator to ban list (used in reload, so idle).
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in a new issue