Skip to content

support systemd-journal log prefix in authelia filter - #4262

Merged
sebres merged 2 commits into
fail2ban:masterfrom
rafaelsoje:add-authelia-filter
Nov 3, 2026
Merged

sebres merged 2 commits into
fail2ban:masterfrom
rafaelsoje:add-authelia-filter

Conversation

@rafaelsoje

Copy link
Copy Markdown
Contributor

Summary

Follow-up to gh-4259 (and gh-4005) addressing the review comment regarding systemd-journal prefix handling in config/filter.d/authelia.conf.

Details

  • In config/filter.d/authelia.conf:
    • Included before = common.conf and set _daemon = authelia so logtype = file is inherited from [DEFAULT], allowing Fail2Ban to switch automatically to logtype = journal when backend = systemd is used.
    • Replaced ^\s* in [lt_file] with ^<__prefix_line> (where __prefix_line = \s* in [lt_file]), keeping the compiled regex identical for logtype = file.
    • Added [lt_short] and [lt_journal] sections reusing <lt_file/failregex> with the standard journal prefix (hostname authelia[pid]:).
    • Added ^<lt_short/__prefix_line> to [lt_json] so structured JSON logs also match when prefixed by journal metadata.
  • In fail2ban/tests/files/logs/authelia:
    • Added sample log tests for logtype = journal (including a negative test case for successful authentication) and JSON format with a journal prefix.

Checklist

  • CONSIDER adding a unit test if your PR resolves an issue
  • LIST ISSUES this PR resolves or describe the approach in detail
  • MAKE SURE this PR doesn't break existing tests
  • KEEP PR small so it could be easily reviewed
  • AVOID making unnecessary stylistic changes in unrelated code
  • ACCOMPANY each new failregex for filter X with sample log lines (and # failJSON) within fail2ban/tests/files/logs/X file

@sebres
sebres force-pushed the add-authelia-filter branch from d759626 to 81f3c37 Compare November 3, 2026 19:20
@sebres
sebres merged commit fd09a9d into fail2ban:master Nov 3, 2026
10 checks passed
@sebres

sebres commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thx!
I adjusted it a bit in 81f3c37 (datepattern for journal must cover timestamp at start of message)...
Merge now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants