zone { localhost public } iplist { # List of known good hosts, don't ban these @good 192.168.0.0/24 foobar.fi # List containing banned IP addresses. They will be banned for 5 minutes. @banned dynamic=yes element_timeout=5m } public-localhost { # Drop all new traffic if source IP address is in @banned iplist. # Update/reset ban expire timeout. Add this as first rule. saddr @banned iplist_update saddr @banned drop log + ":banned" # Allow SSH from known good hosts and others with rate limit. # If there are more than 5/minute connections add them to @banned iplist. ssh saddr @good ssh saddr_rate "5/minute burst 5" ssh iplist_update saddr @banned drop log + ":ban-ssh" # ...other normal rules, with or without similar rate limit banning... # Instead of normal final "drop log" rule: # - Allow 2/min dropped connections without banning. # - Somebody is port scanning us. Add IP address to @banned iplist. # - Make sure @good addresses are never banned. saddr @good drop log saddr_rate "2/minute burst 10" drop log iplist_update saddr @banned drop log + ":ban-portscan" }