| 1 |
zone { |
| 2 |
localhost |
| 3 |
public |
| 4 |
} |
| 5 |
|
| 6 |
iplist { |
| 7 |
# List of IP addresses that have performed initial knock.. |
| 8 |
# It is valid for 30 seconds. |
| 9 |
@knock dynamic=yes element_timeout=30s |
| 10 |
} |
| 11 |
|
| 12 |
public-localhost { |
| 13 |
# Allow SSH if IP address is in @knock iplist. |
| 14 |
ssh saddr @knock |
| 15 |
|
| 16 |
# Add source IP address to @knock iplist if there is UDP packet to port 5042. |
| 17 |
udp 5042 iplist_update saddr @knock drop log + ":knock" |
| 18 |
|
| 19 |
# Delete IP address from @knock iplist if there is any packet to any other |
| 20 |
# port. This prevents opening SSH if port scan is received. |
| 21 |
saddr @knock iplist_delete saddr @knock continue log + ":unknock" |
| 22 |
|
| 23 |
# ...other normal rules... |
| 24 |
drop log |
| 25 |
} |