Skip to content

Instantly share code, notes, and snippets.

@ph1048
Created May 1, 2021 22:06
Show Gist options
  • Save ph1048/b8743b180e423383741fbaff37c255d1 to your computer and use it in GitHub Desktop.
Save ph1048/b8743b180e423383741fbaff37c255d1 to your computer and use it in GitHub Desktop.
keenetic port knocking for vpn
#!/bin/sh
[ "$table" != "filter" ] && exit 0
/opt/sbin/ipset create knockd hash:ip -exist
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 1701 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 500 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 4500 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -m set --match-set knockd src -p udp --dport 1701 -j ACCEPT
/opt/sbin/iptables -I _NDM_IP_PUBLIC -m set --match-set knockd src -p udp --dport 500 -j ACCEPT
/opt/sbin/iptables -I _NDM_IP_PUBLIC -m set --match-set knockd src -p udp --dport 4500 -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment