Skip to main content

gnome-keyring-unlock

Script to unlock gnome keyring using password from stdin. This can be used for example to unlock gnome-keyring when using fingerprint to login.

Installation

pip install gnome-keyring-unlock

Usage

Read password and unlock

read password
unlock-gnome-keyring <<<$password

Decrypt password using tpm chip

First you need to set up the encrypted password file. You will need to install clevis. I'm using doas, but you can replace with sudo.

The required configurion for doas is (replace USERNAME with your user):

permit nopass USERNAME as tss cmd /usr/bin/clevis-encrypt-tpm2
permit nopass USERNAME as tss cmd /usr/bin/clevis-decrypt-tpm2

To setup the encrypted password file, run:

read password
doas -u tss /usr/bin/clevis-encrypt-tpm2 '{"pcr_ids":"7"}' <<<$password > ~/.config/gnome-keyring.tpm2

Then to unlock you can run:

doas -u tss /usr/bin/clevis-decrypt-tpm2 < .config/gnome-keyring.tpm2 | unlock-gnome-keyring 

Setting up automatic unlock during login

If you are using fingerprint and/or fido2 to log in instead of password, gnome keyring will not be unlocked. Copy unlock.py to ~/bin and put the following in ~/.bash_profile if using bash or ~/.zprofile if using zsh:

if [ -f ~/.config/gnome-keyring.tpm2 ]
then
    if ! [ -S /run/user/$UID/keyring/control ]
    then
      gnome-keyring-daemon --start --components=secrets
    fi
    doas -u tss /usr/bin/clevis-decrypt-tpm2 < .config/gnome-keyring.tpm2 | ~/bin/unlock.py
fi

Use as library

To use as library:

with open('.pw') as f:
    pw = f.readline().strip('\n')
    unlock_keyring(password=pw)

Calling unlock_keyring() with no argument will read password from stdin.

Metadata

Release files for gnome-keyring-unlock 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gnome-keyring-unlock 1.0
File Size Uploaded Provenance Actions
gnome-keyring-unlock-1.0.tar.gz 15.7 kB Without provenance Details for gnome-keyring-unlock-1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gnome-keyring-unlock 1.0
File Interpreter ABI Platform Actions
gnome_keyring_unlock-1.0-py3-none-any.whl Python 3 none any Details for gnome_keyring_unlock-1.0-py3-none-any.whl

Total release size: 32.0 kB

Release files / gnome-keyring-unlock-1.0.tar.gz

Download URL gnome-keyring-unlock-1.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d9ddd39db3ab321ede5c2940c3e232c92dfa2cf4252c474370886fe826b575fc
BLAKE2b-256 checksum
How to use checksums
1b4e370164d8c1328a1df7eb3da072f25305439e15f9eed12dd4d32643a939e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.8.10

Release files / gnome_keyring_unlock-1.0-py3-none-any.whl

Download URL gnome_keyring_unlock-1.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a8e46d94f743d88c0c54fbeb16cbab394cecaca7d2a8b5a9ac1195e78185169
BLAKE2b-256 checksum
How to use checksums
42b5fb4e44e51b64855037ce620bbfadb19f9fc05057c914ca90c3dec95c57a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.8.10

Security for gnome-keyring-unlock 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page