OpenVPN no escucha en el puerto 1190 no predeterminado

OpenVPN no escucha en el puerto 1190 no predeterminado

Estoy intentando configurar OpenVPN en un servidor, pero no puedo hacerlo funcionar. Cambié el puerto predeterminado (principalmente para evitar posibles bloqueos de VPN), pero no puedo conectarme al servidor.

openvpnas@ip-xxx-xx-xx-xx:~$ sudo netstat -uapn | grep openvpn
udp        0      0 0.0.0.0:1190            0.0.0.0:*                           1455/openvpn-openss 

Otra salida

openvpnas@ip-xxx-xx-xx-xx:~$ netstat -atnp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:904           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:905           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:906           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:907           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:908           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:909           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:943             0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 172.31.42.30:22         xx.xx.xxx.xx:52882      ESTABLISHED -                   
tcp        0      0 127.0.0.1:42390         127.0.0.1:908           TIME_WAIT   -                   
tcp        0    150 xxx.xx.xx.xx:34884      xxx.xxx.xx.xx:443       ESTABLISHED -                   
tcp6       0      0 :::22                   :::*                    LISTEN      - 

Desde mi máquina local, la conexión se agota.

(base) ➜  dir  nc -v x.xx.xx.xx 1190
nc: connect to x.xx.xx.xx port 1190 (tcp) failed: Connection timed out 

Para solucionar este problema, intenté ejecutar el siguiente comando sin éxito:

sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1190 -j ACCEPT

Al conectarme con el cliente OpenVPN en Linux, aparece lo siguiente:

2022-06-13 17:49:00 WARNING: --ns-cert-type is DEPRECATED.  Use --remote-cert-tls instead.
2022-06-13 17:49:00 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-06-13 17:49:00 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-06-13 17:49:00 TCP/UDP: Preserving recently used remote address: [AF_INET]x.xx.xx.xx:1190
2022-06-13 17:49:00 Socket Buffers: R=[212992->212992] S=[212992->212992]
2022-06-13 17:49:00 UDP link local: (not bound)
2022-06-13 17:49:00 UDP link remote: [AF_INET]x.xx.xx.xx:1190
2022-06-13 17:49:04 Server poll timeout, restarting
2022-06-13 17:49:04 SIGUSR1[soft,server_poll] received, process restarting
2022-06-13 17:49:04 WARNING: --ns-cert-type is DEPRECATED.  Use --remote-cert-tls instead.
2022-06-13 17:49:04 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-06-13 17:49:04 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-06-13 17:49:04 TCP/UDP: Preserving recently used remote address: [AF_INET]x.xx.xx.xx:1190
2022-06-13 17:49:04 Socket Buffers: R=[212992->212992] S=[212992->212992]
2022-06-13 17:49:04 UDP link local: (not bound)
2022-06-13 17:49:04 UDP link remote: [AF_INET]x.xx.xx.xx:1190

Se agradece cualquier ayuda para solucionar y solucionar problemas.

Respuesta1

Hay un par de cosas aquí.

  1. El primer bloque de código en su publicación muestra OpenVPN escuchando en UDP.
  2. El segundo bloque de código muestra TCP.
  3. ncintenta conectarse al puerto TCP 1190, no al puerto UDP 1190.
  4. Su iptablesregla muestra nuevamente TCP; no UDP.

Por defecto OpenVPN usa UDP,por buenas razones.

UDP también implica que no se puede comprobar la conectividad tan fácilmente como con TCP; Es difícil distinguir entre un firewall que descarta paquetes silenciosamente y el servicio que descarta silenciosamente entradas desconocidas.

Pruebe con un cliente OpenVPN, no con NC. Solucione su problema con TCP frente a UDP.

información relacionada