zone { localhost public } iplist { # List of IP addresses that have performed initial knock.. # It is valid for 30 seconds. @knock dynamic=yes element_timeout=30s } public-localhost { # Allow SSH if IP address is in @knock iplist. ssh saddr @knock # Add source IP address to @knock iplist if there is UDP packet to port 5042. udp 5042 iplist_update saddr @knock drop log + ":knock" # Delete IP address from @knock iplist if there is any packet to any other # port. This prevents opening SSH if port scan is received. saddr @knock iplist_delete saddr @knock continue log + ":unknock" # ...other normal rules... drop log }