From 00a0e980417de8524d0fef4210e840ecaae5bbc0 Mon Sep 17 00:00:00 2001 From: Matt Stancliff Date: Thu, 5 Jul 2018 12:29:41 -0400 Subject: [PATCH] Load logpath only after findtime is configured When new log paths are configured, their start offset is immediately determined by a filter searching for (now - findTime). But, since findTime is configured *after* the log is loaded and searched, logs are only searched back by the default 10 minute findTime, regardless of user configuration of jail settings. So, findTime must be configured before logpath or else the default findtime is used, which ignores any findtime time defined by the user. This fixes new reads on startup for actual log files. The systemd filter always performed as expected due to being setup after the jail's findtime config submission. --- fail2ban/client/jailreader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fail2ban/client/jailreader.py b/fail2ban/client/jailreader.py index 651bbc37..3ec68cbb 100644 --- a/fail2ban/client/jailreader.py +++ b/fail2ban/client/jailreader.py @@ -90,12 +90,12 @@ class JailReader(ConfigReader): opts1st = [["bool", "enabled", False], ["string", "filter", ""]] opts = [["bool", "enabled", False], - ["string", "logpath", None], - ["string", "logtimezone", None], - ["string", "logencoding", None], ["string", "backend", "auto"], ["int", "maxretry", None], ["string", "findtime", None], + ["string", "logpath", None], + ["string", "logtimezone", None], + ["string", "logencoding", None], ["string", "bantime", None], ["string", "usedns", None], # be sure usedns is before all regex(s) in stream ["string", "failregex", None],