Fail2Ban 0.8.13 und Dovecot 2.2.13

Alles rund um sicherheitsrelevante Fragen und Probleme.
Antworten
jochen35
Beiträge: 63
Registriert: 03.10.2009 10:03:48

Fail2Ban 0.8.13 und Dovecot 2.2.13

Beitrag von jochen35 » 01.09.2015 07:14:58

Hallo,

ich habe unter Debian Jessie einen Mailserver bestehend aus Dovecot 2.2.13 und Postfix 2.11.3 installiert und möchte diesen zusätzlich mit Fail2ban 0.8.13 absichern. Das Problem ist nun, dass Dovecot folgende Log-Einträge in der /var/log/mail.log erzeugt.

Code: Alles auswählen

Aug 29 09:44:09 v1234567890 dovecot: imap-login: Disconnected: Inactivity (auth failed, 9 attempts in 176 secs): user=<test@mydomain.com>, method=PLAIN, rip=x.x.x.x, lip=x.x.x.x, TLS, session=<6RYbU24eRABPzsG1>
Aug 29 09:59:49 v1234567890 dovecot: imap-login: Disconnected: Inactivity (auth failed, 9 attempts in 180 secs): user=<test@mydomain.com>, method=PLAIN, rip=x.x.x.x, lip=x.x.x.x, TLS, session=<jbHwim4eFABPzsG1>
Aug 29 10:10:51 v1234567890 dovecot: imap-login: Disconnected: Inactivity (auth failed, 33 attempts in 180 secs): user=<test@mydomain.com>, method=PLAIN, rip=x.x.x.x, lip=x.x.x.x, TLS, session=<J/Zfsm4eAgBPzsG1>
Aug 29 10:13:57 v1234567890 dovecot: imap-login: Disconnected: Inactivity during authentication (auth failed, 14 attempts in 180 secs): user=<test@mydomain.com>, method=LOGIN, rip=x.x.x.x, lip=x.x.x.x, TLS, session=<WB56vW4ebgBPzsG1>
Fehlgeschlagene IMAP-Loginversuche werden also nicht direkt und als jeweils neue Zeile in die /va/log/mail.log geschrieben, so dass die Auswertung durch fail2ban nicht richtig funktioniert. Wo liegt hier das Problem bzw. kann man Dovecot dazu bringen fehlgeschlagene Login-Versuche sofort ins Log zu schreiben?

Gruß
Jochen

Hier noch meine Fail2ban-Konfiguration:

/etc/fail2ban/filter.d/dovecot.conf

Code: Alles auswählen

[Definition]
failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed|Aborted login \(\d+ authentication attempts).*rip=(?P<host>\S*),.*
ignoreregex = imap-login: Disconnected.*\(no auth attempts\).*
/etc/fail2ban/jail.local

Code: Alles auswählen

[DEFAULT]
ignoreip = 127.0.0.1/8
bantime  = 3600
maxretry = 3
backend = auto
destemail = root
banaction = iptables-multiport
mta = sendmail
protocol = tcp
chain = INPUT
action_ = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
action_mw = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
              %(mta)s-whois[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s"]
action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
               %(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s"]
action = %(action_mwl)s
[...]
[dovecot]
enabled   = true
port      = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
filter    = dovecot
logpath   = /var/log/mail.log
maxretry  = 3
[...]

rendegast
Beiträge: 15041
Registriert: 27.02.2006 16:50:33
Lizenz eigener Beiträge: MIT Lizenz

Re: Fail2Ban 0.8.13 und Dovecot 2.2.13

Beitrag von rendegast » 01.09.2015 08:32:30

Eintrag "... Disconnected: Inactivity during authentication (auth failed..."
<->
Suchbegriff: "...|Disconnected \(auth failed|..."
Eher sowas

Code: Alles auswählen

...|Disconnected \(auth failed|Disconnected: Inactivity during authentication \(auth failed|...
Wobei Du Dich dabei auch ins Knie schießen könntest,
scheint ein potentieller DoS.
mfg rendegast
-----------------------
Viel Eifer, viel Irrtum; weniger Eifer, weniger Irrtum; kein Eifer, kein Irrtum.
(Lin Yutang "Moment in Peking")

Antworten