fix(pam): pass profile names to pam-auth-update --remove#376
Open
maybebyte wants to merge 1 commit into
Open
Conversation
pam-auth-update --remove matches pam-config filenames under /usr/share/pam-configs/, but prerm and postrm passed $DPKG_MAINTSCRIPT_PACKAGE -- the package name security-misc-shared -- which matches no profile and is silently ignored. The prerm early-disable was therefore dead: on removal, /etc/pam.d/common-* kept referencing helper scripts under /usr/libexec/security-misc/ that dpkg then deleted, risking failed authentication (block-unsafe-logins is a Priority 1100 requisite entry). prerm now passes the eight profile filenames explicitly, guarded by command -v so a bulk purge cannot abort under set -e. postrm drops the ineffective --remove for a plain reconciliation scoped to remove|purge|disappear, so it never strips live hardening during an upgrade or abort.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
prerm/postrmscripts try to disable this package's PAM profiles when thepackage is removed, but they pass the package name to
pam-auth-update --remove,which matches profile filenames — so the removal was silently a no-op. This
restores the intended early-disable and hardens the removal path across dpkg states.
Changes
pam-auth-update --removematches the config filenames in/usr/share/pam-configs/(readdir basenames), never the package name. Bothscripts passed
$DPKG_MAINTSCRIPT_PACKAGE(security-misc-shared), matching noprofile, so nothing was removed. An unknown target is not validated and never
errors, so it failed silently. The
prermearly-disable was therefore dead:on removal,
/etc/pam.d/common-*kept referencing helper scripts under/usr/libexec/security-misc/that dpkg then deleted — andblock-unsafe-loginsis a Priority 1100
requisite, so a dangling reference fails all logins.prerm: pass the 8 actual profile filenames to--remove, guarded bycommand -v pam-auth-update. This is the man-page-documented purpose of--remove: strip profiles before the modules they reference leave disk.postrm: replace the inert--remove <pkg>with a plainpam-auth-update --packagereconciliation scoped toremove|purge|disappear,so
upgrade/abort-*never strip live hardening mid-transaction.Testing
security-misc-shared.deb (the actual profiles, the referencedhelper scripts, and these maintainer scripts) and ran install →
dpkg -r→dpkg -Pindebian:stable-slim— 11/11 checks passed. Crux: same tree,only the
--removeargument differs —--remove security-misc-sharedleft theprofile in
common-auth(old no-op reproduced), while--remove <8 filenames>removed it with the files still on disk;
dpkg -r/-Pexited 0 withcommon-*cleaned before the helper was deleted.postrminvoked pam-auth-update only forremove/purge/disappear(notupgrade/abort-upgrade/abort-install/failed-upgrade/deconfigure), andpostrm purgeexited 0 withpam-auth-update absent from
PATH.bash -npasses on both scripts;shellcheckis clean on the changed blocks.Notes for reviewers
reconciliation already drops the profiles once their files are gone. This fix
restores the
prermearly-disable that closes the window wherecommon-authreferences a just-deleted module; it is a correctness/robustness fix, not a
fix for a failure users currently hit.
postrmkeeps a plain--package(rather than dropping the call)as a safety net for profile-list drift and the
disappearstate, whereprermnever runs. A real
--remove <profiles>there was deliberately avoided — itwould strip live hardening during
upgrade/abort-*.prermmust stay in sync withdebian/security-misc-shared.installandusr/share/pam-configs/; a forgottenprofile is still reconciled away by the
postrmnet within the same dpkg run.