#! /bin/bash
/sbin/iptables -F INPUT
/sbin/iptables -Z INPUT
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -A INPUT -m state --state INVALID -j DROP
/sbin/iptables -A INPUT -p icmp -j ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m state --state NEW,RELATED,ESTABLISHED -m tcp --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m state --state NEW,RELATED,ESTABLISHED -m tcp --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m state --state NEW,RELATED,ESTABLISHED -m tcp --dport 1723 -j ACCEPT
/sbin/iptables -A INPUT -p gre -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A INPUT -p udp -m policy --dir in --pol ipsec -m udp --dport 1701 -j ACCEPT
/sbin/iptables -A INPUT -p udp -m udp --dport 1701 -j ACCEPT
/sbin/iptables -A INPUT -p udp -m udp --dport 500 -j ACCEPT
/sbin/iptables -A INPUT -p udp -m udp --dport 4500 -j ACCEPT
/sbin/iptables -A INPUT -p esp -j ACCEPT
/sbin/iptables -A INPUT -m policy --dir in --pol ipsec -j ACCEPT
/sbin/iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
/sbin/iptables -F FORWARD
/sbin/iptables -Z FORWARD
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables -A FORWARD -m state --state INVALID -j DROP
#/sbin/iptables -A FORWARD -m policy --dir in --pol ipsec -j ACCEPT
/sbin/iptables -A FORWARD -d 10.0.10.0/24 -j ACCEPT
/sbin/iptables -A FORWARD -s 10.0.10.0/24 -j ACCEPT
/sbin/iptables -A FORWARD -i ppp+ -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -j REJECT --reject-with icmp-host-prohibited
/sbin/iptables -F OUTPUT
/sbin/iptables -Z OUTPUT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -A OUTPUT -m state --state INVALID -j DROP
/sbin/iptables -F -t nat
/sbin/iptables -Z -t nat
/sbin/iptables -t nat -A POSTROUTING -s 10.0.10.0/24 -o eth0 -j MASQUERADE