Hallo liebe Gemeinde,
hier mal ein Problem in Sachen fail2ban, für die Profis unter Euch. 😉 😉
Vorweg: Alle Jails starten sauber und laufen.
Folgender Jail funtioniert einwandfrei:
Jail:
1 2 3 4 5 6 7 8 9 10 | [ssh] enabled = true port = 22 name = ssh protocol = tcp filter = sshd banaction = ufw logpath = /var/log/auth.log maxretry = 3 bantime = 60 |
Nach dreimaliger Falscheingabe des PW wird die IP geblockt. Perfekt.
fail2ban.log 2019-03-17 16:24:00,070 fail2ban.filter [11626]: INFO [sshd] Found 123.123.123.123 2019-03-17 16:24:00,072 fail2ban.filter [11626]: INFO [ssh] Found 123.123.123.123 2019-03-17 16:24:02,300 fail2ban.filter [11626]: INFO [ssh] Found 123.123.123.123 2019-03-17 16:24:02,302 fail2ban.filter [11626]: INFO [sshd] Found 123.123.123.123 2019-03-17 16:24:06,306 fail2ban.filter [11626]: INFO [ssh] Found 123.123.123.123 2019-03-17 16:24:06,307 fail2ban.filter [11626]: INFO [sshd] Found 123.123.123.123 2019-03-17 16:24:06,796 fail2ban.actions [11626]: NOTICE [ssh] Ban 123.123.123.123 2019-03-17 16:39:57,828 fail2ban.actions [11626]: NOTICE [ssh] Unban 123.123.123.123
Jetzt der Jail der nicht funktioniert:
1 2 3 4 5 6 7 8 9 10 | [pop3-auth] enabled = true port = pop3,pop3s name = POP3 protocol = tcp filter = pop3-auth banaction = ufw logpath = /var/log/mail.log maxretry = 3 bantime = 60 |
Hier der dazu gehörige Filter:
[Definition] #Failed login attempts due to wrong password failregex = POP3: Invalid password for user .*@xxx1.de. Attempt from IP address <HOST>. POP3: User .*@xxx1.de doesn't exist. Attempt from IP address <HOST>. POP3: Invalid password for user .*@xxx2.de. Attempt from IP address <HOST>. POP3: User .*@xxx2.de doesn't exist. Attempt from IP address <HOST>. POP3: Invalid password for user .*@xxx3.de. Attempt from IP address <HOST>. POP3: User .*@xxx3.de doesn't exist. Attempt from IP address <HOST>. ignoreregex =
Das hier taucht bei jedem Fehlversuch in der mail.log auf:
Mar 17 17:01:19 blabla.provider.de KerioSec  Failed POP3 login from 123.123.123.123 with SASL method DIGEST-MD5. Mar 17 17:01:19 blabla.provider.de KerioSec  POP3: Invalid password for user user@xxx1.de. Attempt from IP address 123.123.123.123. Mar 17 17:01:22 blabla.provider.de KerioSec  Failed POP3 login from 123.123.123.123, user user@xxx1.de.
Der Filter funktioniert auch einwandfrei:
fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/pop3-auth.conf
Resultat
Running tests ============= Use failregex filter file : pop3-auth, basedir: /etc/fail2ban Use log file : /var/log/mail.log Use encoding : UTF-8 Results ======= Failregex: 33 total |- #) [# of hits] regular expression | 1) [33] POP3: Invalid password for user .*@xxx1.de. Attempt from IP address <HOST>.
(Ich hoffe, ich habe keine wichtigen Infos vergessen)
Und jetzt wird's haarig!! Jetzt wird nämlich nicht geblockt!!
Die IP taucht nicht in der fail2ban.log auf. Es passiert einfach gar nichts.
Die finale Frage ist nun: Warum??
Ihr habt leider weder Telefon- noch Publikumsjoker. 😛 😛
Es wäre echt super, wenn hier jemand helfen könnte. Ich komme einfach nicht mehr weiter.