jotyGill / openpyn-nordvpn

Easily connect to and switch between, OpenVPN servers hosted by NordVPN on Linux (+patch leakes)
GNU General Public License v3.0
628 stars 114 forks source link

Server connection halted, TLS handsake failed, no new selection of suitable server #261

Open guidoevers opened 4 years ago

guidoevers commented 4 years ago

Hi,

I hate opening this issue as a similar one had been open en closed before. I tried searching all of the internet but I can't get find an answer to this problem.

I have openpyn running quite well on a little linux machine, Vero 4K+. After a certain time, the connection would come to an halt. When I log in the log I see that openpyn tries to restart the connection to the same remote address. Also I see some TLS handshake errors.

I would have liked that when a connection to a certain vpn server is halted for whatever reason, the whole initiation process of finding a new most suitable vpn server would start. Reading the openpyn wiki I believe this is also how it is intended to work. I can't find out why this doesn't happen in my case. I hope anyone can push me in the right direction.

● openpyn.service - NordVPN connection manager
   Loaded: loaded (/etc/systemd/system/openpyn.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-03-14 23:51:13 CET; 1 day 17h ago
  Process: 1186 ExecStartPre=/bin/sleep 5 (code=exited, status=0/SUCCESS)
 Main PID: 1480 (openpyn)
   CGroup: /system.slice/openpyn.service
           ├─1480 /usr/bin/python3 /usr/local/bin/openpyn nl --p2p --silent
           ├─1719 sudo openvpn --redirect-gateway --auth-retry nointeract --config /usr/local/lib/python3.5/dist-packages/openpyn/files/ovpn_udp/nl555.nordvpn.com.udp.ovp
           └─1726 openvpn --redirect-gateway --auth-retry nointeract --config /usr/local/lib/python3.5/dist-packages/openpyn/files/ovpn_udp/nl555.nordvpn.com.udp.ovpn --a

Mar 16 17:18:50 osmc openpyn[1480]: Mon Mar 16 17:18:50 2020 SIGUSR1[soft,tls-error] received, process restarting
Mar 16 17:18:50 osmc openpyn[1480]: Mon Mar 16 17:18:50 2020 Restart pause, 300 second(s)
Mar 16 17:23:50 osmc openpyn[1480]: Mon Mar 16 17:23:50 2020 TCP/UDP: Preserving recently used remote address: [AF_INET]185.229.191.101:1194
Mar 16 17:23:50 osmc openpyn[1480]: Mon Mar 16 17:23:50 2020 Socket Buffers: R=[212992->1048576] S=[212992->1048576]
Mar 16 17:23:50 osmc openpyn[1480]: Mon Mar 16 17:23:50 2020 UDP link local: (not bound)
Mar 16 17:23:50 osmc openpyn[1480]: Mon Mar 16 17:23:50 2020 UDP link remote: [AF_INET]185.229.191.101:1194
Mar 16 17:24:50 osmc openpyn[1480]: Mon Mar 16 17:24:50 2020 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Mar 16 17:24:50 osmc openpyn[1480]: Mon Mar 16 17:24:50 2020 TLS Error: TLS handshake failed
Mar 16 17:24:50 osmc openpyn[1480]: Mon Mar 16 17:24:50 2020 SIGUSR1[soft,tls-error] received, process restarting
Mar 16 17:24:50 osmc openpyn[1480]: Mon Mar 16 17:24:50 2020 Restart pause, 300 second(s)

as mentioned in the other issues, a sudo systemctl restart openpyn kind of fixes the problem, but is not really a solution as it isn't automated.

I've made slight adjustments to sudo nano /etc/systemd/system/openpyn.service

[Unit]
Description=NordVPN connection manager
Wants=network-online.target
After=network-online.target
After=multi-user.target
[Service]
Type=simple
User=root
WorkingDirectory=/usr/local/lib/python3.5/dist-packages/openpyn/
ExecStartPre=/bin/sleep 5
ExecStart=/usr/local/bin/openpyn nl --p2p --silent
ExecStop=/usr/local/bin/openpyn --kill
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target

in any case, thanks for this amazing tool!