pam: add optional fingerprint authentication#445
pam: add optional fingerprint authentication#445rjarry wants to merge 2 commits intoswaywm:masterfrom
Conversation
ccca3b7 to
bfdf45d
Compare
f1b1f12 to
f671322
Compare
|
Nice PR. I accidentally happen to maintain a fork of a fork of fork of a fork of this project, which also has a fingerprint scanner, including support for fingerprint scanners which shut down after some time. Perhaps you'd like to take a peek? |
|
Hi @hboetes, thanks for the link. I will have a look. I wonder, why not contribute your security fixes and quality of life improvements to the original project? I guess some eye candy things aren't essential and would go against the minimalist nature of sway{,lock}. But security issues should be reported and fixed. |
|
Is there no way to run |
|
Unfortunately, no. In order to talk to fprintd, you need to start a PAM challenge. In order to avoid any DBUS dependency, I resorted to a separate blocking PAM conversation with only pam_fprintd.so and that sends an "empty" password. |
Because I have been using I am not aware where the security problems @ink-splatters and I found and came from, just that they existed in the swaylock-effects code. |
Thanks for shining in 👍 I had a quick look at your implementation. It is quite well integrated with actual GUI feedback but unfortunately requires additional libdbus and glib dependencies which swaylock does not have at the moment. I remember @emersion saying that he preferred to keep the dependencies as lean as possible in #283 which led me to add this PR. |
What I mean is that a PAM backend can do all of this dance? |
Replace the custom get_pam_auth_error() function with the standard pam_strerror() call. This provides accurate, localized error messages from PAM itself rather than a limited set of hardcoded strings. Signed-off-by: Robin Jarry <robin@jarry.cc>
|
Hey Simon, I had looked into this and unfortunately a single PAM service with both To have both methods available simultaneously, you would need to talk to fprintd directly over D-Bus to start and cancel verify operations, which would add libdbus/libglib dependencies. The separate child process with its own PAM conversation avoids that while still allowing both methods to race in parallel. Let me know if you have another idea I might have missed. |
Add optional fingerprint authentication via pam_fprintd. When enabled with the -p/--fingerprint option, swaylock spawns a child process that runs a separate PAM conversation using the swaylock-fingerprint service. The PAM service is configured with max-tries=-1 and timeout=-1 so that pam_fprintd handles retries internally and the child stays in a single pam_authenticate() call. If the user sets finite values, swaylock starts a fresh PAM session when pam_authenticate returns. Messages from pam_fprintd (finger placement prompts, match failures) are forwarded to the parent via a pipe and displayed in the indicator text box. Failed fingerprint attempts do not increment the failed password counter. If the conversation function is never called (missing PAM service file or unavailable device), the child retries with a 1 second delay and gives up after 3 consecutive failures, displaying a diagnostic message in the indicator. The child is automatically terminated when the parent exits via prctl(PR_SET_PDEATHSIG). Signed-off-by: Robin Jarry <robin@jarry.cc>
Allow unlocking the screen with a fingerprint reader via
pam_fprintd. When enabled with-p/--fingerprint, a child process is spawned that runs in parallel with normal password authentication. Users can unlock with either method, whichever succeeds first.The fingerprint child blocks on
pam_authenticate()using a dedicatedswaylock-fingerprintPAM service. On success, it notifies the parent via a pipe. On failure, it retries until a valid fingerprint is detected. The child terminates automatically when the parent exits.This achieves the same feature than #283 but without any additional dependencies.