Code Monkey home page Code Monkey logo

linux-cli-community's Introduction

ProtonVPN-CLI

Logo

Downloads GitHub Downloads per Week
Twitter Follow Subreddit subscribers

A Linux CLI for ProtonVPN. Written in Python.

ProtonVPN-CLI is a full rewrite of the bash protonvpn-cli in Python, which adds more features and functionality with the purpose of improving readability, speed and reliability.

Important information

The official ProtonVPN Linux app is available for Debian 10, Ubuntu 20+, Mint 19+, MX Linux 19+, Fedora 31+ and Archlinux / Manjaro. Where possible, we recommend that you upgrade to the official app. The community Linux client described below remains available for those who need it.

Installation & Updating

For more detailed information on installing, updating and uninstalling, please view the extensive usage guide.

Installing from distribution repositories

For the following Linux distribution(s), install the official protonvpn-cli package:

Fedora

sudo dnf install -y protonvpn-cli

CentOS & RHEL

protonvpn-cli is available for CentOS/RHEL 7.x and 8.x via the EPEL repositories.

For CentOS/RHEL 7.x:

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install protonvpn-cli

For CentOS/RHEL 8.x:

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install -y protonvpn-cli

Installing from PyPI

Installing Dependencies

Dependencies:

  • openvpn
  • dialog (optional, needed for interactive selection)
  • pip for python3 (pip3)
  • python3.5+
  • setuptools for python3 (python3-setuptools)

Depending on your distribution, run the appropriate following command to install the necessary dependencies

Distro Command
Fedora/CentOS/RHEL sudo dnf install -y openvpn dialog python3-pip python3-setuptools
Ubuntu/Linux Mint/Debian and derivatives sudo apt install -y openvpn dialog python3-pip python3-setuptools
OpenSUSE/SLES sudo zypper in -y openvpn dialog python3-pip python3-setuptools
Arch Linux/Manjaro sudo pacman -S openvpn dialog python-pip python-setuptools

Installing ProtonVPN-CLI

Installation happens via Python's package manager PIP.

Note: Make sure to run pip with sudo, so it installs globally and recognizes the command with sudo

sudo pip3 install protonvpn-cli

Updating ProtonVPN-CLI

sudo pip3 install protonvpn-cli --upgrade

Manual Installation from source

Disclaimer: If you are unsure about what you're doing, please follow the normal installation guide.

It is recommended to do the manual installation in a virtual environment. Especially if it serves the purpose of developing.

  1. Clone this repository

    git clone https://github.com/ProtonVPN/linux-cli-community

  2. Step into the directory

    cd linux-cli

  3. Install

    pip3 install -e .

For updating, you just need to pull the latest version of the repository with git.

How to use

For more detailed information, see the extensive usage guide.

Command Description
protonvpn init Initialize ProtonVPN profile.
protonvpn connect, c Select a ProtonVPN server and connect to it.
protonvpn c [servername] Connect to a specified server.
protonvpn c -r Connect to a random server.
protonvpn c -f Connect to the fastest server.
protonvpn c --p2p Connect to the fastest P2P server.
protonvpn c --cc [countrycode] Connect to the fastest server in a specified country.
protonvpn c --sc Connect to the fastest Secure Core server.
protonvpn reconnect, r Reconnect or connect to the last server used.
protonvpn disconnect, d Disconnect the current session.
protonvpn status, s Print connection status.
protonvpn configure Change CLI configuration.
protonvpn refresh Refresh OpenVPN configuration and server data.
protonvpn examples Print example commands.
protonvpn --version Display version.
protonvpn --help Show help message.

All connect options can be used with the -p flag to explicitly specify which transmission protocol is used for that connection (either udp or tcp).

Contributing

If you want to contribute to this project, please read the contribution guide.

linux-cli-community's People

Contributors

calexandru2018 avatar jsoref avatar jwflory avatar kaplun avatar karmadonov avatar krey avatar kylekatarnls avatar mrtnmch avatar nichogx avatar rafficer avatar serokin avatar tausigma5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linux-cli-community's Issues

[BUG] Connecting to a Secure Core or Tor server while using a Free or Basic plan returns "IndexError: Cannot choose from an empty sequence" error message

Describe the bug
Connecting to a Secure Core or Tor server while the CLI is initialized with a Free or Basic account returns an error message.

To Reproduce
Steps to reproduce the behavior:

  1. sudo protonvpn init
  2. Enter the OpenVPN credentials
  3. Choose either a Free or Basic plan
  4. Choose the default protocol
  5. Confirm the configuration
  6. sudo protonvpn c --sc or sudo protonvpn c --tor
  7. See error

Expected behavior
Show a message saying that Secure Core and Tor servers are not available to Free and Basic subscribers i.e. something along these lines:

Secure Core is a premium feature that requires ProtonVPN Plus or Visionary subscription plan.

Secure Core adds advanced protection against VPN server monitoring. To learn more about Secure Core, visit https://protonvpn.com/support/secure-core-vpn/

or

Tor over VPN is a premium feature that requires ProtonVPN Plus or Visionary subscription plan.

To learn more about Tor over VPN, visit https://protonvpn.com/support/tor-vpn/

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

sudo protonvpn c --sc returns:

Traceback (most recent call last):
  File "/usr/local/bin/protonvpn", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 73, in main
    cli()
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 125, in cli
    connection.feature_f(1, protocol)
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/connection.py", line 219, in feature_f
    fastest_server = get_fastest_server(server_pool)
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/utils.py", line 176, in get_fastest_server
    fastest_server = random.choice(fastest_pool[:pool_size])["Name"]
  File "/usr/lib/python3.6/random.py", line 260, in choice
    raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence

sudo protonvpn c --tor returns:

Traceback (most recent call last):
  File "/usr/local/bin/protonvpn", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 73, in main
    cli()
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 127, in cli
    connection.feature_f(2, protocol)
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/connection.py", line 219, in feature_f
    fastest_server = get_fastest_server(server_pool)
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/utils.py", line 176, in get_fastest_server
    fastest_server = random.choice(fastest_pool[:pool_size])["Name"]
  File "/usr/lib/python3.6/random.py", line 260, in choice
    raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence
2019-12-19 15:27:30,102 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli/pvpn-cli.log to protonlabs
2019-12-19 15:27:30,102 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-12-19 15:27:30,102 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-12-19 15:27:30,102 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-12-19 15:27:30,102 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'init']
2019-12-19 15:27:30,102 — protonvpn-cli — DEBUG — cli:88 — USER: protonlabs
2019-12-19 15:27:30,102 — protonvpn-cli — DEBUG — cli:89 — CONFIG_DIR: /home/protonlabs/.pvpn-cli
2019-12-19 15:27:30,109 — 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>': None, 'c': False, 'configure': False, 'connect': False, 'd': False, 'disconnect': False, 'examples': False, 'init': True, 'r': False, 'reconnect': False, 'refresh': False, 's': False, 'status': False}
2019-12-19 15:27:30,128 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli to protonlabs
2019-12-19 15:28:00,422 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli/pvpn-cli.cfg to protonlabs
2019-12-19 15:28:00,423 — protonvpn-cli — DEBUG — init_config_file:174 — pvpn-cli.cfg initialized
2019-12-19 15:28:00,423 — protonvpn-cli — DEBUG — call_api:35 — Initiating API Call: https://api.protonmail.ch/vpn/logicals
2019-12-19 15:28:01,465 — protonvpn-cli — DEBUG — call_api:64 — Successful json response
2019-12-19 15:28:01,535 — protonvpn-cli — DEBUG — pull_server_data:86 — SERVER_INFO_FILE written
2019-12-19 15:28:01,543 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli/serverinfo.json to protonlabs
2019-12-19 15:28:01,544 — protonvpn-cli — DEBUG — pull_server_data:93 — last_api_call updated
2019-12-19 15:28:01,546 — protonvpn-cli — DEBUG — pull_server_data:79 — Last server pull within 15mins
2019-12-19 15:28:01,553 — protonvpn-cli — DEBUG — call_api:35 — Initiating API Call: https://api.protonmail.ch/vpn/config?Platform=linux&LogicalID=BzHqSTaqcpjIY9SncE5s7FpjBrPjiGOucCyJmwA6x4nTNqlElfKvCQFr9xUa2KgQxAiHv4oQQmAkcA56s3ZiGQ==&Protocol=tcp
2019-12-19 15:28:01,998 — protonvpn-cli — DEBUG — call_api:67 — Successful non-json response
2019-12-19 15:28:01,999 — protonvpn-cli — DEBUG — make_ovpn_template:287 — OpenVPN config file downloaded
2019-12-19 15:28:02,001 — protonvpn-cli — DEBUG — make_ovpn_template:342 — remote and proto lines removed
2019-12-19 15:28:02,008 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli/template.ovpn to protonlabs
2019-12-19 15:28:02,010 — protonvpn-cli — DEBUG — set_config_value:133 — Writing username to [USER] in config file
2019-12-19 15:28:02,011 — protonvpn-cli — DEBUG — set_config_value:133 — Writing tier to [USER] in config file
2019-12-19 15:28:02,012 — protonvpn-cli — DEBUG — set_config_value:133 — Writing default_protocol to [USER] in config file
2019-12-19 15:28:02,013 — protonvpn-cli — DEBUG — set_config_value:133 — Writing dns_leak_protection to [USER] in config file
2019-12-19 15:28:02,013 — protonvpn-cli — DEBUG — set_config_value:133 — Writing custom_dns to [USER] in config file
2019-12-19 15:28:02,014 — protonvpn-cli — DEBUG — set_config_value:133 — Writing killswitch to [USER] in config file
2019-12-19 15:28:02,014 — protonvpn-cli — DEBUG — init_cli:260 — Passfile created
2019-12-19 15:28:02,015 — protonvpn-cli — DEBUG — set_config_value:133 — Writing initialized to [USER] in config file
2019-12-19 15:28:02,015 — protonvpn-cli — DEBUG — init_cli:267 — Initialization completed.
2019-12-19 15:28:21,851 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-12-19 15:28:21,851 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-12-19 15:28:21,852 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-12-19 15:28:21,852 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'c', '--sc']
2019-12-19 15:28:21,852 — protonvpn-cli — DEBUG — cli:88 — USER: protonlabs
2019-12-19 15:28:21,852 — protonvpn-cli — DEBUG — cli:89 — CONFIG_DIR: /home/protonlabs/.pvpn-cli
2019-12-19 15:28:21,859 — protonvpn-cli — DEBUG — cli:92 — Arguments
{'--cc': None, '--fastest': False, '--help': False, '--p2p': False, '--random': False, '--sc': True, '--tor': False, '--version': False, '-p': None, '<servername>': None, 'c': True, 'configure': False, 'connect': False, 'd': False, 'disconnect': False, 'examples': False, 'init': False, 'r': False, 'reconnect': False, 'refresh': False, 's': False, 'status': False}
2019-12-19 15:28:21,871 — protonvpn-cli — DEBUG — feature_f:206 — Starting fastest feature connect with feature 1
2019-12-19 15:28:21,872 — protonvpn-cli — DEBUG — disconnect:302 — Initiating disconnect
2019-12-19 15:28:21,881 — protonvpn-cli — DEBUG — is_connected:200 — Checking connection Status. OpenVPN processes: 0
2019-12-19 15:28:21,881 — protonvpn-cli — DEBUG — manage_dns:608 — Restoring DNS
2019-12-19 15:28:21,881 — protonvpn-cli — DEBUG — manage_dns:625 — No Backupfile found
2019-12-19 15:28:21,881 — protonvpn-cli — DEBUG — manage_ipv6:684 — Restoring ip6tables
2019-12-19 15:28:21,881 — protonvpn-cli — DEBUG — manage_ipv6:699 — No Backupfile found
2019-12-19 15:28:21,881 — protonvpn-cli — DEBUG — manage_killswitch:774 — Restoring iptables
2019-12-19 15:28:21,881 — protonvpn-cli — DEBUG — manage_killswitch:783 — No Backupfile found
2019-12-19 15:28:21,881 — protonvpn-cli — DEBUG — disconnect:342 — No connection found
2019-12-19 15:28:21,882 — protonvpn-cli — DEBUG — call_api:35 — Initiating API Call: https://api.protonmail.ch/vpn/logicals
2019-12-19 15:28:22,691 — protonvpn-cli — DEBUG — call_api:64 — Successful json response
2019-12-19 15:28:22,760 — protonvpn-cli — DEBUG — pull_server_data:86 — SERVER_INFO_FILE written
2019-12-19 15:28:22,769 — protonvpn-cli — DEBUG — pull_server_data:93 — last_api_call updated
2019-12-19 15:28:22,770 — protonvpn-cli — DEBUG — get_servers:100 — Reading servers from file
2019-12-19 15:28:22,779 — protonvpn-cli — DEBUG — get_fastest_server:174 — Returning fastest server with pool size 1

Desktop:

  • OS: Ubuntu
  • Python Version: 3.6.9
  • ProtonVPN-CLI Version: 2.2.0

[BUG] Split tunneling should take precedence over Kill Switch

At the moment enabling kill switch renders split tunneling settings useless.

Steps to reproduce the behavior:

  1. protonvpn configure

  2. Choose 5, set to 2.

  3. protonvpn configure

  4. Choose 6, y, add IP address

  5. IP address added in 4. cannot be reached. For example ping gives:

    ping: sendmsg: Operation not permitted
    

Expected behavior

I should be able to reach the given host.

[BUG] Not working on OSX due to missing "ip" command

Describe the bug

sudo protonvpn init does not work gives output:

'ip' not found. 
 Please install ip.

To Reproduce
Steps to reproduce the behavior:

sudo pip3 install protonvpn-cli
sudo protonvpn init

Expected behavior
For it to work

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

Desktop (please complete the following information):

  • OS: OSX 10.14.6 Mojave
  • Python Version: Python 3.7.5
  • ProtonVPN-CLI Version: ProtonVPN-CLI v2.1.2

Additional context
I do have the gui client installed as well, but can't see how that would change anything.

[BUG] status command prints error message with active Kill Switch instead of informing the user

Describe the bug
When the Kill Switch is active (OpenVPN process died) and you call protonvpn status it prints out an error message

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

To Reproduce
Steps to reproduce the behavior:

  1. Activate Kill Switch
  2. Connect to a server
  3. Kill OpenVPN process sudo pkill openvpn
  4. Use protonvpn status

Expected behavior
The User gets a warning that the Kill Switch is active and a manual reconnection is needed

Desktop (please complete the following information):

  • OS: Fedora 31
  • Python Version: 3.7.4
  • ProtonVPN-CLI Version: 2.1.1

[Enhancement] Proton SRP Support

Is your feature request related to a problem? Please describe.
Today, protonvpn-cli-ng relies on the user to enter the OpenVPN credentials stored in the user's Proton account, and then relies on all public unauthenticated APIs. However in the future these APIs are going to be protected (in order not to disseminate for free the list of IP addresses of ProtonVPN servers).

Describe the solution you'd like
The client needs to implement the Proton's flavor of the SRP authentication protocol and should thus switch to use Proton's account, and store locally only a refresh token.

[Enhancement] Create a status json file once connected.

Is your feature request related to a problem? Please describe.
Some how yes, I was using i3 blocks for my chooses Linux distro and I want to add some information if I'm connected to VPN or not, this includes country, IP address and connection status but using protonvpn status every time is a hassle at the same time it's quite take 2-3 seconds to give the info and it's not on format that I want so it's harder for me to display the status.

Describe the solution you'd like
I'm not sure if this is a good solution but creating a file with the information in json format should help, it's easier too to check if I'm connected or not. You just need to check if the file exist or not and if it existed you can extract the data in it also once you got disconnected to the VPN it should be purged automatically.

Describe alternatives you've considered
A my current solution is to run a curl command on certain url to get my IP once I detect a process of openvpn but this is something that I want to avoid because every minute I need to run certain commands and curl a certain URL.

[Enhancement] Connect to fastest plus server?

Is your feature request related to a problem? Please describe.
I guess you could say this is related to a problem. Sometimes when I connect to the "fastest" server, it'll connect me to "normal" server that often times has a higher load that some other ones. This doesn't happen all the time, but when it does I often find myself reconnecting to the "fastest" server multiple times over and over again until I get connected to a "plus" server. Sometimes that won't work and I'll end up having to find and connect to a "plus" server manually.

Describe the solution you'd like
It would be really nice if there was a way to connect to the fastest "plus" server via a flag/switch. That way I don't find myself reconnecting over and over again until I get connected to a "plus" server.


I understand if this isn't something high up on your list or even worth considering. I just figured I'd suggest this as an enhancement, because perhaps others have had to do the same thing I do and would be in agreement with this enhancement.


This is off-topic from this issue, but I just wanted to say that I like this re-write of the script. I was a bit irked by it at first because I've had some really bad times with Python in the past, but I'm genuinely impressed by this script. It hasn't even been announced yet (as far as I can tell), and I already find it to be on par or better than the bash version. :)

Ownership of install folders in Home directory - installation warning

I get the message below upon installing in Ubuntu 18.04

jake@jtp-x1c6:~$ sudo pip3 install protonvpn-cli
The directory '/home/jake/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/jake/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Should I rerun with the sudo -H flag? Uninstall and reinstall with the -H flag? or just leave it alone?

Thanks,
Jake

[Enhancement] application .desktop file

Today there is no GUI components to interact with this client.
While the support states that this is already in a TO-DO list, I created a .dektop file as a alternative to make interaction with it easier.
I'm sharing this here for anyone that find it useful:

[Desktop Entry]
Name=ProtonVPN
Comment=Secure network connection
Exec=sudo /usr/local/bin/protonvpn connect --cc BR
Icon=/opt/protonvpn/protonvpn-sign-green.png
Terminal=false
Type=Application
Categories=Network;
Actions=fastest-br;fastest;p2p;tor;sc;reconnect;disconnect;

[Desktop Action fastest-br]
Name=Connect to fastest BR server
Exec=sudo /usr/local/bin/protonvpn connect --cc BR

[Desktop Action fastest]
Name=Connect to fastest server
Exec=sudo /usr/local/bin/protonvpn connect --fastest

[Desktop Action p2p]
Name=Connect to fastest p2p server
Exec=sudo /usr/local/bin/protonvpn connect --p2p

[Desktop Action tor]
Name=Connect to fastest tor server
Exec=sudo /usr/local/bin/protonvpn connect --tor

[Desktop Action sc]
Name=Connect to fastest secure core server
Exec=sudo /usr/local/bin/protonvpn connect --sc

[Desktop Action reconnect]
Name=Reconnect to current server
Exec=sudo /usr/local/bin/protonvpn reconnect

[Desktop Action disconnect]
Name=Disconnect from ProtonVPN
Exec=sudo /usr/local/bin/protonvpn disconnect

[BUG] DNS leaking with systemd-resolved

Describe the bug

DNS requests still leak through the physical interface's servers on Ubuntu 18.04 with PVPN DNS Leak Protection enabled.

When connecting to PVPN, the CLI tool will modify the systemd-resolved config in an effort to route DNS traffic to the PVPN DNS server, 10.8.8.1. However, it seems to do this with the Global config, not the tun0 interface. Here are outputs of several systemd-resolve --status runs, altered and snipped for brevity.

No VPN

Global
          DNS Domain: my.lan
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      ...
                      test

Link 3 (wlp2s0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 10.xx.xx.x # <- My local network DNS
          DNS Domain: ~.
                      my.lan

...

ProtonVPN

Global
         DNS Servers: 10.8.8.1
          DNS Domain: my.lan
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      ...
                      test

Link 31 (tun0)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 3 (wlp2s0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 10.xx.xx.x
          DNS Domain: ~.
                      my.lan

...

Third-party VPN

Global
          DNS Domain: my.lan
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      ...
                      test

Link 32 (tun0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 10.yyy.yyy.1 # <- VPN provider's DNS server
          DNS Domain: ~.

Link 3 (wlp2s0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 10.xx.xx.x
          DNS Domain: ~.
                      my.lan

...

I currently have two other VPN providers and they both handle the systemd-resolved config in about the same way. The PVPN method is different and results in my regular DNS servers appearing in DNS leak tests.

Modifying the systemd-resolved config myself after connecting to PVPN temporarily fixes the issue until I disconnect.

$ sudo systemd-resolve --interface tun0 --set-dns 10.8.8.1 --set-domain ~.
$ systemd-resolve --interface wlp2s0 --revert
# Disconnect and reconnect the physical network to restore DNS to wlp2s0 after disconnecting PVPN.

To Reproduce

Steps to reproduce the behavior:

  1. $ protonvpn c -f
  2. Go to dnsleaktest.com and see your real DNS servers appear in the test results.

Expected behavior

My guess is that you'd want the PVPN CLI to set the DNS server on the tun0 interface, not in the Global config.

Error Messages

Just a few debug messages showing I have DNS Leak Protection enabled.

2019-11-24 19:19:39,685 — protonvpn-cli — DEBUG — manage_dns:573 — DNS Leak Protection is enabled
2019-11-24 19:19:39,686 — protonvpn-cli — DEBUG — manage_dns:579 — resolv.conf backed up
2019-11-24 19:19:39,687 — protonvpn-cli — DEBUG — manage_dns:587 — Removed existing DNS Servers
2019-11-24 19:19:39,688 — protonvpn-cli — DEBUG — manage_dns:595 — Added ProtonVPN or custom DNS

Desktop (please complete the following information):

  • OS: Ubuntu 18.04
  • Python Version: 3.6.8
  • ProtonVPN-CLI Version: 2.1.1

Additional context

I noticed that the CLI tool relies on directly modifying the resolv.conf file in place, so this may not be a trivial fix. The third-party VPN client does not modify the resolv.conf file, and I wish I could find exactly how it does it.

Thanks for the hard work!

[Enhancement] Persistent notification when connection is lost

As I often experience connection drops, it would be very helpful to have a persistent notification (f.i. through notify-send) to be notified of them, because at the moment there's no graphical feedback if a VPN connection is established or not, like f.i. in Gnome's Network Manager.

As a workaround, I use this Gnome extension to see the IP or/and country flag.

[BUG] Just did a fresh install from pip, getting ModuleNotFoundError on Gentoo.

Describe the bug
As the title says. Though I think I may know the problem. I'm on Gentoo, so I can't install protonvpn-cli globally. I have to use pip3 install --user protonvpn-cli instead.

To Reproduce
Steps to reproduce the behavior:

  1. Install with the --user option in pip3.
  2. Run the command sudo $HOME/.local/bin/protonvpn c -f
  3. See error

Expected behavior
I expected the cli to connect to the vpn.

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

Traceback (most recent call last):
  File "/home/valley/.local/bin/protonvpn", line 6, in <module>
    from protonvpn_cli.cli import main
ModuleNotFoundError: No module named 'protonvpn_cli'

Desktop (please complete the following information):

  • OS: Gentoo
  • Python Version: 3.6.9
  • ProtonVPN-CLI Version: 2.1.0

[Enhancement] Automatic reconnection

After a connection drop there's no automatic reconnection. Is this by design? Happened to me three times today with Kills Switch enabled on Ubuntu 19.04.

[BUG] Version pip

I am already using the latest version, but still have this warning.

"You are using pip version 18.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command."

[Enhancement] Kill Switch should allow local network traffic

Currently the kill switch feature prevents all traffic on the local network.

It would be great to have the option to allow traffic on the local network. Or at least, as an advanced option, allow to configure the iptables rules that it uses for the kill switch.

[Enhancement] Connect randomly to predefined servers

Would love to see a command that allows to connect randomly to predefined servers, f.i.

protonvpn c -r IS-BR#1 CH-DK#1 SE-FR#1 --cc CH --cc IS

The idea behind this is to alternate between different IPs, but only from selected servers/countries.

[BUG] IPv6 gets leaked after reconnecting the NIC, even with Kill Switch

Describe the bug
Even with the Kill Switch being active, the IPv6 gets leaked when reconnecting to a network interface that provides an IPv6 address (e.g. waking the computer from sleep).

To Reproduce
Steps to reproduce the behavior:

  1. Connect to a network that provides an IPv6 Address
  2. Connect to ProtonVPN with the Kill Switch enabled
  3. Kill the OpenVPN process (sudo pkill openvpn)
  4. Disconnect and reconnect to the network that provides the IPv6 address
  5. Confirm that you can access an IPv6 site (https://ipv6.google.com) but not an IPv4 site (https://ipv4.google.com)

Expected behavior
IPv6 should not be leaked when reconnecting a network interface

Desktop (please complete the following information):

  • OS: Fedora 31
  • Python Version: 3.7.4
  • ProtonVPN-CLI Version: 2.1.2

Additional context
Huge thank you to /u/EngGrompa on Reddit for bringing this up and being kind enough to provide me with lots of important data to narrow down the issue! 💯

[BUG] Mageia 7 KDE issue

I have attempt to install protonvpn-cli to Mageia 7:

openvpn installed
python3-pip installed
python3-setuptools installed
I have not dialog, I have kdialog and Xdialog installed, It is not installed python3-dialog and python-dialog: I have installed they. Without this I have a dialog error into protonvpn.

# pip3 install protonvpn-cli
works fine.

# protonvpn init
don't works: [!] The program was not executed as root.

I add my username to sudoers (mageia has not sudo, only root) and then try:

$ sudo protonvpn init
don't works: unknown protonvpn command

$ sudo /usr/local/bin/protonvpn init
works!

$ sudo /usr/local/bin/protonvpn connect
don't work (dialog problem), I install python3-dialog and the dialog windows works.

I have try all configuration but I get always:
[!] Authentication failed. into $ sudo /usr/local/bin/protonvpn connect

Checked my login data with $ sudo /usr/local/bin/protonvpn configure and copy and paste my login data (username and password) without success.

Firewall problem?

[BUG] Connection Failed - cli.py

Hello,
I tried to connect on my freshly installed raspbian and couldn't use pvpn this time, like I used to do. I've already reinstalled the pvpn-ng...
Every time i try to connect now this message apears:


Traceback (most recent call last):
File "/usr/local/bin/protonvpn", line 10, in
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/cli.py", line 72, in main
cli()
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/cli.py", line 120, in cli
connection.dialog()
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/connection.py", line 123, in dialog
openvpn_connect(server_result, protocol_result)
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/connection.py", line 463, in openvpn_connect
disconnect(passed=True)
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/connection.py", line 339, in disconnect
manage_dns("restore")
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/connection.py", line 612, in manage_dns
oldhash = get_config_value("metadata", "resolvconf_hash")
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/utils.py", line 113, in get_config_value
return config[group][key]
File "/usr/lib/python3.7/configparser.py", line 1251, in getitem
raise KeyError(key)
KeyError: 'resolvconf_hash'


Desktop:

  • OS: Raspbian Buster
  • Python Version: 3.7.3
  • ProtonVPN-CLI Version: 2.1.2

[BUG] Directly connecting to a server under maintenance without using the TUI leads to a crash

Describe the bug
protonvpn-cli-ng crashes when trying to connect to a server under maintenance with protonvpn connect <server>

To Reproduce
Steps to reproduce the behavior:

  1. sudo protonvpn c <serverUnderMaintenance>

Expected behavior
Throw an error that the respective server is under maintenance.

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

$ sudo protonvpn c chat1
Traceback (most recent call last):
  File "/usr/local/bin/protonvpn", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 72, in main
    cli()
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 108, in cli
    connection.direct(args.get("<servername>"), protocol)
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/connection.py", line 273, in direct
    .format(servername),
KeyError: 'servername'

pvpn-cli.log

Desktop:

  • OS: Linux Mint 19.2 Tina
  • Python Version: 3.6.8
  • ProtonVPN-CLI Version: 2.1.1

[BUG] KeyError: 'resolvconf_hash' when trying to connect after reinitializing the profile with an active connection

Describe the bug
When running sudo protonvpn init and reinitializing the profile while a connection is currently active, the connect commands will fail after finishing the initialization process with a `KeyError: 'resolvconf_hash'

To Reproduce
Steps to reproduce the behavior:

  1. Connect with ProtonVPN-CLI (protonvpn c -f)
  2. Reinitialize the profile while ProtonVPN is running (protonvpn init)
  3. Try to connect again (protonvpn c -f)
  4. See error

Expected behavior
The connection passes without issues

Version
ProtonVPN-CLI v2.1.2

Cause
This happens because during reinitialization the configuration file ~/.pvpn-cli/pvpn-cli.cfg is being reset, but all "backup files" for the IPv6 configuration, DNS configuration or firewall configuration aren't purged. As the DNS configuration expects the resolvconf_hash value in the config file, it will fail because the backup file still exists but the resolvconf_hash value doesn't anymore.

Resolution
Disconnect when a reinitialization has been detected, which removes all backup files.

[BUG] Killswitch makes the cli unable to connect to the VPN.

Describe the bug
When enabling the killswitch, the cli errors out and I have no internet access until I disconnect from the VPN. The VPN works perfectly fine when the killswitch is disabled, and it only errors out after enabling the killswitch.

To Reproduce
Steps to reproduce the behavior:

  1. Enable the killswitch with the configure option.
  2. Attempt to connect to the VPN.
  3. Receive error.
  4. Lose internet access.

Expected behavior
I expected to be able to connect to the VPN.

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

Connecting to US-IL#5 via UDP...
[!] There was an error connecting to the ProtonMail API.
[!] Please make sure your connection is working properly!

Desktop (please complete the following information):

  • OS: Gentoo
  • Python Version: 3.6.9
  • ProtonVPN-CLI Version: 2.1.0

Don't reveal true IP when establishing a connection

I'm using the Kill Switch, but observe that while establishing a VPN connection my true IP is disclosed. Is there a way to hide it while doing so?

The aim is to only go online through a VPN, never revealing the true IP.

[BUG] Killswitch Option Prevents Hotspot from Allowing Connection

Describe the bug
I've discovered that the Killswitch (option 5) prevents my android phone from connecting to the WiFi Hotspot feature. Quite simply, the phone never connects and eventually gets blocked. When the Killswitch option is turned off, the phone gets the connection and all is well with no DNS leaks.

To Reproduce
Steps to reproduce the behavior:

  1. Enable Killswitch
  2. Enable WiFi and then Hotspot feature
  3. Attempt Connection with Android = Fail
  4. Disable Killswitch
  5. Repeat 2 and 3 = Success

Expected behavior
If there aren't any security risks, I would like my phone to connect to my laptop running OpenVPN with the killswitch enabled so I can disable the phone's LTE data. This seems to work perfectly when Killswitch is disabled, but I worry that a percentage of packets are going to slip through.

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

Desktop (please complete the following information):

  • OS: [e.g. POP_OS! 19.10]
  • Python Version: [3.7.5]
  • ProtonVPN-CLI Version: [2.0.0]

Additional context
WPA_Supplicant -version [2.9]

Praise

This program is absolutely wonderful. It has been a joy to use and seems deterministic rather than the seemingly stochastic connections of the previous offering. Much love, ya'll.

[BUG] Kill Switch stopped working after a reconnection failure

After a connection drop I've checked

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

and wanted to reconnect with

$ sudo protonvpn r
Connecting to CH#17 via UDP...
[!] Authentication failed. 
[!] Please make sure that your Username and Password is correct.

While doing so, my internet connection established through my normal IP, so the Kill Switch was not working here.

Happens on Ubuntu 19.04 with Python 3.7.3 and ProtonVPN 2.1.0.

An extract from ~/.pvpn-cli/pvpn-cli.log:

2019-11-18 16:44:28,511 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-11-18 16:44:28,512 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-11-18 16:44:28,512 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-11-18 16:44:28,512 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 's']
2019-11-18 16:44:28,512 — protonvpn-cli — DEBUG — cli:88 — Arguments
{'--cc': None,
 '--fastest': False,
 '--help': False,
 '--p2p': False,
 '--random': False,
 '--sc': False,
 '--tor': False,
 '--version': False,
 '-p': None,
 '<servername>': None,
 'c': False,
 'configure': False,
 'connect': False,
 'd': False,
 'disconnect': False,
 'examples': False,
 'init': False,
 'r': False,
 'reconnect': False,
 'refresh': False,
 's': True,
 'status': False}
2019-11-18 16:44:28,512 — protonvpn-cli — DEBUG — cli:89 — USER: sojusnik
2019-11-18 16:44:28,513 — protonvpn-cli — DEBUG — cli:90 — CONFIG_DIR: /home/sojusnik/.pvpn-cli
2019-11-18 16:44:28,515 — protonvpn-cli — DEBUG — call_api:30 — Initiating API Call: https://api.protonmail.ch/vpn/logicals
2019-11-18 16:44:38,528 — protonvpn-cli — DEBUG — call_api:40 — Error connecting to ProtonMail API
2019-11-18 16:44:49,259 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-11-18 16:44:49,260 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-11-18 16:44:49,260 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-11-18 16:44:49,260 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'r']
2019-11-18 16:44:49,260 — protonvpn-cli — DEBUG — cli:88 — Arguments
{'--cc': None,
 '--fastest': False,
 '--help': False,
 '--p2p': False,
 '--random': False,
 '--sc': False,
 '--tor': False,
 '--version': False,
 '-p': None,
 '<servername>': None,
 'c': False,
 'configure': False,
 'connect': False,
 'd': False,
 'disconnect': False,
 'examples': False,
 'init': False,
 'r': True,
 'reconnect': False,
 'refresh': False,
 's': False,
 'status': False}
2019-11-18 16:44:49,260 — protonvpn-cli — DEBUG — cli:89 — USER: sojusnik
2019-11-18 16:44:49,260 — protonvpn-cli — DEBUG — cli:90 — CONFIG_DIR: /home/sojusnik/.pvpn-cli
2019-11-18 16:44:49,260 — protonvpn-cli — DEBUG — check_root:326 — Program wasn't executed as root
2019-11-18 16:45:09,979 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-11-18 16:45:09,979 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-11-18 16:45:09,979 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-11-18 16:45:09,979 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'r']
2019-11-18 16:45:09,979 — protonvpn-cli — DEBUG — cli:88 — Arguments
{'--cc': None,
 '--fastest': False,
 '--help': False,
 '--p2p': False,
 '--random': False,
 '--sc': False,
 '--tor': False,
 '--version': False,
 '-p': None,
 '<servername>': None,
 'c': False,
 'configure': False,
 'connect': False,
 'd': False,
 'disconnect': False,
 'examples': False,
 'init': False,
 'r': True,
 'reconnect': False,
 'refresh': False,
 's': False,
 'status': False}
2019-11-18 16:45:09,979 — protonvpn-cli — DEBUG — cli:89 — USER: sojusnik
2019-11-18 16:45:09,979 — protonvpn-cli — DEBUG — cli:90 — CONFIG_DIR: /home/sojusnik/.pvpn-cli
2019-11-18 16:45:09,990 — protonvpn-cli — DEBUG — reconnect:285 — Starting reconnect
2019-11-18 16:45:09,991 — protonvpn-cli — DEBUG — openvpn_connect:443 — Initiating OpenVPN connection
2019-11-18 16:45:09,991 — protonvpn-cli — DEBUG — openvpn_connect:445 — Connecting to CH#17 via UDP
2019-11-18 16:45:10,059 — protonvpn-cli — DEBUG — get_servers:90 — Reading servers from file
2019-11-18 16:45:10,065 — protonvpn-cli — DEBUG — openvpn_connect:461 — IPs: ['193.36.117.238']
2019-11-18 16:45:10,065 — protonvpn-cli — DEBUG — openvpn_connect:462 — connect.ovpn written
2019-11-18 16:45:10,065 — protonvpn-cli — DEBUG — disconnect:304 — Initiating disconnect
2019-11-18 16:45:10,076 — protonvpn-cli — DEBUG — is_connected:178 — Checking connection Status. OpenVPN processes: 0
2019-11-18 16:45:10,076 — protonvpn-cli — DEBUG — manage_dns:608 — Restoring DNS
2019-11-18 16:45:10,077 — protonvpn-cli — DEBUG — manage_dns:618 — resolv.conf restored from backup
2019-11-18 16:45:10,080 — protonvpn-cli — DEBUG — manage_dns:623 — resolv.conf.backup removed
2019-11-18 16:45:10,080 — protonvpn-cli — DEBUG — manage_ipv6:690 — Restoring IPv6
2019-11-18 16:45:10,080 — protonvpn-cli — DEBUG — manage_ipv6:692 — No Backupfile found
2019-11-18 16:45:10,080 — protonvpn-cli — DEBUG — manage_killswitch:761 — Restoring iptables
2019-11-18 16:45:10,080 — protonvpn-cli — DEBUG — manage_killswitch:763 — Restoring IPTables rules
2019-11-18 16:45:10,087 — protonvpn-cli — DEBUG — manage_killswitch:766 — iptables restored
2019-11-18 16:45:10,087 — protonvpn-cli — DEBUG — manage_killswitch:768 — iptables.backup removed
2019-11-18 16:45:10,087 — protonvpn-cli — DEBUG — disconnect:344 — No connection found
2019-11-18 16:45:10,087 — protonvpn-cli — DEBUG — get_ip_info:132 — Getting IP Information
2019-11-18 16:45:10,087 — protonvpn-cli — DEBUG — call_api:30 — Initiating API Call: https://api.protonmail.ch/vpn/location
2019-11-18 16:45:10,300 — protonvpn-cli — DEBUG — call_api:54 — Successful json response
2019-11-18 16:45:10,306 — protonvpn-cli — DEBUG — openvpn_connect:480 — OpenVPN process started
2019-11-18 16:45:43,394 — protonvpn-cli — DEBUG — openvpn_connect:523 — Authentication failure
2019-11-18 16:45:51,451 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-11-18 16:45:51,451 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-11-18 16:45:51,451 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-11-18 16:45:51,451 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'r']
2019-11-18 16:45:51,451 — protonvpn-cli — DEBUG — cli:88 — Arguments
{'--cc': None,
 '--fastest': False,
 '--help': False,
 '--p2p': False,
 '--random': False,
 '--sc': False,
 '--tor': False,
 '--version': False,
 '-p': None,
 '<servername>': None,
 'c': False,
 'configure': False,
 'connect': False,
 'd': False,
 'disconnect': False,
 'examples': False,
 'init': False,
 'r': True,
 'reconnect': False,
 'refresh': False,
 's': False,
 'status': False}
2019-11-18 16:45:51,451 — protonvpn-cli — DEBUG — cli:89 — USER: sojusnik
2019-11-18 16:45:51,451 — protonvpn-cli — DEBUG — cli:90 — CONFIG_DIR: /home/sojusnik/.pvpn-cli
2019-11-18 16:45:51,469 — protonvpn-cli — DEBUG — reconnect:285 — Starting reconnect
2019-11-18 16:45:51,470 — protonvpn-cli — DEBUG — openvpn_connect:443 — Initiating OpenVPN connection
2019-11-18 16:45:51,470 — protonvpn-cli — DEBUG — openvpn_connect:445 — Connecting to CH#17 via UDP
2019-11-18 16:45:51,470 — protonvpn-cli — DEBUG — get_servers:90 — Reading servers from file
2019-11-18 16:45:51,475 — protonvpn-cli — DEBUG — openvpn_connect:461 — IPs: ['193.36.117.238']
2019-11-18 16:45:51,475 — protonvpn-cli — DEBUG — openvpn_connect:462 — connect.ovpn written
2019-11-18 16:45:51,475 — protonvpn-cli — DEBUG — disconnect:304 — Initiating disconnect
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — is_connected:178 — Checking connection Status. OpenVPN processes: 0
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — manage_dns:608 — Restoring DNS
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — manage_dns:625 — No Backupfile found
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — manage_ipv6:690 — Restoring IPv6
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — manage_ipv6:692 — No Backupfile found
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — manage_killswitch:761 — Restoring iptables
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — manage_killswitch:770 — No Backupfile found
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — disconnect:344 — No connection found
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — get_ip_info:132 — Getting IP Information
2019-11-18 16:45:51,485 — protonvpn-cli — DEBUG — call_api:30 — Initiating API Call: https://api.protonmail.ch/vpn/location
2019-11-18 16:45:51,667 — protonvpn-cli — DEBUG — call_api:54 — Successful json response
2019-11-18 16:45:51,675 — protonvpn-cli — DEBUG — openvpn_connect:480 — OpenVPN process started
2019-11-18 16:47:41,259 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-11-18 16:47:41,259 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-11-18 16:47:41,259 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-11-18 16:47:41,259 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'c', '--cc', 'CH']
2019-11-18 16:47:41,259 — protonvpn-cli — DEBUG — cli:88 — Arguments
{'--cc': 'CH',
 '--fastest': False,
 '--help': False,
 '--p2p': False,
 '--random': False,
 '--sc': False,
 '--tor': False,
 '--version': False,
 '-p': None,
 '<servername>': None,
 'c': True,
 'configure': False,
 'connect': False,
 'd': False,
 'disconnect': False,
 'examples': False,
 'init': False,
 'r': False,
 'reconnect': False,
 'refresh': False,
 's': False,
 'status': False}
2019-11-18 16:47:41,259 — protonvpn-cli — DEBUG — cli:89 — USER: sojusnik
2019-11-18 16:47:41,259 — protonvpn-cli — DEBUG — cli:90 — CONFIG_DIR: /home/sojusnik/.pvpn-cli
2019-11-18 16:47:41,268 — protonvpn-cli — DEBUG — country_f:169 — Starting fastest country connect
2019-11-18 16:47:41,268 — protonvpn-cli — DEBUG — disconnect:304 — Initiating disconnect
2019-11-18 16:47:41,277 — protonvpn-cli — DEBUG — is_connected:178 — Checking connection Status. OpenVPN processes: 0
2019-11-18 16:47:41,277 — protonvpn-cli — DEBUG — manage_dns:608 — Restoring DNS
2019-11-18 16:47:41,277 — protonvpn-cli — DEBUG — manage_dns:625 — No Backupfile found
2019-11-18 16:47:41,277 — protonvpn-cli — DEBUG — manage_ipv6:690 — Restoring IPv6
2019-11-18 16:47:41,277 — protonvpn-cli — DEBUG — manage_ipv6:692 — No Backupfile found
2019-11-18 16:47:41,277 — protonvpn-cli — DEBUG — manage_killswitch:761 — Restoring iptables
2019-11-18 16:47:41,277 — protonvpn-cli — DEBUG — manage_killswitch:770 — No Backupfile found
2019-11-18 16:47:41,277 — protonvpn-cli — DEBUG — disconnect:344 — No connection found
2019-11-18 16:47:41,278 — protonvpn-cli — DEBUG — call_api:30 — Initiating API Call: https://api.protonmail.ch/vpn/logicals
2019-11-18 16:47:41,656 — protonvpn-cli — DEBUG — call_api:54 — Successful json response
2019-11-18 16:47:41,704 — protonvpn-cli — DEBUG — pull_server_data:76 — SERVER_INFO_FILE written
2019-11-18 16:47:41,712 — protonvpn-cli — DEBUG — pull_server_data:83 — last_api_call updated
2019-11-18 16:47:41,714 — protonvpn-cli — DEBUG — get_servers:90 — Reading servers from file
2019-11-18 16:47:41,720 — protonvpn-cli — DEBUG — get_fastest_server:164 — Returning fastest server with pool size 1
2019-11-18 16:47:41,720 — protonvpn-cli — DEBUG — openvpn_connect:443 — Initiating OpenVPN connection
2019-11-18 16:47:41,720 — protonvpn-cli — DEBUG — openvpn_connect:445 — Connecting to CH#7 via UDP
2019-11-18 16:47:41,720 — protonvpn-cli — DEBUG — get_servers:90 — Reading servers from file
2019-11-18 16:47:41,726 — protonvpn-cli — DEBUG — openvpn_connect:461 — IPs: ['185.159.157.10']
2019-11-18 16:47:41,726 — protonvpn-cli — DEBUG — openvpn_connect:462 — connect.ovpn written
2019-11-18 16:47:41,726 — protonvpn-cli — DEBUG — disconnect:304 — Initiating disconnect
2019-11-18 16:47:41,738 — protonvpn-cli — DEBUG — is_connected:178 — Checking connection Status. OpenVPN processes: 0
2019-11-18 16:47:41,738 — protonvpn-cli — DEBUG — manage_dns:608 — Restoring DNS
2019-11-18 16:47:41,738 — protonvpn-cli — DEBUG — manage_dns:625 — No Backupfile found
2019-11-18 16:47:41,738 — protonvpn-cli — DEBUG — manage_ipv6:690 — Restoring IPv6
2019-11-18 16:47:41,738 — protonvpn-cli — DEBUG — manage_ipv6:692 — No Backupfile found
2019-11-18 16:47:41,738 — protonvpn-cli — DEBUG — manage_killswitch:761 — Restoring iptables
2019-11-18 16:47:41,739 — protonvpn-cli — DEBUG — manage_killswitch:770 — No Backupfile found
2019-11-18 16:47:41,739 — protonvpn-cli — DEBUG — disconnect:344 — No connection found
2019-11-18 16:47:41,739 — protonvpn-cli — DEBUG — get_ip_info:132 — Getting IP Information
2019-11-18 16:47:41,739 — protonvpn-cli — DEBUG — call_api:30 — Initiating API Call: https://api.protonmail.ch/vpn/location
2019-11-18 16:47:41,946 — protonvpn-cli — DEBUG — call_api:54 — Successful json response
2019-11-18 16:47:41,950 — protonvpn-cli — DEBUG — openvpn_connect:480 — OpenVPN process started
2019-11-18 16:47:48,270 — protonvpn-cli — DEBUG — set_config_value:123 — Writing dns_server to [metadata] in config file
2019-11-18 16:47:48,271 — protonvpn-cli — DEBUG — manage_dns:559 — Leak Protection initiated
2019-11-18 16:47:48,271 — protonvpn-cli — DEBUG — manage_dns:573 — DNS Leak Protection is enabled
2019-11-18 16:47:48,271 — protonvpn-cli — DEBUG — manage_dns:579 — resolv.conf backed up
2019-11-18 16:47:48,272 — protonvpn-cli — DEBUG — manage_dns:587 — Removed existing DNS Servers
2019-11-18 16:47:48,272 — protonvpn-cli — DEBUG — manage_dns:595 — Added ProtonVPN or custom DNS
2019-11-18 16:47:48,273 — protonvpn-cli — DEBUG — set_config_value:123 — Writing resolvconf_hash to [metadata] in config file
2019-11-18 16:47:48,273 — protonvpn-cli — DEBUG — manage_ipv6:644 — Disabling IPv6
2019-11-18 16:47:48,281 — protonvpn-cli — DEBUG — manage_ipv6:665 — No IPv6 present
2019-11-18 16:47:48,282 — protonvpn-cli — DEBUG — manage_killswitch:794 — Backing up iptables rules
2019-11-18 16:47:48,322 — protonvpn-cli — DEBUG — manage_killswitch:828 — Killswitch enabled
2019-11-18 16:47:48,323 — protonvpn-cli — DEBUG — get_ip_info:132 — Getting IP Information
2019-11-18 16:47:48,323 — protonvpn-cli — DEBUG — call_api:30 — Initiating API Call: https://api.protonmail.ch/vpn/location
2019-11-18 16:47:48,584 — protonvpn-cli — DEBUG — call_api:54 — Successful json response
2019-11-18 16:47:48,586 — protonvpn-cli — DEBUG — openvpn_connect:514 — Connection successful
2019-11-18 16:47:48,586 — protonvpn-cli — DEBUG — openvpn_connect:533 — Writing connection info to file

[Enhancement] Provide option for ignoring IPv6

I sport a Gentoo system where I have globally disabled IPv6 (i.e., no ipv6 kernel module and all packages are stripped of any IPv6 functionality with USE=-ipv6). Since v2.2.0 I can no longer use protonvpn-cli on my IPv6-less system:

# protonvpn c -f
Connecting to NL-FREE#2 via UDP...
Traceback (most recent call last):
  File "/root/.venvs/pvpn/bin/protonvpn", line 11, in <module>
    sys.exit(main())
  File "/root/.venvs/pvpn/lib64/python3.6/site-packages/protonvpn_cli/cli.py", line 73, in main
    cli()
  File "/root/.venvs/pvpn/lib64/python3.6/site-packages/protonvpn_cli/cli.py", line 116, in cli
    connection.fastest(protocol)
  File "/root/.venvs/pvpn/lib64/python3.6/site-packages/protonvpn_cli/connection.py", line 164, in fastest
    openvpn_connect(fastest_server, protocol)
  File "/root/.venvs/pvpn/lib64/python3.6/site-packages/protonvpn_cli/connection.py", line 504, in openvpn_connect
    manage_ipv6("disable")
  File "/root/.venvs/pvpn/lib64/python3.6/site-packages/protonvpn_cli/connection.py", line 658, in manage_ipv6
    stdout=subprocess.PIPE)
  File "/usr/lib64/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ip6tables-save': 'ip6tables-save'

This functionality was introduced in commit 95701b0

It would be awesome if there was a way to disable IPv6 functionality, either through a config key or a command-line argument.

Happy to help with more info and/or the implementation if you decide on a design.

[Enhancement] All releases should be signed

Since the package requires significant privileges it is only reasonable to expect that all releases will be signed, preferably using a key under control of ProtonVPN and easily verifiable.

[BUG] Archlinux Connection Fail

Describe the bug
Hello,

It is impossible to connect.

To Reproduce
Steps to reproduce the behavior:

sudo protonvpn c -f

Expected behavior
Connection is possible

**Error Messages/Program Output/Log Messages (~/.pvpn-cli/pvpn-cli.log)**
File "/usr/bin/protonvpn", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/protonvpn_cli/cli.py", line 72, in main
    cli()
  File "/usr/lib/python3.8/site-packages/protonvpn_cli/cli.py", line 107, in cli
    connection.fastest(protocol)
  File "/usr/lib/python3.8/site-packages/protonvpn_cli/connection.py", line 149, in fastest
    disconnect(passed=True)
  File "/usr/lib/python3.8/site-packages/protonvpn_cli/connection.py", line 339, in disconnect
    manage_dns("restore")
  File "/usr/lib/python3.8/site-packages/protonvpn_cli/connection.py", line 612, in manage_dns
    oldhash = get_config_value("metadata", "resolvconf_hash")
  File "/usr/lib/python3.8/site-packages/protonvpn_cli/utils.py", line 113, in get_config_value
    return config[group][key]
  File "/usr/lib/python3.8/configparser.py", line 1254, in __getitem__
    raise KeyError(key)
KeyError: 'resolvconf_hash

Desktop (please complete the following information):

  • OS: Archlinux
  • Python Version: Python 3.8.0
  • ProtonVPN-CLI Version: ProtonVPN-CLI v2.1.2

Thanks in advance.

Kind Regards,

Authentication failed.

ProtonVPN-CLI version: v2.1.2
OS: Ubuntu64 19.10

I cannot make Authentication although my password is exactly correct.
I have alert:
[!] Authentication failed.
[!] Please make sure that your Username and Password is correct.
When I login through desktop-client on mac or windows then my authentication is ok, but I also enter the password for my mailbox protonmail when I login in my account for protonvpn that is, I enter two password. On ubuntu proton CLI I enter only one password for protonvpn

protonvpn status crashing or giving an error

the "status" command is not working on Ubuntu 19.04. Either it crashes with the following trace :
sudo protonvpn s
Traceback (most recent call last):
File "/usr/local/bin/protonvpn", line 10, in
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/cli.py", line 103, in main
cli()
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/cli.py", line 160, in cli
connection.status()
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/connection.py", line 398, in status
country = get_country_name(country_code)
File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/utils.py", line 148, in get_country_name
with open(cc_file, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/dist-packages/protonvpn_cli/country_codes.json'

or it returns the following:
sudo protonvpn status
[!] Could not reach the VPN Server
[!] You may want to reconnect with 'pvpn-cli reconnect'

[BUG] installation problems, missing dependency python-wheel/python3-wheel

Describe the bug
Failed to install due to missing dependency: python-wheel or python3-wheel.

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/ProtonVPN/protonvpn-cli-ng.git
  2. cd protonvpn-cli-ng.
  3. sudo pip3 install .
  4. See error

Expected behavior
Install correctly.

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

Building wheels for collected packages: protonvpn-cli
  Running setup.py bdist_wheel for protonvpn-cli ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-n2qfegib-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpu_f150_6pip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'

Desktop (please complete the following information):

  • OS: antiX 17.4.1 (Helen Keller)
  • Python Version: 3.5.3
  • ProtonVPN-CLI Version: master branch as of commit f1fa3f9a25be4a0bb17fffab208ac44aa6addc68

Additional context
I looked at the documentation to try and figure out why there were missing dependencies.
The requirements.txt lists docopt, requests, pythondialog but does not list python-wheel or python3-wheel (Source: https://github.com/pypa/wheel .

[BUG] DNS leak protection potentially breaks name resolution when restoring resolv.conf from backup

Describe the bug
Systems that use systemd's resolved use a symlink from /etc/resolv.conf to /run/systemd/resolve/resolv.conf (or similar). The current implementation of the DNS leak protection restores the original resolv.conf from a backup file, resulting in resolv.conf now being a static file with the original content rather than a symlink to the resolv.conf managed by resolved.
Worse even, on Linux Mint no DNS behaviour is configured in NetworkManager, relying on its default of not touching resolv.conf if it is a symlink to systemd's resolv.conf (see https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html). This results in resolv.conf now suddenly being managed by NM instead of systemd because it is no longer a symlink. A reboot does not restore the symlink.

To Reproduce
Steps to reproduce the behaviour:

  1. Enable DNS leak protection
  2. sudo protonvpn c -f
  3. sudo protonvpn d

Expected behaviour
Restore the symlink instead of a static file. I understand that this will mess with the current behaviour of checking the hash. So I think a check should be performed whether resolv.conf is a symlink. If yes, just store its target location and restore the link without bothering about the actual contents. The backend managing the link target should take care of the contents.
A second option would be the old protonvpn-cli behaviour of overwriting the target file. Maybe this is just a setting in the python copy method to follow the link instead of overwriting it. However, personally I think temporarily replacing the symlink with a static file could have the advantage of preventing the backend to mess with the file. On the other hand, NM might do so anyway...

Desktop:

  • OS: Linux Mint 19.2 Tina
  • Python Version: 3.6.8
  • ProtonVPN-CLI Version: 2.1.1

Additional context
I know resolv.conf management is notoriously painful. Otherwise I really like the new version. It is a huge improvement.
As a side note: In addition, the immutable attribute could be set on resolv.conf to prevent any other program from touching it.

[BUG] OpenBSD - ifconfig(8) support

Bug description

protonvpn-cli-ng requires ip(8) and doesn't support ifconfig(8), thus not supporting OpenBSD.

To Reproduce

Steps to reproduce:

  1. Install protonvpn-cli 2.2.0, as root, via pip3.
  2. Run doas protonvpn init
  3. See error

Expected behavior

protonvpn 2.0 should connect to the ProtonVPN servers via ifconfig(8)

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

doas protonvpn init
'ip' not found.
Please install ip.

Desktop (please complete the following information):

  • OS: [OpenBSD 6.6 (-STABLE)]
  • Python Version: [3.7.4]
  • ProtonVPN-CLI Version: [2.2.0]

[BUG] Cannot run protonvpn-cli as user, only as root in a root shell.

Each and every time I try to run the binary via $ sudo protonvpn init, I receive the error:
[!] The program was not executed as root. [!] Plase run as root.

The log throws an SELinux error at the same time as well --> "SELinux is preventing /usr/libexec/platform-python3.6 from using the dac_override capability."

The only way I am able to create a config and connect is via direct root login shell, and keeping that root shell open for as long as I'm using the VPN.

Tried the 'virtualenv' mode of install as suggested, to no avail. Tried adding the 'NOPASSWD' directive in the sudoers file, also as suggested, this doesn't work either. Perhaps its an SELinux issue? No problems at all if I simply open a root shell and run it exclusively in there.

Error Messages/Program Output/Log Messages (~/.pvpn-cli/pvpn-cli.log)
Nothing shown of relevance in pvpn-cli.log
$ which protonvpn shows /usr/local/bin/protonvpn. This path is in my shell $PATH.

Desktop

  • OS: RHEL 8.1
  • Python Version: 3.6.8
  • ProtonVPN-CLI Version: 2.1.2

Active Killswitch prevents reconnection

When the killswitch is active (connection dropped) and reconnecting is initiated, the reconnecting won't work:

user@debian9:~$ sudo protonvpn r
[!] There was an error connecting to the ProtonMail API.
[!] Please make sure your connection is working properly!

Steps to reproduce:

  1. Activate Killswitch
  2. Connect to any VPN Server
  3. Kill the OpenVPN Process via sudo pkill openvpn
  4. Try to reconnect: sudo protonvpn r

[BUG] Killswitch breaks connections to localhost servers

Can't establish connections to localhost servers.

To Reproduce

  1. Enable the killswitch while connected or connect after enabling it.
  2. Serve something on localhost.
  3. Try to connect to said localhost server through a client and it will never connect.

Expected behavior
As a developer, I expect that the killswitch feature will not affect my ability to connect to localhost servers and step 3 would result in a successful connection.

Desktop (please complete the following information):

  • OS: Ubuntu 18.10
  • Python Version: 3.7.3
  • ProtonVPN-CLI Version: 2.0.0

[BUG] Enabling Split Tunneling and leaving the field empty to stop the process returns "FileNotFoundError: [Errno 2]" error message

Describe the bug
Enabling Split Tunneling and leaving the field empty causes FileNotFoundError: [Errno 2] No such file or directory error message.

To Reproduce
Steps to reproduce the behavior:

  1. sudo protonvpn configure
  2. Enter 6 for Split Tunneling and then confirm by typing y
  3. Leave the field Please enter an IP or CIDR to exclude from VPN. Or leave empty to stop: empty and press Enter.
  4. See error

Expected behavior
Stop the process without issues

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

Traceback (most recent call last):
  File "/usr/local/bin/protonvpn", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 73, in main
    cli()
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 143, in cli
    configure_cli()
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 343, in configure_cli
    set_split_tunnel()
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/cli.py", line 621, in set_split_tunnel
    change_file_owner(SPLIT_TUNNEL_FILE)
  File "/usr/local/lib/python3.6/dist-packages/protonvpn_cli/utils.py", line 354, in change_file_owner
    current_owner = subprocess.run(["id", "-nu", str(os.stat(path).st_uid)],
FileNotFoundError: [Errno 2] No such file or directory: '/home/protonlabs/.pvpn-cli/split_tunnel.txt'
2019-12-18 14:57:38,866 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli/pvpn-cli.log to protonlabs
2019-12-18 14:57:38,867 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-12-18 14:57:38,867 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-12-18 14:57:38,867 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-12-18 14:57:38,867 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'configure']
2019-12-18 14:57:38,867 — protonvpn-cli — DEBUG — cli:88 — USER: protonlabs
2019-12-18 14:57:38,867 — protonvpn-cli — DEBUG — cli:89 — CONFIG_DIR: /home/protonlabs/.pvpn-cli
2019-12-18 14:57:38,875 — 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>': None, 'c': False, 'configure': True, 'connect': False, 'd': False, 'disconnect': False, 'examples': False, 'init': False, 'r': False, 'reconnect': False, 'refresh': False, 's': False, 'status': False}
2019-12-18 14:57:38,884 — protonvpn-cli — DEBUG — check_init:500 — Initialized Profile not found
2019-12-18 14:57:53,606 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-12-18 14:57:53,607 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-12-18 14:57:53,607 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-12-18 14:57:53,607 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'configure']
2019-12-18 14:57:53,607 — protonvpn-cli — DEBUG — cli:88 — USER: protonlabs
2019-12-18 14:57:53,607 — protonvpn-cli — DEBUG — cli:89 — CONFIG_DIR: /home/protonlabs/.pvpn-cli
2019-12-18 14:57:53,614 — 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>': None, 'c': False, 'configure': True, 'connect': False, 'd': False, 'disconnect': False, 'examples': False, 'init': False, 'r': False, 'reconnect': False, 'refresh': False, 's': False, 'status': False}
2019-12-18 14:57:53,624 — protonvpn-cli — DEBUG — check_init:500 — Initialized Profile not found
2019-12-18 14:57:58,297 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-12-18 14:57:58,298 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-12-18 14:57:58,298 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-12-18 14:57:58,298 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'init']
2019-12-18 14:57:58,298 — protonvpn-cli — DEBUG — cli:88 — USER: protonlabs
2019-12-18 14:57:58,298 — protonvpn-cli — DEBUG — cli:89 — CONFIG_DIR: /home/protonlabs/.pvpn-cli
2019-12-18 14:57:58,305 — 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>': None, 'c': False, 'configure': False, 'connect': False, 'd': False, 'disconnect': False, 'examples': False, 'init': True, 'r': False, 'reconnect': False, 'refresh': False, 's': False, 'status': False}
2019-12-18 14:57:58,321 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli to protonlabs
2019-12-18 14:58:07,344 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli/pvpn-cli.cfg to protonlabs
2019-12-18 14:58:07,344 — protonvpn-cli — DEBUG — init_config_file:174 — pvpn-cli.cfg initialized
2019-12-18 14:58:07,345 — protonvpn-cli — DEBUG — call_api:35 — Initiating API Call: https://api.protonmail.ch/vpn/logicals
2019-12-18 14:58:08,364 — protonvpn-cli — DEBUG — call_api:64 — Successful json response
2019-12-18 14:58:08,433 — protonvpn-cli — DEBUG — pull_server_data:86 — SERVER_INFO_FILE written
2019-12-18 14:58:08,441 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli/serverinfo.json to protonlabs
2019-12-18 14:58:08,442 — protonvpn-cli — DEBUG — pull_server_data:93 — last_api_call updated
2019-12-18 14:58:08,444 — protonvpn-cli — DEBUG — pull_server_data:79 — Last server pull within 15mins
2019-12-18 14:58:08,450 — protonvpn-cli — DEBUG — call_api:35 — Initiating API Call: https://api.protonmail.ch/vpn/config?Platform=linux&LogicalID=BzHqSTaqcpjIY9SncE5s7FpjBrPjiGOucCyJmwA6x4nTNqlElfKvCQFr9xUa2KgQxAiHv4oQQmAkcA56s3ZiGQ==&Protocol=tcp
2019-12-18 14:58:08,909 — protonvpn-cli — DEBUG — call_api:67 — Successful non-json response
2019-12-18 14:58:08,909 — protonvpn-cli — DEBUG — make_ovpn_template:287 — OpenVPN config file downloaded
2019-12-18 14:58:08,911 — protonvpn-cli — DEBUG — make_ovpn_template:342 — remote and proto lines removed
2019-12-18 14:58:08,919 — protonvpn-cli — DEBUG — change_file_owner:361 — Changed owner of /home/protonlabs/.pvpn-cli/template.ovpn to protonlabs
2019-12-18 14:58:08,921 — protonvpn-cli — DEBUG — set_config_value:133 — Writing username to [USER] in config file
2019-12-18 14:58:08,921 — protonvpn-cli — DEBUG — set_config_value:133 — Writing tier to [USER] in config file
2019-12-18 14:58:08,922 — protonvpn-cli — DEBUG — set_config_value:133 — Writing default_protocol to [USER] in config file
2019-12-18 14:58:08,923 — protonvpn-cli — DEBUG — set_config_value:133 — Writing dns_leak_protection to [USER] in config file
2019-12-18 14:58:08,924 — protonvpn-cli — DEBUG — set_config_value:133 — Writing custom_dns to [USER] in config file
2019-12-18 14:58:08,924 — protonvpn-cli — DEBUG — set_config_value:133 — Writing killswitch to [USER] in config file
2019-12-18 14:58:08,925 — protonvpn-cli — DEBUG — init_cli:260 — Passfile created
2019-12-18 14:58:08,925 — protonvpn-cli — DEBUG — set_config_value:133 — Writing initialized to [USER] in config file
2019-12-18 14:58:08,926 — protonvpn-cli — DEBUG — init_cli:267 — Initialization completed.
2019-12-18 14:58:13,495 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-12-18 14:58:13,496 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-12-18 14:58:13,496 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-12-18 14:58:13,496 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'configure']
2019-12-18 14:58:13,497 — protonvpn-cli — DEBUG — cli:88 — USER: protonlabs
2019-12-18 14:58:13,497 — protonvpn-cli — DEBUG — cli:89 — CONFIG_DIR: /home/protonlabs/.pvpn-cli
2019-12-18 14:58:13,504 — 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>': None, 'c': False, 'configure': True, 'connect': False, 'd': False, 'disconnect': False, 'examples': False, 'init': False, 'r': False, 'reconnect': False, 'refresh': False, 's': False, 'status': False}
2019-12-18 14:58:18,371 — protonvpn-cli — DEBUG — set_config_value:133 — Writing split_tunnel to [USER] in config file

Desktop:

  • OS: Ubuntu
  • Python Version: 3.6.9
  • ProtonVPN-CLI Version: 2.2.0

[BUG] Auto-connect not working

Describe the bug
I followed the instructions to set up auto-connecting on boot but it doesn't work.

Manually connecting to the server works.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the steps above and set up auto-connect on boot
  2. Restart computer
  3. Check IP address

Expected behavior
I was expecting the client to auto-connect to the provided server, but it didn't, I've got the IP from my ISP instead of the VPN server's IP.

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

Output of the relevant section of ~/.pvpn-cli/pvpn-cli.log

2019-11-21 19:44:20,359 — protonvpn-cli — DEBUG — cli:84 — ###########################
2019-11-21 19:44:20,360 — protonvpn-cli — DEBUG — cli:85 — ### NEW PROCESS STARTED ###
2019-11-21 19:44:20,360 — protonvpn-cli — DEBUG — cli:86 — ###########################
2019-11-21 19:44:20,361 — protonvpn-cli — DEBUG — cli:87 — ['/usr/local/bin/protonvpn', 'connect', 'UK#6', '-p', 'UDP']
2019-11-21 19:44:20,361 — protonvpn-cli — DEBUG — cli:88 — Arguments
{'--cc': None,
'--fastest': False,
'--help': False,
'--p2p': False,
'--random': False,
'--sc': False,
'--tor': False,
'--version': False,
'-p': 'UDP',
'': 'UK#6',
'c': False,
'configure': False,
'connect': True,
'd': False,
'disconnect': False,
'examples': False,
'init': False,
'r': False,
'reconnect': False,
'refresh': False,
's': False,
'status': False}
2019-11-21 19:44:20,361 — protonvpn-cli — DEBUG — cli:89 — USER: peter
2019-11-21 19:44:20,361 — protonvpn-cli — DEBUG — cli:90 — CONFIG_DIR: /home/peter/.pvpn-cli
2019-11-21 19:44:20,380 — protonvpn-cli — DEBUG — direct:226 — Starting direct connect with UK#6
2019-11-21 19:44:20,381 — protonvpn-cli — DEBUG — call_api:30 — Initiating API Call: https://api.protonmail.ch/vpn/logicals
2019-11-21 19:44:20,386 — protonvpn-cli — DEBUG — call_api:40 — Error connecting to ProtonMail API

Desktop (please complete the following information):

  • OS: elementary OS
  • Python Version: 3.6.8
  • ProtonVPN-CLI Version: 2.1.1

[Bug] - Connect command fails

Hi,

Command sudo protonvpn c fails:


Traceback (most recent call last):
  File "/usr/local/bin/protonvpn", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/cli.py", line 103, in main
    cli()
  File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/cli.py", line 150, in cli
    connection.dialog()
  File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/connection.py", line 65, in dialog
    country = get_country_name(server["ExitCountry"])
  File "/usr/local/lib/python3.7/dist-packages/protonvpn_cli/utils.py", line 148, in get_country_name
    with open(cc_file, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/dist-packages/protonvpn_cli/country_codes.json'

Testing in Debian 10.

Kind Regards.

[Enhancement] Background daemon for connection monitoring

Is your feature request related to a problem? Please describe.
Currently, when a connection goes down the CLI has no way of re-establishing the connection in the event it cuts, as it doesn't run a background service. This also makes it impossible for the CLI to automatically connect on boot or notify the user in such case

Describe the solution you'd like
A background daemon constantly checking the VPN connection and re-establishing it in the event it goes down.

Autostart Not Working - Raspbian 10 - buster

I am seeing the same issue that sojusnik was in enhancement #10

My systemd file looks the following, but it won't auto connect at start-up:
` GNU nano 3.2 /etc/systemd/system/protonvpn-autoconnect.service

[Unit]
Description=ProtonVPN-CLI auto-connect
Wants=network-online.target

[Service]
Type=forking
ExecStart=/usr/local/bin/protonvpn connect --sc
Environment=PVPN_WAIT=300
Environment=PVPN_DEBUG=1
Environment=SUDO_USER=pi

[Install]
WantedBy=multi-user.target
`

The status shows:
`pi@raspberrypi:~ $ sudo systemctl status protonvpn-autoconnect
● protonvpn-autoconnect.service - ProtonVPN-CLI auto-connect
Loaded: loaded (/etc/systemd/system/protonvpn-autoconnect.service; enabled; v
Active: failed (Result: exit-code) since Sat 2019-12-21 02:32:45 CST; 10min a
Process: 375 ExecStart=/usr/local/bin/protonvpn connect --sc (code=exited, sta

Dec 21 02:32:45 raspberrypi protonvpn[375]: 2019-12-21 02:32:45,499 — protonvpn-
Dec 21 02:32:45 raspberrypi protonvpn[375]: 2019-12-21 02:32:45,500 — protonvpn-
Dec 21 02:32:45 raspberrypi protonvpn[375]: 2019-12-21 02:32:45,507 — protonvpn-
Dec 21 02:32:45 raspberrypi protonvpn[375]: Waiting for connection...
Dec 21 02:32:45 raspberrypi protonvpn[375]: Connection working!
Dec 21 02:32:45 raspberrypi protonvpn[375]: [!] There was an error connecting to
Dec 21 02:32:45 raspberrypi protonvpn[375]: [!] Please make sure your connection
Dec 21 02:32:45 raspberrypi systemd[1]: protonvpn-autoconnect.service: Control p
Dec 21 02:32:45 raspberrypi systemd[1]: protonvpn-autoconnect.service: Failed wi
Dec 21 02:32:45 raspberrypi systemd[1]: Failed to start ProtonVPN-CLI auto-conne
lines 1-15/15 (END)
Manually executingpi@raspberrypi:~ $ sudo systemctl start protonvpn-autoconnect`
works fine.

I am sure I am the problem, but I cannot figure out what I am doing wrong. Do you see it?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.