diff --git a/client/jailreader.py b/client/jailreader.py index 4df4ecc8..635f62d6 100644 --- a/client/jailreader.py +++ b/client/jailreader.py @@ -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": diff --git a/server/filter.py b/server/filter.py index 4e5fc8b4..d7467761 100644 --- a/server/filter.py +++ b/server/filter.py @@ -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.