Skip to content

Instantly share code, notes, and snippets.

@rafaelfoster
Created February 25, 2014 16:19
Show Gist options
  • Save rafaelfoster/9212175 to your computer and use it in GitHub Desktop.
Save rafaelfoster/9212175 to your computer and use it in GitHub Desktop.
Some iptables rules.
# This rule, block one IP for 5 minutes, that is trying to connect to SSH port more than 3 times.
# ideal to block Brute Force Attacks
iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 300 --hitcount 3 -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment