debian_forex
(usa Debian)
Enviado em 13/10/2009 - 22:17h
Obrigado pelos esclarecimentos. No final ficou assim.
# meuprimeiro.sh
# Meu primeiro firewall
# Limpando todas as regras
echo "Limpando todas as tabelas e regras"
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Carregando os modulos do iptables
modprobe ip_tables
modprobe iptable_filter
modprobe iptable_mangle
modprobe iptable_nat
modprobe ipt_MASQUERADE
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
echo "Carregando modulos do iptables ...........[ OK ]"
# Fechando todas as portas
echo "Fechando tudo"
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
# Liberando a internet através da interface ppp0 na porta 80
echo "Liberando a internet pela interface ppp0"
#iptables -A INPUT -s 0.0.0.0/0 -i ppp0 -j ACCEPT
#iptables -A OUTPUT -o ppp0 -j ACCEPT
#iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#iptables -A INPUT -p tcp -i ppp0 --dport 80 -j DROP
# Permite o ping
iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 8 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 0 -j ACCEPT
#Liberando o SSH
#iptables -A INPUT -p tcp --dport ssh -j ACCEPT
#iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --sport 53 -j ACCEPT
#iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --sport 80 -j ACCEPT
#iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp --sport 443 -j ACCEPT
#Liberando MSN
#iptables -A OUTPUT -p tcp --sport 1024:5999 --dport 1863:1863 -m state --state NEW -j ACCEPT
#iptables -A INPUT -p tcp --dport 1024:5999 --sport 1863:1863 -m state --state NEW -j ACCEPT
#Liberando conexão (P2P Gnutela)
#iptables -A OUTPUT -p tcp --sport 0:65535 --dport 6346:6346 -m state --state NEW -j ACCEPT
#Liberando conexão (P2P aMule)
iptables -A INPUT -p tcp -m multiport --destination-port 4007,4232,4242,4550,4661 -j ACCEPT
#iptables -A FORWARD -j ACCEPT -p tcp --dport 4672
#Liberando Azureus
#iptables -A INPUT -p tcp --destination-port 6881 -j ACCEPT
#iptables -A FORWARD -j ACCEPT -p tcp --dport 6881
# Fim