# # ipchains Script to load ipchains style firewall # # Author: Eric von Bayer # # chkconfig: 2345 35 65 # description: Loads or clears the ipchains style firewall in a \ # system # Source function library. . /etc/rc.d/init.d/functions ipconf=/etc/ipchains.conf lockfile=/var/lock/subsys/ipchains # See how we were called. case "$1" in start) # Start up the firewall as long as we have a config file if [ -f $ipconf ]; then action "Starting ipchains firewall: " /sbin/ipchains-config else action "Starting ipchains firewall: " /bin/false fi touch $lockfile ;; stop) # Stop the firewall if we started it if [ -f $lockfile ] ; then action "Stopping ipchains firewall: " /sbin/ipchains -F /sbin/ipchains -X rm -f /var/lock/subsys/ipchains else action "Stopping ipchains firewall: " /bin/false fi ;; status) # Give a firewall status if [ -f $lockfile ]; then echo -n "IP Chains Firewall was loaded at " ls -al $lockfile | awk '{ print $6 " " $7 " " $8 "." ; }' else echo "IP Chains Firewall is not loaded." fi ;; restart|reload) # Same as start for now if [ -f $ipconf ]; then action "Restarting ipchains firewall: " /sbin/ipchains-config else action "Restarting ipchains firewall: " /bin/false fi touch $lockfile ;; *) # do not advertise unreasonable commands that there is no reason # to use with this device echo "Usage: firewall {start|stop|status|restart|reload}" exit 1 esac exit 0