2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-24 03:12:18 +00:00
Commit Graph

29143 Commits

Author SHA1 Message Date
Daniel Hilst e9f27f139b fix(xcat-core): the documented repair relabels before the guest exclusions exist
The SELinux page carried the repair in two blocks. The first mapped the
published artifacts and ran restorecon over the image root. The second mapped
the publication directory and excluded both guest trees. An operator with
site.installdir=/srv/xcat-install who reads the page in order therefore
relabels before any mapping covers that tree, and rootimg/etc/shadow resolves to
var_t. The exclusion added afterwards keeps the var_t it finds, because it only
stops the next relabel from changing the label again.

The order also cost the artifacts. file_contexts keeps the expressions in the
order they are read and the last one that matches a path wins, so the exclusions
of the second block beat the artifact mappings of the first. Where the image
root carries a rootimg component in the middle, the exclusion matches the
artifacts as well, and the five expressions with a wildcard, the initrds and the
packed images, resolve <<none>>. kernel and hypervisor carry no wildcard and win
either way, which is why the defect showed on a subset.

The page is now one sequence: the publication directory, both guest exclusions,
the artifact mappings, then one restorecon. It says what each step orders and
why.

xCAT-test/native/selinux_image_repair.t passes 381 of 381 checks on this
sequence and fails 47 on the order of the parent commit. selinux_docs.t fails 3
of 30 on the parent commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-23 00:56:50 -03:00
Daniel Hilst 7d66afe2f3 test(xcat-core): no case runs the documented repair as one sequence
selinux_image_repair.t measured a moved publication directory and an image root
with a rootimg component in the middle in separate fixtures, and it called the
mappings of a scenario a repair without running the restorecon the page puts
between them. Neither condition reaches the ordering defect on its own, and the
relabel the procedure runs itself was never measured.

The case now gives each scenario the relabel, so the scenario places it where
the page does. It reads the guest labels straight after the procedure, because a
label the procedure overwrote cannot be recovered by a mapping added afterwards.
It then asserts the mapping and the label of each path after a recursive relabel
and after a reinstall of the module.

A third scenario runs the four documented steps on the layout that needs all of
them: site.installdir is /srv/xcat-images, so no mapping covers the tree until
the procedure adds one, and the image root carries a rootimg component in the
middle, so the guest exclusion matches the published artifacts too.

selinux_docs.t gains three checks on the order of the page: the guest exclusions
come before the artifact mappings, the relabel comes after the last mapping, and
there is one relabel. All three fail against the page at 78f6d65a7.

With the command order of that page, the full sequence fails 47 of 381 checks:
16 guest labels, which go from shadow_t, etc_t and bin_t to var_t, and 15
artifact mappings, which resolve <<none>> for the five expressions that carry a
wildcard.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-23 00:56:41 -03:00
Daniel Hilst 78f6d65a7c fix(xcat-core): the documented repair of a published artifact relabels the guest trees
The SELinux page told the operator to run chcon -R -t public_content_t over the
image root to repair a published artifact that kept an older type. That command
walks into rootimg and rootimg-statelite, so it replaces the labels of the guest
operating system with public_content_t. The xcat.fc comment carried the same
advice. chcon also writes a type that no mapping selects, so the next relabel of
a path that has a mapping reverts it: the repair held only until then.

The page now maps each published artifact with semanage fcontext and applies the
mapping with restorecon. Each expression names one regular file directly below
the image root, so no path in either guest tree matches one, and both trees keep
the <<none>> of the packaged mappings. The procedure reads the publication
directory from site.installdir, and a site that moved it maps the configured
directory and keeps both guest trees out of that mapping. The page says why a
tree mapping over the image root is the same defect as the chcon.

xCAT-test/native/selinux_image_repair.t passes 170 of 170 checks with the
documented procedure. With the chcon of the previous page it fails 101, 36 of
them guest labels. selinux_docs.t fails 7 of 26 on the parent commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 18:25:33 -03:00
Daniel Hilst 576370bdf9 test(xcat-core): no case measures the documented repair of a published artifact
The SELinux page documents a recursive chcon to repair a published artifact
that carries the wrong type. No case runs that procedure, so nothing measures
what it does to the guest trees of the image root, and nothing measures whether
the repair survives a later relabel.

selinux_image_repair.t starts with default_t on every published artifact of an
image root and with valid types in both rootimg and rootimg-statelite. It runs
the repair, then reads the labels back after a recursive relabel and after a
reinstall of the module. It covers the standard publication directory and one
that site.installdir moved, because the packaged mappings name /install.

semanage writes to the policy store of the host, so the case refuses to run
where SELinux is enabled and removes every mapping it adds. restorecon is a
no-op where SELinux is disabled, so the case applies the mappings with setfiles
and asserts that the merged file_contexts answers what the store answers for
each path.

selinux_docs.t gains the checks that keep the page and the xcat.fc comment from
describing a chcon repair. 7 of its 26 checks fail on this commit.

With the chcon of the page in place of the documented procedure,
selinux_image_repair.t fails 101 of its 170 checks, 36 of them guest labels that
the recursive chcon overwrote.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 18:25:22 -03:00
Daniel Hilst b46826434a fix(xcat-selinux): openEuler builds a policy package it cannot compile
xCAT-selinux is in the default package set of buildrpms.pl, so every target
builds it. openEuler 20.03sp4 and 22.03sp4 carry selinux-policy 3.14.2, which
defines none of unconfined_server_stream_connectto(), files_map_etc_files() or
chronyd_manage_pid_files(). m4 leaves an undefined interface name in its
output and checkmodule stops with a syntax error, so rpmbuild fails and the
core build for that target publishes no repository at all.

SELinux support is EL only. XCAT::BuildUtils::package_skip_reason names the
packages an openEuler target does not build, and buildrpms.pl prints each pair
it skips. openEuler 24.03sp4 carries selinux-policy 40.7 and does compile the
module. It is excluded as well, so no openEuler release ships a package the
other releases cannot build.

xCAT-server and xCATsn required xCAT-selinux when selinux-policy-targeted was
installed, on openEuler too. openEuler defines %openEuler and no %rhel, so the
condition now names EL 8 and later and Fedora only. Without this an openEuler
management node cannot resolve xCAT-server.

xCAT-test/unit/selinux_el_only_scope.t fails on the parent commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 12:03:43 -03:00
Daniel Hilst bd91348c54 test(xcat-selinux): assert the policy package is built for EL targets only
Nothing holds the scope of xCAT-selinux down. The package is in the default
set of buildrpms.pl, so every target builds it, and xCAT-server and xCATsn
require it on openEuler as well as on EL.

The test reads the build-plan decision and the two spec conditions. It fails
on this commit: BuildUtils has no build-plan decision, and both conditions
still name openEuler.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 12:03:35 -03:00
Daniel Hilst 37de3e634e fix(xcat-probe): a terminal tput cannot measure erases every checkpoint message
xcatprobe asks 'tput cols' for the screen width whenever TERM is set. The
GitHub Actions container sets TERM=unknown, terminfo carries no such
terminal, and tput writes nothing. The width became 0 and the layout cut
every checkpoint message to the empty string, so the probe printed a
column of bare [ OK ], [WARN] and [FAIL] marks with no text beside them.

xcatprobe_xcatmn_selinux failed on that output. It asserts that the
SELinux checkpoint reports [ OK ], and no checkpoint text reached the log.
The rest of the probe diagnostics were unreadable for the same reason, so
the one [FAIL] in the run named no checkpoint.

probe_format::screen_width keeps the 80 column default when 'tput cols'
gives no usable number. probe_xcatmn_selinux_case.t renders the checkpoint
at that width and three of its assertions fail without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 08:49:45 -03:00
Daniel Hilst f38418bd75 test(xcat-probe): the probe case measures a checkpoint line the test wrote itself
xcatprobe_xcatmn_selinux asserts the text of the SELinux checkpoint, and
probe_xcatmn_selinux_case.t built that line by hand. The line xcatprobe
prints in the GitHub Actions container carries no text, so the test passed
while the case failed.

xcatprobe held the layout in format_cmd_output, which no test can call.
This moves the layout to probe_format and leaves xcatprobe the printing.
The rendering is unchanged at every width: an identical column of output
for widths 7, 40, 79, 80, 120, 121 and 200, truncated and wrapped, with
and without colour.

The test now renders the checkpoint through probe_format at the width the
container gives, and it fails here. screen_width returns 0 for a terminal
'tput cols' cannot measure, the message is cut to the empty string, and
three assertions read '[ OK ]' where they expect the checkpoint text.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 08:49:37 -03:00
Daniel Hilst 6f578741af fix(xcat-core): the comment says an unlabeled kernel stops netboot, and it does not
The file contexts leave the published kernel of a middle-rootimg image
root out of the relabel. The comment and the SELinux page read that as
the kernel being unlabeled, httpd refusing to serve it, and that osimage
losing netboot, with restorecon as the repair. Three of those four
claims are wrong.

Measured. An entry of <<none>> keeps the label a path has: restorecon
-R, restorecon -RF and setfiles -F all left a kernel at default_t, while
the same setfiles call relabeled a path that has a rule. A new file
inherits the type of its directory, so a kernel that genimage writes
into an image root already made public_content_t is public_content_t. In
the policy with the xcat module loaded, httpd_t holds one allow rule to
read public_content_t and none for default_t. So the ordinary case
serves and netboot works, and restorecon is not the repair for the case
that does not: chcon -R -t public_content_t over the image root is, and
a later relabel leaves that value alone.

selinux_file_contexts.t now starts half the custom roots at
public_content_t, which is what genimage produces, and half at
default_t, and requires each to keep its own type. It fails 324 of its
618 checks against the previous xcat.fc.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 20:03:44 -03:00
Daniel Hilst 45ebeacab8 docs(selinux): the page says a path left out of the relabel is unlabeled
A file context of <<none>> stops restorecon changing the label. It does
not clear it. A tree that genimage creates under an image root that is
already public_content_t inherits that type, measured on an enforcing
el10 host: mkdir -p rootimg/common/sub under a public_content_t parent
gives every new component public_content_t, and the same tree under a
default_t parent gives default_t.

Say what the label is, and name the case that costs something: a tree
older than the package keeps default_t, and restorecon -RF over the
image root sets it.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:53:51 -03:00
Daniel Hilst cb4e7bc09b fix(xcat-test): a quiet audit window fails, and a control leaks into the next case
The SELinux cases marked their audit window with date "+%H:%M:%S" and
gave it to selinux_avc_check.sh. Two failures follow from the time
window. The body of selinux_mn_labels runs inside one second, so an el9
run reported SEARCHED=0 and the guard called a quiet node a usage error.
And ausearch -ts has one second of granularity, so the denials that the
positive control of selinux_mn_labels creates on purpose landed in the
window of selinux_restapi_avc, which failed with XCAT_AVC=2 on two
httpd_t getattr records it did not cause.

selinux_avc_check.sh takes a checkpoint file: --init consumes the
records written so far and prints BASELINE, --since reports the denials
after that point. A checkpoint is an offset, so an empty answer has one
meaning and two cases cannot read one record. Each case opens its own
checkpoint, and the positive control opens a second one, which also
removes the sleep 1 that the granularity needed.

The count refuses an answer that is neither a record nor '<no matches>',
so an ausearch error message cannot read as a clean window. The -ts form
stays for the keywords boot and today, and now asks for today's records
before it calls an empty window a usage error.

/xcatpost is reported and no longer asserted on a compute or service
node. The kickstart relabel runs in %post, the xCAT post scripts write
that tree at the first boot, and the node carries no xCAT-selinux, so a
clean restorecon -Rnv there is not what the design promises.

selinux_avc_check.bats fails 7 of its 15 checks without this change, on
rome01.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:35:31 -03:00
Daniel Hilst 830b731143 test(xcat-test): no check tells a quiet audit window from a broken search
selinux_avc_check.sh refuses a window that holds no audit record, and
calls it a usage error. On a quiet node that answer is wrong: the body of
selinux_mn_labels runs inside one second, so an el9 run of the case
failed with SEARCHED=0 AVC=0 XCAT_AVC=0 while the search was working.
The guard has no way to tell the two apart, and no check names which
guard fires.

The time window has a second defect that no check covers. ausearch -ts
has one second of granularity, so the denials the positive control of
selinux_mn_labels creates on purpose land in the window of the case that
runs next: selinux_restapi_avc failed with SEARCHED=50 AVC=6
XCAT_AVC=2, and both kept records were the control's httpd_t getattr on
/install/postscripts/xcatdsklspost.

selinux_avc_check.bats now requires a checkpoint interface, --init and
--since, and requires the count to refuse an ausearch error message
while it accepts an empty read. It also requires the time window to
consult today before it calls an empty window a usage error.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:35:20 -03:00
Daniel Hilst 27fdca22a8 fix(xcat-test): the xcatmn probe case reports an empty output as a failure
The case ran xcatprobe xcatmn through grep -i selinux and checked the rc
of the pipeline. Nothing in the output named SELinux, so grep exited 1,
the case failed with an empty output, and the log carries no checkpoint
and no reason. The probe prints every checkpoint, so the diagnostics
existed and the filter threw them away.

The case now runs the probe with -H, which runs the checks on this node
instead of dispatching them, and keeps the whole output. It asserts that
the SELinux checkpoint is marked [ OK ] and is not marked [FAIL], which
xcatprobe writes for a checkpoint that passes and one that fails. It no
longer asserts the rc of the probe: a management node under test can
report another checkpoint as a problem, and that is not this case.

probe_xcatmn_selinux_case.t fails 3 of its 11 checks without this change,
on rome01.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:30:21 -03:00
Daniel Hilst ea658e280e test(xcat-core): the xcatmn probe case throws away the output it checks
xcatprobe_xcatmn_selinux runs the probe through grep -i selinux. grep
keeps the lines that name SELinux and discards every other checkpoint,
so the one CI failure of this case reported rc 1 with an empty output
and said nothing about which checkpoint the probe stopped at. The second
check, on the word FAIL, read that empty output and passed.

probe_xcatmn_selinux_case.t requires the case to keep the whole output,
to assert at least one pattern the output must hold, and to name the
SELinux checkpoint in every pattern. It takes the marks of a checkpoint
from probe_utils->send_msg, and requires each pattern to tell a passing
checkpoint from a failing one.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:30:14 -03:00
Daniel Hilst c9210eb26e docs(selinux): two pages describe a module that is not the one shipped
The security page said xcatd runs in unconfined_service_t and that
xCAT-selinux defines no type. The module defines xcat_t for xcatd and
the client commands, and xcat_image_t for the image build, and declares
both permissive. The older page placed a service node and a compute node
outside the scope because xCAT does not select their mode, and the branch
ships noderes.selinux and site.selinux.

Both pages now state what the module does: the two permissive domains,
the transitions to tftpd_t and chronyd_t for the services xCAT starts,
the mode a node resolves, and the goal of an enforcing management node.
The scope page also records that a published common or overlay directory
of an image root called rootimg is unlabeled, for the same reason as a
published kernel there.

selinux_docs.t fails 6 of its 18 checks without this change, on rome01.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:27:46 -03:00
Daniel Hilst 95127756f1 test(xcat-core): no case compares the SELinux pages with the shipped policy
Two pages describe SELinux, and both disagree with xCAT-selinux. The
security page says the package defines no type and that xcatd runs in
unconfined_service_t. The older page says a service node and a compute
node are out of scope because xCAT does not select their mode, and the
branch ships noderes.selinux.

selinux_docs.t reads the permissive domains out of xcat.te and requires
each page to name them, to call them permissive, and to leave out the
two claims above. Nothing held the pages to the module before.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:27:38 -03:00
Daniel Hilst fa703a5943 fix(xcat-core): restorecon relabels a guest tree below a common directory
The published-name rules end with /install(/.*)?/rootimg(-statelite)?/common(/.*)?
and the same entry for overlay. The trailing (/.*)? takes a whole
subtree, so the entry matches a guest tree as well as a published
directory. With rootimgdir=/install/rootimg/common/compute, the guest
files rootimg/etc/shadow and rootimg-statelite/etc/shadow resolve to
public_content_t, and so does a directory called common or overlay at
the root of any guest tree. %posttrans runs restorecon -R /install, so
an install or an upgrade of the package overwrites the labels of the
guest operating system.

A common or an overlay directory one component below a rootimg component
has the same path as the same directory at the root of a guest tree, so
no rule can keep one and leave the other. Remove both entries. The
remaining entries each name one file and cannot take a tree with them.
A published common or overlay of an image root called rootimg is left
unlabeled, which restorecon over the image root repairs.

selinux_file_contexts.t fails 360 of its 618 checks without this change,
measured in a privileged almalinux:10 container on rome01.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:25:30 -03:00
Daniel Hilst cd75a9f820 test(xcat-core): no case measures a common or overlay directory in a guest tree
The published-name rules for an image root called rootimg end with two
recursive entries, common(/.*)? and overlay(/.*)?. A recursive entry
below the rootimg component matches a guest tree as well: with
rootimgdir=/install/rootimg/common/compute, the guest file
/install/rootimg/common/compute/rootimg/etc/shadow resolves to
public_content_t, and so does a directory called common at the root of
any guest tree.

selinux_file_contexts.t covers neither shape. Add three case groups: an
image root that holds a rootimg component in the middle, a guest tree
that holds a common or an overlay directory at its own root, and the
published files of such an image root. Each new path is measured in the
lookup and in both relabel passes.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:25:22 -03:00
Daniel Hilst 745d7f4d19 fix(xcat-core): the policy omits three accesses an EL9 management node makes
The policy was measured on EL10. An enforcing AlmaLinux 9.8 management
node running the same bundle logged 38 denials in xcat_t that the EL10
node did not log at all. The domain is permissive, so nothing failed,
but each one has to be granted before the domain can enforce.

Three causes, all of them EL9 running ISC DHCP where EL10 runs Kea:

- omshell reads /proc/sys/net/ipv4/ip_local_port_range before it opens
  the OMAPI socket, which is 9 read, 9 open, 9 getattr on sysctl_net_t
  and 8 dir search. makedhcp runs omshell on every ISC backend.
  kernel_read_net_sysctls covers it.
- makedhcp asks systemd to start and query dhcpd.service, whose unit
  carries dhcpd_unit_file_t. The Kea units carry systemd_unit_file_t,
  which the policy already grants, so EL10 recorded nothing.
- copycds loop-mounts the install DVD, and mount asks the kernel for the
  iso9660 and loop modules. kernel_request_load_module covers it.

The module compiles against the EL9 and the EL10 policy headers.
selinux_file_contexts.t keeps its 224 checks on EL10.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 18:04:35 -03:00
Daniel Hilst b5607a944c fix(xcat-test): every AVC check in the selinux cases searches an empty window
The cases marked the start of their window with date "+%x %T" and gave
it to ausearch. audit 4.0.3 takes a bare HH:MM:SS and rejects that
format: it prints nothing and exits 0. Measured on an enforcing
AlmaLinux 10.2 management node, with the raw log holding 4197 records:
"-ts 10/21/2026 20:59:08" returned 0 records, "-ts 20:59:08" returned
22 and "-ts today" returned 4006. So selinux_avc_check.sh searched
nothing and reported XCAT_AVC=0 whatever the node did.

The positive control of selinux_mn_labels is what found it. The case
mislabels /install/postscripts/xcatdsklspost, shows httpd answering 403
and requires the check to report XCAT_AVC=[1-9]; it reported
SEARCHED=0 AVC=0 XCAT_AVC=0 and the case failed on an enforcing el10
node.

The four cases now write date "+%H:%M:%S". selinux_avc_check.sh refuses
a window that holds no audit record at all, because that is not a
credible answer on a running node, and names the format in the message.
selinux_avc_check.bats fails its ninth check against the unguarded
script.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 18:00:10 -03:00
Daniel Hilst d7f579440d test(xcat-core): nothing starts xcatd without the recorded prefix file
%post writes /etc/xcat/xcatroot.env and %preun removes it, so the file
is absent on rpm --justdb, before %post runs, and after an interrupted
install. Both subtests of xcatd_relocated_startup.t have the file
present, so neither reads what happens without it.

Add a subtest that removes the file: each EnvironmentFile of the unit
carries a leading -, which makes a missing file not an error, XCATROOT
is the default of the unit, and the daemon starts with that default
instead of the installed prefix. Dropping the default XCATROOT from the
unit fails checks 4 and 7 of that subtest.

Record the trade the file contexts make for a rootimg component in the
middle of an image root: the guest labels are kept, which leaves the
published kernel of that one layout unlabeled, so httpd cannot serve it
and that osimage cannot netboot. The note names the recovery.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 17:16:06 -03:00
Daniel Hilst 141f5b62ef Merge remote-tracking branch 'upstream/master' into feat/selinux-netboot
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>

# Conflicts:
#	.github/workflows/xcat_test.yml
2026-10-21 16:51:43 -03:00
Daniel Hilst 4ba2cd0d70 docs(selinux): the page says the daemon context is always in /opt/xcat
The page states that the context belongs to the file in /opt/xcat. The
prefix is now recorded at install time, so a relocated package starts
the daemon of its own tree, and the file contexts still name /opt/xcat.

Say both, so a reader of a relocated installation knows the entrypoints
need their own entries.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 16:50:52 -03:00
Daniel Hilst 3d58aefcba fix(xcat-core): a relocated xcatd loads the modules of another installation
xcatd.service sets XCATROOT and PATH to the literal /opt/xcat. The
previous ExecStart sourced xcat.sh, which %post generates from
RPM_INSTALL_PREFIX0, so a relocated package got its own prefix. With the
package installed under /srv/xcat the daemon symlink reaches
/srv/xcat/sbin/xcatd and the Perl search path still names /opt/xcat, so
xcatd cannot load its own modules unless the administrator overrides the
environment or a default installation is left behind.

%post writes /etc/xcat/xcatroot.env with XCATROOT and PATH built from
RPM_INSTALL_PREFIX0, and the unit reads it with EnvironmentFile. The
order is the default in the unit, then that file, then
/etc/sysconfig/xcat, so the recorded prefix replaces the default and the
site file keeps the last word. ExecStart stays a direct call, so the
kernel still enters xcat_t on the xcatd script. %preun removes the file
on erase. The file is not in %files, so rpm --verify is unaffected.

xcatd_relocated_startup.t fails 3 checks of its /srv/xcat subtest
without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 16:50:33 -03:00
Daniel Hilst 14f0f28477 test(xcat-core): no case starts xcatd from a relocated installation
xcatd_service_direct_exec.t reads the shipped unit on a default install,
where the prefix in the unit and the prefix of the installation are the
same path. It cannot fail when they differ, which is the case the
systemd startup has to get right.

xcatd_relocated_startup.t installs the built xCAT-server package twice,
once with the default prefix and once with rpm --prefix /srv/xcat. For
each one it composes the environment the unit gives ExecStart, in the
order the unit lists Environment and EnvironmentFile, then asserts
XCATROOT, that every xCAT directory on PATH is under that prefix, and
that the daemon the start command runs receives the prefix. The
/srv/xcat subtest fails 3 of its 11 checks before the next commit; the
/opt/xcat subtest passes either way.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 16:50:32 -03:00
Daniel Hilst 07ef2be0de 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>
2026-10-21 16:37:00 -03:00
Daniel Hilst 4487162ff6 test(xcat-core): no case has an image root called rootimg
The file contexts exclude a guest tree by the name rootimg at any depth
under /install. The native lookup case has no image whose profile is
rootimg, so nothing measured what happens when the image root itself
carries that name.

Add three images: a profile called rootimg, one called rootimg-statelite
and one whose name only contains rootimg. Each contributes its guest
files and its published files, so the case asks for both answers on the
same path depth. Record the choice for a rootimg component inside an
image root, which is ambiguous, and add four guest files whose own names
are published names.

54 of the 224 checks fail against the file contexts before the next
commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 16:37:00 -03:00
Daniel Hilst 21a0ad8089 Merge pull request #7962 from VersatusHPC/feat/uftp-rootimg-transport
feat(uftp): distribute stateless root images over UFTP multicast
2026-10-21 15:52:02 -03:00
Daniel Hilst a7bf2a180a Merge pull request #7967 from VersatusHPC/test/cumulus-discovery-bats
test(cumulus): exercise discovery key failure with Bats
2026-10-21 15:38:43 -03:00
Vinícius Ferrão 12e5a89b91 test(cumulus): wait for background listener probes 2026-10-21 14:35:09 -03:00
Vinícius Ferrão 07f3442380 test(cumulus): isolate the key-generation failure
Use a valid provisioning URL so the missing-master path cannot satisfy the
expected key-generation failure status.
2026-10-21 14:35:09 -03:00
Vinícius Ferrão b6334f7f55 docs(test): update Cumulus discovery test instructions 2026-10-21 14:35:09 -03:00
Vinícius Ferrão cc603ea2c0 test(cumulus): exercise discovery key failure with Bats
Run the complete discovery postscript in the shared shell sandbox. Keep the
key-generation, exit-status and listener side-effect checks. Preserve the
dedicated CI step and its cancellation condition.
2026-10-21 14:18:21 -03:00
Daniel Hilst 4deb10d9ca Merge pull request #7965 from VersatusHPC/docs/shared-profile-maintenance
docs(profiles): explain shared profile maintenance
2026-10-21 14:15:31 -03:00
Daniel Hilst 40292a1019 Merge pull request #7957 from VersatusHPC/fix/genesis-header-redraw
fix(genesis): clear stale identity text from the console header
2026-10-21 13:14:47 -03:00
Daniel Hilst 383f85ea14 Merge pull request #7961 from VersatusHPC/refactor/r26-fips-policy
refactor(fips): share shell policy across runtime artifacts
2026-10-21 13:13:12 -03:00
Vinícius Ferrão 632f700e44 docs(uftp): list openEuler among the UFTP images
openEuler stateless images use the rh genimage and dracut modules,
which add the UFTP receiver, and xcat-dep now builds uftp for the
openEuler targets. List openEuler with the supported images and the
uftp package.
2026-10-21 11:44:23 -03:00
Vinícius Ferrão 126a468117 docs(uftp): describe UFTP root image distribution
Describe how genimage, nodeset, the listener and the booting node work
together, the supported images, the cases that nodeset refuses, and
what a transfer trusts. Describe the listener setup, the firewall and
multicast requirements, service nodes, and the transfer rate and jumbo
frame settings. Add the rootimgtransport attributes of the site and
the osimage to the reference pages.
2026-10-21 11:44:23 -03:00
Vinícius Ferrão c0f99c235b test(uftp): cover the UFTP marker in imgexport and imgimport
The export of an image must name the UFTP marker of its initial
ramdisk, and the import must place the marker next to the ramdisk. An
import from a bundle that names the marker but lacks it must fail and
leave the published files.
2026-10-21 11:44:23 -03:00
Vinícius Ferrão 1cf8dcc5e3 feat(uftp): keep the UFTP marker through imgexport and imgimport
nodeset refuses a uftp image unless the marker that genimage wrote
matches its initial ramdisk. imgexport did not carry the marker, so an
imported image could not use UFTP until genimage ran again. imgexport
and imgimport now carry it like the root image check marker.
imgimport refuses a bundle that names the marker but lacks it, before
it replaces any boot file.
2026-10-21 11:44:23 -03:00
Vinícius Ferrão 8a425dcde8 test(uftp): cover the UFTP boot arguments of nodeset
The anaconda, sles and debian plugins must pass the listener port and
the server key fingerprint only for a stateless image set to uftp,
directly or from the site value. They must refuse a node for a managed
argument in addkcmdline, a turned off check, an https image URL, an
initial ramdisk without the receiver, a missing listener
configuration, or an unknown transport. A refused node must keep the
kernel and initial ramdisk in TFTP. A statelite ramdisk image must
ignore site.rootimgtransport.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão 9a7a690ec7 feat(uftp): pass the UFTP boot arguments in nodeset
nodeset adds xcat.uftp= and xcat.uftpfp= to the kernel command line of
a stateless node whose image has rootimgtransport uftp, directly or
from site.rootimgtransport. The node then receives the root image over
UFTP and downloads it over HTTP when that fails.

nodeset refuses a node when its image cannot use UFTP. That is the case
when the root image check is off, the image URL uses https, or the
image has a BitTorrent .metainfo file. It is also the case when the
listener does not serve the image directory, or the initial ramdisk
that nodes will boot is not the one that genimage marked as having the
receiver. nodeset also refuses a node whose linuximage.addkcmdline or
bootparams.addkcmdline sets either argument. nodeset checks this before
it copies the boot files to TFTP, so a refused node keeps its current
boot entry and the kernel and initial ramdisk that the entry names.
Statelite images ignore the attribute, as it applies to stateless
images only.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão 621c460a21 test(uftp): cover the UFTP receiver of Ubuntu stateless nodes
The Ubuntu xcatroot must receive an image over UFTP under dash and
check it like a download. It must read the UFTP arguments from the
kernel command line, which has them, and not from its environment,
which does not.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão 0c160da2d0 feat(uftp): receive the root image over UFTP on Ubuntu stateless nodes
genimage gives the stateless dracut initial ramdisk of an Ubuntu image
the same UFTP receiver as an EL image, under the same conditions.
xcatroot receives the first copy of the image over UFTP when nodeset
asks for it, and checks it like an HTTP download.

The kernel does not pass an argument with a dot, such as xcat.uftp=,
to init as a variable. The Ubuntu xcatroot reads these arguments with
the dracut getarg function, in a subshell, so its other variables keep
their sources.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão dc84312cd0 test(uftp): cover the UFTP receiver of SLES stateless nodes
The SLES xcatroot must receive an image over UFTP and check it like a
download, and fall back to HTTP in the same cases as the EL scripts.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão a4cef2c4ce feat(uftp): receive the root image over UFTP on SLES stateless nodes
genimage gives the stateless initial ramdisk of a SLES or openSUSE Leap
image with dracut 033 or later the same UFTP receiver as an EL image. It
adds the helper and uftpd when the image has the UFTP 5 receiver of
xcat-dep for its architecture, checks the built ramdisk, and marks it
for nodeset. xcatroot receives the first copy of the image over UFTP
when nodeset asks for it, and checks it like an HTTP download.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão d4ea2c6c51 test(uftp): cover the UFTP receiver of EL stateless nodes
genimage must add the helper only for an image with the UFTP 5 receiver
of xcat-dep for its architecture, and remove an older copy otherwise. It
must fail when the built ramdisk lacks the receiver files. The marker
must follow the published ramdisk.

The helper must ask the listener only for a digest that the checksum
file lists for the image, and stop its receiver on every failure.
xcatroot must check a received image like a download. It must fall back
to HTTP when UFTP fails, is not set up, or the image is not checked.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão 3dcf4bdef7 feat(uftp): receive the root image over UFTP on EL stateless nodes
genimage adds the UFTP fetch helper and uftpd to the stateless initial
ramdisk of an EL image that has the UFTP 5 receiver of xcat-dep for its
architecture. It checks that the built ramdisk holds the receiver files.
It writes a marker with the digest of the published ramdisk, which
nodeset compares before it asks for UFTP. Without a usable receiver,
genimage removes the helper and the marker.

When nodeset passes xcat.uftp=, xcatroot receives the first copy of the
image over UFTP. The helper asks the listener for the archive that the
checksum file names, as fetched before the request. xcatroot checks the
received file against the checksum file like an HTTP download. A
mismatch or a failed transfer is followed by the HTTP download loop.
UFTP is used only together with rootimgchecksum=yes.
2026-10-21 11:44:21 -03:00
Vinícius Ferrão 0f2f1cfd05 test(uftp): cover the UFTP transfer listener and its package removal
The listener must send the requests for one archive with one sender. It
must refuse paths outside the image roots, archives without a checksum,
and digests that the checksum file does not list. A queued batch must
keep its archive after the next publication. The limits on
connections, queued jobs, senders, receivers and time must hold. Package
removal must stop and disable the service, and an upgrade must leave it
alone.

The unit test calls the listener subs of xCAT::UFTP in process, with a
fixed clock and a sender start that it records. native/uftp_listener.t
runs the listener script with uftp and uftp_keymgt fixtures. It covers
key creation, a read-only log directory, sender processes, shutdown and
connection limits. The pull-request workflow runs it.
2026-10-21 11:44:21 -03:00
Vinícius Ferrão 199e4733a7 feat(uftp): add the UFTP transfer listener
Booting nodes need a server that sends a published root image once to
every node that asks for it in a short window.

xcat-uftp-listener accepts HTTP/1.0 GET requests that name an image
path and its digest. It serves only an archive that packimage published
under the configured image roots, for a digest that the checksum file
lists. It keeps the archive open from the first request, so a later
packimage does not change the bytes of a queued batch. It collects the
requests for the same inode, digest and port for batch_delay seconds,
then runs one closed-group uftp session for the batch. Connections,
queued jobs, senders and receivers per job are limited.

The sender gets an argument vector built only from the configuration,
and signs the encrypted session with a persistent server key. It drops a
receiver that misses nearly every block of a section, so one node
without multicast cannot hold the session open. A sender that is not the
UFTP 5 build of xcat-dep is refused.

block_size allows larger packets on jumbo frame networks, up to the
8800-byte limit of uftp.

xCAT::UFTP holds the decisions of the listener: request checks, batches,
limits, timeouts and the runtime check. The script holds the sockets,
the key commands and the sender processes.

The packages install the service but do not enable it. Package removal
stops and disables it.
2026-10-21 11:44:21 -03:00