Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fingerprint functionality via fprintd DBus service #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

quantum5
Copy link

@quantum5 quantum5 commented Nov 19, 2023

For fun, I've ported swaywm#283 to run on this version of swaylock-effects. To enable fingerprint, build with -Dfingerprint=enabled.

@jirutka
Copy link
Owner

jirutka commented Dec 1, 2023

GitHub denied pushing into your branch, but allowed me to add commit via web interface. Weird.

ERROR: Permission to quantum5/swaylock-effects.git denied to jirutka.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists

@SebTM
Copy link

SebTM commented Dec 5, 2023

Would love to see this integrated into swaylock-effects and finally finding a home - otherwise you could have a look at this approach which would be sufficient to reach the same goal with some manual workarounds.

@quantum5
Copy link
Author

quantum5 commented Dec 6, 2023

Okay this should now build without fingerprint support. @jirutka is there anything else you want before merging?

@niksingh710
Copy link

@jirutka is this pr is in consideration?

@jirutka
Copy link
Owner

jirutka commented Dec 31, 2023

@jirutka is this pr is in consideration?

Yes, it is, I just need some time to test it.

@niksingh710
Copy link

@jirutka I have been using this pr and in my observation if it is build with fingerprint support then fingerprint works fine but manual password input fails to verify.

/etc/pam/swaylock

auth sufficient pam_fprintd.so
auth include login

after adding the pam_fprintd.so line in pam everything works fine.
it unlocks with password and fp both

@spikespaz
Copy link

spikespaz commented Feb 6, 2024

Why is this PR needed? It already works for me on NixOS (nixpkgs tracks this fork). I can press Enter and then grace the fingerprint sensor to log in, or I can just type the password and press Enter as normal.

$ cat /etc/pam.d/swaylock

auth sufficient pam_unix.so try_first_pass nullok
auth sufficient /nix/store/m0d04vgf83hmfck6njjiphn5px7i1hz6-fprintd-1.94.2/lib/security/pam_fprintd.so

Edit:

swaywm#283 (comment)

Hm, do we really all of this complexity? I'd rather not do any of the D-Bus stuff. Can't users leverage a PAM module which integrates with the fingerprint reader instead?

Yes, we want to check password and fingerprint in parallel. With Pam closest solution is check fingerprint after empty password was entered.

With this MR we can touch fingerprint scanner while PC is asleep, it will wake up over USB and immediately unlock without necessety to press any button.

@niksingh710
Copy link

Why is this PR needed? It already works for me on NixOS (nixpkgs tracks this fork). I can press Enter and then grace the fingerprint sensor to log in, or I can just type the password and press Enter as normal.

This pr enables to scan fingerprint without the press of the enter key.
Either you scan your finger or enter password and press enter. (Makes the experience a bit Clean)
For me after pressing enter and trying to put finger and if it fails the manually entering password also fails but this pr resolves that too for me.

@spikespaz
Copy link

spikespaz commented Feb 7, 2024

I don't know anything but would it be possible to use pkg-config to get the DBus interface?
systemd/systemd@1bd0cc4

Reason: PKG_CONFIG_DBUS_1_INTERFACES_DIR does not work in Nixpkgs.

Alternative:

postPatch = let
  dbusInterfacesDir = (pkgs.symlinkJoin {
    name = "${self.pname}-${self.version}_dbus-interfaces-dir";
    paths = self.buildInputs;
    pathsToLink = [ "share/dbus-1/interfaces" ];
  }) + "/share/dbus-1/interfaces";
in super.postPatch or "" + ''
  sed -i 's@/usr/share/dbus-1/interfaces@${dbusInterfacesDir}@g' \
    fingerprint/meson.build
'';

@@ -18,6 +18,7 @@ _arguments -s \
'(--hide-keyboard-layout -K)'{--hide-keyboard-layout,-K}'[Hide the current xkb layout while typing]' \
'(--ignore-empty-password -e)'{--ignore-empty-password,-e}'[When an empty password is provided, do not validate it]' \
'(--image -i)'{--image,-i}'[Display the given image, optionally only on the given output]:filename:_files' \
'(--fingerprint -p)'{--fingerprint,-p}'[Enable fingerprint scanning. Fprint is required]' \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Fprint/fprintd/

@@ -14,6 +14,7 @@ complete -c swaylock -l help -s h --description "Show help mes
complete -c swaylock -l hide-keyboard-layout -s K --description "Hide the current xkb layout while typing."
complete -c swaylock -l ignore-empty-password -s e --description "When an empty password is provided, do not validate it."
complete -c swaylock -l image -s i --description "Display the given image, optionally only on the given output."
complete -c swaylock -l fingerprint p --description "Enable fingerprint scanning. Fprint is required."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Fprint/fprintd

@@ -1106,6 +1113,10 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state,
"Disable the Caps Lock text.\n"
" -l, --indicator-caps-lock "
"Show the current Caps Lock state also on the indicator.\n"
#if HAVE_FINGERPRINT
" -p, --fingerprint "
"Enable fingerprint scanning. Fprint is required.\n"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Fprint/fprintd

spikespaz added a commit to spikespaz/dotfiles that referenced this pull request Feb 9, 2024
@spikespaz
Copy link

It doesn't work when resuming from hibernation, works for suspend. Can anyone reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants