Haufenweise SASL Logins die fehlschlagen?

Hallo,

ich habe heute meinen Windows-Rootserver platt gemacht und einen ISPConfig auf Debian 6.0 installiert.

Das ganze läuft bisher wirklich wunderbar; aber eine Sache ist mir beim kontrollieren der Logs aufgefallen:

Code:
May 11 20:19:58 srv1 postfix/smtpd[2916]: lost connection after AUTH from p57B2E265.dip0.t-ipconnect.de[87.178.226.101]
May 11 20:19:58 srv1 postfix/smtpd[2916]: disconnect from p57B2E265.dip0.t-ipconnect.de[87.178.226.101]
May 11 20:19:59 srv1 postfix/smtpd[2907]: connect from p57B2E265.dip0.t-ipconnect.de[87.178.226.101]
May 11 20:19:59 srv1 postfix/smtpd[2907]: warning: p57B2E265.dip0.t-ipconnect.de[87.178.226.101]: SASL LOGIN authentication failed: authentication failure

Und das alle paar Sekunden, immer von der gleichen IP.

Was genau ist das? Versucht da jemand/etwas eine eMail mit falschen Zugangsdaten über meinen Server zu versenden?
 
Wie krieg ich das raus? :)
Edit: Nein, die werden natürlich nicht gebannt. Es ist immer wieder die gleiche Anfrage, alle 2-3 Sekunden, von der gleichen IP.
Auch im fail2ban.log gibt es nur INFO-Einträge.

Ich bin genau nach dem Tutorial für Debian 6.0, ISP 3 und Courier vorgegangen, FYI.

Im Fail2ban-Filter steht folgendes:
failregex = (?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed:) [A-Za-z0-9+/]*={0,2})?$

Das sieht ja zumindest schonmal nach einer passenden Regel für meine Fehler im Log aus.

Habe in einem HowTo den Befehl fail2ban-regex gefunden, um die Pattern auf ein Logfile anzuwendern und zu prüfen, ob was passt.
Also ein Test mit der mail.log:

Code:
root@srv1:/var/log# fail2ban-regex /var/log/mail.log '(?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [A-Za-z0-9+/]*={0,2})?$'
/usr/share/fail2ban/server/filter.py:442: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5

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

Use regex line : (?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|P...
Use log file   : /var/log/mail.log


Results
=======

Failregex
|- Regular expressions:
|  [1] (?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [A-Za-z0-9+/]*={0,2})?$
|
`- Number of matches:
   [1] 0 match(es)

Ignoreregex
|- Regular expressions:
|
`- Number of matches:

Summary
=======

Sorry, no match

Hmmm :/

Edit2: Handarbeit!
Hab mir die originale sasl.conf kopiert, und den regulären Ausdruck angepasst:
vi /etc/fail2ban/filter.d/sasl2.conf
Code:
# Fail2Ban configuration file
#
# Author: Yaroslav Halchenko
#
# $Revision: 728 $
#

[Definition]

# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values: TEXT
#
failregex = \[<HOST>\]: SASL LOGIN authentication failed: authentication failure

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

Danach in der jail.local unter /etc/fail2ban/ einen Zusatzeintrag hinzugefügt:
Code:
[sasl-bm]

enabled  = true
port     = smtp
filter   = sasl2
logpath  = /var/log/mail.log
maxretry = 5

Und siehe da, das Ergebnis:
Code:
2013-05-11 23:02:31,652 fail2ban.filter : INFO   Set findtime = 600
2013-05-11 23:02:31,653 fail2ban.actions: INFO   Set banTime = 3600
2013-05-11 23:02:31,660 fail2ban.jail   : INFO   Jail 'courierpop3' started
2013-05-11 23:02:31,663 fail2ban.jail   : INFO   Jail 'courierimaps' started
2013-05-11 23:02:31,666 fail2ban.jail   : INFO   Jail 'courierpop3s' started
2013-05-11 23:02:31,668 fail2ban.jail   : INFO   Jail 'pureftpd' started
2013-05-11 23:02:31,670 fail2ban.jail   : INFO   Jail 'ssh' started
2013-05-11 23:02:31,674 fail2ban.jail   : INFO   Jail 'sasl-bm' started
2013-05-11 23:02:31,676 fail2ban.jail   : INFO   Jail 'courierimap' started
2013-05-11 23:02:31,679 fail2ban.jail   : INFO   Jail 'sasl' started
2013-05-11 23:02:41,735 fail2ban.actions: WARNING [sasl2] Ban 87.178.226.101

Mich wundert nur, dass das von "Haus aus" nicht der richtige reguläre Ausdruck war...
 
Zuletzt bearbeitet:
Okay, jetzt habe ich aber ein anderes Problem... bis jetzt hat's ja fehlerfrei funktioniert.

Aktuell häufen sich wieder die Meldungen, dass ein SASL Auth fehlgeschlagen ist. Fail2ban sagt dazu aber nur, dass die betreffende IP bereits gebannt ist - und so steht's auch in den IPTables.
Die ganzen Fehler im mail.log tauchen aber weiterhin auf?!

fail2ban-log:
Code:
2013-05-12 14:18:25,013 fail2ban.actions: WARNING [sasl2] 87.178.245.133 already banned
2013-05-12 14:18:55,065 fail2ban.actions: WARNING [sasl2] 87.178.245.133 already banned
2013-05-12 14:19:23,115 fail2ban.actions: WARNING [sasl2] 87.178.245.133 already banned
2013-05-12 14:19:50,163 fail2ban.actions: WARNING [sasl2] 87.178.245.133 already banned

mail.log:
Code:
May 12 14:19:47 srv1 postfix/smtpd[7155]: lost connection after AUTH from p57B2F585.dip0.t-ipconnect.de[87.178.245.133]
May 12 14:19:47 srv1 postfix/smtpd[7155]: disconnect from p57B2F585.dip0.t-ipconnect.de[87.178.245.133]
May 12 14:19:48 srv1 postfix/smtpd[7051]: connect from p57B2F585.dip0.t-ipconnect.de[87.178.245.133]
May 12 14:19:49 srv1 postfix/smtpd[7051]: warning: p57B2F585.dip0.t-ipconnect.de[87.178.245.133]: SASL LOGIN authentication failed: authentication failure
May 12 14:19:49 srv1 postfix/smtpd[7051]: lost connection after AUTH from p57B2F585.dip0.t-ipconnect.de[87.178.245.133]
May 12 14:19:49 srv1 postfix/smtpd[7051]: disconnect from p57B2F585.dip0.t-ipconnect.de[87.178.245.133]
May 12 14:19:53 srv1 postfix/smtpd[7155]: connect from p57B2F585.dip0.t-ipconnect.de[87.178.245.133]
May 12 14:19:53 srv1 postfix/smtpd[7155]: warning: p57B2F585.dip0.t-ipconnect.de[87.178.245.133]: SASL LOGIN authentication failed: authentication failure

iptables:
Code:
-A fail2ban-sasl -j RETURN 
-A fail2ban-sasl2 -s 87.178.245.133/32 -j DROP 
-A fail2ban-sasl2 -j RETURN


Woran kann das nun liegen?


Edit1: Und hier die Lösung:
Ich hatte meine jail.local angepasst, und die bantime auf 84600 gesetzt - also einen Tag. Nach etwas Recherche scheint es so zu sein, dass nur 3 Ziffern erlaubt sind - also 999, etwa 16 Minuten.
Habe die bantime auf 999 gesetzt, fail2ban neu gestartet, und é voila... das gespamme hat aufgehört.
 
Zuletzt bearbeitet:

nowayback

Well-Known Member
Nach etwas Recherche scheint es so zu sein, dass nur 3 Ziffern erlaubt sind - also 999

wo hast du das denn gefunden? Ich hab meine Bantime auf 86400 also einen tag und habe keinerlei probleme damit.

Code:
2013-05-09 23:31:54,715 fail2ban.jail   : INFO   Creating new jail 'sasl'
2013-05-09 23:31:54,715 fail2ban.jail   : INFO   Jail 'sasl' uses Gamin
2013-05-09 23:31:54,825 fail2ban.filter : INFO   Added logfile = /var/log/mail.log
2013-05-09 23:31:54,825 fail2ban.filter : INFO   Set maxRetry = 3
2013-05-09 23:31:54,826 fail2ban.filter : INFO   Set findtime = 600
2013-05-09 23:31:54,826 fail2ban.actions: INFO   Set banTime = 86400
2013-05-11 15:52:29,772 fail2ban.actions: WARNING [sasl] Ban 145.253.119.114
2013-05-12 15:52:29,936 fail2ban.actions: WARNING [sasl] Unban 145.253.119.114

Grüße
nwb
 
Ich bin auf diesen Ubuntu-Eintrag gestoßen:
[ubuntu] Fail2ban not banning?

Da heißt es im 2 oder 3 Post, dass "jemand glaubt, die bantime dürfte nur aus 3 Ziffern bestehen".

Ich habe daraufhin die bantime auf 999 gesetzt, und sofort hat fail2ban die IP wieder geblockt.

Dachte daher, der Herr hätte recht :)
 

nowayback

Well-Known Member
ich hab dir mal meine dateien bezüglich sasl drangehängt :)

/etc/fail2ban/jail.local
Code:
[sasl]
enabled  = true
port     = smtp
filter   = sasl
logpath  = /var/log/mail.log
maxretry = 3

/etc/fail2ban/filter.d/sasl.conf
Code:
# Fail2Ban configuration file
#
# Author: Yaroslav Halchenko
#
# $Revision$
#

[Definition]

# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values: TEXT
#
failregex = (?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [ A-Za-z0-9+/]*={0,2})?\s*$

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

schau dir hier mal failregex an

grüße
 

Werbung

Top