• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Issue fail2ban postfix.conf not filtering authentication failures (dictionary attacks)

PeterKi

Regular Pleskian
There are frequent attempts to brute force login to my mail server which show up in /var/log/maillog as shown below.
The filter in /etc/fail2ban/filter.d/postfix.conf does not detect those lines and thus does not ban the IPs in question.
I did check with the following command, and it indeed does not match any of the warnings shown below but lists them as missed
fail2ban-regex -v --print-all-matched --print-all-missed /var/log/maillog /etc/fail2ban/filter.d/postfix.conf

Thus, I think the postfix.conf filter should either be adapted or there should be a separate filter and jail to ban those attacking servers.
As a workaround I did setup a postfix-sasl.local filter as shown, but I would expect a plesk filter for these common attacks.


May 19 23:59:24 h1231588 plesk_saslauthd[32060]: No such user 'ellis@stratoserver.net' in mail authorization database
May 19 23:59:24 h1231588 plesk_saslauthd[32060]: failed mail authentication attempt for user 'ellis@stratoserver.net' (password len=6)
May 19 23:59:24 h1231588 postfix/smtpd[32028]: warning: unknown[103.147.184.193]: SASL LOGIN authentication failed: authentication failure
May 19 23:59:27 h1231588 plesk_saslauthd[32060]: No such user 'ellis@stratoserver.net' in mail authorization database
May 19 23:59:27 h1231588 plesk_saslauthd[32060]: failed mail authentication attempt for user 'ellis@stratoserver.net' (password len=10)
May 19 23:59:27 h1231588 postfix/smtpd[32028]: warning: unknown[103.147.184.193]: SASL LOGIN authentication failed: authentication failure
May 19 23:59:29 h1231588 plesk_saslauthd[32060]: No such user 'ellis@stratoserver.net' in mail authorization database
May 19 23:59:29 h1231588 plesk_saslauthd[32060]: failed mail authentication attempt for user 'ellis@stratoserver.net' (password len=7)
May 19 23:59:29 h1231588 postfix/smtpd[32028]: warning: unknown[103.147.184.193]: SASL LOGIN authentication failed: authentication failure
May 19 23:59:30 h1231588 plesk_saslauthd[32060]: No such user 'ellis@stratoserver.net' in mail authorization database
May 19 23:59:30 h1231588 plesk_saslauthd[32060]: failed mail authentication attempt for user 'ellis@stratoserver.net' (password len=5)
May 19 23:59:30 h1231588 postfix/smtpd[32028]: warning: unknown[103.147.184.193]: SASL LOGIN authentication failed: authentication failure
May 19 23:59:33 h1231588 plesk_saslauthd[32060]: No such user 'ellis@stratoserver.net' in mail authorization database
May 19 23:59:33 h1231588 plesk_saslauthd[32060]: failed mail authentication attempt for user 'ellis@stratoserver.net' (password len=6)
May 19 23:59:33 h1231588 postfix/smtpd[32028]: warning: unknown[103.147.184.193]: SASL LOGIN authentication failed: authentication failure


cat /etc/fail2ban/filter.d/postfix-sasl.local
# Fail2Ban filter for postfix authentication failures
[INCLUDES]
# include common.conf rules before other definitions
before = common.conf

[Definition]
daemon = postfix(-\w+)?/(?:submission/|smtps/)?smtp[ds]

# ref: regex101: build, test, and debug regex
failregex = ^%(__prefix_line)swarning: [-._\w]+\[<HOST>\]: SASL ((?i)LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed([\s\w+\/:]*={0,4})?\s*$

ignoreregex = authentication failed: Connection lost to authentication server$

[Init]
journalmatch = _SYSTEMD_UNIT=postfix.service
 
Back
Top