Skip to content

Instantly share code, notes, and snippets.

@songpon
Created February 17, 2017 15:40
Show Gist options
  • Save songpon/3eda447ddc296480b8d6abb59da15c00 to your computer and use it in GitHub Desktop.
Save songpon/3eda447ddc296480b8d6abb59da15c00 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Stopping firewall and allowing everyone..."
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 2122 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -A INPUT -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment