Fail2ban filter in 5.0 für management-console-web-server.log - HELP NEEDED

Hallo zusammen,

Zum Glück kann man fail2ban jetzt in 5.0 einfach über apt installieren und wir haben es auf einem Kundensystem jetzt bereits für postfix-sasl, SSL und dovecot am laufen, um Brute-Force-Passwort-Angriffe abzuwehren.

Wir würden jetzt noch gerne das Portal selbst absichern, scheitern aber mit den Filtern.

 fail2ban-regex -v '24.03.22 14:11:08.351  MAIN        ( PROCESS ) : CPAuth (185.214.223.14:44560) response message: The authentication has failed, please login again.' '^.+CPAuth .\(<ADDR>\:\d+\) response message\: The authentication has failed\, please login again\.$'

spuckt leider folgendes aus:

Lines: 1 lines, 0 ignored, 0 matched, 1 missed
[processed in 0.02 sec]

|- Missed line(s):
|  24.03.22 14:11:08.351  MAIN        ( PROCESS ) : CPAuth (185.214.223.14:44560) response message: The authentication has failed, please login again.
`-

Wenn ich ADDR durch HOST ersetze, derselbe Effekt.

Hier das filter-File:

# Fail2Ban filter for unsuccesful Univention Web Console Login  attempts
#
#
# log-error=/var/log/univention/management-console-web-server.log
#

[INCLUDES]

# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf

[Definition]

failregex = ^.+CPAuth .\(<ADDR>\:\d+\) response message\: The authentication has failed\, please login again\.$

ignoreregex = 

# DEV Notes:
#
# Example:
# 24.03.22 14:11:08.351  MAIN        ( PROCESS ) : CPAuth (185.214.223.14:44560) response message: The authentication has failed, please login again.

Für Hilfe bin ich mehr als dankbar und würde den Filter gerne auch veröffentlichen - das Problem sollten ja eigentlich alle Univention-Portalbetreiber haben?

Moin, habe das jetzt nicht in fail2ban geprüft, aber mit regex101.com sehe ich, dass im regulären Ausdruck ein Punkt zu viel ist nach CPAuth.

Ohne diesen sollte es matchen, siehe hier regex101: build, test, and debug regex

^.+CPAuth \(.*\:\d+\) response message\: The authentication has failed\, please login again\.$

With some help on the fail2ban github site, I learned that no dates were matched and that I had to add a datepattern in the filter def. Voila, here is the filter. Feel free to publish. No warranties of course.

# Fail2Ban filter for unsuccesful Univention Web Console Login  attempts
#
#
# log-error=/var/log/univention/management-console-web-server.log
#

[INCLUDES]

# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf

[Definition]

datepattern = ^%%d\.%%m\.%%y %%H:%%M:%%S(?:\.%%f)

failregex = ^\s*MAIN [^:]*: CPAuth \(<ADDR>:\d+\) response message: The authentication has failed

ignoreregex = 

# DEV Notes:
#
# Example:
# 24.03.22 14:11:08.351  MAIN        ( PROCESS ) : CPAuth (192.168.1.1:44560) response message: The authentication has failed, please login again.
# Author: Ralf Holighaus
Mastodon