Bug 504312 - plasma-nm is now unable to read passwords from KeepassXC-based secret service backend
Summary: plasma-nm is now unable to read passwords from KeepassXC-based secret service...
Status: REPORTED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Networking in general (other bugs)
Version First Reported In: 6.3.5
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-16 07:39 UTC by Andreas Schneider
Modified: 2025-08-12 18:27 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
DBus traces of entering WiFi password (password removed from traces) (17.86 KB, text/x-log)
2025-05-19 08:51 UTC, turtoise
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schneider 2025-05-16 07:39:40 UTC
SUMMARY
I've updated to Plasma 3.6.5 and migrated KWallet to KeepassXC Secret Storage implementation. Since then plasma-nm is unable to read the password for my wifi network. I need to change it to always ask for a password to get it working again.

STEPS TO REPRODUCE
1. Setup KeepassXC with Secret Storage backend
2. Migrate Kwallet to secret storage, see https://notmart.org/blog/2025/04/towards-a-transition-from-kwallet-to-secret-service/
3. Try to connect to a wifi with stored password

OBSERVED RESULT
plasma-nm times out trying to get the password from kwallet

EXPECTED RESULT
plasma-nm getting the password from secret stroage and connecting to the network.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 42
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.14
Qt Version: 6.9.0
Comment 1 michaelk83 2025-05-16 13:34:15 UTC
AFAIK, plasma-nm doesn't have code to use Secret Service directly. It's one of the KDE apps that need to be migrated to QtKeyChain (which can use both Secret Service and old KWallet APIs).

Until that's implemented, the other part here is to make sure that the kwalletd proxy is working correctly (it may not be).
Comment 2 michaelk83 2025-05-18 13:03:22 UTC
Now that we have a few more users here, it would be good to get some DBus traces, so we can check if kwalletd is at fault. The relevant interfaces are org.kde.kwalletd6 , org.kde.KWallet , org.freedesktop.secrets , and org.kde.secretservicecompat . Or you could filter by path: /modules/kwalletd6 , /org/freedesktop/secrets , and /ksecretd .

It would also be good to see your kwalletrc, to check that everything is configured correctly (or to see how different configurations affect the behavior).
Comment 3 Marco Martin 2025-05-19 08:01:40 UTC
One ting i noted while using keepassXC is that every entry in the wallet is separatedly locked, but what should happen in that case is keepassxc popping up with some gui to unlock when networkmanager tries to access the network
Comment 4 turtoise 2025-05-19 08:49:38 UTC
(In reply to michaelk83 from comment #2)
> Now that we have a few more users here, it would be good to get some DBus
> traces, so we can check if kwalletd is at fault. The relevant interfaces are
> org.kde.kwalletd6 , org.kde.KWallet , org.freedesktop.secrets , and
> org.kde.secretservicecompat . Or you could filter by path:
> /modules/kwalletd6 , /org/freedesktop/secrets , and /ksecretd .
> 
> It would also be good to see your kwalletrc, to check that everything is
> configured correctly (or to see how different configurations affect the
> behavior).

For me, this is the kwalletrc:

[KSecretD]
Enabled=false

[Migration]
MigrateTo3rdParty=true
WalletsMigratedToSecretService=kdewallet

[Wallet]
Close When Idle=false
Close on Screensaver=false
Default Wallet=Passwörter
Enabled=true
First Use=false
Idle Timeout=10
Launch Manager=false
Leave Manager Open=false
Leave Open=true
Prompt on Open=false
Use One Wallet=true

[org.freedesktop.secrets]
apiEnabled=true

And i'll add the DBus Traces as attachment.
Comment 5 turtoise 2025-05-19 08:51:21 UTC
Created attachment 181492 [details]
DBus traces of entering WiFi password (password removed from traces)
Comment 6 michaelk83 2025-05-19 09:55:40 UTC
(In reply to Marco Martin from comment #3)
> One ting i noted while using keepassXC is that every entry in the wallet is
> separatedly locked, but what should happen in that case is keepassxc popping
> up with some gui to unlock when networkmanager tries to access the network

That's a good point, but one of the problems with that is that not all the relevant API methods support the Prompt interface. However, KeepPassXC may still try to show an unlock prompt to avoid some other problems. In that case, the call can still time out.
See https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/101 and https://github.com/keepassxreboot/keepassxc/issues/4443

To avoid that, clients should never use `Collection.SearchItems()` with KeePassXC (`Service.SearchItems()` at least has a `locked` output array), and, if possible, should issue an explicit `Unlock()` call before trying any other operations.
Comment 7 michaelk83 2025-05-19 10:50:26 UTC
(In reply to turtoise from comment #5)
> Created attachment 181492 [details]
> DBus traces of entering WiFi password (password removed from traces)

Thanks!

What I see from this trace, is:
A. The network manager is talking to the old KWallet API (and not directly to Secret Service), as expected currently.
B. More `folderUpdated` signals than I'd expect to see, for a bunch of unrelated folders. Might indicate some issue or weird behavior, but probably not related to this bug.
C. There are a few attempts to save a password (writeMap), and what looks like one attempt to read it back (readMap), but without the `method return` bits, its hard to tell if any of these are successful or not.

I don't see any communication between KWallet and KeePassXC's Secret Service. That's probably due to the trace filter.

What I would like to see is the part where plasma-nm is trying (and failing) to read the stored password, including the communication between KWallet and KeePassXC, and with the method return values as well.
Comment 8 Marco Martin 2025-05-19 11:03:18 UTC
Trying to reproduce i didn't manage to reproduce the problem

in KeepassXC i do get an entry for each wifi network, in the form "Network Management/{UUID such as 07ea43b2-......}/802-11-wireless-security"  each of them contains a value of type {"psk": "pass..."}

NetworkManager seems to be able to access those entries just fine and seems to just work.

Is by change all normal preshared keys or is more complicated wifi authentication methods?
Comment 9 Marco Martin 2025-05-19 11:06:31 UTC
(In reply to michaelk83 from comment #6)
> (In reply to Marco Martin from comment #3)
> > One ting i noted while using keepassXC is that every entry in the wallet is
> > separatedly locked, but what should happen in that case is keepassxc popping
> > up with some gui to unlock when networkmanager tries to access the network
> 
> That's a good point, but one of the problems with that is that not all the
> relevant API methods support the Prompt interface. However, KeepPassXC may
> still try to show an unlock prompt to avoid some other problems. In that
> case, the call can still time out.
> See https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/101 and
> https://github.com/keepassxreboot/keepassxc/issues/4443
> 
> To avoid that, clients should never use `Collection.SearchItems()` with
> KeePassXC (`Service.SearchItems()` at least has a `locked` output array),
> and, if possible, should issue an explicit `Unlock()` call before trying any
> other operations.

searching is fine, it will get the names and the metadata of the locked value just fine, it will just need an explicit unlock when trying to actually retrieve the secret, which we do. when this happens, i see that for me keepassxc pops up with an authorization dialog
Comment 10 turtoise 2025-05-19 13:47:47 UTC
(In reply to Marco Martin from comment #8)
> Trying to reproduce i didn't manage to reproduce the problem
> 
> in KeepassXC i do get an entry for each wifi network, in the form "Network
> Management/{UUID such as 07ea43b2-......}/802-11-wireless-security"  each of
> them contains a value of type {"psk": "pass..."}
> 
> NetworkManager seems to be able to access those entries just fine and seems
> to just work.

Actually, for me it's the same behaviour, KeePassXC is updating the Network Management Key correctly. But my system does not seem to ask KeePassXC for the keys so for me it may be a configuration problem only.
Comment 11 Marco Martin 2025-05-20 09:58:22 UTC
(In reply to turtoise from comment #10)
> Actually, for me it's the same behaviour, KeePassXC is updating the Network
> Management Key correctly. But my system does not seem to ask KeePassXC for
> the keys so for me it may be a configuration problem only.

if you go in the kwallet systemsettings page, is the "default wallet" set to the one where the password is actually saved?
Comment 12 Andreas Schneider 2025-07-27 18:17:09 UTC
(In reply to michaelk83 from comment #2)
> Now that we have a few more users here, it would be good to get some DBus
> traces, so we can check if kwalletd is at fault. The relevant interfaces are
> org.kde.kwalletd6 , org.kde.KWallet , org.freedesktop.secrets , and
> org.kde.secretservicecompat . Or you could filter by path:
> /modules/kwalletd6 , /org/freedesktop/secrets , and /ksecretd .
> 
> It would also be good to see your kwalletrc, to check that everything is
> configured correctly (or to see how different configurations affect the
> behavior).

I'm also running into issues on my notebook with Fedora 42. How exactly do I trace dbus?
Comment 13 Andreas Schneider 2025-08-12 18:27:06 UTC
I can open kwallet, and if I open a password in kwallet, keepassxc asks me if kwallet is allowed to read the password. Also my mailtransport passwords are there and work just fine.

However with plasma-nm I'm not able to store a password. I also don't get any popups anymore.

This is really strange. However I don't really know how to debug it and help would be very welcome.