Author: | middayc |
---|---|
Mode: | shellscript |
Date: | Mon, 28 Sep 2009 08:41:11 |
#!/bin/bash # # iptables example configuration script # # Let's not lock ourselves out of the server # iptables -P INPUT ACCEPT # # Flush all current rules from iptables # iptables -F # # Allow SSH connections on tcp port 22 # This is essential when working on remote servers via SSH to prevent locking yourself out of the system # iptables -A INPUT -p tcp --dport 22 -j ACCEPT # # Allow HTTP connections on tcp port 80 # iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -j ACCEPT # # Set default policies for INPUT, FORWARD and OUTPUT chains # iptables -P INPUT ACCEPT iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT # # Set access for localhost # iptables -A INPUT -i lo -j ACCEPT # # Accept packets belonging to established and related connections # iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT # # Save settings # /sbin/service iptables save # # List rules # iptables -L -v
Author: | middayc |
---|---|
Mode: | shellscript |
Date: | Mon, 28 Sep 2009 09:59:40 |
#!/bin/bash # # iptables example configuration script # # Let's not lock ourselves out of the server # iptables -P INPUT ACCEPT # # Flush all current rules from iptables # iptables -F # # Allow SSH connections on tcp port 22 # This is essential when working on remote servers via SSH to prevent locking yourself out of the system # iptables -A INPUT -p tcp --dport 22 -j ACCEPT # # Allow HTTP connections on tcp port 80 # iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -j ACCEPT # # Set access for localhost # iptables -A INPUT -i lo -j ACCEPT iptables -A FORWARD -i lo -j ACCEPT # # Accept packets belonging to established and related connections # iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # # Set default policies for INPUT, FORWARD and OUTPUT chains # iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT # # Save settings # # /sbin/service iptables save # # List rules # iptables -L -v