Fail2ban - IP banned is able to connect

I am using Ubuntu Server 20.04.

I installed fail2ban and it is correctly banning the IP but still its able to connect. Giving below the fail2ban.log snippet.

2021-07-19 09:52:14,543 fail2ban.filter         [1254638]: INFO    [postfix-sasl] Found 218.4.239.146 - 2021-07-19 09:52:14
2021-07-19 09:52:21,285 fail2ban.filter         [1254638]: INFO    [postfix-sasl] Found 218.4.239.146 - 2021-07-19 09:52:21
2021-07-19 09:52:21,457 fail2ban.actions        [1254638]: WARNING [postfix-sasl] 218.4.239.146 already banned

My jail.local has the following for postfix-sasl

[postfix-sasl]

enabled = true
filter   = postfix[mode=auth]
port     = smtp,465,submission,imap,imaps,pop3,pop3s
# You might consider monitoring /var/log/mail.warn instead if you are
# running postfix since it would provide the same log lines at the
# "warn" level but overall at the smaller filesize.
logpath  = %(postfix_log)s
backend  = %(postfix_backend)s
action = iptables-multiport
maxretry = 2
findtime = 600
bantime = 86400

My banaction is also given below.

banaction = iptables-allports
banaction_allports = iptables-allports

Please do let me know if I am setting it up properly.


Solution 1:

I installed fail2ban and it is correctly banning the IP but still its able to connect

See the answer for second question ("Ban takes place but does not work, the intruder is still able to connect and continues an attack") in the wiki :: How fail2ban works.

action = iptables-multiport

Don't set action directly, because it overwrites mandatory (default) settings the action would need. Use banaction instead or supply all parameters the action may need, see jail.conf#L212.