- Added "ignoreip" feature

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@359 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 18 years ago
parent bd2b94cc84
commit a618313206

@ -61,6 +61,7 @@ class JailReader(ConfigReader):
["int", "maxretry", 3],
["int", "maxtime", 600],
["int", "bantime", 600],
["string", "ignoreip", None],
["string", "filter", ""],
["string", "action", ""]]
self.opts = ConfigReader.getOptions(self, self.name, opts)
@ -103,6 +104,8 @@ class JailReader(ConfigReader):
stream.append(["set", self.name, "addlogpath", path])
elif opt == "maxretry":
stream.append(["set", self.name, "maxretry", self.opts[opt]])
elif opt == "ignoreip":
stream.append(["set", self.name, "addignoreip", self.opts[opt]])
elif opt == "maxtime":
stream.append(["set", self.name, "maxtime", self.opts[opt]])
elif opt == "bantime":

@ -230,8 +230,18 @@ class Filter(JailThread):
# @param ip IP address to ignore
def addIgnoreIP(self, ip):
logSys.debug("Add " + ip + " to ignore list")
self.ignoreIpList.append(ip)
if DNSUtils.isValidIP(ip):
logSys.debug("Add " + ip + " to ignore list")
self.ignoreIpList.append(ip)
else:
logSys.warn(ip + " is not a valid address")
def delIgnoreIP(self, ip):
logSys.debug("Remove " + ip + " from ignore list")
self.ignoreIpList.remove(ip)
def getIgnoreIP(self):
return self.ignoreIpList
##
# Check if IP address is in the ignore list.

Loading…
Cancel
Save