Código PHP:
#!/bin/bash
#
# firewall          Start/Stop firewalling rules.
#
# chkconfig: 35 11 92
#
# description: inicia/para as regras de firewall.
#
# processname: firewall
# config: /etc/firewall.conf
# pidfile: /var/run/firewall.pid

# Source function library.
. /etc/init.d/functions

PATH
="$PATH:/usr/local/bin"

RETVAL=0

# See how we were called.

prog="firewall"

funct_stop() {

iptables -t nat -F PREROUTING
iptables 
-t nat -F POSTROUTING
iptables 
-t nat -F TRANSPROXY
iptables 
-F FORWARD
iptables 
-F
iptables 
-Z
iptables 
-X
iptables 
-t mangle -F FORWARD
iptables 
-t mangle -F PREROUTING
iptables 
-t mangle -F POSTROUTING
##iptables -t mangle -F CONNLIMIT
echo "0" > /proc/sys/net/ipv4/ip_forward

iptables 
-P INPUT ACCEPT
iptables 
-P OUTPUT ACCEPT
iptables 
-P FORWARD DROP

}

start() {
        echo -
$"Starting $prog: "
        
bash -/etc/firewall.conf > /root/fwlog 2>&1
        fwports
        smtpservers
        redirs
        bloqueados
        RETVAL
=$?
        if [ 
$RETVAL -eq 0 ]; then
                echo_success
        
else
                
echo_failure
        fi
        
echo
        
ulimit -HSn 16384
}

stop() {
        echo -
$"Stopping $prog: "
        
funct_stop
        RETVAL
=$?
        if [ 
$RETVAL -eq 0 ]; then
                echo_success
        
else
                
echo_failure
        fi
        
echo
}

rhstatus() {
        
iptables --n
}

restart() {
        
stop
        start
}


case 
"$1" in
  start
)
        
start
        
;;
  
stop)
        
stop
        
;;
  
restart)
        
restart
        
;;
  
reload)
        
reload
        
;;
  
status)
        
rhstatus
        
;;
  
condrestart)
        [ -
/var/lock/subsys/firewall ] && restart || :
        ;;
  *)
        echo $
"Usage: $0 {start|stop|status|restart|condrestart}"
        
exit 1
        
;;
esac 
obrigado