ssh port cloaking
by admin on Apr.14, 2007, under Tech, Uncategorized
SSH port cloaking made simple
## Set this to your WAN (internet) network card
DEVICE_WAN=eth1
iptables -N Ssh
iptables -F Ssh
iptables -A Ssh -m state –state ! NEW,INVALID -j ACCEPT
iptables -A Ssh -m state –state NEW -m recent –set –name Ssh
iptables -A Ssh -m state –state NEW -m recent –update –name Ssh –seconds 1 –hitcount 2 -j REJECT –reject-with tcp-reset
iptables -A Ssh -m state –state NEW -m recent –update –name Ssh –seconds 2 –hitcount 2 -j REJECT –reject-with tcp-reset
iptables -A Ssh -m state –state NEW -m recent –rcheck –name Ssh –seconds 4 –hitcount 2 -j ACCEPT
iptables -A Ssh -j DROP
iptables -A INPUT -i DEVICE_WAN -p tcp –dport 22 -j Ssh













































