Created
February 15, 2017 19:49
-
-
Save Klexx/1c98cbd064d5997963fcf4e0bdd62994 to your computer and use it in GitHub Desktop.
minimal iptables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSH_PORT=1234 | |
iptables -X | |
iptables -F | |
iptables -t nat -F | |
iptables -t nat -X | |
iptables -t mangle -F | |
iptables -t mangle -X | |
iptables -P INPUT DROP | |
iptables -P OUTPUT ACCEPT | |
iptables -P FORWARD DROP | |
## allow established | |
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | |
## allow ssh | |
iptables -A INPUT -p tcp --dport $SSH_PORT -j ACCEPT | |
iptables -A INPUT -p tcp --dport 443 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
## allow ping | |
iptables -A INPUT -p icmp --icmp-type 8 -m conntrack --ctstate NEW -j ACCEPT | |
ip6tables -F | |
ip6tables -X | |
ip6tables -t nat -F | |
ip6tables -t nat -X | |
ip6tables -t mangle -F | |
ip6tables -t mangle -X | |
ip6tables -P INPUT DROP | |
ip6tables -P OUTPUT ACCEPT | |
ip6tables -P FORWARD DROP | |
## allow established | |
ip6tables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | |
## allow ssh | |
ip6tables -A INPUT -p tcp --dport $SSH_PORT -j ACCEPT | |
ip6tables -A INPUT -p tcp --dport 443 -j ACCEPT | |
ip6tables -A INPUT -p tcp --dport 80 -j ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment