From 07ef2be0dece17c7017fe6d8f2ed239b5b98631d Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:37:00 -0300 Subject: [PATCH] fix(xcat-core): a published kernel loses public_content_t beside an image root called rootimg The exclusions match the component name rootimg anywhere under /install. A profile may be called rootimg, and the image root is then /install/netboot///rootimg. The files genimage and packimage publish in that image root, among them kernel and the initrds, sit one component below a name the exclusions match, so each resolves to <> instead of public_content_t and httpd cannot serve it. The same happens for a profile called rootimg-statelite. Name each published file in the image root: kernel, hypervisor, the initrds, the rootimg archives, rootimgtree, litefile.csv, common.filelist, common and overlay. The entry names the component directly below the rootimg component, so a guest file deeper in the tree matches none of them and keeps the label of its own operating system. selinux_file_contexts.t fails 54 of its 224 checks without this change. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-selinux/xcat.fc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xCAT-selinux/xcat.fc b/xCAT-selinux/xcat.fc index 9b24c4bdb3..65c2299aed 100644 --- a/xCAT-selinux/xcat.fc +++ b/xCAT-selinux/xcat.fc @@ -20,3 +20,21 @@ # depth under /install. /install(/.*)?/rootimg(/.*)? <> /install(/.*)?/rootimg-statelite(/.*)? <> + +# A profile may be called rootimg or rootimg-statelite. The image root is then +# itself called rootimg, the guest tree is <...>/rootimg/rootimg, and the files +# genimage and packimage publish in the image root sit one component below a +# name the two rules above match. Each published name is listed here, so the +# published file keeps public_content_t while the tree beside it stays excluded. +# A guest file matches none of these: the name must be the one directly below +# the rootimg component. +/install(/.*)?/rootimg(-statelite)?/kernel -- gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/hypervisor -- gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/initrd[^/]* -- gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/rootimg\.[^/]* -- gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/rootimg-statelite\.[^/]* -- gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/rootimgtree\.[^/]* -- gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/litefile\.csv -- gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/common\.filelist -- gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/common(/.*)? gen_context(system_u:object_r:public_content_t,s0) +/install(/.*)?/rootimg(-statelite)?/overlay(/.*)? gen_context(system_u:object_r:public_content_t,s0)