ProtonVPN / linux-cli

Official ProtonVPN Linux app (CLI)
https://protonvpn.com/download-linux
GNU General Public License v3.0
335 stars 43 forks source link

"No session was found. Please login first." directly after logging in #48

Open notDavid opened 3 years ago

notDavid commented 3 years ago

Hi there,

I have this issue: #7 on Ubuntu 64-bit running on a Raspberry Pi4. Please advise thank you;

ubuntu at pi5 in ~
$ protonvpn-cli login xxxx@protonmail.com
Enter your ProtonVPN password:
Successful login.

ubuntu at pi5 in ~
$ protonvpn-cli c
No session was found. Please login first.
$ keyring --list-backends
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.chainer.ChainerBackend (priority: -10)
keyring.backends.SecretService.Keyring (priority: 5)
$ dpkg -l | grep -i 'gnome-keyring'
ii  gnome-keyring                                               3.36.0-1ubuntu1                                             arm64        GNOME keyring services (daemon and tools)
ii  gnome-keyring-pkcs11:arm64                                  3.36.0-1ubuntu1                                             arm64        GNOME keyring module for the PKCS#11 module loading library
ii  libpam-gnome-keyring:arm64                                  3.36.0-1ubuntu1                                             arm64        PAM module to unlock the GNOME keyring upon login
~/.cache/protonvpn/logs/protonvpn.log : ``` 2021-08-22 11:15:07,653 — settings_backend.py — INFO — get_backend:13 — Settings backend: 2021-08-22 11:15:08,036 — _base.py — INFO — get_default:16 — Using "" keyring 2021-08-22 11:15:08,753 — linuxkeyring.py — ERROR — _ensure_backend_is_working:127 — Unable to select keyring.backends.SecretService.Keyring (priority: 5) backend Traceback (most recent call last): File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out return function_in(*args, **kwargs) File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__ return self._connection.call_blocking(self._named_service, File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking reply_message = self.send_message_with_reply_and_block( dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/secrets/collection/login During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection return Collection(bus) File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__ self.collection_props_iface.Get(COLLECTION_IFACE, 'Label', File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 34, in function_out raise ItemNotFoundException('Item does not exist!') secretstorage.exceptions.ItemNotFoundException: Item does not exist! During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 52, in get_preferred_collection collection = secretstorage.get_default_collection(bus) File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 157, in get_default_collection return create_collection(bus, 'Default', File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 139, in create_collection raise ItemNotFoundException('Prompt dismissed.') secretstorage.exceptions.ItemNotFoundException: Prompt dismissed. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/keyring/linuxkeyring.py", line 121, in _ensure_backend_is_working self.__keyring_backend.get_password( File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 64, in get_password collection = self.get_preferred_collection() File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 54, in get_preferred_collection raise InitError("Failed to create the collection: %s." % e) keyring.errors.InitError: Failed to create the collection: Prompt dismissed.. 2021-08-22 11:15:08,763 — _base.py — INFO — get_default:16 — Using "" keyring 2021-08-22 11:15:08,767 — _base.py — INFO — get_default:16 — Using "" keyring 2021-08-22 11:15:08,768 — session.py — ERROR — __init__:176 — 'NoneType' object has no attribute 'get' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/session/session.py", line 171, in __init__ self.__keyring_load_session() File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/session/session.py", line 212, in __keyring_load_session if keyring_data.get('api_url') != self.__proton_api.dump()['api_url']: AttributeError: 'NoneType' object has no attribute 'get' 2021-08-22 11:15:10,463 — utilities.py — INFO — ensure_internet_connection_is_available:21 — Checking for internet connectivity 2021-08-22 11:15:10,486 — killswitch.py — INFO — __init__:60 — Initialized killswitch manager 2021-08-22 11:15:10,493 — killswitch.py — INFO — get_status_connectivity_check:601 — Conn check available (0) - Conn check enabled (0) 2021-08-22 11:15:10,493 — utilities.py — INFO — ensure_internet_connection_is_available:23 — Skipping as killswitch is enabled 2021-08-22 11:15:10,494 — utilities.py — INFO — ensure_api_is_reacheable:46 — Checking API connectivity 2021-08-22 11:15:10,494 — utilities.py — INFO — ensure_api_is_reacheable:49 — Skipping as killswitch is enabled 2021-08-22 11:15:12,672 — session.py — INFO — servers:484 — Could not load server cache 2021-08-22 11:15:13,320 — session.py — INFO — clientconfig:544 — Could not load client config cache 2021-08-22 11:15:18,781 — settings_backend.py — INFO — get_backend:13 — Settings backend: 2021-08-22 11:15:19,100 — _base.py — INFO — get_default:16 — Using "" keyring 2021-08-22 11:15:19,391 — linuxkeyring.py — ERROR — _ensure_backend_is_working:127 — Unable to select keyring.backends.SecretService.Keyring (priority: 5) backend Traceback (most recent call last): File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out return function_in(*args, **kwargs) File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__ return self._connection.call_blocking(self._named_service, File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking reply_message = self.send_message_with_reply_and_block( dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/secrets/collection/login During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection return Collection(bus) File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__ self.collection_props_iface.Get(COLLECTION_IFACE, 'Label', File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 34, in function_out raise ItemNotFoundException('Item does not exist!') secretstorage.exceptions.ItemNotFoundException: Item does not exist! During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 52, in get_preferred_collection collection = secretstorage.get_default_collection(bus) File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 157, in get_default_collection return create_collection(bus, 'Default', File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 139, in create_collection raise ItemNotFoundException('Prompt dismissed.') secretstorage.exceptions.ItemNotFoundException: Prompt dismissed. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/keyring/linuxkeyring.py", line 121, in _ensure_backend_is_working self.__keyring_backend.get_password( File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 64, in get_password collection = self.get_preferred_collection() File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 54, in get_preferred_collection raise InitError("Failed to create the collection: %s." % e) keyring.errors.InitError: Failed to create the collection: Prompt dismissed.. 2021-08-22 11:15:19,397 — _base.py — INFO — get_default:16 — Using "" keyring 2021-08-22 11:15:19,402 — _base.py — INFO — get_default:16 — Using "" keyring 2021-08-22 11:15:19,403 — session.py — ERROR — __init__:176 — 'NoneType' object has no attribute 'get' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/session/session.py", line 171, in __init__ self.__keyring_load_session() File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/session/session.py", line 212, in __keyring_load_session if keyring_data.get('api_url') != self.__proton_api.dump()['api_url']: AttributeError: 'NoneType' object has no attribute 'get' ```
protonvpn-cli.log : ``` 2021-08-22 09:15:07,644 — cli.py — INFO — __init__:17 — ------------------------------------------------- ----------- Initialized protonvpn-cli ----------- ------------------------------------------------- 2021-08-22 09:15:07,644 — cli.py — INFO — __init__:29 — ProtonVPN CLI v3.8.0 (protonvpn-nm-lib v3.3.2; proton-client v0.5.1) 2021-08-22 09:15:07,658 — cli.py — INFO — __init__:64 — CLI command: Namespace(command='login', get_logs=False, help=False, version=False) 2021-08-22 09:15:10,462 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login 2021-08-22 09:15:18,743 — cli.py — INFO — __init__:17 — ------------------------------------------------- ----------- Initialized protonvpn-cli ----------- ------------------------------------------------- 2021-08-22 09:15:18,773 — cli.py — INFO — __init__:29 — ProtonVPN CLI v3.8.0 (protonvpn-nm-lib v3.3.2; proton-client v0.5.1) 2021-08-22 09:15:18,787 — cli.py — INFO — __init__:64 — CLI command: Namespace(command='c', get_logs=False, help=False, version=False) 2021-08-22 09:15:18,789 — cli.py — INFO — connect:128 — Options: Namespace(cc=None, fastest=False, help=False, p2p=False, protocol=None, random=False, sc=False, servername=None, tor=False) ```
System specs: ``` $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS" $ uname -a Linux pi5 5.4.0-1041-raspi #45-Ubuntu SMP PREEMPT Thu Jul 15 01:17:56 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux ```

Not sure if this warning i got while installing is related: #46

notDavid commented 3 years ago

I noticed another error in the journal/log while running the login command:

$ journalctl -f

Aug 22 12:36:33 pi5 dbus-daemon[3935]: [session uid=1000 pid=3935] Activating service name='org.gnome.keyring.SystemPrompter' requested by ':1.2' (uid=1000 pid=3937 comm="/usr/bin/gnome-keyring-daemon --start --foreground" label="unconfined")
Aug 22 12:36:33 pi5 org.gnome.keyring.SystemPrompter[8301]: Unable to init server: Could not connect: Connection refused
Aug 22 12:36:33 pi5 gcr-prompter[8301]: cannot open display: 
Aug 22 12:36:33 pi5 dbus-daemon[3935]: [session uid=1000 pid=3935] Activated service 'org.gnome.keyring.SystemPrompter' failed: Process org.gnome.keyring.SystemPrompter exited with status 1
Aug 22 12:36:33 pi5 gnome-keyring-daemon[3937]: couldn't initialize prompt: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.keyring.SystemPrompter exited with status 1
Aug 22 12:36:33 pi5 gnome-keyring-d[3937]: couldn't initialize prompt: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.keyring.SystemPrompter exited with status 1

Is this happening because i'm running a headless server / not having a Desktop installed?

notDavid commented 3 years ago

Apparently. A bit weird for a cli tool not to work on a headless server...

Please note that, at the present time, the new ProtonVPN CLI doesn’t support Split Tunneling and doesn’t run on headless servers.

https://protonvpn.com/support/linux-vpn-tool/

ghost commented 2 years ago

Unbelievable, a headless version is a MUST.

4censord commented 2 years ago

I have run into this as well, but on my laptop, that ist neither headless, nor a server.

numonedad commented 2 years ago

Please reopen, this isn't a cli tool until it works headless.

numonedad commented 2 years ago

Issue appears to be around how the keyring is storing data: https://keyring.readthedocs.io/en/latest/#using-keyring-on-headless-linux-systems

On headless, I see these options

keyring --list-backends
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.chainer.ChainerBackend (priority: 0)

On a linux with gui (even just SSH'd in), I get these

-> % keyring --list-backends
keyrings.cryptfile.file.EncryptedKeyring (priority: 0.6)
keyrings.cryptfile.cryptfile.CryptFileKeyring (priority: 2.5)
keyring.backends.fail.Keyring (priority: 0)
keyrings.cryptfile.file.PlaintextKeyring (priority: 0.5)
keyring.backends.chainer.ChainerBackend (priority: 10)
keyring.backends.SecretService.Keyring (priority: 5)
numonedad commented 2 years ago

I got further along by installing gnome-keyring which forces a UI prompt via X11. I still can not connect due to unknown error during server connect.

EricZimmerman commented 2 years ago

this program is terrible.

notDavid commented 2 years ago

fyi, there seems to be a new beta version here (i haven't tested it yet): https://protonvpn.com/support/early-access-linux-vpn/

via https://reddit.com/r/ProtonVPN/comments/q8my4j/grab_an_exclusive_seat_in_protonvpns_linux_beta/

joedborg commented 2 years ago

@notDavid I've just tried this too but it doesn't fix the issue.

If this is totally reliant on X11 libs, I think it's going to be a ground up remake to fix. I have to say, I'm pretty surprised that a headless use case wasn't considered with a CLI app; it seems to be to be the number 1 use case for this. Pretty disappointed considering we pay for it.

goodboy commented 2 years ago

Lol, seriously eh?

And I was just thinking, well if i try the tina approach it's gotta be easier then all the networkmanager rabbit holing 😂

In case anyone misses it, the workaround is to install gnome-keyring (i think).

UPDATE: ahh i guess to be fair it is mentioned here in step 4: https://protonvpn.com/support/official-linux-client-arch/

EricZimmerman commented 2 years ago

i cant believe this is still broken. totally useless garbage on a non GUI install

KybraNET commented 1 year ago

"The Proton VPN Linux CLI is intended for every Proton VPN service user"

This makes no sense at all. It's a CLI, which is not a CLI, because it needs a GUI?! More specific: uses the keyring of Gnome. What went wrong there on design/architecture level?!? They should write at least first in repo: "This is not a real CLI, you need Gnome". Currently, this is deliberate misdirection and I ask to explain this deliberate deception.

KybraNET commented 1 year ago

Have anyone a quickfix/work around?

4censord commented 1 year ago

@REficul-dRAw I use this one, and have basically given up on them actually doing anything to fix this. https://github.com/Rafficer/linux-cli-community

iEscapedVim commented 1 year ago

it's 2023 and I can confirm it's still broken, I am using swayWM/hyprland on arch and it's causing issues I even went ahead and installed gnome-keyring can't believe this is an official package... What's the point of cli version if it requires GUI??