2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-15 21:38:10 +00:00

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/<os>/<arch>/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
<<none>> 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>
This commit is contained in:
Daniel Hilst
2026-10-21 16:37:00 -03:00
parent 4487162ff6
commit 07ef2be0de
+18
View File
@@ -20,3 +20,21 @@
# depth under /install.
/install(/.*)?/rootimg(/.*)? <<none>>
/install(/.*)?/rootimg-statelite(/.*)? <<none>>
# 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)