Update of /cvsroot/devil-linux/build/config/etc/init.d
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20274
Modified Files:
Tag: rel-1-2-patches
firewall
Log Message:
- standardizing script
Index: firewall
===================================================================
RCS file: /cvsroot/devil-linux/build/config/etc/init.d/firewall,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -u -d -r1.7 -r1.7.4.1
--- firewall 19 Aug 2003 20:44:56 -0000 1.7
+++ firewall 26 Oct 2005 11:15:48 -0000 1.7.4.1
@@ -16,19 +16,73 @@
# Description: setup the firewall rules
### END INIT INFO
+NAME="Firewall"
+CONFIGNAME=FIREWALL
+
#
# Include the functions declared in the /etc/init.d/functions file
#
-
source /etc/init.d/functions
# settings
source /etc/sysconfig/config
-if [ "$1" = "start" ] && [ "$START_FIREWALL" = "yes" ] && [ "$1" = "start" ] ; then
- echo -n "Starting Firewall"
+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
+ ;;
-exit 0
+ 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
|