Beruflich Dokumente
Kultur Dokumente
/bin/bash
IPTABLES="/sbin/iptables"
# Portas para fazer forward na SERVICES_MACHINE, setada adiante
#FORWARD_PORTSTCP="25 80 110 143 443 995 3050 10000"
FORWARD_PORTSUDP=""
# Permite entrada
INPUT_PORTSTCP="$FORWARD_PORTSTCP "
INPUT_PORTSTCP+="22"
DMZ_IFACE=eth0
INET_IFACE=eth1
EXT_IP=`ifconfig $INET_IFACE | grep "inet end" | cut -d " " -f 13`
SERVICES_MACHINE=192.168.0.3
#-----------------START-----------------
# Modulos
modprobe ip_conntrack
modprobe ip_conntrack_ftp
# Habilitando IP Forward
sysctl net.ipv4.ip_forward=1
## Cria chain que rejeita novas conexões, exceto as vindas da rede interna.
for i in filter; do
iptables -t $i -X block 2> /dev/null
iptables -t $i -N block
iptables -t $i -A block -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t $i -A block -m state --state NEW -i ! $INET_IFACE -j ACCEPT
iptables -t $i -A block -j DROP
done