2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-30 06:12:19 +00:00
Commit Graph

29053 Commits

Author SHA1 Message Date
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 9b469b68d5 feat(xcat-core): record the SELinux default at the first install
xcatconfig recorded no SELinux mode at the first install, so an enforcing
management node left site.selinux unset and its nodes were provisioned
with SELinux disabled.

At the first install, xcatconfig now sets site.selinux to enforcing when
the management node is enforcing, and to disabled when it is permissive
or disabled. xCAT::SELinux->install_default makes the decision. An
existing site.selinux value stays, and an upgrade does not set it.
xcatconfig does not change the SELinux mode of the management node.

With the existing value ignored, 12 checks of xcatconfig_selinux_policy.t
fail. With a permissive mode recorded as permissive, 4 checks fail.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:30:47 -03:00
Daniel Hilst 057fe98ccf test(xcat-core): capture the site.selinux default of a first install
xcatconfig records no SELinux mode at the first install. A management
node that is enforcing therefore leaves site.selinux unset, and its nodes
are provisioned with SELinux disabled.

xcatconfig_selinux_policy.t now drives xCAT::SELinux->install_default for
each runtime mode with no value, an empty value and each existing value.
Only an enforcing node records enforcing, and an existing value is kept.
The test dies on this commit because install_default does not exist.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:30:47 -03:00
Daniel Hilst 9923aadb11 feat(xcat-core): resolve the SELinux mode of each node
No code resolved the SELinux mode of a node, so each provisioning path
would have to repeat the precedence and the platform rules.

xCAT::SELinux->node_modes returns the mode for each node. The noderes row
of the node comes first, then the noderes rows of its groups, then
site.selinux, then disabled. A node or group row can enable SELinux when
site.selinux is disabled. A node resolves to disabled when its OS is not
in the Red Hat, Fedora or openEuler families, when its OS is not known,
and when the node or its osimage is statelite. The OS and the provisioning
method come from the osimage row when nodetype.provmethod names one. An
optional hash reference receives the reason for each such clamp.

With the clamp removed, 7 checks of selinux_node_modes.t fail. With the
site value read before noderes, 5 checks fail.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:30:46 -03:00
Daniel Hilst 7e495f118a test(xcat-core): capture how the SELinux mode of a node is resolved
No code resolves the SELinux mode of a node from noderes.selinux and
site.selinux. Each provisioning path would need to repeat the precedence
and the platform rules.

selinux_node_modes.t drives xCAT::SELinux->node_modes with Perl stubs for
the noderes, nodetype and osimage tables and for site.selinux. It covers
the node row, the group row, the site value, an absent site value, a node
that enables SELinux under a disabled site, an invalid value, the SLES and
Ubuntu clamp, the osimage OS and the statelite clamp. The test dies on
this commit because node_modes does not exist.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:30:46 -03:00
Daniel Hilst e0c12830fd feat(xcat-core): add site.selinux and noderes.selinux
xCAT had no attribute that selects the SELinux mode of a node.

site.selinux holds the default mode for the cluster. The values are
enforcing, permissive and disabled, and an unset key means disabled. The
new noderes.selinux column overrides it for a node or a group, and chdef
and lsdef show it as the selinux attribute of node and group objects.
Nothing reads the attributes yet.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:30:46 -03:00
Daniel Hilst c922dbcf52 test(xcat-core): capture the missing SELinux mode attributes
xCAT has no attribute that selects the SELinux mode of a node. The site
table help does not describe a selinux key, and noderes has no selinux
column, so neither the admin nor the provisioning code can set a mode per
site, group or node.

selinux_schema.t loads xCAT::Schema and checks the noderes.selinux column,
its description, the node and group object attribute, and the site.selinux
help. 18 of its 19 checks fail on this commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:30:46 -03:00
Daniel Hilst c12dfe3063 Merge remote-tracking branch 'upstream/master' into feat/selinux-netboot 2026-10-21 10:30:06 -03:00
Daniel Hilst ee6b4f5328 Merge pull request #7964 from VersatusHPC/fix/ci-run-bats-after-perl-failure
fix(ci): run Bats after Perl unit failures
2026-10-21 09:33:40 -03:00
Vinícius Ferrão e87e226412 Merge pull request #7963 from KevinSpek/fix-dead-links
docs: replace the dead GitGuys reference for remote branches
2026-10-21 09:22:52 -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
Daniel Hilst c0724ea08c Merge pull request #7959 from VersatusHPC/test/r26-oe-behavior-gaps
test(genesis): cover console interaction and NetworkManager policy
2026-10-21 07:59:14 -03:00
Vinícius Ferrão 9653713bdd test(ci): cover Perl and Bats failure combinations
Exercise the full driver with either or both unit suites failing. Check
execution order, both result messages, and the final exit status.

Allow multiple command failures in the fixture. Encode logged commands as
JSON arrays for compatibility with older JSON::PP versions.
2026-10-20 16:20:29 -03:00
Vinícius Ferrão a1b2ac7a80 fix(ci): run Bats after Perl unit failures
Run both unit suites before stopping the CI driver. Preserve the failure
of either suite and leave later phases blocked when either suite fails.
2026-10-20 16:14:13 -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
Kevin 3926cafcff docs: replace the dead GitGuys reference for remote branches 2026-10-20 18:42:34 +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 214cbd4c9a test(profiles): accept owner-only executable source assets
A restrictive checkout umask can remove group and other execute bits.
Require the owner execute bit on source postinstall files and reject all
execute bits on data files. Native package tests still require exact modes.
2026-10-19 19:47:59 -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 0ad1448564 fix(packaging): remove write access from Debian profile payloads
Group-writable sources leave install and netboot assets writable by other users in the Debian package. Remove group and other write permission from those two staged trees. Preserve executable bits and leave source files and the rest of the payload unchanged.
2026-10-19 19:31:25 -03:00
Vinícius Ferrão fa29763b71 test(profiles): allow group-writable source checkouts
Check executable bits when selecting source profiles. Exact package modes remain covered by the native payload test.
2026-10-19 19:29:44 -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 306723152f Merge pull request #7958 from VersatusHPC/fix/genesis-journal-selection
fix(genesis): retain the selected journal entry across history rollover
2026-10-19 16:14:11 -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 0d1e044ea9 refactor(ubuntu): share identical release and architecture package lists 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 adaff490cf refactor(profiles): share identical EL10 RISC-V assets
Use relative aliases for identical shipped profiles. Keep their public names,
resolved contents and executable modes. Custom copies remain independent.
2026-10-19 11:48:36 -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 2a5b55da47 refactor(ubuntu): share architecture-specific APT mirror defaults 2026-10-19 11:30:48 -03:00
Vinícius Ferrão 6931621d65 test(pkglist): cover shared line filtering through both readers
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-10-19 11:30:48 -03:00
Vinícius Ferrão db6cec2b80 refactor(pkglist): share package-list line filtering
Share line normalization and directive filtering across the legacy text
reader, its include reader and the record reader. Keep leading whitespace
in legacy includes and leave each parser expansion policy unchanged.

Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-10-19 11:30:48 -03:00
Vinícius Ferrão f9024b9fd2 docs(test): describe journal selection rollover coverage 2026-10-18 19:28:55 -03:00
Vinícius Ferrão 53a2b75d49 test(genesis): cover paused journal selection during rollover 2026-10-18 19:28:55 -03:00
Vinícius Ferrão 5d125637ee fix(genesis): retain the selected journal entry across history rollover
A paused journal view restores a row number after refreshing its history.
When older records leave the window, that row selects a different entry.

Match the selected entry by its journal cursor and retain its wrapped-line
position. If the entry has left the window, select the oldest retained row
without resuming follow mode.
2026-10-18 19:06:39 -03:00
Daniel Hilst b5f48f2089 Merge pull request #7956 from VersatusHPC/fix/genesis-first-journal-entry
fix(genesis): retain the first entry in the journal view
2026-10-17 18:55:12 -03:00
Daniel Hilst 44386f7a47 Merge pull request #7960 from VersatusHPC/fix/imgimport-restore-boot-files
fix(imgport): put back the image when its definition cannot be written
2026-10-17 18:53:05 -03:00
Vinícius Ferrão 431bd0c23f test(imgport): cover the boot files after a failed definition write
Each failure of the definition write runs over a published image, an
image without a checksum, a new image, or a statelite image. The
previous root image, checksum, metainfo, kernel and ramdisk must be
back, and the files of a new image must be gone. When a row does not go
back, also after a changed rootimgdir, the new files must stay. The
publication lock must be held during the writes and released after
them. A row written before its call failed must keep the new files.
2026-10-17 00:16:05 -03:00
Vinícius Ferrão c0f1bef473 fix(imgport): put back the boot files when the definition is not written
imgimport publishes the root image, kernel and ramdisk before it writes
the image definition. When the database refused or failed a write, the
new boot files stayed with the previous definition.

The import now holds the publication lock of the image from before it
places the files until the outcome of the definition is known. When the
definition is not written and its rows went back, it puts back the
previous files, with the checksum and metainfo of the root image. It
removes the files that had no previous version. While a row did not go
back, the new files stay, as that row can refer to them.
2026-10-17 00:16:05 -03:00
Vinícius Ferrão 161a876f36 test(svrutils): cover a caller that holds the publication lock
A caller takes the publication lock, then publishes or removes a root
image under it. Another host must not get the lock meanwhile, the lock
must stay held until the caller releases it, and a lock that another
host left must be reported.
2026-10-17 00:16:05 -03:00
Vinícius Ferrão 06311b04bb feat(svrutils): let a caller hold the publication lock of a root image
The image lock is per host, so another host can publish a root image
between two steps of a caller. lock_rootimg_publication and
unlock_rootimg_publication let a caller hold the publication lock across
such steps. publish_rootimg takes the held lock, and the new
unpublish_rootimg removes an archive with its checksum and metainfo
under it.
2026-10-17 00:16:05 -03:00
Vinícius Ferrão 82f03324b3 test(imgport): cover the image rows after a failed definition write
The database refuses the linuximage, kit or kitrepo write, the
linuximage commit dies, or a kitrepo section of an unexpected shape
dies, after earlier rows are written. The osimage row, also a disabled
one, one with a quote in a value, or one whose disable column was NULL,
and a previous linuximage row with its rootimgdir must be back, and a
new linuximage row must be gone. A kit that another import uses and a
row that another writer changed or filled must stay. A restore that
fails, or a row that cannot be read back, must be reported.
2026-10-17 00:16:05 -03:00
Vinícius Ferrão 89a8fc78f4 fix(imgport): put back the image rows when a later definition write fails
set_config writes the osimage, linuximage and kit rows one by one. When
a later write failed, the rows written before it stayed. An image could
keep a new linuximage row, with a new rootimgdir, beside its previous
osimage row.

set_config now keeps the osimage and linuximage rows that it replaces,
disabled rows included. When a write or its commit fails, or bundle
data of an unexpected shape dies between the writes, it checks each row
that it tried to write. It writes changed rows back and removes the rows
that it added, with NULL values as NULL. It skips a row that another
writer changed or filled, so that change stays. set_config reports the
rows that did not go back, also to a caller that asks for their number.
Kit rows stay as written, because other images can use them.
2026-10-17 00:16:04 -03:00
Vinícius Ferrão a72899b5a1 test(imgport): cover a definition write that the database refuses
A database trigger refuses the write to the osimage or the linuximage
table after the import opened it. The write also dies, gets no reply,
dies after its row is written, or its commit dies. The import must fail
and name the table, unless the row is written. It must leave no
transaction open and keep the pending write of another request.
2026-10-17 00:16:04 -03:00
Vinícius Ferrão 20bc593b61 fix(imgport): fail an import when the database refuses its definition
imgimport ignored the result of each write of the image definition. A
write that the database refused left the previous rows, and the import
still reported success. The import now fails and names the table when a
write returns an error, returns no reply or dies, or its commit fails.
A row that holds the new values despite the failure counts as written,
with a warning.

After a failed write the import commits, as before. A rollback would
drop the pending writes of other requests, which share the transaction
of the table in the database worker.
2026-10-17 00:16:04 -03:00