2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 17:02:15 +00:00
Commit Graph

137 Commits

Author SHA1 Message Date
Daniel Hilst f775471804 test(xcat-core): the OpenEmbedded Genesis DUID matches no reservation
The OpenEmbedded Genesis image sets ipv6.dhcp-duid=ll, so NetworkManager sends a
DUID-LL. makedhcp builds a DUID-UUID from vpd.uuid, and kea_node_reservations6 puts
either a duid or a hw-address in a reservation, never both. A node that reported an
SMBIOS UUID therefore gets a DUID-only reservation that its DUID-LL cannot match: it
takes a pool address with no bootfile-url and does not netboot over IPv6. The legacy
image is correct here, because doxcat writes a DUID-UUID in firmware order.

genesis_openembedded_duid.bats asserts the image turns the SMBIOS UUID into the same
DUID that xCAT-test/bats/genesis_duid_uuid.bats pins for the legacy image, and that a
node with no SMBIOS UUID keeps the DUID-LL, which is what a hw-address reservation
needs. genesis_openembedded_duid.t covers the unit that writes it before
NetworkManager, and genesis_metadata.py covers the installed files.

All 15 assertions fail on this commit: there is no genesis-duid script and no unit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 17:51:45 -03:00
Daniel Hilst ca5587a73b Merge pull request #7976 from VersatusHPC/fix/debian-package-lifecycle
fix(debian): preserve upgrade context and skip chroot service actions
2026-10-26 14:41:46 -03:00
Daniel Hilst d28b9c31ca Merge pull request #7981 from VersatusHPC/fix/release-source-only-signing
fix(build): preserve binaries in source-only runs
2026-10-26 11:44:23 -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 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 a289434ae8 test(build): cover source-only repository preservation
Run the real finalization command with empty, unsigned and differently signed binary repositories, including absent and retained aliases.

Check binary bytes, modes and timestamps across unsigned and repeated signed runs. Verify source package checksums and signatures with a separate source key.
2026-10-23 11:50:49 -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 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 11e6e642c4 test(debian): cover interrupted management package transactions 2026-10-22 18:01:36 -03:00
Vinícius Ferrão a7d7b85c7c test(build): limit the upgrade log allocation fault 2026-10-22 17:33:44 -03:00
Vinícius Ferrão b6f9294a79 test(debian): exercise service callers in proc-mounted chroots 2026-10-22 17:33:44 -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
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 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
Vinícius Ferrão 8c6ba3b2c0 test(netboot): exercise firewalld cleanup with Bash and dash
Execute each profile through /bin/sh. Check both firewalld entries as
regular files, valid links, dangling links, directories and missing paths.
Preserve unit targets, unrelated links and the older profiles without this
cleanup.
2026-10-21 18:07:22 -03:00
Vinícius Ferrão 402f398bb1 test(netboot): cover SELinux settings across postinstall profiles
Execute all affected owners and their aliases in isolated image roots. Check
policy contents and metadata, missing files, repeated runs and host
sentinels. Run the cases in Ubuntu and EL CI.
2026-10-21 18:07:11 -03:00
Vinícius Ferrão 33fee7bb0d test(netboot): resolve the shell mount target in profile tests
Older bubblewrap releases reject a symlink mount destination. Bind Bash over
the resolved shell path without changing the profile cases.
2026-10-21 17:52:06 -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 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 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
Vinícius Ferrão d90c9e6f53 test(build): verify signed repository package checksums 2026-10-21 16:09:57 -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
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 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
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 262bf12ae4 docs(test): describe Genesis header redraw coverage 2026-10-21 11:43:54 -03:00
Vinícius Ferrão 82fa33a0eb test(genesis): cover console header identity changes 2026-10-21 11:43:34 -03:00
Daniel Hilst 4ee82d40d8 fix(xcat-core): a stateless node is told to run SELinux and cannot boot
netboot_supported() answered 1 for rhels8 and later and for every
openEuler, so mknetboot wrote no selinux= argument and a stateless node
was asked to run SELinux enforcing. It does not boot.

A stateless root is a cpio archive unpacked into tmpfs, and cpio carries
no SELinux label, so the root starts unlabelled. Three boots of an
AlmaLinux 10.1 image on an enforcing node measured both ways out of
that, on cluster xcat163:

- With the stock dracut selinux module, which this branch added to the
  module list, the policy loads at pre-pivot 50 over the unlabelled
  initramfs. 61 Permission denied lines follow, setfiles returns 126 and
  the node loops. That module ships with check() returning 255, so no
  image enables it by accident.
- Without it, and with the relabel hook corrected, setfiles labels the
  root: /usr/lib/systemd/systemd reads init_exec_t. systemd then loads
  the policy after switch_root, cannot relabel /dev or /run, and stops
  with "Failed to allocate manager object. Freezing execution".

The hook could not have worked as written either. It read the mode with
sed piped into tail, and the initramfs has neither tail nor chroot:
chroot arrived with the selinux module. The console reported "tail:
command not found" twice and relabelled nothing.

So netboot_supported() answers 0, mknetboot writes selinux=0 for every
stateless node and nodeset says why. The code that only serves a
stateless node with SELinux on is removed with it: the relabel hook and
its two installers, the selinux dracut module, write_image_config, and
the squashfs label machinery that stored labels nothing reads. The
netboot postinstalls and the stateless xcatroot write SELINUX=disabled
again, so the image says what the kernel command line does.

What stays is what was measured working: a diskful node provisioned
enforcing with zero xCAT denials, the kickstart templates, the policy
package, and the service node mount options.

Tests: selinux_netboot_kcmdline.t fails 34 of its 69 checks on the
parent commit. selinux_cn_diskless_disabled_by_design in cases1
provisions a stateless node asked for enforcing and requires selinux=0
on its command line and getenforce Disabled. selinux_image_config.t and
selinux_squashfs_labels.t go with the subs they tested.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:35:22 -03:00
Daniel Hilst fabfaedc89 feat(xcat-core): provision compute and service nodes with SELinux enabled
Every compute and service node was provisioned with SELinux disabled.
mknetboot added selinux=0, the kickstart templates said selinux
--disable, and the genimage postinstall and the dracut hooks wrote
SELINUX=disabled into the image. noderes.selinux and site.selinux had no
consumer on the node side.

The mode that xCAT::SELinux->node_modes resolves now reaches the node:

- Kernel command line: mknetboot appends kcmdline_selinux(): selinux=0
  for disabled, enforcing=0 for permissive, nothing for enforcing. An
  image built without the relabel hook (EL7 and older), and a squashfs
  image without labels, boot with selinux=0 and nodeset says why.
  Test: selinux_netboot_kcmdline.t.
- Kickstart: #SELINUXMODE# and #SELINUXRELABEL# in xCAT::Template. The
  rh el8/9/10, riscv64 and openEuler templates use them; the %post ends
  with restorecon -RF over the paths the xCAT scripts write. mkinstall
  warns when a template cannot express the mode of the node.
  Test: selinux_kickstart_template.t.
- genimage: the el8-10 postinstalls no longer write SELINUX=disabled, and
  the stateless xcatroot no longer writes /etc/sysconfig/selinux. genimage
  sets SELINUX=enforcing in the image, adds dracut 98selinux, and installs
  a pre-pivot hook that runs setfiles with the image file_contexts unless
  selinux=0 is set. Tests: selinux_image_config.t, selinux_relabel_hook.bats.
- packimage -m squashfs stores the labels of the image policy through
  mksquashfs pseudo xattr definitions (squashfs-tools 4.6 or later), and
  writes rootimg.sfs.selinux beside the image. Test:
  selinux_squashfs_labels.t.
- Service nodes mount /install and /tftpboot from the management node with
  context=public_content_t and tftpdir_t when SELinux is on.
  Test: selinux_sn_mount_options.t.
- makedns no longer warns about SELinux. xcatprobe xcatmn checks the xcat
  module and the labels of installdir and tftpdir instead of failing on
  enforcing. Test: probe_utils_selinux_policy.t.

The selinux/cases1 xcattest cases provision a diskful, a stateless and a
squashfs node enforcing, and a stateless node with site.selinux=disabled.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:33:16 -03:00
Daniel Hilst b74a0f27aa Merge upstream/master into refactor/r26-fips-policy
Two files needed a resolution. Both are unions of independent additions.

XCAT::Test::Lifecycle::build_deb takes master's new $source argument and its
-xpf extraction, and keeps the control-$arch selection this branch adds for
xCAT-genesis-scripts. $source defaults to the repository root, so the branch
behaviour does not change.

.github/workflows/xcat_test.yml keeps master's profile_package_payload.t on
both lifecycle prove lines and master's Perl module list, and keeps this
branch's FIPS steps, bzip2 and openssl.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:32:47 -03:00
Daniel Hilst 3a7c1d66a8 Merge master into feat/selinux-netboot
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 08:53:16 -03:00
Daniel Hilst 47168d7adf Merge pull request #7934 from VersatusHPC/refactor/r26-provisioning-reuse
refactor(provisioning): share package defaults and identical profiles
2026-10-21 08:21:57 -03:00
Vinícius Ferrão 32a98d6d99 docs(test): describe Genesis policy and terminal coverage 2026-10-20 13:09:32 -03:00
Vinícius Ferrão 8dab5e4989 test(genesis): exercise maintenance shell confirmation and return 2026-10-20 13:09:32 -03:00
Vinícius Ferrão 385f641e03 test(genesis): exercise journal follow and navigation 2026-10-20 13:09:32 -03:00
Vinícius Ferrão 2281b14a13 test(genesis): exercise live console status and diagnostics 2026-10-20 13:09:31 -03:00
Vinícius Ferrão 516e915bcc test(genesis): exercise the NetworkManager wait-online policy 2026-10-20 12:03:51 -03:00
Vinícius Ferrão fa233e6d36 test(packaging): cover Debian profile permissions from writable sources
Preserve source modes when staging Debian package builds and accept a
private source fixture. Build group-writable profiles under umasks 0022
and 0002, then check the extracted data, postscripts and directories.

Verify that staging and packaging leave source permissions unchanged,
including a world-writable data file. Reuse the payload checks for normal,
reduced and permission-regression builds.
2026-10-19 19:33:33 -03:00
Vinícius Ferrão 91e19b16b1 test(profiles): check packaged modes independently of checkout
RPM preparation removes group write permission from source files. Assert the packaged data and postinstall modes instead of comparing them with checkout permissions. Report modes in octal and keep the content, alias and customization checks.
2026-10-19 19:29:26 -03:00
Daniel Hilst 37a25b0fbc Merge master into feat/selinux-netboot
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-19 16:11:59 -03:00
Vinícius Ferrão 7f3a0acf8e test(profiles): retain Rocky assets in the reduced RPM 2026-10-19 12:17:03 -03:00
Vinícius Ferrão 16ebc98702 test(ubuntu): cover package-list aliases across releases and architectures 2026-10-19 12:17:03 -03:00
Vinícius Ferrão 4a894610a5 test(profiles): exercise packaged assets and custom profile precedence 2026-10-19 12:17:03 -03:00
Vinícius Ferrão a13ecfe9c6 test(ubuntu): cover shared mirror defaults through provisioning callers 2026-10-19 11:30:49 -03:00
Vinícius Ferrão f9024b9fd2 docs(test): describe journal selection rollover coverage 2026-10-18 19:28:55 -03:00