I couldn't make fail2ban to block IP address coming up in postfix log on Debian 9. I rewrote the failregex to be like this:
NOQUEUE: reject: RCPT from (.*)\[<HOST>\]:(.*) 550 5.7.1 Service unavailable; client \[(.*)\] blocked using .* from=<.*>, to=<.*>, proto=ESMTP, helo=<.*>
instead
^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[<HOST>\]: 454 4\.7\.1 Service unavailable; Client host \[\S+\] blocked using .* from=<\S*> to=<\S+> proto=ESMTP helo=<\S*>$
So now it will ban just fine. However, as soon as the ban expires, it will not block it again, but will print in fail2ban.log a lot of "Found" entries, without banning them...
2019-02-13 20:03:50,558 fail2ban.actions [4924]: NOTICE [postfix-rbl] 217.169.214.225 already banned
2019-02-13 20:03:50,574 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:50,625 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:50,666 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:50,752 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:50,770 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:50,836 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:50,861 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:51,132 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:51,173 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.151.62
2019-02-13 20:03:51,216 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:51,315 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:51,410 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:51,497 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:51,560 fail2ban.actions [4924]: NOTICE [postfix-rbl] 217.169.214.225 already banned
2019-02-13 20:03:51,581 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:51,604 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.151.62
2019-02-13 20:03:51,751 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.148.30
2019-02-13 20:03:51,860 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:51,961 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:52,514 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:52,561 fail2ban.actions [4924]: NOTICE [postfix-rbl] 217.169.214.225 already banned
2019-02-13 20:03:52,602 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:52,689 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:52,776 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:52,868 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:52,952 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:53,141 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:53,238 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:53,317 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:53,325 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:53,411 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:53,490 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:53,563 fail2ban.actions [4924]: NOTICE [postfix-rbl] 188.255.152.32 already banned
2019-02-13 20:03:53,577 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:53,585 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:53,671 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:53,707 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:53,765 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:53,773 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:53,854 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.201
2019-02-13 20:03:53,865 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
2019-02-13 20:03:53,908 fail2ban.filter [4924]: INFO [postfix-rbl] Found 188.255.159.5
How do i resolve this? :/ I'm getting really frustrated.
EDIT: Ban action is set in jail.conf for postfix and postfix-rbl like this:
action = %(banaction)s[name=%(__name__)s-tcp, port="%(port)s", protocol="tcp", chain="%(chain)s", actname=%(banaction)s-tcp]
As mentoned, it will ban it just fine at first, as soon as fail2ban starts (or restarts using systemctl restart fail2ban). But not again after it expires.
iptables -nvL
? If not they're not actually banned.Found ${addr}
. Restart helps. Version 0.11.2.