#!/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 220.110.184.60 netmask 255.255.255.248 broadcast 220.110.184.63
ifconfig eth0 202.41.218.52 netmask 255.255.255.240 broadcast 202.41.218.63
ifconfig eth0:0 10.250.10.63 netmask 255.255.255.0 broadcast 10.250.10.255
ifconfig eth1 10.250.20.63 netmask 255.255.255.0 broadcast 10.250.20.255
#route add default gw 220.110.184.57 dev eth0
route add default gw 202.41.218.49

route add -net 10.250.21.0/24 gw 10.250.20.250

iptables -A INPUT -s 127.0.0.0/16 -i lo -j ACCEPT
iptables -A INPUT -s 10.250.0.0/16 -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


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


