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
5 changes: 3 additions & 2 deletions debian/security-misc-shared.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

## style-ok: no-has - has.sh isn't reliably available in maintainer scripts
## style-ok: no-strict - full strict block could leak into APT/debconf
## style-ok: allow-echo (Debian maintainer-script convention)
## style-ok: no-has (has.bsh not reliably available this early in maintainer scripts)
## style-ok: no-strict (debconf maintainer script; full strict block would leak into APT/debconf)

if [ -f /usr/libexec/helper-scripts/pre.bsh ]; then
source /usr/libexec/helper-scripts/pre.bsh
Expand Down
24 changes: 13 additions & 11 deletions usr/bin/permission-hardener#security-misc-shared
Original file line number Diff line number Diff line change
Expand Up @@ -472,31 +472,33 @@ load_state() {
processed_config_line="${line}"

## We can handle filenames with spaces. This is because the first item
## after a filename is an octal file mode, and we only support user/group
## names, not UIDs and GIDs, as owner identifiers. This means that we can
## scan from right to left for the furthest-right octal integer field and
## use it to separate the filename from the rest of the options. (If
## usernames could themselves be octal integers, this would break, but
## adduser.conf's default NAME_REGEX forbids this. This is definitely a
## hack, but the alternative is to change the format of the policy files,
## which would break custom config for users.
## after a filename is either an octal file mode or a keyword, and we
## only support user/group names, not UIDs and GIDs, as owner
## identifiers. This means that we can scan from right to left for the
## furthest-right octal integer or keyword field and use it to separate
## the filename from the rest of the options. (If usernames could
## themselves be octal integers, this would break, but adduser.conf's
## default NAME_REGEX forbids this. This is definitely a hack, but the
## alternative is to change the format of the policy files, which would
## break custom config for users.
##
## 'read' will collapse consecutive spaces when splitting on spaces.
## Convert spaces into newlines first, then split on newlines with a
## loop.
field_list=()
while read IFS= -r one_field; do
while IFS= read -r one_field; do
field_list+=( "${one_field}" )
done < <(printf '%s\n' "${line}" | tr ' ' '\n')
field_count="${#field_list[@]}"

hit_barrier='false'
fso_name=""
meta_list=()
for (( field_index = field_count - 1; field_index <= 0; \
for (( field_index = field_count - 1; field_index >= 0; \
field_index-- )); do
if [ "${hit_barrier}" = 'false' ]; then
if [[ "${field_list[field_index]}" =~ ^[0-7]{3,4}$ ]]; then
if [[ "${field_list[field_index]}" =~ ^[0-7]{3,4}$ ]] \
|| [[ "${field_list[field_index]}" =~ ^(nosuid|exactwhitelist|matchwhitelist|disablewhitelist)$ ]]; then
hit_barrier='true'
fi
meta_list=( "${field_list[field_index]}" "${meta_list[@]}" )
Expand Down
2 changes: 1 addition & 1 deletion usr/bin/remount-secure#security-misc-shared
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
## https://www.kicksecure.com/wiki/Dev/remount-secure
## https://forums.whonix.org/t/re-mount-home-and-other-with-noexec-and-nosuid-among-other-useful-mount-options-for-better-security/7707

## style-ok: no-has - may run in dracut without helper-scripts
## style-ok: no-has (runs in dracut where helper-scripts has.bsh is unavailable; id itself may be absent)

## Mount helper functions (_boot, _sys, _usr, ...) are invoked indirectly via
## the dispatch in main().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ shopt -s inherit_errexit
shopt -s shift_verbose
export LC_ALL=C

# shellcheck source=../../../../helper-scripts/usr/libexec/helper-scripts/has.sh
source "${HELPER_SCRIPTS_PATH:-}"/usr/libexec/helper-scripts/has.sh
## security-misc-shared Depends on helper-scripts.
# shellcheck source=../../../../helper-scripts/usr/libexec/helper-scripts/has.bsh
source "${HELPER_SCRIPTS_PATH:-}"/usr/libexec/helper-scripts/has.bsh

## Package 'pciutils' provides tool 'lspci'.
has lspci
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ shopt -s inherit_errexit
shopt -s shift_verbose
export LC_ALL=C

# shellcheck source=../../../../../helper-scripts/usr/libexec/helper-scripts/has.sh
source "${HELPER_SCRIPTS_PATH:-}"/usr/libexec/helper-scripts/has.sh
## security-misc-shared Depends on helper-scripts.
# shellcheck source=../../../../../helper-scripts/usr/libexec/helper-scripts/has.bsh
source "${HELPER_SCRIPTS_PATH:-}"/usr/libexec/helper-scripts/has.bsh

## Check if the VirtualBox host software is installed.
if ! has vboxmanage ; then
Expand Down