diff --git a/bin/fail2ban-client b/bin/fail2ban-client index 8068d60f..e0b7efc6 100755 --- a/bin/fail2ban-client +++ b/bin/fail2ban-client @@ -102,7 +102,7 @@ class Fail2banClient: def __sigTERMhandler(self, signum, frame): # Print a new line because we probably come from wait print - logSys.warn("Caught signal %d. Exiting" % signum) + logSys.warning("Caught signal %d. Exiting" % signum) sys.exit(-1) def __getCmdLineOptions(self, optList): diff --git a/fail2ban/client/beautifier.py b/fail2ban/client/beautifier.py index 153ab905..a0ff8ff3 100644 --- a/fail2ban/client/beautifier.py +++ b/fail2ban/client/beautifier.py @@ -133,7 +133,7 @@ class Beautifier: c += 1 msg = msg + "`- [" + str(c) + "]: " + response[len(response)-1] except Exception: - logSys.warn("Beautifier error. Please report the error") + logSys.warning("Beautifier error. Please report the error") logSys.error("Beautify " + `response` + " with " + `self.__inputCmd` + " failed") msg = msg + `response` diff --git a/fail2ban/client/configreader.py b/fail2ban/client/configreader.py index 6f1e7740..b2d3e392 100644 --- a/fail2ban/client/configreader.py +++ b/fail2ban/client/configreader.py @@ -70,7 +70,7 @@ class ConfigReader(SafeConfigParserWithIncludes): # files must carry .conf suffix as well config_files += sorted(glob.glob('%s/*.conf' % config_dir)) else: - logSys.warn("%s exists but not a directory or not accessible" + logSys.warning("%s exists but not a directory or not accessible" % config_dir) # check if files are accessible, warn if any is not accessible @@ -80,7 +80,7 @@ class ConfigReader(SafeConfigParserWithIncludes): if os.access(f, os.R_OK): config_files_accessible.append(f) else: - logSys.warn("%s exists but not accessible - skipping" % f) + logSys.warning("%s exists but not accessible - skipping" % f) if len(config_files_accessible): # at least one config exists and accessible @@ -122,11 +122,11 @@ class ConfigReader(SafeConfigParserWithIncludes): values[option[1]] = option[2] except NoOptionError: if not option[2] == None: - logSys.warn("'%s' not defined in '%s'. Using default one: %r" + logSys.warning("'%s' not defined in '%s'. Using default one: %r" % (option[1], sec, option[2])) values[option[1]] = option[2] except ValueError: - logSys.warn("Wrong value for '" + option[1] + "' in '" + sec + + logSys.warning("Wrong value for '" + option[1] + "' in '" + sec + "'. Using default one: '" + `option[2]` + "'") values[option[1]] = option[2] return values diff --git a/fail2ban/client/jailreader.py b/fail2ban/client/jailreader.py index 6e35bc0b..d8102971 100644 --- a/fail2ban/client/jailreader.py +++ b/fail2ban/client/jailreader.py @@ -105,7 +105,7 @@ class JailReader(ConfigReader): logSys.debug("Caught exception: %s" % (e,)) return False if not len(self.__actions): - logSys.warn("No actions were defined for %s" % self.__name) + logSys.warning("No actions were defined for %s" % self.__name) return True def convert(self): diff --git a/fail2ban/server/actions.py b/fail2ban/server/actions.py index c0373239..b7e58975 100644 --- a/fail2ban/server/actions.py +++ b/fail2ban/server/actions.py @@ -177,7 +177,7 @@ class Actions(JailThread): aInfo["time"] = bTicket.getTime() aInfo["matches"] = "".join(bTicket.getMatches()) if self.__banManager.addBanTicket(bTicket): - logSys.warn("[%s] Ban %s" % (self.jail.getName(), aInfo["ip"])) + logSys.warning("[%s] Ban %s" % (self.jail.getName(), aInfo["ip"])) for action in self.__actions: action.execActionBan(aInfo) return True @@ -217,7 +217,7 @@ class Actions(JailThread): aInfo["failures"] = ticket.getAttempt() aInfo["time"] = ticket.getTime() aInfo["matches"] = "".join(ticket.getMatches()) - logSys.warn("[%s] Unban %s" % (self.jail.getName(), aInfo["ip"])) + logSys.warning("[%s] Unban %s" % (self.jail.getName(), aInfo["ip"])) for action in self.__actions: action.execActionUnban(aInfo) diff --git a/fail2ban/server/asyncserver.py b/fail2ban/server/asyncserver.py index 8c905010..e6af4b26 100644 --- a/fail2ban/server/asyncserver.py +++ b/fail2ban/server/asyncserver.py @@ -135,7 +135,7 @@ class AsyncServer(asyncore.dispatcher): if os.path.exists(sock): logSys.error("Fail2ban seems to be already running") if force: - logSys.warn("Forcing execution of the server") + logSys.warning("Forcing execution of the server") os.remove(sock) else: raise AsyncServerException("Server already running") diff --git a/fail2ban/server/filter.py b/fail2ban/server/filter.py index a7062f16..d4108dc2 100644 --- a/fail2ban/server/filter.py +++ b/fail2ban/server/filter.py @@ -632,7 +632,7 @@ class FileContainer: try: line = line.decode(self.getEncoding(), 'strict') except UnicodeDecodeError: - logSys.warn("Error decoding line from '%s' with '%s': %s" % + logSys.warning("Error decoding line from '%s' with '%s': %s" % (self.getFileName(), self.getEncoding(), `line`)) if sys.version_info >= (3,): # In python3, must be decoded line = line.decode(self.getEncoding(), 'ignore') @@ -668,11 +668,11 @@ class DNSUtils: try: return socket.gethostbyname_ex(dns)[2] except socket.gaierror: - logSys.warn("Unable to find a corresponding IP address for %s" + logSys.warning("Unable to find a corresponding IP address for %s" % dns) return list() except socket.error, e: - logSys.warn("Socket error raised trying to resolve hostname %s: %s" + logSys.warning("Socket error raised trying to resolve hostname %s: %s" % (dns, e)) return list() dnsToIp = staticmethod(dnsToIp) diff --git a/fail2ban/server/filterpoll.py b/fail2ban/server/filterpoll.py index 3217e958..191b95b3 100644 --- a/fail2ban/server/filterpoll.py +++ b/fail2ban/server/filterpoll.py @@ -131,10 +131,10 @@ class FilterPoll(FileFilter): % (filename, e)) self.__file404Cnt[filename] += 1 if self.__file404Cnt[filename] > 2: - logSys.warn("Too many errors. Setting the jail idle") + logSys.warning("Too many errors. Setting the jail idle") if self.jail: self.jail.setIdle(True) else: - logSys.warn("No jail is assigned to %s" % self) + logSys.warning("No jail is assigned to %s" % self) self.__file404Cnt[filename] = 0 return False diff --git a/fail2ban/server/transmitter.py b/fail2ban/server/transmitter.py index 2d27ff6e..2a4514da 100644 --- a/fail2ban/server/transmitter.py +++ b/fail2ban/server/transmitter.py @@ -55,7 +55,7 @@ class Transmitter: ret = self.__commandHandler(command) ack = 0, ret except Exception, e: - logSys.warn("Command %r has failed. Received %r" + logSys.warning("Command %r has failed. Received %r" % (command, e)) ack = 1, e return ack