From fdd1f4b7f88efc22bb57c2ad3e83c0c2e8cbb064 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Mon, 28 Oct 2024 05:06:05 -0400 Subject: [PATCH] refactoring --- usr/libexec/security-misc/hide-hardware-info | 27 ++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/usr/libexec/security-misc/hide-hardware-info b/usr/libexec/security-misc/hide-hardware-info index 40e31c2..9eaae72 100755 --- a/usr/libexec/security-misc/hide-hardware-info +++ b/usr/libexec/security-misc/hide-hardware-info @@ -17,21 +17,25 @@ run_cmd_whitelist() { echo "$0: INFO: START" -sysfs_whitelist=1 -cpuinfo_whitelist=1 +default_variables_set() { + sysfs_whitelist=1 + cpuinfo_whitelist=1 -sysfs=1 + sysfs=1 -## https://www.kicksecure.com/wiki/Security-misc#selinux -selinux=0 + ## https://www.kicksecure.com/wiki/Security-misc#selinux + selinux=0 +} shopt -s nullglob -## Allows for disabling the whitelist. -for i in /usr/local/etc/hide-hardware-info.d/*.conf /etc/hide-hardware-info.d/*.conf ; do - bash -n "${i}" - source "${i}" -done +parse_configuration() { + ## Allows for disabling the whitelist. + for i in /usr/local/etc/hide-hardware-info.d/*.conf /etc/hide-hardware-info.d/*.conf ; do + bash -n "${i}" + source "${i}" + done +} create_whitelist() { if [ "${1}" = "sysfs" ]; then @@ -55,6 +59,9 @@ create_whitelist() { fi } +default_variables_set +parse_configuration + ## sysfs and debugfs expose a lot of information ## that should not be accessible by an unprivileged ## user which includes hardware info, debug info and