Thoughts, scripts and concepts.

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

Share and Enjoy:
  • Google Bookmarks
  • Digg
  • E-mail this story to a friend!
  • MySpace
  • Share/Save/Bookmark

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...