Skip to content

Instantly share code, notes, and snippets.

@ViKingIX
Created December 10, 2015 07:04
Show Gist options
  • Save ViKingIX/b8c1fbb17886ef48186c to your computer and use it in GitHub Desktop.
Save ViKingIX/b8c1fbb17886ef48186c to your computer and use it in GitHub Desktop.
block brute force ssh login
iptables -A SSH -m conntrack --ctstate NEW -m recent --set --name ssh --mask 255.255.255.255 --rsource
iptables -A SSH -m recent --update --seconds 30 --hitcount 6 --name ssh --mask 255.255.255.255 --rsource -j DROP
iptables -A SSH -m recent --update --seconds 15 --hitcount 2 --name ssh --mask 255.255.255.255 --rsource -j DROP
iptables -A SSH -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment