Sign in to sudo and polkit with a security key or fingerprint

Ports configure security-key and configure fingerprint from CoreDesktop's
9dc5eb1: touch a FIDO2 key or a finger instead of typing your password for
sudo and polkit, falling back to the password. Each shows only when the
hardware is there. The fingerprint skips to the password with the lid shut.

lib/pam.sh is CoreDesktop's, but also takes Ubuntu's "@include
common-auth" as the start of a stack's auth part, which is how sudo's and
polkit's begin. Only those two stacks change, not common-auth, which
pam-auth-update owns and every sign-in includes. libpam-fprintd's
pam-auth-update profile is off by default, so installing it changes no
sign-in by itself. The login and lock screens keep asking for the
password, unlike on GNOME.

Smoketest: 70-sign-in, on copies of Ubuntu's sudo and polkit stacks.
TEST.md: with a real key and reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 19:03:41 -07:00
co-authored by Claude Opus 5.5
parent 2952034654
commit 7185d6cb3e
8 changed files with 411 additions and 3 deletions
+7
View File
@@ -90,6 +90,10 @@ Each item installs what it needs the first time you set it up, after asking.
- An SFTP folder is mounted by sshfs as you, at login, with the SSH keys in your Bitwarden SSH agent or your keyring's, so the server has to accept one of them (it can't ask for a password).
- "Remove one" unmounts it and takes it back out.
- **Agent sandbox**, if WinBoat is set up: the sandbox hides WinBoat's settings (~/.winboat) from agents, since they include your Windows password. To let agents read them, run `configure sandbox` and switch it; switch it again to hide them.
- **Security key**, if one is plugged in: a FIDO2 key (YubiKey, Nitrokey, SoloKey, ...) to touch instead of typing your password for sudo and the password prompts of COSMIC's apps and settings (polkit). Without the key, they ask for your password as before. It installs `libpam-u2f`, `pamu2fcfg` and `fido2-tools`. Run it again to add a spare key, or to stop using keys.
- **Fingerprint**, if this computer has a fingerprint reader: the same, with your fingerprint. It installs `fprintd` and enrolls your right index finger, unless you've enrolled one already. With the laptop's lid shut, it goes straight to your password. The login and lock screens still ask for your password. Run it again to stop.
Both add a line at the top of `/etc/pam.d/sudo` and `/etc/pam.d/polkit-1` (a copy of `/usr/lib/pam.d/polkit-1`), not to `common-auth`, which every sign-in uses. `/etc/pam.d/sudo` is a file the `sudo-common` package owns, so if an update to it changes the file, apt keeps yours or asks. Security keys are in `/etc/u2f_mappings`, and the lid check is `/usr/local/lib/federated-connector/lid-closed`.
### When your Core password changes
@@ -161,6 +165,8 @@ Each file in `configure.d/` is one item. It sets `TITLE` and `DESCRIPTION` and d
- `sidebar.sh` and `cosmic-favorites`: the Files sidebar
- `json.sh`: editing JSON settings files
- `mdns.sh`: finding things on the network with Avahi
- `tailnet.sh`: finding the computers on the Core's Tailscale network
- `pam.sh`: adding sign-in methods to sudo and polkit
- `agents.sh`: the agents' real commands and srt
- `tools.sh`: Node.js and srt
@@ -178,4 +184,5 @@ Each file in `configure.d/` is one item. It sets `TITLE` and `DESCRIPTION` and d
- davfs2 mounts need Ubuntu's setuid `mount.davfs` and the `davfs2` group, where Arch uses the `network` group.
- Languages come from mise's apt repository, and nothing is installed with it up front. CoreDesktop's `update` upgrades them; here, run `mise upgrade`.
- The agents are installed by `configure agents`, and srt runs on its own Node.js. On Ubuntu, bubblewrap may need an AppArmor profile.
- A fingerprint works for sudo and polkit, but not the login and lock screens: COSMIC's greeter signs in through `common-auth`, which this leaves alone. CoreDesktop's works on GNOME's login and lock screens too.
- `update` updates only Federated Connector; Pop!_OS updates the rest.