Give a finger a meaning beyond "it was you"

The trustlet has always reported WHICH finger matched and the daemon only ever
used it to answer yes. A table in /etc/fingerprintd/actions.conf now gives each
finger a meaning: run a command as root, tell the user's session, or report
no-match while doing one of those anyway -- which is duress, where the phone
should look like it simply did not recognise the finger.

Two rules shaped the design.

Root does not launch applications. The daemon has no session bus, no display
and no user environment, so a `session` rule carries no command at all: the
daemon emits net.catcrafts.Fingerprintd1.FingerMatched(finger, uid) and an
agent in the user's own session decides what that means from the user's own
configuration. The only commands in the file are ones root is meant to run.

Which makes the file a root shell, and the parser treats it as one. It is
refused outright unless root owns it and nobody else can write it, group
included. A malformed line rejects the WHOLE file rather than being skipped:
applying the prefix would leave a policy nobody wrote, and the missing half
could be the one that mattered. That property is tested, and the test caught it
being false the first time -- rules accumulated before the bad line survived
the rejection.

A system command must be an absolute path, because resolving a bare name
through PATH makes what root runs depend on an environment this daemon does not
control. It is double-forked with a scrubbed environment so an action may
outlive the daemon (a reboot) without ever stalling the worker thread that is
the only thread allowed to touch the trustlet.

Ordering is deliberate: the verdict override happens before the client is told,
because that is the point of duress; the session signal and the root command
happen after, on the same principle that keeps the harvest and the save off the
unlock path.

No actions.conf ships. An example goes to /usr/share/doc, because shipping a
root shell nobody asked for is not a default.

Not yet exercised on hardware.
This commit is contained in:
Jorijn van der Graaf 2026-09-05 05:12:41 +02:00
commit 928fe1482e
10 changed files with 582 additions and 6 deletions

View file

@ -0,0 +1,61 @@
# fingerprintd — per-finger actions.
#
# Install as /etc/fingerprintd/actions.conf. With no such file, a finger does
# exactly what it always did: it unlocks, and nothing else happens.
#
# THIS FILE IS A ROOT SHELL. Every `system` line is a command root runs when
# that finger touches the sensor, so anything able to write this file owns the
# machine at the next press. fingerprintd refuses the whole file — not just the
# offending line — unless root owns it and no one else can write it:
#
# sudo install -Dm644 -o root -g root actions.conf.example \
# /etc/fingerprintd/actions.conf
#
# It is read once, at startup. Editing it means restarting the unit, which is
# also when you get to see the parse errors.
#
# Format, four fields:
#
# <finger> <where> <verdict> <command...>
#
# finger an fprintd finger name: left-thumb, left-index-finger,
# left-middle-finger, left-ring-finger, left-little-finger, and
# the right-* equivalents.
#
# where system root runs the command below.
# session no command here. The daemon emits
# net.catcrafts.Fingerprintd1.FingerMatched(finger, uid)
# and an agent in your session decides what it means.
# This is how you launch an application: root has no
# session bus and no display, and running your software
# as root to get one would be a poor trade.
#
# verdict match the client is told the finger matched. Normal.
# no-match the client is told it did NOT, whatever really
# happened, while the action runs anyway.
#
# command an ABSOLUTE path, required for system, forbidden for session.
# It is passed to /bin/sh -c with a fixed environment plus
# FINGERPRINTD_FINGER. It is double-forked, so it may outlive the
# daemon and will never delay an unlock.
#
# A finger with no line here is untouched.
# --- Launching things in your session -----------------------------------
# The daemon only announces the finger; your agent maps it to an app.
#right-ring-finger session match
# --- A duress finger ------------------------------------------------------
# The phone reports that it did not recognise this finger, and runs the
# script anyway. Think carefully before making that script destructive:
#
# * a false accept that opens a camera is a shrug; one that wipes is not,
# * and anyone who can compel one unlock can usually compel a second, so
# this is a panic button, not protection for data at rest. Only
# encryption is that, and by unlock time your session is already
# decrypted in RAM.
#
#left-little-finger system no-match /etc/fingerprintd/panic.sh
# --- Something harmless to try it with ------------------------------------
#left-thumb system match /usr/bin/logger -t fingerprintd "thumb"