#!/bin/bash # ### BEGIN INIT INFO # Provides: iptables-config # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: load and unload iptables config # Description: loads the firewall.config file in to iptables and flushs iptables ### END INIT INFO conf="/etc/firewall.config" case "${1:-''}" in 'start') sh $conf ;; 'stop') iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F ;; 'flush') iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F ;; 'reload') iptables -F sh $conf ;; 'restart') iptables -F sh $conf ;; *) echo "Usage: start|stop|flush|reload|restart" exit 1 ;; esac