-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Gate sudo fingerprint behind lid state (clamshell) #6003
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| echo "Gate sudo fingerprint behind lid state (skip fingerprint when the laptop lid is closed)" | ||
|
|
||
| # Desktops / machines without an ACPI lid button are left completely untouched. | ||
| lid_present=false | ||
| for f in /proc/acpi/button/lid/*/state; do | ||
| [[ -e "$f" ]] && lid_present=true | ||
| done | ||
| $lid_present || exit 0 | ||
|
|
||
| # Only relevant if sudo actually uses fingerprint and isn't already guarded. | ||
| if grep -q pam_fprintd.so /etc/pam.d/sudo && ! grep -q omarchy-lid-open /etc/pam.d/sudo; then | ||
| # Install / refresh the lid-state helper used by pam_exec. | ||
| sudo tee /usr/local/bin/omarchy-lid-open >/dev/null <<'EOF' | ||
| #!/bin/bash | ||
| # omarchy:summary=Exit 0 if the laptop lid is open (used by PAM to gate fingerprint auth) | ||
| for f in /proc/acpi/button/lid/*/state; do | ||
| [[ -r "$f" ]] || continue | ||
| if grep -q open "$f"; then exit 0; else exit 1; fi | ||
| done | ||
| exit 0 | ||
| EOF | ||
|
Comment on lines
+13
to
+21
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the catch. I went back and forth on this one. These migrations are run-once, self-contained snapshots: I considered extracting the helper into a shared shipped file that both consumers install, but the natural home ( |
||
| sudo chmod 755 /usr/local/bin/omarchy-lid-open | ||
|
|
||
| # Insert the guard immediately above the existing pam_fprintd line. | ||
| sudo sed -i '/pam_fprintd\.so/i auth [success=ignore default=1] pam_exec.so quiet /usr/local/bin/omarchy-lid-open' /etc/pam.d/sudo | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (the
&& exit 0 || exit 1idiom) is now fixed in both places.