/ Published in: Bash
URL: http://mark.haktstudios.com/
Simple RC script for starting and stopping IP Tables, place it in your init.d
Expand |
Embed | Plain Text
#!/bin/sh # # firewall Start/Stop iptables firewall # # Author: Mark A. LaDoux <[email protected]> # set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin SCRIPTNAME=/etc/init.d/$NAME # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 case "$1" in start) echo -n "Starting iptables firewall" iptables-restore < /etc/firewall.conf echo "." ;; stop) echo -n "Stopping iptables firewall" iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT echo "." ;; save) echo -n "Saving iptables firewall configuration" rm -rf /etc/firewall.conf iptables-save > /etc/firewall.conf echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|save}" >&2 exit 1 ;; esac exit 0
You need to login to post a comment.
