I'd like to set up the following logic using firewalld
- When a host attempts to access the server from the internet on port 22:
- DROP and
- add their IP to an ipset called "trap" (with 24 hour timeout)
- When a host whose IP is on the "trap" list attempts to connect to any port: DROP.
I've read many doc pages but can't see how to implement 1.2 above.
firewalld supports ipsets and you specify the 24 hour timeout (86400 seconds) when setting up that ipset:
In native net-filter / iptables the logic and ordering of the necessary rules would be:
Translating that to native firewalld / firewall-cmd rules/structures is bit beyond me at the moment, but adding the rules 1 & 2 as direct rules should be easy enough.
You should be able to get display entries in the trap list with: