gnome-keyring-yubikey-unlock icon indicating copy to clipboard operation
gnome-keyring-yubikey-unlock copied to clipboard

feat: libsecret instead of libgnome-keyring-1

Open snowyu opened this issue 4 years ago • 6 comments

a little hint: https://askubuntu.com/questions/470384/is-it-possible-to-use-secret-tool-to-lookup-existing-seahorse-passwords

snowyu avatar Jan 31 '21 06:01 snowyu

thanks a lot for your info! I'll look into it.

Jan 31, 2021 14:20:42 Riceball LEE [email protected]:

a little hint: https://askubuntu.com/questions/470384/is-it-possible-to-use-secret-tool-to-lookup-existing-seahorse-passwords

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub[https://github.com/recolic/gnome-keyring-yubikey-unlock/issues/2], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AEVTVEDUMFN2NEXT2JDXY53S4TZCHANCNFSM4W3BKYYQ]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAAySURBVHic7cEBDQAAAMKg909tDjegAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeDVulAABbzDScQAAAABJRU5ErkJggg==###24x24:true###][Tracking image][https://github.com/notifications/beacon/AEVTVECMAPAO563GBEDPNHTS4TZCHA5CNFSM4W3BKYY2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4L4K5LFA.gif]

recolic avatar Jan 31 '21 07:01 recolic

Hi. I read the libsecret usage again (the third time), but I still don't know how to use it instead of libgnome-keyring. Here's the problem:

I'm sure that I need to use secret_service_unlock_sync(), but it seems that there's no way to pass a password into this function. It only accepts password from user input. The function signature is here, and I have did some test on libsecret here.

// This one is easy to use
GnomeKeyringResult  gnome_keyring_unlock_sync (const char *keyring, const char *password);

// This is libsecret version. It have to read password from an interactive window. 
gint
secret_service_unlock_sync (SecretService *service,
                            GList *objects,
                            GCancellable *cancellable,
                            GList **unlocked,
                            GError **error);

recolic avatar Jul 10 '21 14:07 recolic

https://stackoverflow.com/questions/69581225/gnome-keyring-unlock-sync-equivalent-in-libsecret-to-unlock-a-gnome-keyring

recolic avatar Dec 13 '21 10:12 recolic

It should be easy:

secret_service_unlock_sync says The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.

secret_service_prompt indicates that is possible to override it: Override the SecretServiceClass prompt_async virtual method to change the behavior of the propmting.

janbrummer avatar Feb 08 '22 06:02 janbrummer

After some research, I don't think it's even possible to do that with libsecret.

libsecret will call method org.freedesktop.Secret.Prompt via DBus, and the password text does not goes to libsecret at all. After a successful prompt, it will call another method to actually unlock these keyrings. There is no existing interface to do that automatically.

This is a test to prove my idea: (Using this branch)

  1. Run libsecret version of unlock_keyring program.
  2. Now the prompt appears.
  3. Kill the unlock_keyring program from another SSH session.
  4. type my password into the prompt, and ENTER.
  5. Unlock the keyring in seahorse. It does not require a password anymore.

Step 5 means that, the password did not go through our program. The password was passed to libsecret through another channel (so it's impossible to modify this behavior from our program)

If you have any idea, please let me know.

If libgnome-keyring is deprecating, I think we must send raw DBus message by hand.

recolic avatar Jul 18 '22 04:07 recolic

Maybe gnome-keyring-daemon --replace --unlock is a possible solution, but it doesn't work in my test.

https://unix.stackexchange.com/questions/602313/unlock-gnome-keyring-daemon-from-command-line

Let me know if anyone could make progress on this problem.

recolic avatar May 18 '24 01:05 recolic