[packages/fail2ban] already banned: log seconds since the ban, not "age"; rel 4
arekm
arekm at pld-linux.org
Thu Aug 27 16:24:57 CEST 2026
commit 0cef7aa4bbe32e6505662375cb2c4a60aae8afd5
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Aug 27 16:23:51 2026 +0200
already banned: log seconds since the ban, not "age"; rel 4
age from now was ambiguous at 0s; diftm (the level-choosing value) separates
a pre-ban pipeline tail from traffic still hitting the log despite the ban.
fail2ban-lag-visibility.patch | 16 ++++++++--------
fail2ban.spec | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/fail2ban.spec b/fail2ban.spec
index 9eef5a7..5fb64f6 100644
--- a/fail2ban.spec
+++ b/fail2ban.spec
@@ -6,7 +6,7 @@ Summary: Ban IPs that make too many password failures
Summary(pl.UTF-8): Blokowanie IP powodujących zbyt dużo prób logowań z błędnym hasłem
Name: fail2ban
Version: 1.1.1
-Release: 3
+Release: 4
License: GPL
Group: Daemons
Source0: https://github.com/fail2ban/fail2ban/archive/%{version}.tar.gz
diff --git a/fail2ban-lag-visibility.patch b/fail2ban-lag-visibility.patch
index d7fb5d8..5a00a62 100644
--- a/fail2ban-lag-visibility.patch
+++ b/fail2ban-lag-visibility.patch
@@ -18,10 +18,10 @@ diff -ru a/fail2ban/server/actions.py b/fail2ban/server/actions.py
else logging.NOTICE if diftm < 60 \
else logging.WARNING
- logSys.log(ll, "[%s] %s already banned", self._jail.name, ip)
-+ # small age = IP still reaches the log despite the ban (action not
-+ # effective?); large age = just processing a log backlog
-+ age = '' if ticket.restored else ' (age %ds)' % max(0, int(MyTime.time() - ticket.getTime()))
-+ logSys.log(ll, "[%s] %s already banned%s", self._jail.name, ip, age)
++ # diftm anchors to the ban, not to now: seconds = log/pipeline
++ # tail from before the ban bit; minutes = traffic still reaching
++ # the log despite the ban (action ineffective? whitelisted earlier?)
++ logSys.log(ll, "[%s] %s already banned (%ds after ban)", self._jail.name, ip, int(diftm))
# if long time after ban - do consistency check (something is wrong here):
if bTicket.banEpoch == self.banEpoch and diftm > 3:
# avoid too often checks:
@@ -78,15 +78,15 @@ diff -ru a/fail2ban/tests/actionstestcase.py b/fail2ban/tests/actionstestcase.py
+ @with_alt_time
+ def testBanAgeAppended(self):
-+ # age = how far behind real-time the triggering failure is: fresh
-+ # bans of a backlog show a big age, an "already banned" IP that
-+ # still hits the log shows a small age (ban possibly not effective)
++ # Ban: age = processing lag behind the log. already banned: the
++ # printed time anchors to the ban moment - failure at now-10 vs
++ # the ban ticket from now-65 gives 55s after ban
+ self.__jail.putFailTicket(FailTicket('192.0.2.9', MyTime.time() - 65))
+ self.__actions.start()
+ try:
+ self.assertLogged('Ban 192.0.2.9 (age 65s)', wait=True)
+ self.__jail.putFailTicket(FailTicket('192.0.2.9', MyTime.time() - 10))
-+ self.assertLogged('192.0.2.9 already banned (age 10s)', wait=True)
++ self.assertLogged('192.0.2.9 already banned (55s after ban)', wait=True)
+ finally:
+ self.__actions.stop()
+ self.__actions.join()
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/fail2ban.git/commitdiff/0cef7aa4bbe32e6505662375cb2c4a60aae8afd5
More information about the pld-cvs-commit
mailing list