[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: iptables - firewall com comportamento estranho..



Cara,
por favor, roda um iptables -vnL -t nat e cola?

Abraço


2009/8/11 Alexandre Lima <limaobr@gmail.com>:
> Tá sim Fábio, estou chamando ele dentro do rc.local pra rodar no boot. Não
> sei te dizer qual é o runlevel, mas não é por save/reload, ele roda como se
> eu estivesse digitando os comandos no Shell...
>
> Olha só, no log, se eu colocar para logar o INPUT ou FORWARD, não aparece
> nada na porta 3389...
> Então estou copiando o iptables -v --list pra ver se te ajuda a me ajudar...
>
> Valeu a força, abraço!
>
> concreto:~# iptables -v --list
> Chain INPUT (policy ACCEPT 465K packets, 324M bytes)
>  pkts bytes target     prot opt in     out     source
> destination
>    0     0 LOG        tcp  --  any    any     anywhere             anywhere
> tcp dpt:5042 LOG level warning prefix `Servico: Wincrash'
>    0     0 LOG        tcp  --  any    any     anywhere             anywhere
> tcp dpt:12345 LOG level warning prefix `Servico: BackOrifice'
>    0     0 LOG        tcp  --  any    any     anywhere             anywhere
> tcp dpt:12346 LOG level warning prefix `Servico: BackOrifice'
>    0     0 LOG        tcp  --  any    any     anywhere             anywhere
> tcp dpt:31337 LOG level warning prefix `Servico: BackOrifice'
>    4   228 DROP       tcp  --  eth0   any     anywhere             anywhere
> tcp dpt:www
>    1    48 DROP       tcp  --  eth0   any     anywhere             anywhere
> tcp dpt:3128
>    0     0 ACCEPT     tcp  --  any    any     192.168.2.0/24       anywhere
> tcp dpt:ssh
>  307K   50M ACCEPT     tcp  --  any    any     192.168.2.0/24       anywhere
> tcp dpt:3128
>    0     0 ACCEPT     tcp  --  any    any     192.168.2.0/24       anywhere
> tcp dpt:www
>    0     0 ACCEPT     tcp  --  any    any     192.168.2.0/24       anywhere
> tcp dpt:ftp
>    0     0 ACCEPT     tcp  --  any    any     192.168.2.0/24       anywhere
> tcp dpt:3389
>    0     0 ACCEPT     tcp  --  any    any     192.168.2.0/24       anywhere
> tcp dpt:9875
>    0     0 ACCEPT     tcp  --  any    any     192.168.2.0/24       anywhere
> tcp dpt:8017
>
> Chain FORWARD (policy ACCEPT 2555K packets, 1777M bytes)
>  pkts bytes target     prot opt in     out     source
> destination
>  1284 63060 ACCEPT     tcp  --  any    any     anywhere             anywhere
> tcp flags:FIN,SYN,RST,ACK/SYN limit: avg 1/sec burst 5
>   12   480 ACCEPT     tcp  --  any    any     anywhere             anywhere
> tcp flags:FIN,SYN,RST,ACK/RST limit: avg 1/sec burst 5
>    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere
> icmp echo-request limit: avg 1/sec burst 5
>    0     0 REJECT     all  --  any    any     anywhere
> 216.35.208.0/24     reject-with icmp-port-unreachable
>    0     0 REJECT     all  --  any    any     anywhere
> 206.142.53.0/24     reject-with icmp-port-unreachable
>    3   144 REJECT     tcp  --  any    any     anywhere             anywhere
> tcp dpt:kazaa reject-with icmp-port-unreachable
>    0     0 REJECT     all  --  any    any     anywhere
> 213-248-112-0.customer.teliacarrier.com/24 reject-with icmp-port-unreachable
>    0     0 REJECT     tcp  --  any    any     anywhere             anywhere
> tcp dpt:kazaa reject-with icmp-port-unreachable
>    0     0 ACCEPT     tcp  --  any    any     anywhere
> cmt.caixa.gov.br    tcp dpt:www
>    0     0 ACCEPT     tcp  --  any    any     anywhere
> 192.168.2.0/24      tcp dpt:8017
> 18582   26M ACCEPT     tcp  --  any    any     anywhere             anywhere
> tcp dpt:smtp
> 10942  492K ACCEPT     tcp  --  any    any     anywhere             anywhere
> tcp dpt:pop3
>  1029 86802 ACCEPT     tcp  --  any    any     anywhere             anywhere
> tcp dpt:3389
>
> Chain OUTPUT (policy ACCEPT 934K packets, 434M bytes)
>  pkts bytes target     prot opt in     out     source
> destination
> concreto:~#
>
> -----Mensagem original-----
> De: fabio.tramasoli@gmail.com [mailto:fabio.tramasoli@gmail.com] Em nome de
> Fábio Tramasoli
> Enviada em: segunda-feira, 10 de agosto de 2009 22:10
> Para: limaobr@gmail.com
> Assunto: Re: iptables - firewall com comportamento estranho..
>
> Cara, esse script tá colocado pra executar no boot? Em qual runlevel,
> ou estás usando um iptables-save/load nas alterações e no boot? Fora
> isso, tens log do netfilter?
>
> Daí ficaria mais fácil de ajudar :)
>
> Abraço
>
> 2009/8/10 Alexandre Lima <limaobr@gmail.com>:
>> Pessoal, configurei um firewall com o script abaixo. Aconteceu algo que
>> nunca tinha visto...Ele simplesmente se comporta de maneira
>> estranha...ignora as regras...por exemplo...
>>
>>
>>
>> Um simples forward da porta 3389 para um micro local, se reinciar o
>> servidor, funciona alguns segundos, depois disso não funciona mais.
>>
>>
>>
>> Dá a impressão de que quando o rc.local roda o script de firewall ele
> perde
>> as conf. e para de funcionar. Ou deve ser bobeira minha no script...alguém
>> pode ajudar??
>>
>>
>>
>> abração!
>>
>> PS: Distro Debian, Kernel 2.6.26-17, iptables 1.4.2
>>
>> Segue o script:
>>
>> modprobe ip_nat_pptp
>> modprobe ip_conntrack_pptp
>> modprobe ip_nat_pptp
>> modprobe ip_gre
>>
>> INTERNET_IP=200.179.98.74
>> INTERNET_CLASS=200.179.98.72/255.255.255.248
>>
>> INTERNAL_IP=192.168.2.1
>> INTERNAL_CLASS=192.168.2.0/24
>> INTERNET_ETH=eth0
>> INTERNAL_ETH=eth1
>>
>> case $1 in start)
>>
>> iptables -F
>> iptables -Z
>> iptables -t nat -F
>> iptables -t filter -P FORWARD ACCEPT
>>
>> iptables -t nat -A POSTROUTING -s $INTERNAL_CLASS -j MASQUERADE
>>
>> echo 1 > /proc/sys/net/ipv4/ip_forward
>>
>> # Bloquear apache e squid para internet
>> iptables -A INPUT -p tcp --dport 80 -i $INTERNET_ETH -j DROP
>> iptables -A INPUT -p tcp --dport 3128 -i $INTERNET_ETH -j DROP
>>
>> # Liberando acessos da rede interna
>> iptables -A INPUT -p tcp -s $INTERNAL_CLASS --dport 22 -j ACCEPT
>> iptables -A INPUT -p tcp -s $INTERNAL_CLASS --dport 3128 -j ACCEPT
>> iptables -A INPUT -p tcp -s $INTERNAL_CLASS --dport 80 -j ACCEPT
>> iptables -A INPUT -p tcp -s $INTERNAL_CLASS --dport 21 -j ACCEPT
>> iptables -A INPUT -p tcp -s $INTERNAL_CLASS --dport 3389 -j ACCEPT
>> iptables -A INPUT -p tcp -s $INTERNAL_CLASS --dport 9875 -j ACCEPT
>> iptables -A INPUT -p tcp -s $INTERNAL_CLASS --dport 8017 -j ACCEPT
>> iptables -A FORWARD -d $INTERNAL_CLASS -p tcp --dport 8017 -j ACCEPT
>>
>> # Emails
>> iptables -A FORWARD -p tcp --dport 25 -j ACCEPT
>> iptables -A FORWARD -p tcp --dport 110 -j ACCEPT
>>
>> # Forward
>> iptables -A FORWARD -p tcp --dport 3389 -j ACCEPT
>>
>> # Libera Acesso da VPN do Siagri
>> echo " Liberando VPN SIAGRI [OK]"
>>
>> VPNSERVER=200.163.51.83
>> iptables -t nat -A PREROUTING -p tcp --dport 1723 -j DNAT --to $VPNSERVER
>> iptables -t nat -A PREROUTING -p gre -j DNAT --to $VPNSERVER
>>
>>
>> # Redirects
>> iptables -t nat -A PREROUTING -i $INTERNET_ETH -p tcp --dport 9875 -j DNAT
>> --to 192.168.2.5:9875
>> iptables -t nat -A PREROUTING -i $INTERNET_ETH -p tcp --dport 3389 -j DNAT
>> --to 192.168.2.5:3389
>
>
>
> --
> Fabio B. Tramasoli
> fabio@tramasoli.com
> GNU\Linux registered user #411510
> Rio Grande/RS - Porto Alegre/RS
> http://devaneios.tramasoli.com
>
> "To understand what recursion is you must first understand recursion"
>
>



-- 
Fabio B. Tramasoli
fabio@tramasoli.com
GNU\Linux registered user #411510
Rio Grande/RS - Porto Alegre/RS
http://devaneios.tramasoli.com

"To understand what recursion is you must first understand recursion"


Reply to: