#!/bin/bash
# Startup script to implement default policy on the iptables packet
# filtering firewall
#
# chkconfig: 2345 08 92
#
# description: Automates application of a default policy on startup.


case "$1" in
	start)
		echo 'Loading iptables modules'
		/etc/multiconf/scripts/iptables_start
		echo 'Restoring the default drop policy on the packet filtering firewall'
		if [ -f /etc/multiconf/iptablebackup ]; then
			cp -f /etc/multiconf/iptablebackup /etc/multiconf/iptinitbackup1
		fi
		cp -f /etc/multiconf/iptablerules /etc/multiconf/iptinitbackup
		iptables-restore < /etc/multiconf/iptablesrules_default_drop_all
		# Supress all messages on console except panics (to avoid iptables log 
		# messages from showing up on the console)
		/bin/dmesg -n 1
		;;
	stop)
		;;
	restart)
		$0 stop
		$0 start
		;;
		
esac
exit 0
