2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-20 09:22:17 +00:00
Commit Graph

29183 Commits

Author SHA1 Message Date
Daniel Hilst cd0a7fd8a9 test(xcat-core): the Genesis payload carries no openssl config, so no certificate is requested
A node boots Genesis, prints "Getting initial certificate --> MN:3001" and goes no
further. xcatd records no credential request, the node status stays at powering-on,
and every case that waits for the node fails.

genesis_openssl_config.bats drives each dracut module's install() with the dracut
helpers replaced by a recorder, so it reads what the module asks the payload to carry.
genesis_getcert_missing_openssl.bats gains one case: the give up message must repeat
what openssl printed, because a message naming only certkey.pem sends the reader to a
key that is intact.

Three of the six cases fail on this commit: both module cases, and the message case.

stub_dir defaulted count to the empty string, which left "{ ; exit 1; }" in the
openssl stub. That is a syntax error, so the stub failed for the wrong reason and
reported bash's message instead of openssl's. The default is now a no-op command.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 08:50:59 -03:00
Daniel Hilst 56a009bf8d Merge pull request #7908 from VersatusHPC/feat/selinux-netboot
feat(xcat-core): SELinux support
2026-10-23 16:44:51 -03:00
Daniel Hilst 88e3a727a9 Merge pull request #7982 from VersatusHPC/fix/genesis-base-deb-loader-perms
fix(xCAT-genesis-base): the deb ships a Genesis loader with no execute bit, so every node panics
2026-10-23 16:04:19 -03:00
Daniel Hilst 6cab708941 Merge pull request #7969 from VersatusHPC/fix/boot-state-correctness
fix(boot): preserve GRUB files and correct Destiny completion
2026-10-23 15:19:33 -03:00
Daniel Hilst c768025739 Merge upstream/master into feat/selinux-netboot
Twelve conflicts, all from xcat-core/#7970 landing.

Eleven are the one sed line in the netboot postinstall profiles, where #7970 and
this branch replaced the same line with different patterns. Master's wins: it
anchors on optional leading blanks and preserves a trailing comment, which this
branch's `s/^SELINUX=.*$/SELINUX=disabled/` would have eaten. This branch's own
postinstall_selinux_config.bats asserts "the comment that names permissive keeps
its text", so the better pattern is the one its test already wanted -- 6 of 6
pass on master's version. What master's pattern does not catch is a value
outside enforcing|permissive, which nothing here tests and no stock config
ships.

The twelfth is .github/workflows/xcat_test.yml: master added a step to the
existing job and this branch adds a whole selinux_policy_test job after it.
Resolved as the union, with master's step where it put it; the file still parses
and names three jobs.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-23 14:42:37 -03:00
Daniel Hilst f4f89c0b49 Merge pull request #7970 from VersatusHPC/fix/netboot-profile-shell-selinux
fix(netboot): correct SELinux settings and firewalld cleanup
2026-10-23 14:39:55 -03:00
Daniel Hilst 37117ab00e Merge pull request #7971 from VersatusHPC/fix/syncfiles-diagnostics-coverage
fix(syncfiles): retain the client name when node lookup fails
2026-10-23 14:38:01 -03:00
Daniel Hilst f095318154 Merge pull request #7975 from VersatusHPC/fix/postscript-route-syslog
fix(postscripts): scope IPv6 gateways and create the syslog directory
2026-10-23 14:36:53 -03:00
Vinícius Ferrão 2de8d308ed test(destiny): cover mixed completed and active chain requests 2026-10-23 14:11:34 -03:00
Vinícius Ferrão d83bf58d9e fix(destiny): preserve enactment when other nodes have completed 2026-10-23 14:11:34 -03:00
Vinícius Ferrão 9b47f76ca2 test(destiny): distinguish complete and overlapping chain states 2026-10-23 14:11:34 -03:00
Vinícius Ferrão 97a0c8d7ac fix(destiny): match complete states when advancing the chain
Substring and regular-expression matches can mistake a different boot state
or image name for a completed chain. Compare the full state values while
preserving the completed boot exception.
2026-10-23 14:11:33 -03:00
Vinícius Ferrão e5df3dde1b test(grub2): preserve boot artifacts on rejected updates 2026-10-23 14:11:33 -03:00
Vinícius Ferrão d9936e4a60 fix(grub2): validate boot inputs before replacing configuration
Rejected protocols, unresolved addresses and missing loaders can leave a
partial configuration after removing the previous files. Check these inputs
before replacing the node configuration and its aliases.
2026-10-23 14:07:54 -03:00
Daniel Hilst 09e277a6a1 fix(xcat-genesis-base): the deb ships a Genesis loader with no execute bit, so every node panics
An Ubuntu node that netboots legacy Genesis dies with

  Failed to execute /init (error -13)
  Kernel panic - not syncing: No working init found.

xCAT-genesis-base/debian/rules is a bare `dh $@`, so dh_fixperms applies its
*.so* rule to the whole package. That is right for a Debian shared library and
wrong for a netboot ROOT FILESYSTEM: the kernel execs the payload's dynamic
loader, and a loader with no execute bit makes open_exec() return EACCES, so
every ELF in the image fails to start. mknb copies the tree verbatim into
genesis.fs.<arch>.lzma, so the mode travels into the image. The pipeline's iPXE
command line carries `quiet`, which hid the reason.

Measured on xcat-master-ub from the installed package:
  644 .../netboot/genesis/x86_64/fs/usr/lib64/ld-linux-x86-64.so.2
  755 .../netboot/genesis/x86_64/fs/usr/bin/basename

and reproduced away from the lab: that management node's own kernel and image
under qemu panicked at 35 seconds, a repack with no change panicked again, and a
repack with only chmod 0755 on the loader reached /init and started dracut.

The EL rpm is unaffected, because it never runs dh_fixperms. This is why only
the Ubuntu genesis-legacy cell saw it, and why that cell has never had a
non-mock green. It is not a regression: the same recipe builds the published
xcat-genesis-base-amd64.

The bit is restored AFTER dh_fixperms rather than excluding the tree with -X,
which would also skip its chown 0:0 pass and ship the payload owned by the build
user.

genesis_deb_loader_executable.t asserts the override exists, still calls
dh_fixperms, is scoped to the netboot tree, names both the glibc and the ppc64le
loader, and runs the chmod AFTER dh_fixperms. Three of its ten assertions fail
without the override, and the ordering assertion fails if the chmod is moved
first -- which is the mistake that looks correct.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-23 12:16:02 -03:00
Daniel Hilst 5b0127e0fb Merge pull request #7968 from VersatusHPC/fix/release-metadata-checksums
fix(build): refresh RPM metadata after signing
2026-10-23 10:55:14 -03:00
Daniel Hilst 422c156e9e Merge pull request #7980 from xcat2/fix/grub2-aarch64-efi-bootfile
fix(grub2): give aarch64 nodes a boot file name ending in .efi
2026-10-23 10:52:51 -03:00
Daniel Hilst 236aafcc87 Merge upstream/master into feat/selinux-netboot
Two conflicts, both from xcat-core/#7978 landing on master.

build-utils/lib/XCAT/BuildUtils.pm: both branches added a package_skip_reason,
#7978 with a general @PACKAGE_SKIPS table and this branch with its own
%EL_ONLY_PACKAGES and a second sub. git merges them as separate hunks because
they sit apart in the file, and Perl takes the LAST definition, so keeping both
silently deletes whichever rule came first. There is now one table and one sub.
A rule names either the target prefixes that do NOT build the package, or, with
`only`, the pattern of the targets that DO. The second form is what an EL-only
package needs: naming the families that are not EL means a family added later
tries to build it, which is how openSUSE reached xCAT-selinux and failed
xcat-core-build-opensuse #42 on a missing selinux-policy-devel.

buildrpms.pl: an empty build plan takes upstream's answer, a clean return rather
than this branch's die. That is the decision #7978 exists for -- the dep
pipeline asks for xCAT-genesis-base alone and no openSUSE target builds it -- so
reinstating the die would fail a build that has nothing to do.

selinux_el_only_scope.t is 37 of 37 and opensuse_no_legacy_genesis.t 22 of 22 on
the merged tree, and the whole unit suite passes: 301 files, 9801 tests.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-23 10:26:24 -03:00
Daniel Hilst b11865612d Merge pull request #7978 from VersatusHPC/fix/opensuse-no-legacy-genesis-rebased
fix(xcat-core): openSUSE builds a Genesis payload its manifest cannot describe
2026-10-23 10:16:09 -03:00
Daniel Hilst 87f9e886d9 fix(xcat-core): xCAT-selinux is built for openSUSE, which has no selinux-policy-devel
xcat-core-build-opensuse #42 failed on three packages whose only error was
"No matching package to install: selinux-policy-devel", and took the whole
openSUSE family of xcat-ci #146 down with it. openSUSE Leap ships no
selinux-policy-devel, so the policy module has nothing to compile against.

package_skip_reason in build-utils/lib/XCAT/BuildUtils.pm tested the target
against /\Aopeneuler-/, because openEuler was the one non-EL family buildrpms.pl
targeted when the guard was written. openSUSE was enabled afterwards and matches
no arm of that test, so the EL-only package was selected for it.

The test is now on EL rather than on the families that are not EL, so a family
added later skips an EL-only package instead of trying to build it.

selinux_el_only_scope.t gains the two openSUSE targets. Without this change its
two new assertions fail and the other 35 pass.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-23 08:45:54 -03:00
Vinícius Ferrão 8bb6f4ef91 test(grub2): cover the aarch64 boot file name and node loader links
Drive the Kea reservation builder and the ISC makedhcp path for grub2
nodes of each architecture. Place the loader links in the site TFTP
directory or in noderes.tftpdir. An aarch64 node with only grub2-<node>
keeps that name. The table stub returns only the requested columns, so
a missing nodetype.arch or noderes.tftpdir read fails the aarch64 cases.

Drive grub2 setstate for the node loader links: both names for an
aarch64 node and one for the others. Cover a repeated nodeset, a node
with only the old link, and removal in the boot, offline and SLES 15
standby states.
2026-10-23 02:24:42 -03:00
Vinícius Ferrão 169f3d54eb fix(grub2): give aarch64 nodes a boot file name ending in .efi
Some aarch64 UEFI firmware ignores a DHCP boot file name that does not
end in .efi and requests grubaa64.efi from the TFTP root instead. xCAT
names grub2-<node>, so these nodes stop with a TFTP error before grub2
runs.

For an aarch64 node, nodeset now links grub2-<node>.efi to
grub2.aarch64 beside grub2-<node>. Both DHCP backends name the .efi
link once it exists in the node's TFTP directory (noderes.tftpdir, or
the site one). A node set by an older xCAT keeps grub2-<node> until its
next nodeset, so makedhcp after an upgrade does not name a missing
file. With site.sharedtftp off, every server that runs nodeset for the
node creates both links. This relies on service nodes running the same
xCAT version as the management node, which xCAT requires.

The old link stays for DHCP configurations that makedhcp did not
write. The boot and offline states remove both links. Other
architectures keep grub2-<node>.
2026-10-23 02:16:59 -03:00
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 c9ec8b4279 fix(xcat-core): openSUSE builds a Genesis payload its manifest cannot describe
xcat-dep-build-opensuse15-x86_64 fails its xCAT-genesis-base step. BuildRequires
resolve, and verify-genesis-payload then reports 566 missing zoneinfo/posix paths,
etc/redhat-release, and 45 EL paths and tool names -- net-tools-deprecated,
kmod-compat, iputils, systemd-sysvinit, timezone, nc, mkdosfs and the lvm symlinks.
The manifest is written for EL, so the package cannot be built on openSUSE.

openSUSE ships no legacy Genesis, so it does not need to be. package_skip_reason names
the pairs a target does not build and why, buildrpms.pl prints each skipped pair, and a
plan that skips everything returns 0 rather than failing: the dep pipeline asks for
xCAT-genesis-base alone, so on openSUSE its whole plan is empty and an empty plan is
the plan.

Dropping the package alone would make xCAT unresolvable there.
xCAT-genesis-scripts.spec requires xCAT-genesis-base-%{tarch} unconditionally and xCAT
requires xCAT-genesis-scripts, so zypper install xCAT would fail on a missing package
-- later than the build and looking like something else. That Requires now stands
behind %if ! 0%{?suse_version}; the Leap chroot's /usr/lib/rpm/suse/macros sets
%suse_version 1500, and no EL or openEuler target defines it.

xCAT-test/unit/opensuse_no_legacy_genesis.t covers the skip, the empty plan and the
conditional Requires.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 23:44:42 -03:00
Daniel Hilst f5a029c448 test(xcat-core): assert openSUSE builds and installs without legacy Genesis
Nothing holds the openSUSE Genesis scope down. xCAT-genesis-base is built for
every target the dep pipeline names, and xCAT-genesis-scripts requires the
payload on every family.

The test reads the build-plan decision and the payload requirement in the spec.
It fails on this commit: the build plan keeps xCAT-genesis-base for openSUSE,
and the requirement carries no condition.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 23:44:42 -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
Vinícius Ferrão ea4738a5ce test(syslog): verify directory setup and native log delivery
Execute the complete postscript and check the daemon UID before real UDP
log delivery. Cover fresh and repeated MN/SN setup, restricted directories,
legacy ownership and modes, and a blocked directory path. Keep the upgrade
wrapper and forwarding cases as compatibility controls.

Select older configuration branches through their version-report boundary;
use the installed daemon, without claiming old-daemon qualification.
Run the isolated native cases in CI.
2026-10-22 15:07:00 -03:00
Vinícius Ferrão 60beaecead fix(syslog): create the local log directory before setting its owner
Create missing Debian-family log directories before assigning their owner.
Use mode 0750 for syslog-owned directories. In the legacy reference-owner
path, copy the parent directory mode so group-writing daemons retain access.
Preserve existing directory modes, log files and forwarding policy.

Stop with an error before restarting syslog if the directory cannot be
created. Keep existing ownership-command failures nonfatal.
2026-10-22 15:01:47 -03:00
Vinícius Ferrão d42f3e3150 test(route): exercise link-local gateways in network namespaces
Run routeop against real kernel routes. Cover repeated add, replacement,
deletion, another device, expanded addresses and failure preservation.
Check SLES, legacy Red Hat and Debian persistent records, including
unscoped records and neighboring interface names. Keep global-gateway
and connected-route controls.
2026-10-22 15:01:47 -03:00
Vinícius Ferrão cc206d5f1c fix(route): retain the device for IPv6 link-local gateways
Scope generic Linux route lookup and updates to the supplied interface for
link-local next hops. Retain the device in SLES routes, legacy Red Hat
route6 records and Debian interface commands. Remove matching saved
records without matching neighboring interface names, and migrate older
unscoped records when adding routes.

Keep global gateways, connected routes and NetworkManager policy unchanged.
2026-10-22 15:01:46 -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
Vinícius Ferrão 66a8b7786b docs(syncfiles): describe the isolated delivery fixture
Document the restricted certificate policy, required tools and cleanup limits. Distinguish the fixture from the default certificate-free postscript path.
2026-10-21 20:42:14 -03:00
Vinícius Ferrão ff2ec0d4ac test(syncfiles): verify authenticated hierarchy delivery
Exercise certificate policy and real SSH copies in a disposable MN/SN/node fixture. This test is opt-in and skips in ordinary CI without XCAT_SYNCFILES_LIVE_CONFIG.
2026-10-21 20:42:14 -03:00
Vinícius Ferrão 090deae902 test(syncfiles): exercise copy consumer identity precedence
Drive the real xdsh and DSHCLI parser from syncfiles and updatenode. Capture only the external copy boundary and preserve inherited identity behavior.
2026-10-21 20:42:14 -03:00
Vinícius Ferrão 7f77e90308 test(syncfiles): check unresolved client names and rejection
Check the original hostname in the unresolved-node diagnostic. Keep blank and missing-client rejection covered without sending a copy request.
2026-10-21 20:42:13 -03:00
Vinícius Ferrão 34ea500af7 fix(syncfiles): retain the client name when node lookup fails
Keep the original client name for the rejection diagnostic. Use the resolved
node only for dispatch, without changing identity or copy-command handling.
2026-10-21 20:09:17 -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