Commit graph

6326 commits

Author SHA1 Message Date
Sergey G. Brester
cae17d2f99
CI: add python 3.16 (alpha.2) to workflow matrix
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15) (push) Has been cancelled
CI / build (3.16.0-alpha.2) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.8) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.9) (push) Has been cancelled
2026-11-18 22:56:51 +01:00
sebres
facc743493 small amend (missing NL) 2026-11-18 22:53:24 +01:00
sebres
5ad738b803 filter.d/pam-generic.conf: avoid catastrophic backtracking for certain circumstances injecting on username (GHSA-wmr3-vx6j-2mwx);
amend to 789571aa44 (not released yet)
2026-11-18 22:33:56 +01:00
sebres
74535b7990 amend with small cleanup (setuptools removed support of dry_run for build process) 2026-11-15 23:37:45 +01:00
sebres
d7ec208daa use new install-ex setup command now in tests; skip setup tests if no setuptools installed 2026-11-15 22:59:55 +01:00
sebres
dd90c75cf6 Merge remote-tracking branch 'fix-pythonic-build-install',
implemented new setup commands `build-ex` and `install-ex`, for instance:
  python3 setup.py build-ex --help
  python3 setup.py install-ex --root=./pkg --build-base=./build --prefix=/usr --without-tests
closes gh-3999
2026-11-15 22:44:58 +01:00
Sergey G. Brester
8ad353e798
Merge pull request #4274 from Dv2Corn/fix/reload-replaced-python-action
reload keeps existing action instance (Python action without reload was replaced and restarted)
2026-11-15 19:42:04 +01:00
sebres
9e1fa80f82 combine reload pythonic action tests to single test, use existing action.d/action.py from test-suite instead of create action on demand 2026-11-15 19:36:15 +01:00
Dv2Corn
5bfe1c4d7d actions: reload retains existing action instead of replacing it
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.
2026-11-13 22:30:21 +10:00
Sergey G. Brester
66de719304
Merge pull request #4272 from Dv2Corn/fix/reload-reset-removed-options
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.8) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.9) (push) Has been cancelled
reload: reset jail options removed from the configuration (bantime.*, ignoreself, logtimezone, prefregex, ...)
2026-11-12 17:21:14 +01:00
Dv2Corn
27a416e5a1 reload: reset jail options removed from configuration
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.
2026-11-13 00:28:40 +10:00
Dv2Corn
06cfe212c4 actions: stop Python action replaced during reload, new instance gets current bans
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.
2026-11-13 00:16:31 +10:00
Sergey G. Brester
bbf16043a2
Merge pull request #4269 from hakarrr/fail2ban-2716-reload-actions
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.8) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.9) (push) Has been cancelled
actions: retain and start actions added during reload
2026-11-10 20:19:01 +01:00
sebres
069f8ccaf5 simplify code a bit (eliminate unneeded _reload_start_actions) 2026-11-10 20:12:10 +01:00
generaltony007
df6654cd34
changelog: record reload action retention fix
Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-10 04:32:58 +05:30
generaltony007
bdee83d10f
tests: cover new and existing action reload lifecycle
Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-10 04:32:06 +05:30
generaltony007
0aab4396c6
actions: retain and start actions added during reload
Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
2026-11-10 04:31:20 +05:30
Sergey G. Brester
d0f70eba16
Merge pull request #4267 from henricop/fix/statistic-alias-formatting
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.8) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.9) (push) Has been cancelled
fix(client): format the statistic command alias
2026-11-07 15:18:52 +01:00
Henrico Piubello
9dd5ffed4a
fix(client): format the statistic command alias 2026-11-07 06:30:44 -03:00
Sergey G. Brester
44e0beb2e3
Merge pull request #4264 from karolyi/fix-pyinotify-freebsd
Some checks are pending
Codespell / Check for spelling errors (push) Waiting to run
CI / build (3.10) (push) Waiting to run
CI / build (3.11) (push) Waiting to run
CI / build (3.12) (push) Waiting to run
CI / build (3.13) (push) Waiting to run
CI / build (3.14) (push) Waiting to run
CI / build (3.15) (push) Waiting to run
CI / build (pypy3.11) (push) Waiting to run
CI / build (ubuntu-24.04, 3.8) (push) Waiting to run
CI / build (ubuntu-24.04, 3.9) (push) Waiting to run
pyinotify: fix directory monitoring on systems with native inotify other than Linux (gh-4250)
2026-11-06 22:46:43 +01:00
László Károlyi
da0fbbcd8b
pyinotify: fix directory monitoring on systems with native inotify other than Linux (gh-4250)
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>
2026-11-06 18:19:11 +01:00
Sergey G. Brester
fd09a9dcd2
Merge pull request #4262 from rafaelsoje/add-authelia-filter
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.8) (push) Has been cancelled
CI / build (ubuntu-24.04, 3.9) (push) Has been cancelled
support systemd-journal log prefix in authelia filter
2026-11-03 20:23:22 +01:00
sebres
81f3c37914 datepattern is optional for journal, but expected for short logtype (line starts with some default date format) 2026-11-03 20:20:21 +01:00
Rafael Soje
a5d479a44e support systemd-journal log prefix in authelia filter 2026-11-03 20:20:21 +01:00
Sergey G. Brester
fe34bcf09f
Merge pull request #4259 from rafaelsoje/add-authelia-filter
Some checks are pending
Codespell / Check for spelling errors (push) Waiting to run
CI / build (3.10) (push) Waiting to run
CI / build (3.11) (push) Waiting to run
CI / build (3.12) (push) Waiting to run
CI / build (3.13) (push) Waiting to run
CI / build (3.14) (push) Waiting to run
CI / build (3.15) (push) Waiting to run
CI / build (pypy3.11) (push) Waiting to run
CI / build (ubuntu-24.04, 3.8) (push) Waiting to run
CI / build (ubuntu-24.04, 3.9) (push) Waiting to run
filter.d/authelia: add new filter and jail for Authelia
2026-11-02 18:48:49 +01:00
sebres
533bbd93f7 remove unneeded (default) include, improved grp-regex (with negative lookahead for msg and remote_ip tokens) 2026-11-02 16:52:48 +01:00
Rafael Soje
e5fdceffae filter.d/authelia: add new filter and jail for Authelia
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
2026-11-02 10:58:03 -03:00
Sergey G. Brester
fefc62a6d1
GHA: fix flow for 3.8/3.9, unavailable on ubuntu 26.04
Some checks are pending
Codespell / Check for spelling errors (push) Waiting to run
CI / build (3.10) (push) Waiting to run
CI / build (3.11) (push) Waiting to run
CI / build (3.12) (push) Waiting to run
CI / build (3.13) (push) Waiting to run
CI / build (3.14) (push) Waiting to run
CI / build (3.15) (push) Waiting to run
CI / build (pypy3.11) (push) Waiting to run
CI / build (ubuntu-24.04, 3.8) (push) Waiting to run
CI / build (ubuntu-24.04, 3.9) (push) Waiting to run
2026-11-02 13:31:27 +01:00
Sergey G. Brester
b3b0dc4641
Merge pull request #4251 from omrzk/fix/postfix-instance-journal-match
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15) (push) Has been cancelled
CI / build (3.8) (push) Has been cancelled
CI / build (3.9) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
Monitor all Postfix instances with the systemd backend
2026-10-27 19:42:55 +01:00
omrzk
839fb632b3 BF: monitor secondary Postfix instances in the journal 2026-10-18 09:04:57 -05:00
Sergey G. Brester
6c88de71d2
CI: update python versions (3.15 is released)
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15) (push) Has been cancelled
CI / build (3.8) (push) Has been cancelled
CI / build (3.9) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
2026-10-11 01:27:08 +02:00
sebres
544aff5dda amend to gh-4196: matches auth-worker message (one line per attempt, <pid><session> in prefix, etc)
Some checks are pending
Codespell / Check for spelling errors (push) Waiting to run
CI / build (3.10) (push) Waiting to run
CI / build (3.11) (push) Waiting to run
CI / build (3.12) (push) Waiting to run
CI / build (3.13) (push) Waiting to run
CI / build (3.14) (push) Waiting to run
CI / build (3.15.0-rc.2) (push) Waiting to run
CI / build (3.8) (push) Waiting to run
CI / build (3.9) (push) Waiting to run
CI / build (pypy3.11) (push) Waiting to run
2026-10-09 20:39:52 +02:00
sebres
789571aa44 filter.d/pam-generic.conf: correctly consider attempt to inject on username for right and both sides;
Some checks are pending
Codespell / Check for spelling errors (push) Waiting to run
CI / build (3.10) (push) Waiting to run
CI / build (3.11) (push) Waiting to run
CI / build (3.12) (push) Waiting to run
CI / build (3.13) (push) Waiting to run
CI / build (3.14) (push) Waiting to run
CI / build (3.15.0-rc.2) (push) Waiting to run
CI / build (3.8) (push) Waiting to run
CI / build (3.9) (push) Waiting to run
CI / build (pypy3.11) (push) Waiting to run
unless proven otherwise, we will prefer injection on the `ruser` field over the `user` field;
normally by invalid user field `user` not logged at all, see for example logging from `pam_syslog(pamh, LOG_NOTICE, "authentication failure; " ...` in pam_unix-module source code:
52b33a56a9/modules/pam_unix/support.c (L822)
2026-10-09 00:06:14 +02:00
sebres
ddd879d226 'filter.d/sshd.conf': properly consider further attempt to inject on username (__on_port_opt and __suff adjusted and don't match on \S+ anymore)
Some checks are pending
Codespell / Check for spelling errors (push) Waiting to run
CI / build (3.10) (push) Waiting to run
CI / build (3.11) (push) Waiting to run
CI / build (3.12) (push) Waiting to run
CI / build (3.13) (push) Waiting to run
CI / build (3.14) (push) Waiting to run
CI / build (3.15.0-rc.2) (push) Waiting to run
CI / build (3.8) (push) Waiting to run
CI / build (3.9) (push) Waiting to run
CI / build (pypy3.11) (push) Waiting to run
2026-10-08 18:48:26 +02:00
sebres
2cc5bed3dc filter.d/common.conf - improved RE for logtype rfc5424 (better compliant to RFC 5424);
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15.0-rc.2) (push) Has been cancelled
CI / build (3.8) (push) Has been cancelled
CI / build (3.9) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
- fixed prefix-line for malformed RFC 5424, vulnerable against ReDoS (catastrophic backtracking) by non-conform logger or artificial "injection" attempt on STRUCTURED-DATA, unescaped new-line in PARAM-VALUE, etc (GHSA-c2mg-2r7g-c3wp)
2026-09-28 22:20:27 +02:00
sebres
7212404e8f amend to 5cbe4b8b01 (systemd RC-fix): lock by closing of journal too (in afterStop, since _closeJournal used in _reopenJournal in lock, and lock is not reentrant)
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15.0-rc.2) (push) Has been cancelled
CI / build (3.8) (push) Has been cancelled
CI / build (3.9) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
2026-09-11 22:05:03 +02:00
sebres
f51ad5a5fb CI: update Python version to 3.15.0-rc.2 in workflow 2026-09-11 21:44:15 +02:00
sebres
5cbe4b8b01 prevent possible race condition accessing journal from 2 threads in parallel (sporadic "OSError: [Errno 22] Invalid argument" in test_delJournalMatch by addJournalMatch), protect journal handle with lock 2026-09-11 21:26:11 +02:00
sebres
12e94859b8 remove redundant set exclusion (glob for ../system.journal can never contain ../system*@*.journal) 2026-09-11 20:49:22 +02:00
Sergey G. Brester
86e415a76a
Merge pull request #4230 from ChrisJr404/gitlab-json-mode
Some checks failed
Codespell / Check for spelling errors (push) Has been cancelled
CI / build (3.10) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / build (3.15.0-rc.1) (push) Has been cancelled
CI / build (3.8) (push) Has been cancelled
CI / build (3.9) (push) Has been cancelled
CI / build (pypy3.11) (push) Has been cancelled
gitlab: add json mode for application_json.log
2026-08-26 16:06:17 +02:00
Sergey G. Brester
0e2ad0360d
update changelog (mode -> logtype, added PR number) 2026-08-26 16:05:01 +02:00
Chris (ChrisJr404)
7924c55682
gitlab: switch mode parameter to standard logtype (file/json) 2026-08-25 23:47:36 -04:00
Chris (ChrisJr404)
050e0b3460
gitlab: add json mode for application_json.log
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
2026-08-24 18:00:21 -04:00
sebres
deffcbcd17 add default banactions for several paths-*.conf depending on default net-filter for distribution;
closes gh-4224, gh-4229
2026-08-22 13:32:00 +02:00
sebres
46d2acd451 ChangeLog 2026-08-22 13:30:47 +02:00
sebres
63c0a46826 add default banactions for several paths-*.conf depending on default net-filter for distribution;
closes gh-4224, gh-4229
2026-08-22 13:26:02 +02:00
Arjen de Korte
c6b20f225c
paths-opensuse.conf: specify default banactions
Since 1.1.1 default banactions need to be specified. Take the opportunity to also synchronize the paths with current Factory settings.
2026-08-21 17:53:28 +02:00
Sergey G. Brester
403df4a91c
Merge pull request #4225 from Deric-W/socket-shutdown
Fix systemd socket activation being broken
2026-08-20 13:46:36 +02:00
Sergey G. Brester
6185bc3ea2
Update ChangeLog entry (added reference to PR) 2026-08-20 13:45:02 +02:00
Eric Wolf
cbdeee8d81
Fix systemd runtime directory containing persistent socket being removed
This resulted in a fail2ban being passed an unreachable socket after being stopped.
2026-08-20 04:03:15 +02:00