Dá uma espiada tambem nos exemplos do link abaixo.

http://www.yourwebexperts.com/forum/viewforum.php?f=35



alessandrosolin escreveu:
> Gostaria da ajuda de vocês para desenvolver o script abaixo. Quero
> deixar pessoas de fora acessarem somente a porta 80. (tanto na eth1 e
> eth2)
> Quero segurança mais eficiente possível.
> E também quero controlar o tráfego interno, tirando alguns sites
> pornográficos, e também for shared.
>
>
> Minha Estrutura Rede
>
> Servidor Interno
> eth0: 10.10.10.1 - Banco de Dados e Sistema Interno
> MYSQL, PHP
>
> Servidor de Arquivos
> eth0: 10.10.10.2 - Samba
>
> Servidor de Internet (Firewal) (Gateway Principal)
> Página para Acesso Externa
> eth0: 10.10.10.3 - Rede Local
> eth1: 200.200.200.1 - Internet 1 - IP fixo
> eth2: 200.200.200.2 - Internet 2 - Ip fixo
>
> Serviços Instalados
> Squid
> Iptables (firewall)
> DNS Interno e Externo (estou pensando em passar o interno para outro
> server)
>
> Agora estou precisando de Ajuda para Configurar o IPTables
>
> Estou começando fazer o script, e já estou com toda idéia na cabeça
>
> Meu script: MINHAS DÚVIDAS ESTÃO NO FINAL DE CADA PARTE
>
> ############################PARTE 01
> ##################################################
> # Primeiro: Zerar as regras do IPTABLES
> /sbin/iptables -F
> /sbin/iptables -X
> /sbin/iptables -F -t nat
> /sbin/iptables -X -t nat
> /sbin/iptables -F -t mangle
> /sbin/iptables -X -t mangle
> echo "Regras do filtro de pacotes zeradas!!!"
> echo " "
>
> #Negando todo trafico de pacotes.
> iptables -P INPUT DROP
> iptables -P FORWARD DROP
> iptables -P OUTPUT ACCEPT
> echo "Negando todo tráfego!!!"
> echo " "
>
>
> ############################PARTE 02
> ##################################################
> #BLOQUEIOS DE SEGURANÇA
>
> #Barrando Time
> iptables -A INPUT -p TCP --dport 113 -j DROP
>
> #Barrando Auth
> iptables -A INPUT -p TCP --dport 37 -j DROP
>
> #Barrando VNC
> iptables -A INPUT -p TCP --dport 5901 -j DROP
> iptables -A INPUT -p TCP --dport 5900 -j DROP
>
> #Barrando X11
> iptables -A INPUT -p TCP --dport 6000 -j DROP
> iptables -A INPUT -p TCP --dport 6001 -j DROP
>
> #Protecao contra ping da morte
> iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit
> 1/s -j ACCEPT
>
> # Protecao contra syn-floods
> iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT
>
> # Protecao contra port scanners ocultos
> iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit
> --limit 1/s -j ACCEPT
>
> #######DÚVIDA PARTE 2 : TEM MAIS COISAS QUE DEVO BLOQUEAR??
>
> ############################PARTE 03
> ##################################################
> #SSH
> #Liberando SSH (porta 4632)
> iptables -A INPUT -p tcp --destination-port 4632 -j ACCEPT
>
>
> #######DÚVIDA PARTE 3 : QUERO LIBERAR SSH SOMENTE REDE ETH0 (LOCAL), E
> BLOQUEAR EXTERNA
>
>
> ############################PARTE 04
> ##################################################
> #LIBERANDO ACESSO EXTERNO AO APACHE, SEM SSL, PORTA 80 SOMENTE.
> #Liberar Apache (porta 80)
> iptables -A INPUT -p tcp --destination-port 80 -j ACCEPT
>
> ############################PARTE 05
> ##################################################
> #AGORA AQUI QUERO COLOCAR AS REGRAS PARA NAVEGAÇÃO DA INTERNET DA REDE
> INTERNA
> #Liberar acesso http (www)
> iptables -A OUTPUT -p tcp --sport 1024:5999 --dport 80:80 -m state
> --state NEW -j ACCEPT
> iptables -A OUTPUT -p tcp --sport 1024:5999 --dport 8080:8080 -m state
> --state NEW -j ACCEPT
>
> #Liberando MSN
> iptables -A OUTPUT -p tcp --sport 1024:5999 --dport 1863:1863 -m state
> --state NEW -j ACCEPT
>
> #LIBERAR LER EMAIL (SERVIDOR POP EXTERNO)
> iptables -A OUTPUT -p tcp --sport 1024:5999 --dport 25:25 -m state
> --state NEW -j ACCEPT
>
> #LIBERAR ENVIAR EMAIL (SERVIDOR SMTP EXTERNO)
> iptables -A OUTPUT -p tcp --sport 1024:5999 --dport 110:110 -m state
> --state NEW -j ACCEPT
>
> #direcionando para squid
> iptables -t nat -A PREROUTING -i eth1 -p tcp -d ! 200.201.174.207
> --dport 80 -j REDIRECT --to-port 3128
>
> #bloqueando sites pornográficos, DÚVIDA: Uso o squid ou bloqueio aqui
> mesmo. jÁ VI ALGO SOBRE SQUID
> #######DÚVIDA PARTE 05 : ESTAS REGRAS ACIMA ESTÃO CERTAS ??
>
>
> ############################PARTE 06
> ##################################################
> AINDA NÃO PENSEI
>
>
> ------------------------------------
>
> Iptables Brasil na campanha "Não alimente os trolls":
> - Pense duas vezes antes de responder a comentários provocativos.
> - Mantenha a qualidade das discussões.Links do Yahoo! Grupos
>
>
>
>   

Responder a