Skip to content

Instantly share code, notes, and snippets.

@gene1wood
Last active December 28, 2015 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gene1wood/7489372 to your computer and use it in GitHub Desktop.
Save gene1wood/7489372 to your computer and use it in GitHub Desktop.
Example knockd.conf file that creates and destroys iptables rules
[options]
logfile = /var/log/knockd.log
[openSSH]
sequence = 10000,20000,30000,40000
seq_timeout = 45
tcpflags = syn
command = /sbin/iptables -I INPUT 15 -s %IP% -p tcp -m state --state NEW -m multiport --dports 22,80,443 -j ACCEPT -m comment --comment "knockd added `date +%F_%T` allowing access to SSH, HTTP and HTTPS : `dig -x %IP% +short`"
[closeSSH]
sequence = 40000,30000,20000,10000
seq_timeout = 45
tcpflags = syn
# https://gist.github.com/gene1wood/7489673
command = /usr/local/sbin/delete_knockd_iptables_rule %IP%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment