9 Commits
Author SHA1 Message Date
nandiandClaude Sonnet 5.5 738928352e Face unlock: let polkit's sandboxed PAM helper open cameras
CI / test (push) Canceled after 28m1s
polkit 126+ runs the password dialog's PAM stack in polkit-agent-helper@.service,
whose PrivateDevices=yes leaves no cameras in /dev, so the dialog reported "no
camera" while sudo and enrolling worked. Install a drop-in that allows only V4L2
devices and keeps the capability and syscall limits PrivateDevices= added.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-25 22:33:44 -08:00
Claude 516180196f Face unlock: say why a camera can't be used, list the cameras, pick one
CI / test (push) Canceled after 21m7s
"no camera at PATH" now says why (not there or a broken link, permission
denied, not a V4L2 device, a metadata node rather than the picture node,
OpenCV couldn't start it or it gives no picture: another app using it) and
lists the cameras found (VIDIOC_QUERYCAP on /dev/v4l/by-id/* and /dev/video*).
New commands: `chandra-face cameras`, `chandra-face set-camera PATH` (root,
edits device in face.conf after checking it is a capture node). The Face
unlock window shows the cameras found with a Use button (one password), then
opens again. just install prints NOT READY with the reason when the
configured camera can't be used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
2026-11-26 04:47:06 +00:00
Claude 2c2ce3f913 Face unlock window steps aside while Apply asks for the password
CI / test (push) Canceled after 3m23s
After Apply the window kept the keyboard and the pointer and its dimmed card
covered the screen, so a password dialog that isn't Chandra's own (another
polkit agent's window) couldn't be reached. While Apply waits, the window now
shows only a note at the top and takes no input. A refused or cancelled
password brings it back with the snaps and marks kept (chandra-face camera
restarts the camera instead of exiting) and says so.

Test: snaps, Enter, the password dialog gets typing (Space no longer snaps
underneath) and the Authenticate click, then the root step finishes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
2026-11-26 04:05:11 +00:00
Claude 9f7489cfea Face unlock window: live camera preview, Snap, thumbnails, one password on Apply
CI / test (push) Failing after 12m30s
Settings > Session "Add or remove faces…" (and "Remove…" on a face) opens a
compositor-drawn Face unlock window instead of running root steps one by one:

- chandra-face camera runs as the user (no password): it streams a small live
  picture with the face box and a cropped thumbnail per snap; the snaps'
  embeddings stay in that process, nothing is written to disk.
- Click a snap to drop it; mark saved faces Remove/Keep.
- Apply saves the snaps as one face and removes the marked ones in one root
  `chandra-face apply` (JSON on stdin, validated) through run0/pkexec: one
  password prompt.
- New raster host function image-pixels (host-wasm, wasmhost, native) for the
  window's pictures.

Tests: camera session and apply in face/test_face.py; the window end to end
against a fake tool in compositor/host/face_test.mbt. Docs explain why the
change itself still needs root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
2026-11-26 02:36:29 +00:00
nandiandClaude Sonnet 5.5 1aabccba5d Face unlock: point at the webcam by its stable by-id path, not /dev/video0 (OBS virtual camera)
CI / test (push) Failing after 3m0s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hjM4nPcLCbqchiA2V3
2026-11-25 17:54:26 -08:00
Claude 3e35c4dfa5 One install recipe: just install installs everything
CI / test (push) Successful in 2m25s
just install now builds as you, then asks for root once and installs the
whole thing: the login session (wasm compositor on the MoonBit host,
modules, chandra-ctl, KDE colors, portal) and face unlock (helper, PAM
module, config, models). The alternatives are flags instead of recipes:
--link (was install-dev), --rust (install-rust), --native
(install-native), --pam (install-face --pam), --no-face, --no-models.
The PAM module is compiled as you into build/, so root only copies it;
without a compiler or libpam headers face unlock is skipped with a warning.
just uninstall removes face unlock too (--purge: enrolled faces).

Removed: install-dev, install-rust, install-native, install-face,
uninstall-face and the old install-session* / uninstall-session aliases.
New docs/install.md; README, docs and installer hints updated. Also drops
a committed __pycache__ file and ignores __pycache__/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hkA52AocBmJHipFRqb
2026-11-26 01:38:58 +00:00
Claude b097116ded Face unlock: Python, OpenCV and numpy from a root-owned pixi environment
CI / test (push) Successful in 2m41s
- face/pixi.toml + pixi.lock (python 3.12, numpy, opencv-python-headless). `just install-face`
  passes the pixi on your PATH; install.py runs `pixi install --frozen` as root into
  /usr/local/lib/chandra/face-env (not the checkout's .pixi: the PAM module runs this Python as
  root, so it must not be user-writable), writes the helper's shebang for it and builds the PAM
  module with it as the default python. No python3-opencv needed; uninstall removes the env.
- The PAM module now also refuses a Python that isn't root's; group-writable is accepted only
  for group root (conda/pixi files are 0775 root:root), in the module and chandra-face's checks.
- Elevation re-runs on the same interpreter (sys.executable). "OpenCV is missing: run just
  install-face" instead of naming the distro package. Dropped a stray __pycache__.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
2026-11-26 01:34:45 +00:00
Claude ac2d0fa205 Face unlock: say that the Settings rows need the new session (just install + log in again)
CI / test (push) Successful in 2m1s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
2026-11-26 01:25:54 +00:00
Claude 932fca627e Face unlock: a Howdy-style PAM module, shown in the password dialog and set up in Settings
CI / test (push) Successful in 2m6s
- face/pam_chandra_face.so (`-auth sufficient`): runs `chandra-face compare` as root with a clean
  environment, forwards what it says as PAM_TEXT_INFO / PAM_ERROR_MSG, and maps its exit status
  to success / auth error / unavailable, so the password always still works. Skips remote
  sessions (PAM_RHOST, SSH_CONNECTION), a closed lid and users without faces; refuses a helper
  that isn't root's; kills one that hangs (timeout + 6 s).
- face/chandra-face (Python + OpenCV): YuNet finds the face, SFace embeds it, cosine similarity
  against the enrolled embeddings (threshold 0.42, two matching frames, dark IR warm-up frames
  skipped, optional require_ir). enroll / list / remove / clear / test / status / pam
  enable|disable / fetch-models (sha256-pinned opencv_zoo models). Embeddings only, in
  /var/lib/chandra-face/USER/faces.json (root, 0600); labels in faces.list (0644). Store, config
  and models must be root's and not writable by others. Root commands re-run through run0 (or
  pkexec), so polkit asks first. Settings in /etc/chandra/face.conf.
- `just install-face [--pam]`, `just uninstall-face [--purge]` (face/install.py; uninstall takes
  the module out of every PAM service first). `pam enable` inserts before the first auth or
  @include line (Debian's sudo has only @include common-auth), keeping a .bak.
- Password dialog: a face row ("Looking for your face…" with a sweeping ring, "Face
  recognized", or why not, "Type your password instead"); typing and Enter during the scan go in
  when PAM asks for the password. Howdy's pam_howdy.so messages are understood too.
- Settings > Session > Face unlock: "Use my face for passwords" (polkit-1 + sudo), the enrolled
  faces (Remove takes a second click), "Add a face…", and the tool's progress. New `face-unlock`
  capability: tables 24 (status) and 25 (faces), request 44, in the wasmer/wasmtime stub, the Rust
  host, the MoonBit wasmhost and chandra:host/plasmoids. compositor/shell/face.mbt runs the tool
  on a socket so the compositor never waits.
- Tests: face/test_face.py (fake camera of PGM frames + fake recognizer; --pam builds the module
  and runs it through pamtester), dialog states and message parsing (polkit_test), the dialog via
  a mock helper (auth_test, shots 14/15), Settings against a fake chandra-face (face_test).
  scripts/test.sh runs them (compositor/polkit was missing from its native list), CI installs
  libpam0g-dev + pamtester. Also regenerated two stale desktop-module bindings (doc comments).
- docs/face-unlock.md, including the limits of 2D face recognition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
2026-11-26 01:19:29 +00:00