- Added "ignoreip" feature

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@359 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 2006-09-17 22:01:14 +00:00
parent bd2b94cc84
commit a618313206
2 changed files with 15 additions and 2 deletions

View File

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

View File

@ -230,8 +230,18 @@ class Filter(JailThread):
# @param ip IP address to ignore # @param ip IP address to ignore
def addIgnoreIP(self, ip): def addIgnoreIP(self, ip):
logSys.debug("Add " + ip + " to ignore list") if DNSUtils.isValidIP(ip):
self.ignoreIpList.append(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. # Check if IP address is in the ignore list.