Skip to content

profiles: fprint: Fix fingerprint sudo integration#245

Merged
vnepogodin merged 1 commit into
masterfrom
fix-sudo
Apr 23, 2026
Merged

profiles: fprint: Fix fingerprint sudo integration#245
vnepogodin merged 1 commit into
masterfrom
fix-sudo

Conversation

@ptr1337
Copy link
Copy Markdown
Member

@ptr1337 ptr1337 commented Apr 19, 2026

sudo does not accept dropin files and therefore the fingerprint sudo auth did not work. Sed the normal pam.

Signed-off-by: Peter Jung <admin@ptr1337.dev>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes fingerprint authentication for sudo by switching from an unsupported PAM drop-in approach to editing /etc/pam.d/sudo directly.

Changes:

  • Replace creation of /etc/pam.d/sudo.d/50-fprintd.conf with a sed insertion into /etc/pam.d/sudo.
  • Update removal logic to delete the inserted # chwd-fprintd line from /etc/pam.d/sudo.
  • Keep enabling/disabling of fprintd.service as part of install/remove hooks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 31 to 34
post_remove = """
if grep -q 'Managed by chwd' /etc/pam.d/sudo.d/50-fprintd.conf 2>/dev/null; then
rm -f /etc/pam.d/sudo.d/50-fprintd.conf
if [ -f /etc/pam.d/sudo ]; then
sed -i '/# chwd-fprintd/d' /etc/pam.d/sudo
fi
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

This update stops managing /etc/pam.d/sudo.d/50-fprintd.conf, but systems that previously installed this profile may still have the legacy drop-in file and directory left behind. Consider cleaning up the old managed file (e.g., if it contains the historical chwd marker) during install/upgrade or in post_remove so the profile doesn’t leave stale, confusing configuration artifacts.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nah

# Managed by chwd - DO NOT EDIT
auth sufficient pam_fprintd.so
EOF
if [ -f /etc/pam.d/sudo ] && ! grep -q 'chwd-fprintd' /etc/pam.d/sudo; then
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

The guard only checks for the marker string (chwd-fprintd). If a user/system already has an auth ... pam_fprintd.so line (without this marker), this will insert a second pam_fprintd entry, which can lead to multiple fingerprint prompts and a confusing PAM stack. Consider also checking for an existing pam_fprintd.so auth line (or otherwise detecting an existing fprint configuration) before inserting.

Suggested change
if [ -f /etc/pam.d/sudo ] && ! grep -q 'chwd-fprintd' /etc/pam.d/sudo; then
if [ -f /etc/pam.d/sudo ] \
&& ! grep -q 'chwd-fprintd' /etc/pam.d/sudo \
&& ! grep -Eq '^[[:space:]]*auth([[:space:]]+[^#[:space:]]+)*[[:space:]]+pam_fprintd\.so([[:space:]]|$)' /etc/pam.d/sudo; then

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@vnepogodin vnepogodin left a comment

Choose a reason for hiding this comment

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

fair. hope auth won't get broken someday

@vnepogodin vnepogodin merged commit 2de751f into master Apr 23, 2026
5 of 6 checks passed
@vnepogodin vnepogodin deleted the fix-sudo branch April 23, 2026 16:50
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.

3 participants