Skip to content

Persistent secure daemon to reduce per-auth startup latency. #1132

Description

@Phant0m1zed

Every authentication attempt (sudo, login, etc.) spawns a completely fresh
pam.py process that has to:

  1. Start the Python interpreter
  2. Import cv2, numpy, and dlib (all fairly heavy C++-backed libraries)
  3. Load the face recognition models from disk
  4. Only then open the camera and begin scanning

In practice this adds roughly 2+ second of pure setup overhead before the
camera even activates, on top of the actual scan time. On my system
(Zorin OS 18 / Ubuntu 24.04, tested on the 2.6.1 PPA build), I found myself
finishing typing my password before the camera LED even turned on, simply
because the cold-start overhead outlasted my typing speed.

Proposed solution

A small persistent, yet secure, background daemon (e.g. a systemd service) that:

  • Starts at boot (or on first use) and imports cv2/numpy/dlib once
  • Loads face models into memory once and keeps them active
  • Keep pam.py bytecode in access instead of compiling it everytime.
  • Listens on a local Unix socket for authentication requests

This should make the camera activate near-instantly on each sudo/login
call, since the expensive one-time setup already happened at boot.

Security should be kept intact

  • Security surface: a daemon that can be queried to test face matches
    needs care so it can't be abused outside of a legitimate PAM auth flow
    (e.g. socket permissions restricted to root, request validation, no way
    to just "ask" it to authenticate without a real PAM-triggered call)
  • Camera lifecycle / privacy: should the daemon hold the camera open
    continuously, or open on-demand and release after each attempt/idle
    timeout? Continuous access has an obvious privacy downside.
  • Has this architecture been discussed or attempted before? I didn't find
    an existing issue covering this specifically, apologies if I missed one.

Environment (for context)

  • Zorin OS 18 (Ubuntu 24.04 base)
  • Howdy 2.6.1 (installed via ppa:boltgolt/howdy)
  • Standard RGB webcam (no IR), /dev/video0, HOG detection mode

Happy to help implement this if it's an actual issue. If this is already been addressed, I'd be glad to know. I really liked Howdy and want to do my part.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions