poleti
(usa Fedora)
Enviado em 20/08/2007 - 16:34h
iptables -N LACCEPT
iptables -A LACCEPT -j LOG --log-level info --log-prefix "ACCESS: "
iptables -A LACCEPT -j ACCEPT
# Monitoramento de pacotes rejeitados
iptables -N FDROP
iptables -A FDROP -j LOG --log-level debug --log-prefix "FDROP: "
iptables -A FDROP -j DROP
################### REGRAS DE SEGURAN� DA REDE ######################
# Descarte de pacotes nao-identificado ICMP (ping)
iptables -A OUTPUT -m state -p icmp --state INVALID -j DROP
# Contra DoS:
iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT
# Contra Port Scanners:
iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
# Contra Pings da morte
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
# Bloquear Back Orifice:
iptables -A INPUT -p tcp --dport 31337 -j DROP
iptables -A INPUT -p udp --dport 31337 -j DROP
# Bloquear NetBus:
iptables -A INPUT -p tcp --dport 12345:12346 -j DROP
iptables -A INPUT -p udp --dport 12345:12346 -j DROP
################### LIBERACAO DE PORTAS ######################
# Liberacao de acesso SSH para acesso remoto
iptables -A INPUT -p tcp -i eth0 \
--dport 22 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
# Liberacao das portas TCP altas (1022 a 65535)
iptables -A INPUT -p tcp -i eth0 --dport 1022:65535 \
-m state --state ESTABLISHED,RELATED -j ACCEPT
# Liberacao das portas TCP altas (1022 a 65535)para pesquisa DNS
iptables -A INPUT -p udp -i eth0 --sport 53 --dport 1024:65535 \
-m state --state ESTABLISHED -j ACCEPT
# Bloqueio de todas as outras portas
#iptables -A INPUT -i eth0 -j FDROP
# Redirecionamento de porta para Proxy Transparente Squid
#iptables -t nat -A PREROUTING -s <ip_rede> -p tcp --dport 80 -j REDIRECT --to-port 3128