linux-cli-community icon indicating copy to clipboard operation
linux-cli-community copied to clipboard

ProtonVPN API is blocked

Open nnzo opened this issue 5 years ago • 16 comments
trafficstars

Hi, I am trying to connect to protonvpn servers on a internet connection that looks like it blocks ProtonVPN connections.

I get this error when starting ProtonVPN for Linux

[!] There was an error connecting to the ProtonVPN API.
[!] Please make sure your connection is working properly!

Is there any way I can connect to the ProtonVPN API without going through a domain name? The tech team here isn't that bright and probably won't have blocked server's IP addresses and would of just blocked *.protonvpn.com

It works on my android phone, I think because it saved the resolved IP when I connected on my home network

Previously I have used my own custom VPN server using IKEv2 and it worked fine here. I switched to ProtonVPN with the basic plan because there are so many server options and it's just overall better

nnzo avatar May 17 '20 23:05 nnzo

I'm having a similar issue on my own network. I have tried reinstalling and using other accounts but this is all I can seem to get.

Is this information correct? [Y/n]: Y
Writing configuration to disk...
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/models.py", line 380, in prepare_url
    scheme, auth, host, port, path, query, fragment = parse_url(url)
  File "/usr/lib/python3/dist-packages/urllib3/util/url.py", line 392, in parse_url
    return six.raise_from(LocationParseError(source_url), None)
  File "<string>", line 2, in raise_from
urllib3.exceptions.LocationParseError: Failed to parse: https://api.protonvpn.ch/vpn/logicals


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/protonvpn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/cli.py", line 73, in main
    cli()
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/cli.py", line 96, in cli
    init_cli()
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/cli.py", line 243, in init_cli
    pull_server_data()
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/utils.py", line 83, in pull_server_data
    data = call_api("/vpn/logicals")
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/utils.py", line 44, in call_api
    response = requests.get(url, headers=headers)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 516, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 449, in prepare_request
    p.prepare(
  File "/usr/lib/python3/dist-packages/requests/models.py", line 314, in prepare
    self.prepare_url(url, params)
  File "/usr/lib/python3/dist-packages/requests/models.py", line 382, in prepare_url
    raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: https://api.protonvpn.ch/vpn/logicals

Spartan-767 avatar May 18 '20 02:05 Spartan-767

@STAR-Sec I think the problem you are having is either because you are not using the correct python version or your linux-cli is not up-to-date

nnzo avatar May 18 '20 06:05 nnzo

Following up my post, I managed to get connected by adding the IP and server domain name to my /etc/hosts file. I connect fine but I can't use the internet as no DNS servers work.

adding DNS server failed shows up a couple times in the logs

nnzo avatar May 18 '20 06:05 nnzo

Please fill out the BUG form entirely.

It works on my android phone, I think because it saved the resolved IP when I connected on my home network

More likely because Android has alternative routing in place.

Rafficer avatar May 18 '20 12:05 Rafficer

@Rafficer My problem really isn't a bug though, It's a problem with the network I'm on. Nothing wrong with this piece of software

nnzo avatar May 18 '20 22:05 nnzo

Doesn't matter, the template asks for a ton of valuable information to troubleshoot that isn't present in your post.

Rafficer avatar May 18 '20 22:05 Rafficer

Doesn't matter, the template asks for a ton of valuable information to troubleshoot that isn't present in your post.

No problem, I will fill it out

nnzo avatar May 18 '20 22:05 nnzo

Describe the bug

I get this error when starting ProtonVPN for Linux

[!] There was an error connecting to the ProtonVPN API.
[!] Please make sure your connection is working properly!

To Reproduce Steps to reproduce the behavior:

  1. Try to use the ProtonVPN linux-cli on a network where the API (api.protonvpn.ch) is blocked
  2. I'm running sudo protonvpn c NZ#13

Expected behavior For it to connect to the API correctely.

Error Messages/Program Output/Log Messages (~/.pvpn-cli/pvpn-cli.log)

2020-05-19 10:42:43,831 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2020-05-19 10:42:43,831 — protonvpn-cli — DEBUG — cli:86 — ###########################
2020-05-19 10:42:43,831 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'c', 'NZ#13']
2020-05-19 10:42:43,831 — protonvpn-cli — DEBUG — cli:88 — USER: atomiclemon
2020-05-19 10:42:43,832 — protonvpn-cli — DEBUG — cli:89 — CONFIG_DIR: /home/atomiclemon/.pvpn-cli
2020-05-19 10:42:43,835 — protonvpn-cli — DEBUG — cli:92 — Arguments
{'--cc': None, '--fastest': False, '--help': False, '--p2p': False, '--random': False, '--sc': False, '--tor': False, '--version': False, '-p': None, '<servername>': 'NZ#13', 'c': True, 'configure': False, 'connect': False, 'd': False, 'disconnect': False, 'examples': False, 'init': False, 'r': False, 'reconnect': False, 'refresh': False, 's': False, 'status': False}
2020-05-19 10:42:43,843 — protonvpn-cli — DEBUG — direct:232 — Starting direct connect with NZ#13
2020-05-19 10:42:43,844 — protonvpn-cli — DEBUG — call_api:36 — Initiating API Call: https://api.protonvpn.ch/vpn/logicals
2020-05-19 10:42:44,483 — protonvpn-cli — DEBUG — call_api:51 — Error connecting to ProtonVPN API

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Python Version: Python 3.8.2
  • ProtonVPN-CLI Version: ProtonVPN-CLI v2.2.2

Is there a mirror for the API maybe?

nnzo avatar May 18 '20 22:05 nnzo

Then you've added the API to /etc/hosts. What's the issue then? Can you post the logs from there?

Rafficer avatar May 18 '20 22:05 Rafficer

Then you've added the API to /etc/hosts. What's the issue then? Can you post the logs from there?

No, I added a single server to the /etc/hosts (NZ#13) The IP's of most of the ProtonVPN servers aren't blocked, just the API.

The domain name and the IP the API resolves to are both blocked.

nnzo avatar May 18 '20 23:05 nnzo

If the IP of the API is blocked, there's not much you can do. There will be a solution for this eventually, but right now there isn't much that can be done.

Rafficer avatar May 19 '20 09:05 Rafficer

Fair enough. I'll post in the issue how my progress goes bypassing this.

nnzo avatar May 21 '20 02:05 nnzo

Hi @AtomicLemon :)

How's the situation, did you manage to fix it ?

calexandru2018 avatar Jun 10 '20 17:06 calexandru2018

I didn't exactly fix it, but I just set up an ipsec configuration for two of the servers I use the most. I had to add an entry in the /etc/hosts file for each of the servers too.

It would still be really great if we could have a mirror or something of the sort of the API so I can connect to whatever server I want as that's really what I bought Protonvpn for.

nnzo avatar Jun 11 '20 02:06 nnzo

Hello @Rafficer. I also have problems with getting list of servers by api but can connect via direct openvpn command.

Can't you mirror it to some service that can't be put in blacklist by provider/government.

I assume that configure automatic commit on server update event (or periodically) into separate github repo should not be a big deal. It this case user can always set raw.github.com/something in CONFIG file and use service.

Right now i believe a lot of people in Russia have problems with you service starting from yesterday.

artemk avatar Oct 01 '20 05:10 artemk

Hello All! I have the same problem. It seems @artemk offers a quite good simple solution

enginecrew1 avatar Oct 02 '20 18:10 enginecrew1