Keeps passwords and login credentials for programs such as Chrome, Chromium, VS Code, Slack and GitHub Desktop.
It implements the freedesktop Secret Service specification (org.freedesktop.secrets), so programs using libsecret work without changes;
it replaces gnome-keyring and needs no GNOME/GTK components.
Security design
- File:
~/.local/share/pomelo/keyring/login.keyring, permissions 0600. - Key: derived from the keyring password with PBKDF2-HMAC-SHA256 (300,000 iterations); the contents are encrypted with AES-256-GCM.
- Everything is encrypted, including each item's label and attributes (such as website URLs and account names). gnome-keyring only encrypts the passwords themselves; labels and attributes are in plain text, so anyone who gets the file can see which websites you have accounts on.
- A wrong password and a tampered file both make GCM verification fail, and both are reported as "incorrect password".
- The service only listens on the local session bus and only accepts connections from the same user; keys and passwords are kept in memory that can't be swapped to disk (mlock) and wiped after use; the program forbids core dumps.
- When a client asks for encrypted transport (libsecret's default), it uses the spec's DH (RFC 2409 group 2) + AES-128-CBC, and the peer's public key is range-checked.
Auto-unlock at login
login screen ─PAM─▶ pam_pomelo_keyring.so (auth: keeps the password; session: starts pomelo-keyring --stash as the user)
│ the password waits in memory for up to 15 minutes
pomelo-session ─▶ pomelo-keyring --daemon ◀───┘ fetches it from the stash process (same uid only) and unlocks
- PAM settings are added to common-auth/common-session by
pam-auth-update, so they apply to LightDM, GDM and text logins. - Starting the desktop with
startx(bypassing PAM): an unlock dialog appears the first time the keyring is needed. - After changing the login password with
passwd: the next automatic unlock fails, so the old password is asked once on first use; after unlocking, it's re-encrypted with the new login password automatically. - When locked: if it was unlocked after this login, programs can still find items while it's locked (labels and attributes stay in memory), and libsecret asks to unlock by itself, showing the dialog; if the service has never been unlocked since it started, a search shows the unlock dialog first, and canceling returns "none".
File format (version 1)
| Offset | Content |
|---|---|
| 0 | PMKR |
| 4 | Version 1 + 3 reserved bytes |
| 8 | PBKDF2 iterations (u32 little-endian) |
| 12 | Salt, 16 bytes |
| 28 | GCM IV, 12 bytes |
| 40 | GCM tag, 16 bytes |
| 56 | Ciphertext length (u32 little-endian) |
| 60 | Ciphertext: the item list (id, time, label, content type, attributes, password, each length-prefixed) |
The first 40 bytes are GCM's additional authenticated data.
Not done yet
- No SSH agent (gnome-keyring has one); use ssh-agent if needed.
- Only one keyring, "Login"; requests to create other collections get "not supported".
- No automatic lock when idle; you can "Lock now" manually in the settings.
What's been tested
secret-tool(libsecret) and python secretstorage (over the DH-encrypted connection): create, read, search, rename, change attributes, change password, delete.- The keyring creation dialog, the unlock dialog when locked (including wrong-password retries and canceling), and Chrome-style explicit unlocking.
- PAM: one authentication + session opening through PAM in a container; the password reached the stash process, and only the same user could get it.
- File format: all 300 random tampering/truncation attempts were blocked; DH public keys of 0, 1 and overlong values were rejected; the memory-error-detection build reported no errors.
- Not yet tested with real Chrome/VS Code (this host can't open a browser); please confirm on real hardware.