#!/bin/bash # # Start and stop the Firewall. # Modify the following settings as required: ### BEGIN INIT INFO # Provides: firewall-sharewiz # Required-Start: $network # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO IPTABLES=/sbin/iptables NAME=firewall-sharewiz opts="start stop restart reload status" #if [[ $1 == start ]] ; then case "$1" in start) /sharewiz/firewall/firewall.sh ;; stop) $IPTABLES --flush $IPTABLES -t nat --flush $IPTABLES -F -t mangle $IPTABLES -P INPUT ACCEPT $IPTABLES -P OUTPUT ACCEPT $IPTABLES -P FORWARD ACCEPT $IPTABLES -t nat -P POSTROUTING ACCEPT $IPTABLES -t nat -P PREROUTING ACCEPT $IPTABLES -t nat -P OUTPUT ACCEPT ;; restart|reload) # $0 stop # $0 start $IPTABLES --flush $IPTABLES -t nat --flush $IPTABLES -F -t mangle $IPTABLES -P INPUT ACCEPT $IPTABLES -P OUTPUT ACCEPT $IPTABLES -P FORWARD ACCEPT $IPTABLES -t nat -P POSTROUTING ACCEPT $IPTABLES -t nat -P PREROUTING ACCEPT $IPTABLES -t nat -P OUTPUT ACCEPT /sharewiz/firewall/firewall.sh ;; status) $IPTABLES --list $IPTABLES -t nat --list $IPTABLES -t mangle --list ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|status}" >&2 exit 1 ;; esac exit 0ยท