Skip to content

Instantly share code, notes, and snippets.

@andygock
Created June 23, 2020 11:47
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 andygock/1855ad9ccb2625372f2483c61cbee0f6 to your computer and use it in GitHub Desktop.
Save andygock/1855ad9ccb2625372f2483c61cbee0f6 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Flush tables
iptables -F
# Allow established connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow SSH, VNC, Web etc
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
# iptables -A INPUT -p tcp --dport 5900 -j ACCEPT
# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# Ping, from anywhere
iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 0 -j ACCEPT
# Accept all from localhost
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Drop everything else
iptables -A INPUT -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment