Fail2ban and Postfix
Protect against Postfix AUTH DoS attacks
I’ve noticed a lot of SASL LOGIN authentication failed
errors in /var/log/mail.log
TL;DR
Simplest and fastest is to just enable already included jail, the one from jail.conf here
|
|
More elaborate is to create a new jail:
|
|
I’m not sure why, the following should work, but it doesn’t:
Default working mode is mode=more
which combines only standard and RBL blocking.
Read about it more inside filter.d/postfix.conf
or online
I’ve decided to enable “aggressive” mode to include all available filters.
|
|
Useful commands
Test if it will catch those errors:
|
|
|
|
You can also use fail2ban-regex to check the filter works for you:
This is valid for versions 0.10 and above (check version with
fail2ban-client version
). Older versions have different configuration.
Useful commands:
|
|
About config files
They simply are all processed, in the following order or precedence:
jail.conf
jail.d/*.conf
(all files, in alphabetical order)jail.local
jail.d/*.local
(all files, in alphabetical order)
The files are all read in sequence, and any option set in a file overrides the same option (same section, same name) in the previous ones.
More ideas:
-
If needed, you can block whole IP ranges: Fail2Ban IP-Range mit Blackliste blocken