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

11070 Commits

Author SHA1 Message Date
Vinícius Ferrão 3505c49b9a fix(anaconda): refuse to mix the RVA20 and RVA23 openEuler media
openEuler publishes RVA20 and RVA23 builds of each riscv64 release. Both
carry the same .treeinfo identity, so copycds copies the second one into
the directory of the first, and the result is a repository with packages
of two builds.

copycds now compares the .discinfo description, RVA23 or empty, with the
copy already in the target directory, and refuses a different build. Media
of the same build, and every other architecture, copy as before.
2026-11-02 19:55:57 -03:00
Vinícius Ferrão 4f8d099b19 fix(install): start kdump on openEuler nodes only with dump memory
On riscv64, an installed openEuler node reserves no dump memory, so
kdump.service fails and the node boots degraded.

The openEuler kickstart %post adds the kdump.service drop-in that
stateless images get. It runs before post.rhels8, which ends the %post
script with exit 0. A node whose command line carries crashkernel= or
fadump= still starts kdump.
2026-11-02 19:55:56 -03:00
Vinícius Ferrão 48c4f81b82 fix(netboot): start kdump on stateless nodes only with dump memory
openEuler diskless images enable kdump.service, which @core brings in. A
stateless command line reserves dump memory only through linuximage.dump
or addkcmdline, so on every other node kdump.service fails and the node
boots degraded.

genimage adds a kdump.service drop-in with triggering conditions on
crashkernel and fadump, so the service is skipped when the command line
has neither. POWER firmware-assisted dumps, which xCAT configures with
fadump= and no crashkernel=, still start. An image without kdump.service
is unchanged.
2026-11-02 19:37:46 -03:00
Vinícius Ferrão 0c9860fcfa fix(netboot): build and pack openEuler riscv64 diskless images
genimage and packimage admit openEuler images only for x86_64 and
ppc64le. For the riscv64 osimage that copycds creates, genimage stops with
"Unsupported openEuler release or architecture" and packimage with
"Unsupported openEuler image release or architecture".

Admit riscv64 in both commands.
2026-11-02 17:48:53 -03:00
Vinícius Ferrão a3d3926c70 fix(anaconda): publish the riscv64 boot loader of openEuler media
copycds looks for EFI/BOOT/grubriscv64.efi on riscv64 media. openEuler
media carry the same image as EFI/BOOT/grubriscv64.EFI, so copycds
publishes no grub2.riscv64. A management node with only openEuler media
then has no riscv64 network boot loader.

Match the image name case-insensitively, as UEFI does.
2026-11-02 17:48:53 -03:00
Vinícius Ferrão 2fb4e3b89a fix(anaconda): accept the openEuler riscv64 media
openEuler publishes 24.03 LTS installation media for riscv64, but the
openEuler media check admits only x86_64 and ppc64le. copycds stops with
"Unsupported openEuler architecture in .treeinfo".

Admit riscv64 as well. aarch64 stays refused.
2026-11-02 17:48:52 -03:00
Daniel Hilst c0698fa253 Merge pull request #7995 from VersatusHPC/fix/opensuse-mn-package-requires
fix(xcat-core): xCAT cannot be installed on an openSUSE management node
2026-10-30 09:57:51 -03:00
Daniel Hilst 10c30c80ba Merge pull request #7993 from VersatusHPC/fix/getpostscript-client-identity-v2
fix(xcat-core): getpostscript serves no node when the client reverse lookup is empty
2026-10-30 09:57:22 -03:00
Daniel Hilst 89b9213e4d Merge pull request #7977 from VersatusHPC/fix/boot-node-template
fix(boot): stop unsupported node-template keys from looping
2026-10-29 15:00:28 -03:00
Daniel Hilst ac0ec70821 Merge pull request #7979 from VersatusHPC/refactor/debian-profile-lookup
refactor(netboot): share profile asset selection
2026-10-29 14:58:18 -03:00
Daniel Hilst e3429791c6 fix(xcat-core): getpostscript serves a node's postscripts to a password or token login
With nodeauthentication off and no peer name, getpostscript used
_xcat_authname as the client identity and expanded it with noderange.
becomeuser and tokens set _xcat_authname to an account name, so a user
named after a node group received the postscripts of the first node in
that group.

xcatd now records the CN of the validated client certificate as
_xcat_certname, and only while no becomeuser or token replaced it. It
deletes any _xcat_certname the client sent. getpostscript uses that
name only when it names exactly one node, with no group or range
expansion. _xcat_authname is no longer a candidate.

getpostscript_client_identity.t drives the plugin with these requests.
On the previous head the group and node login checks fail, and
dropping the exact match fails the group and range checks.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-29 14:41:25 -03:00
Vinícius Ferrão 447db00a81 fix(netboot): keep profile helpers with shared image utilities
Shared image utilities must not require the Debian source directory.

Keep the profile helper beside imgutils and materialize the Debian copy
when building RPM and DEB packages. Source-only Debian copies must follow
symlinks; installed Debian directories stay self-contained.
2026-10-26 18:29: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 ef7989112f fix(xcat-core): xcatd does not start on an openSUSE node
xCAT installs on the leap15.6 node and the install gate still fails:

  GATE FAIL: xcatd not active
  GATE FAIL: lsdef cannot reach xcatd
  GATE FAIL: site.xcatdport not seeded

journalctl for xcatd has no entries, and loading the library by hand on the
node says why:

  Can't locate JSON.pm in @INC ... (@INC contains: /opt/xcat/lib/perl ...)

openSUSE has no perl-generators. Nothing generates a perl(...) requirement for
any xCAT package there, so no spec installs the modules its code loads, and
perl-xCAT names no Requires at all. Measured on xcat20-mn against the 85
external modules the EL build auto-requires: five are absent -- Date::Parse,
Expect, HTML::Form, JSON and SNMP -- and the other 80 are present.

Each openSUSE branch now names the modules EL's generator emits for that
package, as capabilities, so the same core build serves the sles15 and sles12
cells: both Leap releases provide all five, from perl-TimeDate, perl-Expect,
perl-HTML-Form, perl-JSON and perl-SNMP.

Verified with rpmspec that only openSUSE gets these; EL and openEuler are
unchanged and keep generating them.

xCAT-test/unit/opensuse_mn_requires.t fails on the commit before this one.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 10:22:32 -03:00
Daniel Hilst 844a5ba350 fix(xcat-core): xCAT cannot be installed on either openSUSE node
Both openSUSE test cells fail the install step:

  leap15.6: nothing provides 'perl-DB_File' needed by xCAT-server
  sles12:   nothing provides (/usr/sbin/dhcpd if openEuler-release else
            ((kea and kea-hooks) if (system-release >= 10) else
            /usr/sbin/dhcpd)) needed by xCAT

Two requirements are written for EL and have no answer on openSUSE.

xCAT-server asks for perl-DB_File. No package of that name exists on Leap
15.6 or 42.3: 15.6 calls it perl-core-DB_File and 42.3 has neither. Both
provide the capability perl(DB_File), so openSUSE asks for the capability.

xCAT and xCATsn ask for dhcpd through a rich dependency. The sles12 cell is
an openSUSE 42.3 management node whose rpm is 4.11, which has no rich
dependencies and reports the whole expression as an unprovided capability.
Neither Leap release carries kea and both carry chrony and ISC dhcpd, so
openSUSE takes the plain names the expressions resolve to there anyway. One
core build serves both openSUSE cells, so the openSUSE branch must emit no
rich dependency at all.

Verified per platform with rpmspec. openSUSE now gets perl(DB_File),
/usr/sbin/dhcpd and chrony; EL9 keeps perl-DB_File and both expressions; EL10
keeps perl-DB_File as a Recommends; openEuler keeps both expressions.

xCAT-test/unit/opensuse_mn_requires.t fails on the commit before this one.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 10:22:32 -03:00
Daniel Hilst d6392081db docs(xcat-core): the getpostscript comment retells an incident
The comment carried a date, a node, and the request counts from one run. The code
standard keeps bug history out of source comments: the fact a reader needs is that
the peer host is a reverse lookup and can be empty, which the remaining two sentences
state.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 10:02:47 -03:00
Daniel Hilst 6dfcdcbc48 fix(xcat-core): getpostscript serves no node when the management node cannot reverse-resolve it
A diskless openEuler 22.03sp4 node netbooted, took a lease, reached a login
prompt and answered ping, and then every xdsh and ssh answered
"root@xcat59-cn: Permission denied (publickey)" while the node never reported
"booted". reg_linux_diskless_installation_flat failed after 7072 s.

xcatd on that management node logged "xCAT: Allowing getpostscript xcat59-cn"
with no "from <peerhost>", then "Received malformed getpostscript requesting,
ignore it." -- 100 times, with 0 "Sending scripts data" in the whole log. The
green openEuler 24.03sp4 cell beside it logged 3 sends and 0 malformed. The
client certificate named the node correctly; only the reverse lookup of the
peer socket failed.

getpostscript read _xcat_clienthost and nothing else, so it dropped every
request. No postscript ran: remoteshell never installed root's
authorized_keys, which is the ssh failure, and nothing updated node status,
which is the stuck "powering-on". One cause, both symptoms.

process_request now tries each name xCAT::DiscoveryUtils::request_client_names
offers and takes the first that correlates to a node. A request that offers no
name at all, and one whose names correlate to nothing, are now reported as what
they are; the old message said the request was malformed, which sent two
investigations into DNS and the netboot image.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-24 11:28:41 -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 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
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 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 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
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
Vinícius Ferrão f44c46c640 refactor(netboot): share profile asset selection
Share the readable-file search between Debian genimage and imgutils.
Keep version fallbacks and path normalization with each caller so
Debian retains its existing search order and returned paths.
2026-10-23 01:39:53 -03:00
Vinícius Ferrão bb8bc944dd fix(boot): stop node-template expansion on unsupported keys 2026-10-22 21:09:32 -03:00
Vinícius Ferrão c76f53a826 refactor(boot): centralize node-template expansion 2026-10-22 20:53:11 -03:00
Vinícius Ferrão 103076c852 fix(debian): skip service actions inside proc-mounted chroots 2026-10-22 17:33:44 -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
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
Vinícius Ferrão 88915f34cf fix(netboot): use POSIX firewalld checks in postinstall profiles
Use separate test commands under /bin/sh. Remove regular files and symlinks,
including dangling links, while retaining absent entries and directories.
2026-10-21 18:07:11 -03:00
Vinícius Ferrão ce335ba3b3 fix(netboot): correct SELinux assignments in postinstall profiles
Match the complete enforcing or permissive setting. Preserve comments and
whitespace, and do not change unrelated lines or create a missing policy
file.
2026-10-21 18:01:27 -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 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 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 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 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 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 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 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 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
Daniel Hilst 10c2bd5d9b fix(xcat-core): the aarch64 postinstall SELinux substitution doubles the key
compute.rhels10.aarch64.postinstall arrived after the other netboot
postinstall scripts were anchored, and it carries the old pattern:
s/SELINUX=enforcing\|permissive/SELINUX=disabled/. The alternation binds
to the whole pattern, so the right branch is the bare word permissive.

On a permissive image the substitution writes SELINUX=SELINUX=disabled,
which no SELinux reads, and it rewrites the comment line that names
permissive. On a disabled image it still rewrites that comment.

Anchor the pattern to the SELINUX= line, as the other scripts do.
postinstall_selinux_config.bats fails three of its six checks against
this script before the change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:44:04 -03:00
Daniel Hilst e7b24beba7 fix(xcat-core): the netboot postinstall SELinux substitution doubles the key
The substitution had two unanchored alternatives, SELINUX=enforcing and the bare word
permissive. An image whose /etc/selinux/config reads SELINUX=permissive therefore gets
SELINUX=SELINUX=disabled, which the policy loader rejects, so the image boots with
SELinux enabled. The bare alternative also matches the comment that lists the three
values, so every image gets a rewritten comment line.

The substitution is now anchored on the whole assignment, the form xcatconfig already
uses. Thirteen scripts carry it, and eleven more postinstall paths are symlinks into
those files.

The postinstall scripts source no shared library, so each copy is edited in place.
Symlinks are how this tree already shares a postinstall between distributions.

The xcat_inventory fixture test1.postinstall is changed as well. cases.environment
names it as the postinstall attribute of an osimage, so genimage runs it on a real
diskless image.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:35:58 -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 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 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
Vinícius Ferrão 077e5f7b5d feat(uftp): add helpers for UFTP root image distribution
Booting nodes, nodeset, genimage and the transfer listener need one
definition of the root image that a node may receive over UFTP and of
how a request names it. xCAT::UFTP resolves a request inside the
configured image roots to the archive that packimage published with its
checksum file, and the digest that the node names must be a line of that
file. The module also reads the listener configuration and the server
key fingerprint, builds the uftp command, checks the UFTP receiver of an
image, records the initial ramdisk that genimage built with it, and
builds the nodeset kernel arguments. It accepts a uftp sender or
receiver only when it is the UFTP 5 build of xcat-dep, which marks its
version string. That build carries fixes that stock UFTP 5.0.4 lacks.

The design follows the UFTP transport that Richard Ray proposed in
xcat2/xcat-core#3560.
2026-10-20 14:18:56 -03:00