#! /bin/sh
# Copyright (c) 2004 Trimble Navigation Limited
# $Id: iptables,v 1.1 2004/03/04 03:32:32 fish Exp $
# $Source: /home/CVS/fireballTop/fireballFS/root/etc/init.d/iptables,v $

########################################################################
#
# iptables
#
# Script to load network filtering rules via iptables-restore.
# 
# Called at power up time (runlevel 3) just after networking is
# started.  It loads rules which have been selected via the browser
# GUI and stored in /etc/sysconfig/iptables.conf
# 
# 
# 
# 
########################################################################
PATH="/usr/local/sbin:/sbin:/bin:/usr/local/bin:/usr/bin:/usr/local/fireball"
export PATH

IPTABLES_CONFIG=/etc/sysconfig/iptables.conf

    # Make sure that iptables exists and is executable
if [[ ! -x /usr/local/sbin/iptables ]]
then
    exit 0
fi

	# don't do squat if we don't have the config file
if [[ -f $IPTABLES_CONFIG ]]
then

   # Disable filtering by setting INPUT chain's default policy to
   # ACCEPT all packets.  Then clear all the rules.
    iptables -P INPUT ACCEPT
    iptables -F

   # Now restore the desired set of rules which were selected and
   # saved by the browser.
    iptables-restore < $IPTABLES_CONFIG

fi

exit 0

