mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-29 13:52:20 +00:00
89dee4de1e
Eight checks in the selinux testcases asserted ausearch output =~ "<no matches>", which is zero denials of any kind in the window. A cluster denies things xCAT has nothing to do with. On an idle enforcing management node httpd asks the kernel for net_admin on itself every ten seconds, and the base policy carries no dontaudit rule for that shape. One node logged 1034 denials in a day, 817 of them that one shape. So the assertion cannot pass once ausearch is called correctly, and before --input-logs was added it could not fail. selinux_avc_check.sh keeps the denials whose subject program or object path belongs to xCAT and counts those. The cases assert XCAT_AVC=0. selinux_mn_labels now also plants a denial on purpose: it mislabels /install/postscripts/xcatdsklspost, shows httpd answering 403, and requires the check to report XCAT_AVC=[1-9] before restoring the label. A counting method with no positive control cannot be trusted to find anything. restorecon -RnvF reports a difference in the SELinux user as well as the type, and the files xCAT writes carry unconfined_u. On one node -RnvF printed 12 lines over /install where -Rnv printed 2. The checks use -Rnv, which is the type they assert. The six cases were in no bundle and in no pipeline conf, so none had ever run, which is why the dead checks were not noticed. selinux.bundle and selinux_mn.bundle name them, and selinux_bundle.t fails when a case is in no bundle. Tests: selinux_avc_check.bats drives the classifier with records measured on an enforcing management node. Replacing the filter with one that keeps every record fails 4 of its 8 checks; dropping the object-path branch fails 2. selinux_bundle.t fails when selinux.bundle is removed. selinux_kickstart_template.t asserted the relabel order with a regex that matched wherever the relabel sat; it now compares line positions, and moving #SELINUXRELABEL# above the xCAT post includes fails it. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>