diff --git a/fail2ban/server/filter.py b/fail2ban/server/filter.py index af23a1d2..e19b322e 100644 --- a/fail2ban/server/filter.py +++ b/fail2ban/server/filter.py @@ -375,6 +375,8 @@ class Filter(JailThread): # @return True if IP address is in ignore list def inIgnoreIPList(self, ip, log_ignore=False): + if isinstance(ip, basestring): + ip = IPAddr(ip) for net in self.__ignoreIpList: # if it isn't a valid IP address, try DNS resolution if not net.isValidIP() and net.getRaw() != "": @@ -394,7 +396,6 @@ class Filter(JailThread): command = CommandAction.replaceTag(self.__ignoreCommand, { 'ip': ip } ) logSys.debug('ignore command: ' + command) ret_ignore = CommandAction.executeCmd(command) - self.logIgnoreIp(ip, log_ignore and ret_ignore, ignore_source="command") return ret_ignore diff --git a/fail2ban/tests/servertestcase.py b/fail2ban/tests/servertestcase.py index 96734262..d9db6c47 100644 --- a/fail2ban/tests/servertestcase.py +++ b/fail2ban/tests/servertestcase.py @@ -125,14 +125,14 @@ class TransmitterBase(unittest.TestCase): self.transm.proceed(["get", jail, cmd]), (0, [])) for n, value in enumerate(values): ret = self.transm.proceed(["set", jail, cmdAdd, value]) - self.assertEqual((ret[0], sorted(ret[1])), (0, sorted(values[:n+1]))) + self.assertEqual((ret[0], sorted(map(str, ret[1]))), (0, sorted(map(str, values[:n+1])))) ret = self.transm.proceed(["get", jail, cmd]) - self.assertEqual((ret[0], sorted(ret[1])), (0, sorted(values[:n+1]))) + self.assertEqual((ret[0], sorted(map(str, ret[1]))), (0, sorted(map(str, values[:n+1])))) for n, value in enumerate(values): ret = self.transm.proceed(["set", jail, cmdDel, value]) - self.assertEqual((ret[0], sorted(ret[1])), (0, sorted(values[n+1:]))) + self.assertEqual((ret[0], sorted(map(str, ret[1]))), (0, sorted(map(str, values[n+1:])))) ret = self.transm.proceed(["get", jail, cmd]) - self.assertEqual((ret[0], sorted(ret[1])), (0, sorted(values[n+1:]))) + self.assertEqual((ret[0], sorted(map(str, ret[1]))), (0, sorted(map(str, values[n+1:])))) def jailAddDelRegexTest(self, cmd, inValues, outValues, jail): cmdAdd = "add" + cmd