Skip to content

Instantly share code, notes, and snippets.

@ScrambledBits
Created December 11, 2012 03:29
Show Gist options
  • Save ScrambledBits/4255708 to your computer and use it in GitHub Desktop.
Save ScrambledBits/4255708 to your computer and use it in GitHub Desktop.
SSH Dictionary Attack Prevention with iptables
#!/bin/bash
iptables -N SSH_CHECK
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j SSH_CHECK
iptables -A SSH_CHECK -m recent --set --name SSH
iptables -A SSH_CHECK -m recent --update --seconds 60 --hitcount 4 --name SSH -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment