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

Crashes when ovpn file can not be found #227

Open maciex opened 5 years ago

maciex commented 5 years ago

Openpyn fails trying to get the IP from OVPN file which does not exists.

# /usr/local/bin/openpyn pl --p2p -f
2019-04-10 21:19:48 [INFO] Flushing iptables INPUT and OUTPUT chains AND Applying default Rules
According to NordVPN, Least Busy 10 Servers in PL With 'Load' Less Than 70 Which Support OPENVPN-UDP , p2p = True Are: [['pl86', 11], ['pl81', 17], ['pl66', 18], ['pl64', 22], ['pl82', 23], ['pl83', 23], ['pl58', 24], ['pl63', 24], ['pl78', 24], ['pl85', 24]]

Pinging Server pl86 min/avg/max/mdev = [7, 8, 8, 0] 

Pinging Server pl81 min/avg/max/mdev = [9, 12, 15, 2] 

Pinging Server pl66 min/avg/max/mdev = [9, 9, 9, 0] 

Pinging Server pl64 min/avg/max/mdev = [6, 7, 8, 0] 

Pinging Server pl82 min/avg/max/mdev = [9, 11, 12, 1] 

Pinging Server pl83 min/avg/max/mdev = [7, 9, 10, 1] 

Pinging Server pl58 min/avg/max/mdev = [8, 9, 10, 0] 

Pinging Server pl63 min/avg/max/mdev = [8, 9, 10, 0] 

Pinging Server pl78 min/avg/max/mdev = [8, 8, 8, 0] 

Pinging Server pl85 min/avg/max/mdev = [8, 10, 13, 2] 

Top 10 Servers with Best Ping Are: ['pl64', 'pl86', 'pl78', 'pl66', 'pl58', 'pl63', 'pl83', 'pl85', 'pl82', 'pl81']

Out of the Best Available Servers, Chose pl64

Traceback (most recent call last):
  File "/usr/local/bin/openpyn", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/openpyn/openpyn.py", line 144, in main
    args.skip_dns_patch, args.silent, args.nvram, args.openvpn_options, args.location)
  File "/usr/local/lib/python3.5/dist-packages/openpyn/openpyn.py", line 407, in run
    vpn_server_ip = get_vpn_server_ip(aserver, port)
  File "/usr/local/lib/python3.5/dist-packages/openpyn/openpyn.py", line 789, in get_vpn_server_ip
    with open(vpn_config_file, 'r') as openvpn_file:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.5/dist-packages/openpyn/files/ovpn_udp/pl64.nordvpn.com.udp.ovpn'

The file /usr/local/lib/python3.5/dist-packages/openpyn/files/ovpn_udp/pl64.nordvpn.com.udp.ovpn is not there and I was not able to detect why.

jotyGill commented 5 years ago

They keep adding new servers. run sudo openpyn --update to get the latest config files.

maciex commented 5 years ago

This may be a workaround, but it's not a fix. This should happen automatically, without this the VPN is not being setup and the system could be locked and blocking all connections. It should be rather handled in the source code by avoiding the connection to not existing OVPN server files, or maybe doing the update before connecting.

That would probably help, I won't try it as my system had a hardware failure, so I don't have that setup right now.