Skip to content

[SOLVED] Ban every single login attempt which is using a specific domain as part of the username #3166

Answered by sebres
solbu asked this question in Q&A
Discussion options

You must be logged in to vote

Well you have a bit atypical timestamp nov. 25 18:13:43 in your example (which fail2ban would probably not find by default), so you have to specify datepattern = %%b\. %%d %%H:%%M:%%S.

In this case it will be found as a failure with pam-generic or dovecot jail (no matter with which domain).

PoC (fail2ban-regex for pam-generic and dovecot filters) ...
$ msg='nov. 25 18:13:43 login auth[25976]: pam_unix(dovecot:auth): authentication failure; logname= uid=0 euid=0 tty=dovecot ruser=test@example.com rhost=10.0.58.9'
$ fail2ban-regex -d '%b\. %d %H:%M:%S' "$msg" pam-generic

Running tests
=============

Use      datepattern : %b\. %d %H:%M:%S : MON\. Day 24hour:Minute:Second
Use   failregex f…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by sebres
Comment options

You must be logged in to vote
9 replies
@solbu
Comment options

@solbu
Comment options

@solbu
Comment options

@sebres
Comment options

@solbu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants