diff options
Diffstat (limited to 'testing/openscap/sysctl_unittest.patch')
-rw-r--r-- | testing/openscap/sysctl_unittest.patch | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/openscap/sysctl_unittest.patch b/testing/openscap/sysctl_unittest.patch new file mode 100644 index 0000000000..174b38f2e1 --- /dev/null +++ b/testing/openscap/sysctl_unittest.patch @@ -0,0 +1,29 @@ +diff --git a/tests/probes/sysctl/test_sysctl_probe_all.sh b/tests/probes/sysctl/test_sysctl_probe_all.sh +index bb9859d71..6534e1142 100755 +--- a/tests/probes/sysctl/test_sysctl_probe_all.sh ++++ b/tests/probes/sysctl/test_sysctl_probe_all.sh +@@ -4,6 +4,12 @@ + + set -e -o pipefail + ++# on some systems sysctl might live in sbin, which can cause problems for ++# non root users ++PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin ++# non root users are not able to access some kernel params, so they get blacklisted ++SYSCTL_BLACKLIST='stable_secret\|vm.stat_refresh\|fs.protected_hardlinks\|fs.protected_symlinks\|kernel.cad_pid\|kernel.unprivileged_userns_apparmor_policy\|kernel.usermodehelper.bset\|kernel.usermodehelper.inheritable\|net.core.bpf_jit_harden\|net.core.bpf_jit_kallsyms\|net.ipv4.tcp_fastopen_key\|vm.mmap_rnd_bits\|vm.mmap_rnd_compat_bits' ++ + function perform_test { + probecheck "sysctl" || return 255 + +@@ -24,9 +30,9 @@ $OSCAP oval eval --results $result $srcdir/test_sysctl_probe_all.oval.xml > /dev + # sysctl has duplicities in output + # hide permission errors like: "sysctl: permission denied on key 'fs.protected_hardlinks'" + # kernel parameters might use "/" and "." separators interchangeably - normalizing +-sysctl -aN --deprecated 2> /dev/null | tr "/" "." | sort -u > "$sysctlNames" ++sysctl -aN --deprecated 2> /dev/null | grep -v $SYSCTL_BLACKLIST | tr "/" "." | sort -u > "$sysctlNames" + +-grep unix-sys:name "$result" | sed -E 's;.*>(.*)<.*;\1;g' | sort > "$ourNames" ++grep unix-sys:name "$result" | grep -v $SYSCTL_BLACKLIST | sed -E 's;.*>(.*)<.*;\1;g' | sort > "$ourNames" + + diff "$sysctlNames" "$ourNames" + |