From b64a435b0eac0a1298235e320f1450382a2ac9fe Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 13 Mar 2020 22:34:15 +0100 Subject: [PATCH] ignore only not banned old (repeated and ignored) tickets --- fail2ban/server/actions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fail2ban/server/actions.py b/fail2ban/server/actions.py index 902d7aa6..35b027ae 100644 --- a/fail2ban/server/actions.py +++ b/fail2ban/server/actions.py @@ -497,9 +497,12 @@ class Actions(JailThread, Mapping): cnt += self.__reBan(bTicket, actions=rebanacts) else: # pragma: no cover - unexpected: ticket is not banned for some reasons - reban using all actions: cnt += self.__reBan(bTicket) - # add ban to database (and ignore too old tickets, replace it with inOperation later): - if not bTicket.restored and self._jail.database is not None and bTicket.getTime() >= MyTime.time() - 60: - self._jail.database.addBan(self._jail, bTicket) + # add ban to database: + if not bTicket.restored and self._jail.database is not None: + # ignore too old (repeated and ignored) tickets, + # [todo] replace it with inOperation later (once it gets back-ported): + if not reason and bTicket.getTime() >= MyTime.time() - 60: + self._jail.database.addBan(self._jail, bTicket) if cnt: logSys.debug("Banned %s / %s, %s ticket(s) in %r", cnt, self.__banManager.getBanTotal(), self.__banManager.size(), self._jail.name)