Fail2ban Postfix SASL configuration
The basic configuration file of Fail2ban is available at /etc/fail2ban/local.conf. However, to make customization we need to use a local config file called /etc/fail2ban/jail.local
To configure Fail2ban for Postfix SASL, add the following section in the jail.local file.
[sasl]
enabled = true
port = smtp
filter = postfix-sasl
logpath = /var/log/mail.log
maxretry = 5
Additionally, we need to configure Fail2Ban filter for postfix authentication failures in /etc/fail2ban/filter.d/postfix-sasl.conf.
A working postfix-sasl.conf contains the following details:
# Fail2Ban filter for postfix authentication failures
[INCLUDES]
before = common.conf
[Definition]
_daemon = postfix/smtpd
failregex = ^%(__prefix_line)swarning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [ A-Za-z0-9+/]*={0,2})?\s*$
Ref:
https://bobcares.com/blog/fail2ban-postfix-sasl/
Comments
Post a Comment