Last active
August 29, 2015 14:03
-
-
Save alexey-detr/f122f1b70c84a123085e to your computer and use it in GitHub Desktop.
Allow any traffic for loopback. Allow 22, 80 ports. Deny others. Install iptables-persistent to load rules when server boot. I'm using it for default web server configuration.
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
#!/bin/sh | |
sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT | |
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
sudo iptables -A INPUT -j DROP | |
sudo iptables -I INPUT 1 -i lo -j ACCEPT | |
sudo apt-get install iptables-persistent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment