naglfar / krunner-keepassxc

A small krunner plugin to copy keepassxc entries to clipboard using its Freedesktop.org Secret Service dbus integration.
MIT License
27 stars 3 forks source link

DBuss error #3

Closed fabianski7 closed 2 years ago

fabianski7 commented 3 years ago
  • [x] keepass has to be configured for secret service access (in both general and database settings)

KeePassXC 2.6.4 Python 3.9.1

 $  python krunner-keepassxc.pyz -l
ERROR:dbus.proxies:Introspect error on :1.152:/org/freedesktop/secrets/collection/passwords: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/collection/passwords'
[]

Does it look like it is accessing the wrong path? Should I rename the database to a specific name?

dotiful commented 3 years ago

I've got the same problem

rianorie commented 2 years ago

same for me. I used d-feet to browse the dbus endpoints but couldn't find one past org.freedesktop.secrets. I'm on Kubuntu 21.10, is it possible the dbus name changed?

naglfar commented 2 years ago

Hey, I know it's been a hot minute and I'm really sorry I didn't get around to reply until now. I just pushed a new release which I hope will fix this issue. Basically I don't know a whole lot about DBUS and how programs interact with it and just had my own machine to inspect the whole thing. On my machine (Manjaro KDE) I noticed how keepass is set at org.keepassxc.KeePassXC.MainWindow but also answering under org.freedesktop.secrets and I thought "hey, that seems more generic and future proof since it might also work with different password managers". Same with the path name (#5) which is definitely all lowercase on my end. Since these values seem to vary for different people I basically added code to try to find the correct ones on start.

If there's still problems for anyone it would be helpful if you could use a DBUS-Viewer (like qdbusviewer) and tell me how bus name or method path differ on your end.

rianorie commented 2 years ago

Sadly the update didn't fix it. I tried to capture screenshots of everything I could think of. If you need more, let me know!

image

image

image

image

lbiaggi commented 2 years ago

Sadly the update didn't fix it. I tried to capture screenshots of everything I could think of. If you need more, let me know!

image

image

image

image

I have the same structure!

rianorie commented 2 years ago

huh. I wonder why its not working then.. I'm assuming it works fine on your end?

How can I test the code after compilation? Its been a while but I should be sufficiently capable of getting it working, I just have no idea how to get the dev version in use. I can try to see if I can mess with it a bit and get it working.

lbiaggi commented 2 years ago

Hum, I think I found the problem, its related to database name, Password and password are the default names, I don't use it I use another one, checking the dbus interface I found my database name there, I think we need first need to find the avaiable collections through

image And later use it instead of the hardcoded path

from here

rianorie commented 2 years ago

fyi

image

Not sure if this actually refers to Database name, or the filename.

lbiaggi commented 2 years ago

Yes, I think it's related, if you check the collections in your end probably will have a keys folder there

like in my case, which I use dbp as filename/database name image

rianorie commented 2 years ago

what are you using to drill that far down in the bus structure? I grabbed qdbusviewer but it doesn't provide any more details than d-feet and neither show me the collection..

lbiaggi commented 2 years ago

I'm using qdbusviewer at session user bus: keepass bus or secret bus keepass image

secret image

rianorie commented 2 years ago

no joy, I don't see the aliases or collections namespace in my version..

This program uses Qt version 5.15.2.

Maybe my version is older than yours?

I tried using the cli as well, but it's the same. So potentially it's not related to the viewer(s).

$ qdbus --session org.freedesktop.secrets
/
/keepassxc
/org
/org/freedesktop
/org/freedesktop/secrets
/org/freedesktop/secrets/session
/org/freedesktop/secrets/session/13c4b3a555b144f292904cd19db610cd
/org/freedesktop/secrets/session/d6220fc8cf3a4153b0a0ad9fa0862f1f
lbiaggi commented 2 years ago

BTW, did you enable the Secret Service inside the base?

Tools > Settings [image: image.png]

Em seg., 29 de nov. de 2021 às 11:50, Rian Orie @.***> escreveu:

no joy, I don't see the aliases or collections namespace in my version..

This program uses Qt version 5.15.2.

Maybe my version is older than yours?

I tried using the cli as well, but it's the same. So potentially it's not related to the viewer(s).

$ qdbus --session org.freedesktop.secrets / /keepassxc /org /org/freedesktop /org/freedesktop/secrets /org/freedesktop/secrets/session /org/freedesktop/secrets/session/13c4b3a555b144f292904cd19db610cd /org/freedesktop/secrets/session/d6220fc8cf3a4153b0a0ad9fa0862f1f

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/naglfar/krunner-keepassxc/issues/3#issuecomment-981705385, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJGX4B3DVLV7E4BUDICG7DUOOHKDANCNFSM4XXNAEYQ .

-- Lucas

rianorie commented 2 years ago

image

yup

lbiaggi commented 2 years ago

I guess you need to define which folder you are going to expose to the service, only my exposed keys are available through the bus

Em seg., 29 de nov. de 2021 às 12:10, Rian Orie @.***> escreveu:

[image: image] https://user-images.githubusercontent.com/2292861/143892677-ba39ecba-8c06-4437-9f33-4ac2ed7e5c92.png

yup

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/naglfar/krunner-keepassxc/issues/3#issuecomment-981725195, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJGX4CY7F2TVGIPE6IKYZTUOOJV7ANCNFSM4XXNAEYQ .

-- Lucas

rianorie commented 2 years ago

I selected the top-level group, I kind of assumed that without specifying anything it would grab everything..

Now it keeps reporting the DBUS bus name not found thought.. I'm tempted to try and downgrade to 1.3 and see if it works..?

naglfar commented 2 years ago

Hum, I think I found the problem, its related to database name, Password and password are the default names, I don't use it I use another one, checking the dbus interface I found my database name there, I think we need first need to find the avaiable collections through

image And later use it instead of the hardcoded path

from here

Wow, now I feel incredibly stupid. I didn't even think these collections would be the database names, but after opening a second database I can see both showing up (still converted to lowercase though). I'll definitely have to change the code to detect the secret collections (and also search all of them).

Now, @rianorie 's problem still has me a bit confused though, since I put the error message 'DBUS bus name not found' at an earlier step which is supposed to just look for the '/org/freedesktop/secrets' path in either 'org.keepassxc.KeePassXC.MainWindow' or 'org.freedesktop.secrets', but according to the screenshots this path should be available

But for the case of the dbus-viewers not showing anything below /org/freedesktop/secrets: this definitely is the case if the keepass databases are locked or, more likely, not correctly configured. It's not enough to enable secret service in the generall KeepassXC Settings, you have to enable it in the database settings for each database as well. When you do that it basically forces you to select a folder to expose, which would then show up in the general settings (the screenshot)

rianorie commented 2 years ago

fyi, as of the update that I pulled in today, it works!

naglfar commented 2 years ago

That's great to hear, thanks for giving feedback!

I guess I'll close this for now.

fabianski7 commented 2 years ago

thanks for your work @naglfar