[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Carregamento das regras do IPTABLES no boot



Galera,

Antes usando o Etch usava o script abaixo para carregar minhas regras no Iptables diretamente no boot, agora no Lenny ao utilizar este script as regras são carregadas mas a navegação não é possível.
Já descomentei a linha referente ao forward de ipv4 no arquivo /etc/sysctl.conf, mas a cada reboot tenho de chamar o script com as regras do firewall (/etc/firewall/fire1) novamente para liberar a navegação.
Se alguém puder me dar uma ajuda ou indicar outra melhor forma de carregar estas regras no boot eu agradeço.

Sds,

João Henrique

/etc/init.d# cat init.d/firewall
#!/bin/bash
#
# firewall          This shell script takes care of starting and stopping
#                   your firewall
#
# chkconfig: 3 56 11
# description: This service starts/stops your firewall. Starts by calling \
# the /etc/rc.d/fire1 scritp and stops by flushing all the tables and setting \
# their default policies to ACCEPT.
# Source function library.

. /etc/init.d/functions

[ -f /etc/firewall/fire1 ] || exit 0
[ -f /sbin/iptables ] || exit 0

IPTABLES="/sbin/iptables"

start() {
        /etc/firewall/fire1
        return $?
}
stop() {
        $IPTABLES -P INPUT ACCEPT
        $IPTABLES -P OUTPUT ACCEPT
        $IPTABLES -P FORWARD ACCEPT
        # os comandos abaixo deletam todas as regras nas tables Filter e Nat
        $IPTABLES -F
        $IPTABLES -t nat -F
        # Delete all User-specified chains
        $IPTABLES -X
        $IPTABLES -t nat -X
        return $?
}
restart() {
        stop
        start
}

# See how we were called.
case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                restart
                ;;
        reload)
                start
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart|reload}"
                exit 1
esac

exit $?


Reply to: