2017-02-19 17:25:28 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-05-10 23:18:36 -04:00
|
|
|
## Copyright (C) 2012 - 2024 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
|
2017-02-19 17:25:28 -05:00
|
|
|
## See the file COPYING for copying conditions.
|
|
|
|
|
2021-08-03 12:48:57 -04:00
|
|
|
if [ -f /usr/libexec/helper-scripts/pre.bsh ]; then
|
|
|
|
source /usr/libexec/helper-scripts/pre.bsh
|
2017-02-19 17:25:28 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
true "
|
|
|
|
#####################################################################
|
2017-03-06 10:00:33 -05:00
|
|
|
## INFO: BEGIN: $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME $@
|
2017-02-19 17:25:28 -05:00
|
|
|
#####################################################################
|
|
|
|
"
|
|
|
|
|
2024-01-16 09:10:59 -05:00
|
|
|
permission_hardening_legacy_state_files() {
|
2024-01-16 08:45:13 -05:00
|
|
|
if test -d /var/lib/permission-hardener ; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
if ! test -d /var/lib/permission-hardening ; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
mv --verbose /var/lib/permission-hardening /var/lib/permission-hardener
|
|
|
|
}
|
|
|
|
|
2024-01-16 09:10:59 -05:00
|
|
|
permission_hardening_legacy_config_folder() {
|
|
|
|
if ! test -d /etc/permission-hardening.d ; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
rmdir --verbose --ignore-fail-on-non-empty /etc/permission-hardening.d || true
|
|
|
|
}
|
|
|
|
|
2023-10-26 12:20:48 -04:00
|
|
|
permission_hardening() {
|
|
|
|
echo "Running SUID Disabler and Permission Hardener... See also:"
|
|
|
|
echo "https://www.kicksecure.com/wiki/SUID_Disabler_and_Permission_Hardener"
|
2024-01-16 08:32:52 -05:00
|
|
|
echo "$0: INFO: running: permission-hardener enable"
|
|
|
|
if ! permission-hardener enable ; then
|
2023-10-26 12:20:48 -04:00
|
|
|
echo "$0: ERROR: Permission hardening failed." >&2
|
|
|
|
return 0
|
|
|
|
fi
|
2024-01-17 13:23:20 -05:00
|
|
|
echo "$0: INFO: Permission hardening success."
|
2023-10-26 12:20:48 -04:00
|
|
|
}
|
|
|
|
|
2017-02-19 17:25:28 -05:00
|
|
|
case "$1" in
|
|
|
|
configure)
|
2020-04-06 09:25:45 -04:00
|
|
|
if [ -d /etc/skel/.gnupg ]; then
|
|
|
|
## Lintian warns against use of chmod --recursive.
|
|
|
|
chmod 700 /etc/skel/.gnupg
|
|
|
|
fi
|
|
|
|
|
2019-12-08 01:59:55 -05:00
|
|
|
## /usr/share/glib-2.0/schemas/30_security-misc.gschema.override
|
2017-02-19 17:32:04 -05:00
|
|
|
glib-compile-schemas /usr/share/glib-2.0/schemas || true
|
2017-02-19 17:25:28 -05:00
|
|
|
;;
|
|
|
|
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
|
|
;;
|
|
|
|
|
2021-08-01 13:11:18 -04:00
|
|
|
triggered)
|
|
|
|
echo "INFO: triggered $DPKG_MAINTSCRIPT_PACKAGE: '$DPKG_MAINTSCRIPT_PACKAGE' $DPKG_MAINTSCRIPT_PACKAGE DPKG_MAINTSCRIPT_NAME: '$DPKG_MAINTSCRIPT_NAME' $\@: '$@' 2: '$2'"
|
|
|
|
/usr/share/security-misc/lkrg/lkrg-virtualbox || true
|
2023-04-22 00:08:20 -04:00
|
|
|
/usr/libexec/security-misc/mmap-rnd-bits || true
|
2024-01-17 13:23:20 -05:00
|
|
|
permission_hardening
|
2021-08-01 13:11:18 -04:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
2017-02-19 17:25:28 -05:00
|
|
|
*)
|
|
|
|
echo "$DPKG_MAINTSCRIPT_NAME called with unknown argument \`$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2019-07-13 07:41:37 -04:00
|
|
|
pam-auth-update --package
|
2019-07-07 16:51:40 -04:00
|
|
|
|
2021-08-03 12:56:31 -04:00
|
|
|
/usr/libexec/security-misc/permission-lockdown
|
2024-01-16 09:10:59 -05:00
|
|
|
permission_hardening_legacy_state_files
|
|
|
|
|
2024-01-16 08:32:52 -05:00
|
|
|
permission_hardening
|
2019-07-13 12:20:14 -04:00
|
|
|
|
2019-09-07 01:44:23 -04:00
|
|
|
## https://phabricator.whonix.org/T377
|
|
|
|
## Debian has no update-grub trigger yet:
|
|
|
|
## https://bugs.debian.org/481542
|
|
|
|
if command -v update-grub >/dev/null 2>&1; then
|
|
|
|
update-grub || \
|
|
|
|
echo "$DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME ERROR: Running \
|
|
|
|
'update-grub' failed with exit code $?. $DPKG_MAINTSCRIPT_PACKAGE is most \
|
|
|
|
likely only the trigger, not the cause. Unless you know this is not an issue, \
|
|
|
|
you should fix running 'update-grub', otherwise your system might no longer \
|
|
|
|
boot." >&2
|
|
|
|
fi
|
|
|
|
|
2023-05-05 10:44:29 -04:00
|
|
|
/usr/libexec/security-misc/mmap-rnd-bits || true
|
2023-03-24 08:32:58 -04:00
|
|
|
|
2017-02-19 17:25:28 -05:00
|
|
|
true "INFO: debhelper beginning here."
|
|
|
|
|
|
|
|
#DEBHELPER#
|
|
|
|
|
|
|
|
true "INFO: Done with debhelper."
|
|
|
|
|
2024-01-16 09:10:59 -05:00
|
|
|
permission_hardening_legacy_config_folder
|
|
|
|
|
2017-02-19 17:25:28 -05:00
|
|
|
true "
|
|
|
|
#####################################################################
|
2017-03-06 10:00:33 -05:00
|
|
|
## INFO: END : $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME $@
|
2017-02-19 17:25:28 -05:00
|
|
|
#####################################################################
|
|
|
|
"
|
|
|
|
|
|
|
|
## Explicitly "exit 0", so eventually trapped errors can be ignored.
|
|
|
|
exit 0
|