Created
January 25, 2019 10:54
-
-
Save ttj4/8af18d0f9f949f442ba530dafa96dfb4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
sudo iptables --flush | |
sudo iptables --delete-chain | |
allow loopback | |
sudo iptables -A INPUT -i lo -j ACCEPT | |
sudo iptables -A OUTPUT -o lo -j ACCEPT | |
allow established connections | |
sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
allow 80 and 443 | |
sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT | |
sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT | |
sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT | |
default policies | |
--- | |
sudo iptables -P INPUT DROP | |
sudo iptables -P OUTPUT ACCEPT | |
In case to allow access from pc only to 80 and 443 do Delete curent rules and chains | |
sudo iptables --flush | |
sudo iptables --delete-chain | |
allow loopback | |
sudo iptables -A INPUT -i lo -j ACCEPT | |
sudo iptables -A OUTPUT -o lo -j ACCEPT | |
allow established connections | |
sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
allow traffic to 80 and 443 | |
sudo iptables -A OUTPUT -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment