The audit's third tier: everything between this installer and a fresh machine it has never met. The one path that could cost a person their display: the interview probes Secure Boot with mokutil, which install-packages had not installed yet, so on a minimal base the MOK question silently never fired -- and install-hardware still installed akmod-nvidia and blacklisted nouveau, arming a reboot into an unloadable driver with its fallback disabled. The probe tools (pciutils, mokutil, fwupd) now bootstrap beside gum, and install-hardware re-checks Secure Boot for itself and refuses the driver rather than the display. Secrets leave the checkout: the personal environment moves to ~/.config/panama/env at mode 600 by migration, and .bashrc sources it with a permission check that quietly re-tightens drift. change-settings no longer overwrites /etc/dnf/dnf.conf -- two performance keys are set additively, the defaultyes=True that made every `dnf remove` treat Enter as yes is gone, and a migration strips it from machines that already received it. Package installation survives the world changing: the initial and desktop lists run with --skip-unavailable and a report_missing pass that names what was skipped (resolved through --whatprovides, so capability names like awk do not cry wolf); the openh264, appstream and core-group extras go through soft; RustDesk resolves its RPM for the machine's own architecture; and the Claude Desktop repository script is fetched to a kept file and run, never piped from the network into root. The hardware predicates stop guessing: a wireless mouse's scope=Device battery no longer turns a tower into a laptop, USB-PD-only machines read their power state from the battery's own status instead of being permanently "on AC", the lid falls back to logind's LidClosed where ACPI is silent, and charge limits reach every pack of a two-battery machine in one authorization -- with the reported percentage summed across packs. And the parsers stop assuming this machine: snapper is read through --machine-readable csv with named columns instead of a localized box-drawing table, and reports whether snapshots are even possible so ext4 and unconfigured-btrfs stop looking identical; fprintd is parsed under LC_ALL=C; the hypridle drop-in resolves the binary it points at; the recorder's render node became an "auto" token resolved at record time; update-grub writes the config its firmware actually boots; the nvm prompt hook and the SSH tmux takeover are guarded; hipblas and rocm-opencl move to an opt-in gpu-compute category; and the two interactive python tools' libraries are declared. Claude-Session: https://claude.ai/code/session_01Epx9ZC1gwm81K3jm9x9CKh
90 lines
3.6 KiB
Bash
Executable File
90 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Fingerprint state and the one privileged switch, for the Users page.
|
|
#
|
|
# Two independent facts make a working fingerprint login, and conflating them
|
|
# is how the feature usually confuses people: fprintd must hold at least one
|
|
# enrolled print (GNOME's Users panel owns that dialog, and Panama hands off
|
|
# to it), and PAM must be told to ask the reader at all, which on Fedora is
|
|
# authselect's `with-fingerprint` feature. This helper reports both and can
|
|
# flip the second.
|
|
#
|
|
# Usage:
|
|
# panama-fingerprint status -> {"reader":bool,"readerName":"","enrolled":[],"pamEnabled":bool,"error":""}
|
|
# panama-fingerprint set-unlock on|off (prompts through panama-sudo/polkit)
|
|
#
|
|
# authselect is baseline Fedora (it manages PAM for the whole install), and
|
|
# fprintd ships with Workstation; a machine with neither simply reports no
|
|
# reader, which hides the card.
|
|
|
|
set -uo pipefail
|
|
|
|
PANAMA_PATH="${PANAMA_PATH:-$HOME/.local/share/Panama}"
|
|
|
|
emit() {
|
|
jq -cn \
|
|
--argjson reader "$1" \
|
|
--arg readerName "$2" \
|
|
--argjson enrolled "$3" \
|
|
--argjson pamEnabled "$4" \
|
|
--arg error "$5" \
|
|
'{reader: $reader, readerName: $readerName, enrolled: $enrolled,
|
|
pamEnabled: $pamEnabled, error: $error}'
|
|
}
|
|
|
|
cmd_status() {
|
|
command -v fprintd-list >/dev/null 2>&1 || { emit false "" '[]' false ""; return; }
|
|
|
|
# fprintd-list both answers "is there a reader" (fprintd is bus-activated,
|
|
# so this also copes with the daemon not running yet) and names the
|
|
# enrolled fingers in one call.
|
|
local listing
|
|
# LC_ALL=C: the "no devices" match below reads fprintd's message, and a
|
|
# translated daemon would turn every readerless non-English machine into
|
|
# a permanent error card.
|
|
if ! listing="$(LC_ALL=C timeout 10 fprintd-list "$USER" 2>&1)"; then
|
|
# "No devices available" is the normal no-reader machine; anything
|
|
# else is a real problem worth surfacing.
|
|
if grep -qi 'no devices' <<<"$listing"; then
|
|
emit false "" '[]' false ""
|
|
else
|
|
emit false "" '[]' false "fprintd did not answer: $(head -1 <<<"$listing")"
|
|
fi
|
|
return
|
|
fi
|
|
|
|
# "Fingerprints for user gib on FocalTech ... (press):" carries the reader
|
|
# product name; " - #0: right-index-finger" lines carry the enrollment.
|
|
local name enrolled pam
|
|
name="$(sed -n 's/^Fingerprints for user [^ ]* on \(.*\) (\w*):$/\1/p' <<<"$listing" | head -1)"
|
|
enrolled="$(sed -n 's/^ *- #[0-9]*: //p' <<<"$listing" | jq -Rn '[inputs]')"
|
|
pam=false
|
|
authselect current 2>/dev/null | grep -q 'with-fingerprint' && pam=true
|
|
|
|
emit true "$name" "$enrolled" "$pam" ""
|
|
}
|
|
|
|
cmd_set_unlock() {
|
|
local verb reason
|
|
case "$1" in
|
|
on) verb=enable-feature
|
|
reason="Turning on fingerprint login: telling PAM (via authselect) to ask the fingerprint reader when unlocking" ;;
|
|
off) verb=disable-feature
|
|
reason="Turning off fingerprint login: telling PAM (via authselect) to stop asking the fingerprint reader" ;;
|
|
*) echo 'panama-fingerprint set-unlock takes on|off' >&2; exit 1 ;;
|
|
esac
|
|
|
|
local sudo_cmd=(sudo)
|
|
[[ -x "$PANAMA_PATH/bin/panama-sudo" ]] && sudo_cmd=(
|
|
"$PANAMA_PATH/bin/panama-sudo" --reason "$reason" --
|
|
)
|
|
"${sudo_cmd[@]}" authselect "$verb" with-fingerprint
|
|
}
|
|
|
|
case "${1:-}" in
|
|
status) cmd_status ;;
|
|
set-unlock) [[ -n "${2:-}" ]] || { echo 'panama-fingerprint set-unlock takes on|off' >&2; exit 1; }
|
|
cmd_set_unlock "$2" ;;
|
|
*) echo 'usage: panama-fingerprint status | set-unlock on|off' >&2; exit 1 ;;
|
|
esac
|