Document keyring unlock: the login PAM stack must pass the password to the secret service (oo7 or gnome-keyring)
CI / test (push) Failing after 30s
CI / test (push) Failing after 30s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
326dd06f30
commit
0ce0de0356
2 files changed
+34
-4
No files matched your search
@@ -0,0 +1,29 @@
|
|||||||
|
# Keyring unlock
|
||||||
|
|
||||||
|
Apps reach the system keychain through `org.freedesktop.secrets` on the session bus.
|
||||||
|
`chandra-session` uses the per-user systemd bus so it finds the secret service that is already
|
||||||
|
running there (gnome-keyring or oo7-daemon). It does not unlock anything itself: the login
|
||||||
|
password is only available while you log in, so unlocking is the login manager's PAM stack's job.
|
||||||
|
|
||||||
|
If the keychain stays locked (apps ask for the password, or `keepsecret` shows it locked), the
|
||||||
|
stack your login manager uses does not hand the password to your secret service. Check which
|
||||||
|
stack that is: `loginctl show-session <id> -p Service` (for example `plasmalogin`), and look in
|
||||||
|
`/etc/pam.d/<service>` and `/usr/lib/pam.d/<service>`.
|
||||||
|
|
||||||
|
For oo7 (`oo7-daemon`, module `pam_oo7.so`) add, next to the existing keyring lines:
|
||||||
|
|
||||||
|
```
|
||||||
|
-auth optional pam_oo7.so
|
||||||
|
-password optional pam_oo7.so
|
||||||
|
-session optional pam_oo7.so auto_start
|
||||||
|
```
|
||||||
|
|
||||||
|
For gnome-keyring the equivalents are `pam_gnome_keyring.so` (`use_authtok` on the password line,
|
||||||
|
`auto_start` on the session line). Put overrides in `/etc/pam.d`, not `/usr/lib/pam.d`, so package
|
||||||
|
updates don't replace them. Log in again afterwards; the unlock only happens at login.
|
||||||
|
|
||||||
|
Check with: `busctl --user get-property org.freedesktop.secrets
|
||||||
|
/org/freedesktop/secrets/aliases/default org.freedesktop.Secret.Collection Locked` (`b false`).
|
||||||
|
|
||||||
|
Limits: the keyring's password must match the login password, and autologin (no password typed)
|
||||||
|
can't unlock it.
|
||||||
@@ -53,8 +53,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Session bus. Use the per-user bus (systemd's $XDG_RUNTIME_DIR/bus) when there is one: that is
|
# Session bus. Use the per-user bus (systemd's $XDG_RUNTIME_DIR/bus) when there is one: that is
|
||||||
# where pam_gnome_keyring's daemon, unlocked with the login password, registers
|
# where the secret service (gnome-keyring or oo7-daemon), unlocked with the login password by
|
||||||
# org.freedesktop.secrets. A fresh dbus-run-session bus would hide it, and apps would then
|
# its PAM module, registers org.freedesktop.secrets. A fresh dbus-run-session bus would hide it, and apps would then
|
||||||
# activate a second, locked keyring daemon there (unlock prompts, "default keyring" dialogs).
|
# activate a second, locked keyring daemon there (unlock prompts, "default keyring" dialogs).
|
||||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -S "${XDG_RUNTIME_DIR:-/nonexistent}/bus" ]; then
|
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -S "${XDG_RUNTIME_DIR:-/nonexistent}/bus" ]; then
|
||||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
||||||
@@ -87,8 +87,9 @@ if command -v systemctl >/dev/null 2>&1; then
|
|||||||
systemctl --user try-restart xdg-desktop-portal.service >>"$log" 2>&1 || true
|
systemctl --user try-restart xdg-desktop-portal.service >>"$log" 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Hand the PAM-started keyring daemon (already unlocked by the login password) its session
|
# Hand the PAM-started gnome-keyring daemon (already unlocked by the login password) its session
|
||||||
# components, so it owns org.freedesktop.secrets on our bus. Harmless if it isn't installed,
|
# components, so it owns org.freedesktop.secrets on our bus. (oo7-daemon needs none of this: it
|
||||||
|
# is started by systemd and unlocked over its PAM socket; see docs/keyring.md.) Harmless if it isn't installed,
|
||||||
# already running under systemd's socket units, or not unlocked by PAM (it then prompts once).
|
# already running under systemd's socket units, or not unlocked by PAM (it then prompts once).
|
||||||
if command -v gnome-keyring-daemon >/dev/null 2>&1; then
|
if command -v gnome-keyring-daemon >/dev/null 2>&1; then
|
||||||
eval "$(gnome-keyring-daemon --start --components=secrets 2>>"$log")"
|
eval "$(gnome-keyring-daemon --start --components=secrets 2>>"$log")"
|
||||||
|
|||||||
Reference in new issue
Block a user