No puedo conectarme con telnet desde una ip externa

No puedo conectarme con telnet desde una ip externa

Tengo un servidor postfix ejecutándose en un VPS kimsufi, instalé roundcube en él y todo está bien. El problema es que cuando intento conectarme desde otro servidor, se agota el tiempo de espera:

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

aquí está mi resultado de 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

Y las reglas actuales de 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 desde localhost funciona muy bien:

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.

El servidor está alojado en el centro de datos de OVH y el puerto 25 no está bloqueado:

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

También revisé listas de correo SPAM para ver si mi ip estaba en alguna de esas y no está.

¿Cómo puedo hacer para aceptar telnet 25 desde fuera? No tengo idea ahora, ya vi todas las preguntas al respecto en SF y muchas de ellas en el resto de Internet.

Respuesta1

Según los documentos de 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.

Entonces parece que su puerto simplemente está bloqueado por un firewall en alguna parte. ¿Quizás tu ISP local? Porque cuando intento conectarme, obtengo una conexión:

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

Lamentablemente, no es raro que el ISP bloquee la conexión directa al puerto 25 fuera de su propia red, para evitar que los robots en las máquinas cliente envíen spam directamente.

Respuesta2

Lo primero que haría antes de continuar sería probar el puerto 25 de extremo a extremo con una herramienta comonetcat.

La herramienta viene de serie con la mayoría de las distribuciones de Linux. Por ejemplo, en CentOS, detendría postfix para liberar el puerto 25. Luego, iniciaría netcat de esta manera:

# nc -l 25

Luego, en el cliente remoto, lo iniciaría así:

# nc {ip of remote server} 25

Entonces, todo lo que escriba en cualquiera de los extremos debería reflejarse/visible en la pantalla. Si no es así, entonces su puerto está bloqueado en el camino.

información relacionada