File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
set -e -o pipefail
6
6
7
+ # on some systems sysctl might live in sbin, which can cause problems for
8
+ # non root users
9
+ PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
10
+
11
+ # non root users are not able to access some kernel params, so they get blacklisted
12
+ 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'
13
+
7
14
function perform_test {
8
15
probecheck " sysctl" || return 255
9
16
@@ -24,9 +31,9 @@ $OSCAP oval eval --results $result $srcdir/test_sysctl_probe_all.oval.xml > /dev
24
31
# sysctl has duplicities in output
25
32
# hide permission errors like: "sysctl: permission denied on key 'fs.protected_hardlinks'"
26
33
# kernel parameters might use "/" and "." separators interchangeably - normalizing
27
- sysctl -aN --deprecated 2> /dev/null | tr " /" " ." | sort -u > " $sysctlNames "
34
+ sysctl -aN --deprecated 2> /dev/null | grep -v $SYSCTL_BLACKLIST | tr " /" " ." | sort -u > " $sysctlNames "
28
35
29
- grep unix-sys:name " $result " | sed -E ' s;.*>(.*)<.*;\1;g' | sort > " $ourNames "
36
+ grep unix-sys:name " $result " | grep -v $SYSCTL_BLACKLIST | sed -E ' s;.*>(.*)<.*;\1;g' | sort > " $ourNames "
30
37
31
38
# If procps_ver > 3.3.12 we need to filter *stable_secret and vm.stat_refresh
32
39
# options from the sysctl output, for more details see
You can’t perform that action at this time.
0 commit comments