Unlock GNOME Password
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gnome-keyring-unlock-1.0.tar.gz
.
File metadata
- Download URL: gnome-keyring-unlock-1.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9ddd39db3ab321ede5c2940c3e232c92dfa2cf4252c474370886fe826b575fc |
|
MD5 | d393ce7f20cb2a73da92b79183fa0128 |
|
BLAKE2b-256 | 1b4e370164d8c1328a1df7eb3da072f25305439e15f9eed12dd4d32643a939e5 |
File details
Details for the file gnome_keyring_unlock-1.0-py3-none-any.whl
.
File metadata
- Download URL: gnome_keyring_unlock-1.0-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a8e46d94f743d88c0c54fbeb16cbab394cecaca7d2a8b5a9ac1195e78185169 |
|
MD5 | 4bc197b1f9d82f6f5adb3cc16e7ac1cc |
|
BLAKE2b-256 | 42b5fb4e44e51b64855037ce620bbfadb19f9fc05057c914ca90c3dec95c57a9 |