From b5447e5e963508c15e872562bfe04331647b8d2b Mon Sep 17 00:00:00 2001 From: Vunny Sodhi Date: Thu, 10 Oct 2024 16:56:41 +0300 Subject: [PATCH] fprint: Add terminal based app for finger print. For user finger print enrollment add terminal based app which will take finger input to enroll finger based authenication in the system. Works fine across system reboot as well. Signed-off-by: Vunny Sodhi --- modules/common/services/desktop.nix | 6 +++ overlays/custom-packages/default.nix | 1 + packages/fprint-enroll/default.nix | 23 +++++++++++ packages/fprint-enroll/enroll.sh | 59 ++++++++++++++++++++++++++++ packages/icon-pack/default.nix | 1 + 5 files changed, 90 insertions(+) create mode 100644 packages/fprint-enroll/default.nix create mode 100644 packages/fprint-enroll/enroll.sh diff --git a/modules/common/services/desktop.nix b/modules/common/services/desktop.nix index 5917d1d26..aee90adb6 100644 --- a/modules/common/services/desktop.nix +++ b/modules/common/services/desktop.nix @@ -196,6 +196,12 @@ in icon = "${pkgs.ghaf-artwork}/icons/falcon-icon.svg"; } + { + name = "FPrint Enroll"; + path = "${pkgs.foot}/bin/foot -H -T Finger_Print_Enrollment -L ${pkgs.fprint-enroll}/bin/finger-print-enroll"; + icon = "${pkgs.icon-pack}/authy.svg"; + } + { name = "Shutdown"; description = "Shutdown System"; diff --git a/overlays/custom-packages/default.nix b/overlays/custom-packages/default.nix index 1868b1941..d4f65210c 100644 --- a/overlays/custom-packages/default.nix +++ b/overlays/custom-packages/default.nix @@ -24,4 +24,5 @@ globalprotect-openconnect = final.libsForQt5.callPackage ../../packages/globalprotect-openconnect { }; + fprint-enroll = final.callPackage ../../packages/fprint-enroll { }; }) diff --git a/packages/fprint-enroll/default.nix b/packages/fprint-enroll/default.nix new file mode 100644 index 000000000..b69b3480b --- /dev/null +++ b/packages/fprint-enroll/default.nix @@ -0,0 +1,23 @@ +# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# +# +{ + writeShellApplication, + util-linux, + fprintd, +}: +writeShellApplication { + name = "finger-print-enroll"; + runtimeInputs = [ + util-linux + fprintd + ]; + text = builtins.readFile ./enroll.sh; + meta = { + description = "Helper script for finger print enrollment"; + platforms = [ + "x86_64-linux" + ]; + }; +} diff --git a/packages/fprint-enroll/enroll.sh b/packages/fprint-enroll/enroll.sh new file mode 100644 index 000000000..00991da24 --- /dev/null +++ b/packages/fprint-enroll/enroll.sh @@ -0,0 +1,59 @@ +#! /usr/bin/env bash +# shellcheck shell=bash +# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# Notes: +# Thi script can be used enroll finger print +set +xo pipefail +mainmenu () { + echo "Please choose which finger you want to enroll" + echo "0. Right Thumb" + echo "1. Right Index Finger" + echo "2. Right Middle Finger" + echo "3. Right Ring Finger" + echo "4. Right Little Finger" + echo "5. Left Thumb" + echo "6. Left Index Finger" + echo "7. Left Middle Finger" + echo "8. Left Ring Finger" + echo "9. Left Little Finger" + echo "" +} +readfunc() +{ + while true; do + read -r -n 1 -p "Input Selection:" mainmenuinput + echo "" + echo "Please tap on power button for finger enrollment" + echo "" + if [ "$mainmenuinput" = "0" ]; then + fprintd-enroll -f right-thumb + elif [ "$mainmenuinput" = "1" ]; then + fprintd-enroll -f right-index-finger + elif [ "$mainmenuinput" = "2" ]; then + fprintd-enroll -f right-middle-finger + elif [ "$mainmenuinput" = "3" ]; then + fprintd-enroll -f right-ring-finger + elif [ "$mainmenuinput" = "4" ]; then + fprintd-enroll -f right-little-finger + elif [ "$mainmenuinput" = "5" ];then + fprintd-enroll -f left-thumb + elif [ "$mainmenuinput" = "6" ];then + fprintd-enroll -f left-index-finger + elif [ "$mainmenuinput" = "7" ];then + fprintd-enroll -f left-middle-finger + elif [ "$mainmenuinput" = "8" ];then + fprintd-enroll -f left-ring-finger + elif [ "$mainmenuinput" = "9" ];then + fprintd-enroll -f left-ring-finger + else + echo "Invalid Input" + mainmenu + readfunc + fi + echo "" + exit 0 +done +} +mainmenu +readfunc \ No newline at end of file diff --git a/packages/icon-pack/default.nix b/packages/icon-pack/default.nix index d7dde8811..9fae445a8 100644 --- a/packages/icon-pack/default.nix +++ b/packages/icon-pack/default.nix @@ -10,6 +10,7 @@ }: let icons = [ + "authy.svg" "bluetooth-48.svg" "preferences-sound.svg" "chromium.svg"