#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
 
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

ifconfig eth0 10.250.60.4 netmask 255.255.255.0 broadcast 10.250.60.255
ifconfig eth1 10.250.70.4 netmask 255.255.255.0 broadcast 10.250.70.255
route add default gw 10.250.60.254 dev eth0


iptables -A INPUT -s 127.0.0.0/8 -i lo -j ACCEPT
iptables -A INPUT -s 10.250.60.0/24 -i eth0 -j ACCEPT
iptables -A INPUT -s 10.250.70.0/24 -i eth1 -j ACCEPT
iptables -A INPUT -s 202.41.218.48/28 -j ACCEPT
iptables -A INPUT -s 220.110.184.56/29 -j ACCEPT
#iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -p tcp -j ACCEPT
iptables -A INPUT -p icmp -m limit --limit 5/s --limit-burst 5 -j ACCEPT
iptables -A INPUT -p tcp --dport 54321 -j ACCEPT
iptables -A INPUT -p tcp --dport www -j ACCEPT
iptables -A INPUT -p udp -s 210.145.254.169 --sport 53 -j ACCEPT
iptables -A INPUT -p tcp -s 210.145.254.169 --sport 53 -j ACCEPT
iptables -A INPUT -p udp -s 125.170.93.233 --sport 53 -j ACCEPT
iptables -A INPUT -p tcp -s 125.170.93.233 --sport 53 -j ACCEPT


#if [ -x /var/qmail/rc ]; then
#    csh -cf /var/qmail/rc &
#    echo "qmail started."
#    /root/tcpserver-smtp25
#    echo "tcpserver-smtp started."
#fi

#if [ -x /usr/local/pgsql/bin/postmaster -a -d /data/pgsql ]; then
#    rm -f /tmp/.s.PGSQL5432
#    su - postgres -c "postmaster -D /data/pgsql &"
#    echo "PostgreSQL started."
#fi

#if [ -x /usr/local/bin/ntpd ]; then
#    /usr/local/bin/ntpd
#    echo "Time server started."
#fi

if [ -x /usr/local/apache2/bin/apachectl ]; then
    /usr/local/apache2/bin/apachectl start
    echo "Apache2  started."
fi


