[CentOS-pt-br] Problemas com iptables+SSH

Alexandre J. Correa - Onda Internet alexandre em ondainternet.com.br
Quarta Março 2 15:32:57 EST 2011


faça assim:

iptables -t filter -N SSH
iptables -t filter -A SSH -s 177.0.0.0/11 -j ACCEPT
.....
iptables -t filter -A SSH -j DROP

iptables -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t filter -A INPUT -p tcp --dport 22 -m state --state NEW -J SSH


usei a porta 22.. basta trocar pela porta que voce precisa..

deve funcionar desta maneira !!


Em 02/03/2011 17:30, Felipe Nolasco escreveu:
> Thiago,
>
> Ja tentou liberar o acesso para sua rede interna?
>
> 2011/3/2 Thiago Henrique<contato em thiagohenrique.com.br>:
>> Boa tarde a todos,
>>
>> Pessoal, mudei a porta do SSH para 3128, e depois criei algumas regras de
>> firewall liberando acesso a esta porta partindo somente do Brasil, como
>> podem ver na saída do iptables -n -L abaixo:
>>
>> Chain INPUT (policy ACCEPT)
>> target     prot opt source               destination
>> ACCEPT     tcp  --  177.0.0.0/11         x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  177.32.0.0/11        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  186.192.0.0/11       x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  186.224.0.0/11       x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  187.0.0.0/11         x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  187.32.0.0/11        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  187.64.0.0/11        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  187.96.0.0/11        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  189.0.0.0/11         x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  189.32.0.0/11        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  189.64.0.0/11        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  189.96.0.0/11        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  200.17.0.0/16        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  200.18.0.0/15        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  200.20.0.0/16        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  200.96.0.0/13        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  200.128.0.0/9        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  201.0.0.0/12         x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  201.16.0.0/12        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  201.32.0.0/12        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  201.48.0.0/12        x.x.x.x        tcp dpt:3128
>> ACCEPT     tcp  --  201.64.0.0/11        x.x.x.x        tcp dpt:3128
>> DROP       all  --  0.0.0.0/0            x.x.x.x
>>
>> Meu problema:
>>
>> Após aplicar esta regra, eu não consigo abrir novas conexões com o SSH, pois
>> por algum motivo ele fecha a conexão:
>>
>> $ telnet x.x.x.x 3128
>> Trying x.x.x.x...
>> Connected to x.x.x.x.
>> Escape character is '^]'.
>> SSH-2.0-OpenSSH_4.3
>> ^C
>> Connection closed by foreign host.
>> $ ssh usuario em x.x.x.x -p 3128
>> Connection closed by x.x.x.x
>>
>> Antes que alguém pergunte, se eu volto o SSH pra porta 22 e aplico as regras
>> acima para ela, não resolve nada, continua apresentando os mesmos problemas.
>>
>> Já pesquisei, mas, não acho nada que ajude.
>> Alguém tem uma luz do que pode estar causando este problema?
>>
>> Atenciosamente,
>>
>> _______________________________________________
>> CentOS-pt-br mailing list
>> CentOS-pt-br em centos.org
>> http://lists.centos.org/mailman/listinfo/centos-pt-br
>>
>>
>
>


-- 
Sds.

Alexandre Jeronimo Correa
Sócio-Administrador

Onda Internet
www.onda.net.br

IPV6 Ready !
www.ipv6.onda.net.br



Mais detalhes sobre a lista de discussão CentOS-pt-br