Rework as discussed in review: reload keeps every existing action
unconditionally (same instance, neither stopped nor started again).
Changed parameters are applied via reload() if the action supports it,
otherwise (Python action without reload method, e. g. smtp.py) they take
effect after restart of the jail, which is logged now.
Removes the replace path of previous commit (stop of old instance and
restore of current bans for the new one), which is no more needed.
An existing action without reload support (Python action without reload
method, e. g. smtp.py) is replaced by reload with a new instance, which is
started at end of reload, but the previous instance was never stopped.
Now the previous instance is stopped and the current bans are executed for
the new instance as restored tickets (like after restart), so actions with
norestored are bypassed.
The reload cleared the lists only (failregex, ignoreregex, ignoreip, log
paths, actions), the options without a default in jail.conf were sent by
client only if set, so after removing from config they retained previous
values until restart of the jail: bantime.increment and other bantime.*
options, ignoreself, ignorecache, logtimezone, prefregex, maxlines and
datepattern (also ignorecommand, if no default is specified).
Now they are reset to defaults at begin of reload.
The parent directory watch was added with the mask containing IN_ISDIR,
which is an output-only flag (set by the kernel in events). Linux ignores
it, but FreeBSD 15+ (native kernel inotify) rejects the whole add_watch
with EINVAL, so the directory was not monitored at all:
add_watch: cannot watch /var/log WD=-1, Errno=Invalid argument (EINVAL)
The file watch itself kept working, so new lines were found, but after a
log rotation (move + create) the new file was never noticed and the jail
silently stopped to find failures. This became visible with 1.1.1, since
pyinotify was unusable on python 3.12+ before (missing asyncore) and the
jails fell back to polling.
Additionally, the directory watch now includes IN_DELETE and IN_MOVED_FROM,
so removal of a watched log file is detected without relying on IN_IGNORED
for the file watch, which FreeBSD does not send in this case (test_del_file
failed there).
Verified on FreeBSD 15.1 (monitorfailures_FilterPyinotify passes, writes
after rotation detected) and on Linux.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add filter and jail configuration for Authelia 2FA/SSO portal,
supporting standard key-value (file) and structured JSON logging
formats with respective unit test samples.
Closes gh-4005
Gitlab deprecated application.log in 15.10 in favour of the structured
application_json.log. Add a mode option so the filter can read either
format; text stays the default so existing setups keep working.
Closes#3566
The error-log regex hardcoded the file-format prefix, so lines carrying a
systemd journal prefix were missed. Use __prefix_line from
nginx-error-common.conf, as the other nginx error-log filters already do.
Closes gh-3732
The current regex doesn't match the following log entry, seen with
Postfix 3.10.2:
Sep 17 18:19:20 mxhost postfix/smtpd[12345]: NOQUEUE: lost connection after CONNECT from unknown[192.0.2.25]
Sep 17 18:19:20 mxhost postfix/smtpd[12345]: disconnect from unknown[192.0.2.25] commands=0/0
- with `prefregex` to capture content of error only (bypass common prefix and suffix, like server, request, host, referrer);
- to match PAM authentication failures (gh-4071)