|
From: Serge L. <sma...@us...> - 2005-10-26 13:07:13
|
Update of /cvsroot/devil-linux/build/config/etc/init.d In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14233 Modified Files: firewall Log Message: - attempt to standardize script Index: firewall =================================================================== RCS file: /cvsroot/devil-linux/build/config/etc/init.d/firewall,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- firewall 19 Aug 2003 20:44:56 -0000 1.7 +++ firewall 26 Oct 2005 13:07:02 -0000 1.8 @@ -16,6 +16,9 @@ # Description: setup the firewall rules ### END INIT INFO +NAME="Firewall" +CONFIGNAME=FIREWALL + # # Include the functions declared in the /etc/init.d/functions file # @@ -25,10 +28,63 @@ # settings source /etc/sysconfig/config -if [ "$1" = "start" ] && [ "$START_FIREWALL" = "yes" ] && [ "$1" = "start" ] ; then - echo -n "Starting Firewall" - /etc/init.d/firewall.rules +eval START=\$START_$CONFIGNAME + +# Determine the base and follow a runlevel link name. +base=${0##*/} +link=${base#*[SK][0-9][0-9]} + +# # Force execution if not called by a runlevel directory. +test $link = $base && START=yes +test "$START" = "yes" || exit 0 + +case "$1" in + start) + + echo -n "Starting $NAME" + /etc/init.d/firewall.rules evaluate_retval -fi + ;; + + stop) + + echo -n "Stopping $NAME" + IPTABLES=/usr/sbin/iptables + + # Flush tables & setup Policy + ${IPTABLES} -F # flush chains + ${IPTABLES} -X # delete user chains + ${IPTABLES} -Z # zero counters + + for t in `cat /proc/net/ip_tables_names` + do + ${IPTABLES} -F -t $t + ${IPTABLES} -X -t $t + ${IPTABLES} -Z -t $t + done + + ${IPTABLES} -P INPUT ACCEPT # Policy = ACCEPT + ${IPTABLES} -P OUTPUT ACCEPT # Accept all packets + ${IPTABLES} -P FORWARD ACCEPT # + + # Local interface - do not delete! + ${IPTABLES} -A INPUT -i lo -j ACCEPT + ${IPTABLES} -A OUTPUT -o lo -j ACCEPT + + evaluate_retval + ;; + + restart) + + $0 stop + sleep 1 + $0 start + ;; + + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; + +esac -exit 0 |