My understanding is that running Fail2ban using ipset is faster. To that end:
I downloaded and installed per instructions (modified for Fedora 37) ritsu/ipset-fail2ban from Git.
My banaction is still set as:
banaction_allports = firewallcmd-rich-rules[actiontype=]
When I try to add or replace the above with:
banaction = firewallcmd-ipset
I get errors like:
2023-04-09 15:51:46,130 fail2ban.actions [986]: NOTICE [postfix-auth] Restore Ban 117.69.159.181
2023-04-09 15:51:46,526 fail2ban.utils [986]: ERROR 7f29c6bd0ea0 -- exec: ipset -exist create f2b-postfix-unv hash:ip timeout 0
firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -p tcp -m multiport --dports smtp,imap2,imap3,imaps,pop3,pop3s,465,587, submission -m set --match-set f2b-postfix-unv src -j REJECT --reject-with icmp-port-unreachable
2023-04-09 15:51:46,527 fail2ban.utils [986]: ERROR 7f29c6bd0ea0 -- stderr: "Error: COMMAND_FAILED: '/usr/sbin/iptables-restore -w -n' failed: iptables-restore v1.8.8 (legacy): invalid port/service `' specified"
2023-04-09 15:51:46,527 fail2ban.utils [986]: ERROR 7f29c6bd0ea0 -- stderr: 'Error occurred at line: 2'
2023-04-09 15:51:46,527 fail2ban.utils [986]: ERROR 7f29c6bd0ea0 -- stderr: "Try `iptables-restore -h' or 'iptables-restore --help' for more information."
2023-04-09 15:51:46,527 fail2ban.utils [986]: ERROR 7f29c6bd0ea0 -- stderr: ''
2023-04-09 15:51:46,527 fail2ban.utils [986]: ERROR 7f29c6bd0ea0 -- returned 13
If I run firewall-cmd --list-all-zones
I get a listing of currently banned IP addresses.
However they are not in any zone file under /etc/firewalld/zones
$ iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -- anywhere anywhere match-set blacklist-fail2ban src
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DROP tcp -- anywhere 185.191.32.198 tcp dpt:http
Where did I go wrong, if I went wrong?
Thank you
[Addendum 1]
Per advice of Ginnungagap on framing questions, my answer to his query about trailing comma is:
My jail.local for the error example is:
[postfix-unv]
enabled = true
filter = postfix-unv
port = smtp,imap2,imap3,imaps,pop3,pop3s,465,587, submission
logpath = /var/log/maillog
maxretry = 1
bantime = 604800
I don't see an extra comma. I also don't see an extra comma in the actual filter. I'll look into nftables.
[Addendum no 2]
Followed your suggestion by changing banaction. It seems to work when I issued the cmd nft list ruleset.
I restarted firewalld, and it has no additional rules (i.e., rich sets)
I restarted fail2ban and it loaded all the banned rules in about a minute.
Do I still need the files from Git (as mentioned above)?
Thank you Ginnungagap, your help is greatly appreciated.