You could make your own startup script and add it to your existing services with chkconfig.
Here's a template that I often use.
It flushes all rules in place and replaces them with a custom set that allows ssh, http and https in.
#!/bin/bash
#
# firewall firewall script
# description: a firewall script
# chkconfig: 2345 91 09
#
IPTABLES=/sbin/iptables
start() {
ret=0
# input chain
$IPTABLES -A INPUT -m state --state INVALID -j DROP || ret=1
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT || ret=1
$IPTABLES -A INPUT -i lo -j ACCEPT || ret=1
$IPTABLES -A INPUT -p tcp --dport 22 --syn -m state --state NEW -j ACCEPT || ret=1
$IPTABLES -A INPUT -p tcp --dport 80 --syn -m state --state NEW -j ACCEPT || ret=1
$IPTABLES -A INPUT -p tcp --dport 443 --syn -m state --state NEW -j ACCEPT || ret=1
# output chain
$IPTABLES -A OUTPUT -m state --state INVALID -j DROP || ret=1
$IPTABLES -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT || ret=1
$IPTABLES -A OUTPUT -o lo -j ACCEPT || ret=1
return $ret
}
stop() {
ret=0
$IPTABLES -F || ret=1
$IPTABLES -F -t nat || ret=1
$IPTABLES -X || ret=1
$IPTABLES -P INPUT ACCEPT || ret=1
$IPTABLES -P OUTPUT ACCEPT || ret=1
$IPTABLES -P FORWARD ACCEPT || ret=1
return $ret
}
panic() {
ret=0
$IPTABLES -F || ret=1
$IPTABLES -F -t nat || ret=1
$IPTABLES -X || ret=1
$IPTABLES -P INPUT DROP || ret=1
$IPTABLES -P OUTPUT DROP || ret=1
$IPTABLES -P FORWARD DROP || ret=1
$IPTABLES -Z || ret=1
$IPTABLES -t nat -Z || ret=1
return $ret
}
status() {
$IPTABLES -t filter -L -v --line-numbers
$IPTABLES -t nat -L -v --line-numbers
return 0
}
restart() {
stop
start
}
case "$1" in
start)
stop
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
status)
status
RETVAL=$?
;;
panic)
panic
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status|panic}"
exit 1
;;
esac
exit $RETVAL
You could simple put this script inside /etc/init.d/, make it executable and run chkconfig firewall --add && chkconfig firewall on.
You can now enable the firewall with service firewall start, service firewall panic stops all network traffic and service firewall stop disables the firewall.
I think you get the idea.
The major advantage of this system is that you have one script that you can heavily customize and write comments in, without touching any of the existing iptables settings of the OS.