Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion debian/security-misc-shared.postrm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ true "
"

## https://forums.whonix.org/t/is-security-misc-suitable-for-hardening-bridges-and-relays/8299/11
pam-auth-update --package --remove "$DPKG_MAINTSCRIPT_PACKAGE"
## Reconciliation safety net; the authoritative early-disable is in prerm. By the
## time postrm runs dpkg has deleted this package's /usr/share/pam-configs/ files,
## so a plain reconciliation drops the now-file-less profiles from common-*.
## Plain '--package' only (no '--remove <profiles>'): on upgrade/abort states the
## config files are still present and '--remove' would strip live hardening
## mid-transaction, so those states are deliberately not matched here.
case "$1" in
remove|purge|disappear)

@ArrayBolt3 ArrayBolt3 Jul 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we match failed-upgrade, abort-install, and abort-upgrade too? (See https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#summary-of-ways-maintainer-scripts-are-called, specifically the subsection about how the postrm script may be called.) I don't think this will be problematic for any of these (or for upgrade, for that matter), and it might not be redundant in any of those situations. (It is redundant for upgrade though, since the postinst will have already called pam-auth-update.)

if command -v pam-auth-update >/dev/null 2>&1; then
pam-auth-update --package
fi
;;
esac

rm -f /etc/sysctl.d/30_security-misc_aslr-mmap.conf

Expand Down
20 changes: 19 additions & 1 deletion debian/security-misc-shared.prerm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,25 @@ true "
"

if [ "$1" = remove ]; then
pam-auth-update --package --remove "$DPKG_MAINTSCRIPT_PACKAGE"
## 'pam-auth-update --remove' matches pam-config FILENAMES under
## /usr/share/pam-configs/, not the package name. Disable our profiles while
## the helper scripts they reference under /usr/libexec/security-misc/ still
## exist (before dpkg deletes them), so /etc/pam.d/common-* is never left
## referencing a deleted module -- block-unsafe-logins is a Priority 1100
## 'requisite' whose dangling reference would fail all logins. See
## pam-auth-update(8). Keep in sync with security-misc-shared.install and
## usr/share/pam-configs/.
if command -v pam-auth-update >/dev/null 2>&1; then
pam-auth-update --package --remove \
block-unsafe-logins-security-misc \
console-lockdown-security-misc \
faillock-preauth-security-misc \
mkhomedir-security-misc \
pam-abort-on-locked-password-security-misc \
umask-security-misc \
unix-faillock-security-misc \
wheel-security-misc
fi
fi

true "INFO: debhelper beginning here."
Expand Down