ProtonVPN / linux-app

Official ProtonVPN Linux app
https://protonvpn.com/download-linux
GNU General Public License v3.0
409 stars 64 forks source link

Help configuring ProtonVPN to use KWallet #82

Open gustavo-hms opened 2 years ago

gustavo-hms commented 2 years ago

Please complete the following checklist (by adding [x]):


Hi!

I have a non-orthodox setup, so I totally understand you don't have to offer support to my case. But maybe my question can be easily answered by some of you, in which case I would be very thankful.

I'm on a system other than Plasma and Gnome (it's one of those Wayland compositors) and want to make ProtonVPN use KWallet to store its secrets, for three reasons:

When I'm logged in the Plasma desktop, everything works as expected. However, when I'm on the Wayland compositor, it shows a message that it couldn't find any agent.

So, I'm trying to make it use KWallet.

So far, I've managed to configure keyring to use KWallet, by creating a keyringrc.cfg file in ~/.config/python_keyring with the following content:

[backend]
default-keyring=keyring.backends.kwallet.DBusKeyring

I can confirm keyring does use KWallet by following these steps:

Now, even though keyring is using KWallet, ProtonVPN doesn't, something that can be confirmed by this line in protonvpn.log:

Using "<class 'protonvpn_nm_lib.core.keyring.linuxkeyring.KeyringBackendLinuxSecretService'>" keyring

when I'm logged in my Wayland compositor's session, contrasting to

Using "<class 'protonvpn_nm_lib.core.keyring.linuxkeyring.KeyringBackendLinuxKwallet'>" keyring

when I'm logged in the Plasma session.

I also tried setting the PYTHON_KEYRING_BACKEND environnment variable without luck.

Is there a way to make ProtonVPN respect the keyring lib configuration?

Thanks in advance!

larsgw commented 1 year ago

Looking through the source code of the underlying library protonvpn-nm-lib, the backend is chosen based on priorities. The priority of KeyringBackendLinuxSecretService is always 5. The priority of KeyringBackendLinuxKwallet is based on whether the environment variable XDG_CURRENT_DESKTOP is KDE: if so the priority is 5.1, if not 4.9.

In short, to get ProtonVPN to use KeyringBackendLinuxSecretService, I set XDG_CURRENT_DESKTOP to KDE5 (for protonvpn only). This seems to work so far, and there are no other mentions of XDG_CURRENT_DESKTOP in any ProtonVPN repositories (though that may change, and dependencies may still use it).