[packages/fail2ban] lag-visibility: osobny klucz throttlingu dla wpisów zza zegara; rel 9 wpis z przyszłości (timezone,
arekm
arekm at pld-linux.org
Wed Jul 22 17:47:37 CEST 2026
commit ff534047a03834e1ca5c5abdf6b4f2ca0165b541
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Jul 22 15:54:52 2026 +0200
lag-visibility: osobny klucz throttlingu dla wpisów zza zegara; rel 9
wpis z przyszłości (timezone, 24h) uzbrajał wspólny znacznik i wyciszał ostrzeżenia backlogu, które mają iść co 60s
fail2ban-lag-visibility.patch | 35 ++++++++++++++++++++++++++++-------
fail2ban.spec | 2 +-
2 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/fail2ban.spec b/fail2ban.spec
index 2adb568..fbee22e 100644
--- a/fail2ban.spec
+++ b/fail2ban.spec
@@ -2,7 +2,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.0
-Release: 8
+Release: 9
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 4dd72b7..6d707b3 100644
--- a/fail2ban-lag-visibility.patch
+++ b/fail2ban-lag-visibility.patch
@@ -1,6 +1,6 @@
diff -ru a/fail2ban/server/actions.py b/fail2ban/server/actions.py
---- a/fail2ban/server/actions.py 2026-07-22 14:29:42.498472766 +0200
-+++ b/fail2ban/server/actions.py 2026-07-22 14:29:42.499409098 +0200
+--- a/fail2ban/server/actions.py 2026-07-22 15:52:12.372829655 +0200
++++ b/fail2ban/server/actions.py 2026-07-22 15:52:12.374253597 +0200
@@ -503,7 +503,10 @@
# report ticket to observer, to check time should be increased and hereafter observer writes ban to database (asynchronous)
if Observers.Main is not None and not bTicket.restored:
@@ -26,8 +26,8 @@ diff -ru a/fail2ban/server/actions.py b/fail2ban/server/actions.py
if bTicket.banEpoch == self.banEpoch and diftm > 3:
# avoid too often checks:
diff -ru a/fail2ban/server/filter.py b/fail2ban/server/filter.py
---- a/fail2ban/server/filter.py 2026-07-22 14:29:42.498681467 +0200
-+++ b/fail2ban/server/filter.py 2026-07-22 14:29:42.499830570 +0200
+--- a/fail2ban/server/filter.py 2026-07-22 15:52:12.373036499 +0200
++++ b/fail2ban/server/filter.py 2026-07-22 15:52:12.374691282 +0200
@@ -606,12 +606,12 @@
if self.__ignoreCache: c.set(key, False)
return False
@@ -44,16 +44,18 @@ diff -ru a/fail2ban/server/filter.py b/fail2ban/server/filter.py
for args in args:
logSys.warning('[%s] ' + args[0], self.jailName, *args[1:])
-@@ -669,15 +669,19 @@
+@@ -669,15 +669,20 @@
# if weird date - we'd simulate now for timing issue (too large deviation from now):
delta = int(date - MyTime.time())
if abs(delta) > 60:
- # log timing issue as warning once per day:
+- self._logWarnOnce("_next_simByTimeWarn",
+ # entries behind the clock (backlog catch-up, however deep) must
+ # stay visible every minute - lag can grow past the 55m "latency"
-+ # label cutoff; only ahead-of-clock (timezone east) stays daily
++ # label cutoff; ahead-of-clock (timezone east) stays daily, on its
++ # own throttle key so it cannot arm 24h of silence for the backlog
+ latency = -3300 <= delta < 0
- self._logWarnOnce("_next_simByTimeWarn",
++ self._logWarnOnce("_next_simBehindTimeWarn" if delta < 0 else "_next_simByTimeWarn",
("Detected a log entry %s %s the current time in operation mode. "
"This looks like a %s problem. Treating such entries as if they just happened.",
MyTime.seconds2str(abs(delta)), "before" if delta < 0 else "after",
@@ -67,3 +69,22 @@ diff -ru a/fail2ban/server/filter.py b/fail2ban/server/filter.py
# simulate now as date:
date = MyTime.time()
self.__lastDate = date
+diff -ru a/fail2ban/tests/filtertestcase.py b/fail2ban/tests/filtertestcase.py
+--- a/fail2ban/tests/filtertestcase.py 2026-07-22 15:52:12.373231343 +0200
++++ b/fail2ban/tests/filtertestcase.py 2026-07-22 15:52:12.375178158 +0200
+@@ -471,6 +471,7 @@
+ "Total # of detected failures: 3.", all=True, wait=True)
+ #
+ setattr(self.filter, "_next_simByTimeWarn", -1)
++ setattr(self.filter, "_next_simBehindTimeWarn", -1)
+ self.pruneLog("[phase 2] wrong TZ given in log")
+ for i in (1,2,3):
+ self.filter.processLineAndAdd('2019-10-27 04:00:00 GMT fail from 192.0.2.16'); # +3 = 6
+@@ -504,6 +505,7 @@
+ phase += 1
+ MyTime.setTime(1572138000+delta)
+ setattr(self.filter, "_next_simByTimeWarn", -1)
++ setattr(self.filter, "_next_simBehindTimeWarn", -1)
+ self.pruneLog('[phase {phase}] log entries offset by {delta}s'.format(phase=phase, delta=delta))
+ self.filter.processLineAndAdd('2019-10-27 02:00:00 fail from 192.0.2.15');
+ self.assertLogged("Found 192.0.2.15", wait=True)
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/fail2ban.git/commitdiff/74db76d97f2db8dcde983b6ec2568841c1aacf22
More information about the pld-cvs-commit
mailing list