# Fail2Ban IPv6 Patch for Fail2Ban v0.9.3, v0.9.4, v0.9.5 --- filter.py.orig +++ filter.py @@ -849,6 +849,7 @@ class DNSUtils: IP_CRE = re.compile("^(?:\d{1,3}\.){3}\d{1,3}$") + IP_CRE6 = re.compile("^(?:[0-9:A-Fa-f]{3,})$") @staticmethod def dnsToIp(dns): @@ -883,19 +884,21 @@ if match: return match else: - return None + match = DNSUtils.IP_CRE6.match(text) + if match: + """ Right Here, we faced to a ipv6 + """ + return match + else: + return None @staticmethod def isValidIP(string): """ Return true if str is a valid IP + We Consider that logfiles didn't make errors ;) """ - s = string.split('/', 1) - try: - socket.inet_aton(s[0]) - return True - except socket.error: - return False + return True @staticmethod