antonioleite
(usa Debian)
Enviado em 22/09/2007 - 15:44h
Boa Tarde, mais uma vez venho recorrer ao imenso conhecimento de todos vocês é o seguinte:
Além do problema com o APACHE que mensionei em outra pergunta estou também com problema para acessar o Debian Etch pelo Putty se puderem me ajudar segue o firewall abaixo:
#!/bin/bash
#
# Variáveis
# -------------------------------------------------------
iptables=/sbin/iptables
IF_EXTERNA=eth0
IF_INTERNA=eth1
# Ativa módulos
# -------------------------------------------------------
/sbin/modprobe iptable_nat
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ipt_LOG
/sbin/modprobe ipt_REJECT
/sbin/modprobe ipt_MASQUERADE
# Proteção contra IP spoofing
# -------------------------------------------------------
echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter
# Zera regras
# -------------------------------------------------------
$iptables -F
$iptables -X
$iptables -F -t nat
$iptables -X -t nat
$iptables -F -t mangle
$iptables -X -t mangle
# Determina a política padrão
# -------------------------------------------------------
$iptables -P INPUT DROP
$iptables -P OUTPUT DROP
$iptables -P FORWARD DROP
####VARIOS FILTROS ping da morte, port scanner entre outros
# Libera acesso externo a determinadas portas
# -------------------------------------------------------
$iptables -A INPUT -p tcp --dport 22 -i $IF_EXTERNA -j ACCEPT
##PREROUNTING
$iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 3389 -j DNAT --to 192.168.1.111
$iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1433 -j DNAT --to 192.168.1.111
$iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1434 -j DNAT --to 192.168.1.111
###
$iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.1.111
### Regras INPUT
$iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$iptables -A INPUT -i lo -j ACCEPT
$iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT
$iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT
$iptables -A INPUT -p tcp --dport 22 -j ACCEPT
$iptables -A INPUT -p tcp --dport 21 -j ACCEPT
$iptables -A INPUT -p tcp --dport 1194 -j ACCEPT
$iptables -A INPUT -p tcp --dport 3389 -j ACCEPT
$iptables -A INPUT -p tcp --dport 1433 -j ACCEPT
$iptables -A INPUT -p tcp --dport 1434 -j ACCEPT
$iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#Porta VPN
$iptables -A INPUT -p udp --dport 5000 -j ACCEPT
$iptables -A INPUT -p udp --dport 5500 -j ACCEPT
#Libera TUN/TAP
$iptables -A INPUT -i tun+ -j ACCEPT
$iptables -A FORWARD -i tun+ -j ACCEPT
$iptables -A INPUT -i tap+ -j ACCEPT
$iptables -A FORWARD -i tap+ -j ACCEPT
#Permite pacote locais
$iptables -A INPUT -i $IF_INTERNA -j ACCEPT
$iptables -A INPUT -i $IF_EXTERNA -j ACCEPT
$iptables -A INPUT -j ACCEPT -p tcp --dport 5000
$iptables -A INPUT -j ACCEPT -p tcp --dport 5500
### Regras FORWARD
$iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p icmp -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p tcp --dport 25 -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p tcp --dport 22 -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p tcp --dport 21 -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p tcp --dport 110 -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p tcp --dport 443 -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p tcp --dport 3389 -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p tcp --dport 80 -j ACCEPT
$iptables -A FORWARD -i $IF_EXTERNA -o $IF_INTERNA -p tcp --dport 5900 -j ACCEPT
$iptables -A FORWARD -i $IF_EXTERNA -o $IF_INTERNA -p tcp --dport 1433 -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p tcp --dport 1434 -j ACCEPT
$iptables -A FORWARD -i $IF_ EXTERNA -o $IF_ INTERNA -p tcp --dport 80 -j ACCEPT
#VPN
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p udp --dport 5000 -j ACCEPT
$iptables -A FORWARD -i $IF_INTERNA -o $IF_EXTERNA -p udp --dport 5500 -j ACCEPT
### Regras OUTPUT
$iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
# Compartilha a conexao
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo "1" > /proc/sys/net/ipv4/ip_forward
# Abre para a rede local
iptables -A INPUT -p tcp --syn -s 192.168.1.0/255.255.255.0 -j ACCEPT
iptables -A INPUT -p tcp --syn -s 192.168.2.0/255.255.255.0 -j ACCEPT
iptables -A INPUT -p tcp --syn -s 192.168.0.0/255.255.255.0 -j ACCEPT
# Fecha o resto
$iptables -A INPUT -p tcp --syn -j DROP
Desde ja agradeço a todos amigos...