From 7a85a7fddae52572d2cc3f51b7d2f1696b69b94a Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Mon, 8 Apr 2024 18:09:56 -0300 Subject: [PATCH] skip kernel.modules_disabled if MODULES not set Signed-off-by: Eneas U de Queiroz --- kernel_hardening_checker/checks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel_hardening_checker/checks.py b/kernel_hardening_checker/checks.py index e2cf42e..4b5dee6 100644 --- a/kernel_hardening_checker/checks.py +++ b/kernel_hardening_checker/checks.py @@ -688,7 +688,9 @@ def add_sysctl_checks(l, _arch): # At first, it disabled unprivileged userfaultfd, # and since v5.11 it enables unprivileged userfaultfd for user-mode only. - l += [SysctlCheck('cut_attack_surface', 'clipos', 'kernel.modules_disabled', '1')] # radical, but may be useful in some cases + l += [OR(SysctlCheck('cut_attack_surface', 'clipos', 'kernel.modules_disabled', '1'), # radical, but may be useful in some cases + AND(KconfigCheck('cut_attack_surface', 'kspp', 'MODULES', 'is not set'), + have_config_file))] l += [SysctlCheck('harden_userspace', 'kspp', 'fs.protected_symlinks', '1')] l += [SysctlCheck('harden_userspace', 'kspp', 'fs.protected_hardlinks', '1')] -- 2.31.1