Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collection.unlock() and collection.is_locked() both return True #32

Open
mandarm opened this issue Sep 28, 2021 · 4 comments
Open

collection.unlock() and collection.is_locked() both return True #32

mandarm opened this issue Sep 28, 2021 · 4 comments

Comments

@mandarm
Copy link

mandarm commented Sep 28, 2021

I tried the following; collection.unlock() and collection.is_locked() both return True. I must be doing something wrong, but don't know enough about secretstorage to identify what my error is. Please help!

    $ python3
    Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
    [GCC 9.4.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import secretstorage
    >>> collection = secretstorage.get_default_collection(secretstorage.dbus_init())
    >>> collection.is_locked()
    True
    >>> collection.unlock()
    True
    >>> collection.is_locked()
    True
    >>> 

pip list says SecretStorage 3.3.1

@mitya57
Copy link
Owner

mitya57 commented Sep 28, 2021

The unlock method has a counter-intuitive interface:
https://secretstorage.readthedocs.io/en/latest/collection.html#secretstorage.collection.Collection.unlock

Returns a boolean representing whether the prompt has been dismissed; that means False on successful unlocking and True if it has been dismissed.

We inherited it from the Secret Service specification. I hate it too, but now it's too late to change it.

@mandarm
Copy link
Author

mandarm commented Sep 29, 2021

Thanks! Is my understanding that collection.unlock() should interactively prompt for a password correct? It doesn't for me, so I'm probably doing something else that's wrong.

@mitya57
Copy link
Owner

mitya57 commented Sep 29, 2021

Is my understanding that collection.unlock() should interactively prompt for a password correct?

Yes, it should prompt for a password. Are you using gnome-keyring? If yes, is it GNOME Shell, some other desktop environment or a headless system?

@mandarm
Copy link
Author

mandarm commented Sep 30, 2021

Sorry for taking your time. I'll have physical access to the machine tomorrow, and I'm hoping things will just work if I login to the desktop environment (Lubuntu 20.04 / LXQT by default, but will switch to plain fvwm shortly). For now, I'm logged in via ssh and ran the following

gnome-keyring-daemon --start
export SSH_AUTH_SOCK=/run/user/1001/keyring/ssh

before updating SecretStorage and running the code in my first post. collection.unlock() just returns True for me; no prompt, no exception.

One other possibility -- just a random thought -- is that the secrets / collection is stored in an older incompatible format. I'm trying to revive this machine by installing a light distribution, but the home directories have been around and unused for some years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants