Não é possível conectar-se com telnet de IP externo

Não é possível conectar-se com telnet de IP externo

Eu tenho um servidor postfix rodando em um VPS kimsufi, instalei o roundcube nele e está tudo bem. O problema é que quando tento me conectar de outro servidor, o tempo limite é excedido:

telnet whys.fr 25
Trying 5.196.66.189...
telnet: Unable to connect to remote host: Connection timed out

aqui está minha saída netstat:

netstat -ntpul | grep 25
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      17643/master    
tcp6       0      0 :::25                   :::*                    LISTEN      17643/master

E as regras atuais do iptables:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:smtp
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:smtp
fail2ban-ssh  tcp  --  anywhere             anywhere             multiport dports ssh

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain fail2ban-ssh (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            

telnet do localhost está funcionando muito bem:

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 whys.fr ESMTP Postfix (Debian/GNU)
ehlo whys.fr
250-whys.fr
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.

O servidor está alojado no datacenter da OVH e a porta 25 não está bloqueada:

nmap -p 25 whys.fr

Starting Nmap 6.47 ( http://nmap.org ) at 2015-02-20 15:16 CET
Nmap scan report for whys.fr (5.196.66.189)
Host is up (0.019s latency).
rDNS record for 5.196.66.189: ns330237.ip-5-196-66.eu
PORT   STATE    SERVICE
25/tcp filtered smtp

Nmap done: 1 IP address (1 host up) scanned in 0.72 seconds

Também verifiquei nas listas de SPAM de e-mail para ver se meu ip estava em uma delas e não está.

Como posso aceitar o telnet 25 de fora? não tenho ideia agora, já vi todas as perguntas sobre isso no SF e muitas delas no resto da internet.

Responder1

De acordo com os documentos do nmap:

filtered

Nmap cannot determine whether the port is open because packet filtering prevents
its probes from reaching the port. The filtering could be from a dedicated
firewall device, router rules, or host-based firewall software. These ports
frustrate attackers because they provide so little information. Sometimes they
respond with ICMP error messages such as type 3 code 13 (destination unreachable:
communication administratively prohibited), but filters that simply drop probes
without responding are far more common. This forces Nmap to retry several times
just in case the probe was dropped due to network congestion rather than
filtering. This slows down the scan dramatically.

Parece que sua porta está simplesmente bloqueada por um firewall em algum lugar. Talvez o seu ISP local? Porque quando tento me conectar a ele, recebo uma conexão:

$ telnet whys.fr 25
Trying 5.196.66.189...
Connected to whys.fr.
Escape character is '^]'.
220 whys.fr ESMTP Postfix (Debian/GNU)

Infelizmente, não é incomum que o ISP bloqueie a conexão direta com a porta 25 fora de sua própria rede, para evitar que bots em máquinas clientes enviem spam diretamente.

Responder2

A primeira coisa que eu faria antes de prosseguir seria testar a porta 25 de ponta a ponta com uma ferramenta comonetcat.

A ferramenta vem como padrão com a maioria das distribuições Linux. Por exemplo, no CentOS eu pararia o postfix para liberar a porta 25. Então eu iniciaria o netcat assim:

# nc -l 25

Então, no cliente remoto, eu começaria assim:

# nc {ip of remote server} 25

Então, qualquer coisa que você digitar em qualquer extremidade deverá ser refletida/visível na tela. Caso contrário, sua porta está bloqueada no caminho.

informação relacionada