2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-27 12:52:16 +00:00
Commit Graph

172 Commits

Author SHA1 Message Date
Daniel Hilst 9804168ca9 Merge upstream master into feat/ipv6
Integration test of the 51 commits that landed on upstream master after this
branch was built. Four conflicts, all from edits to the same lines:

perl-XCAT/xCAT/BootUtils.pm: both sides add a new sub at the end of the file.
Master adds expand_node_template, this branch adds grub2_kernel_commands and
grub2_image_provides. All three are kept.

xCAT/xCAT.spec and xCATsn/xCATsn.spec: master wraps the chrony and dhcpd
requirements in a suse_version test, and its %endif lands on the line this
branch uses for radvd. The requirement stays outside the test, because an
openSUSE management node writes radvd.conf too.

xCAT-server/xCAT-server.spec: master's openSUSE requirement list is a superset
of this branch's, so master's is taken whole.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-31 08:55:22 -03:00
Daniel Hilst 102dc80920 fix(postscripts): an installed node ignores the DUID its reservation holds
configdhcpv6duid always derived the DHCPv6 client identifier from the SMBIOS
UUID in firmware byte order. makedhcp does that only when mac.duid is unset or
holds 'firmware': 'canonical' reserves the order product_uuid prints, and a
literal DUID is reserved as it stands. A node with either setting wrote an
identifier that matched no reservation, so it took a pool address and had no
boot file URL.

mypostscript.tmpl now exports the attribute as DHCP6DUID, and the postscript
reads it. 'canonical' keeps the order product_uuid printed. A literal is
written as it stands for NetworkManager, which takes a whole DUID.
systemd-networkd composes one from a named type, and only the UUID type can be
expressed that way, so a literal of another type is written for
NetworkManager alone and the reason is logged. A value that is neither keyword
nor DUID writes nothing, which is what makedhcp refuses as well.

The derived values are byte-identical to kea_duid_from_uuid for both orders.
postscript_dhcpv6_duid.bats goes from 9 checks to 16; ignoring the attribute
fails the five that name a setting and leaves the firmware default passing.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-30 13:17:39 -03:00
Daniel Hilst cd67199463 fix(netboot): an IPv6-only diskless node boots with no address
xcatroot writes the netplan of the booted system from the interface it found,
and it always wrote "dhcp4: true". An IPv6-only node has no DHCPv4 server, so it
reached its login prompt with no address: Ubuntu 24.04.5 reported
"[FAILED] Failed to start systemd-networkd-w... Wait for Network to be
Configured." and "[FAILED] Failed to start xcatpostinit.service", and the node
answered no ssh.

The address is already on the kernel command line, in the static form dracut
takes. xcat_static_ip6_fields reads it and the netplan carries the address, the
prefix and a default route through the gateway. A node whose command line holds
an IPv4 form keeps dhcp4, because the fields are read only from a bracketed
literal.

Captured by xCAT-test/bats/ipv6_xcatroot_netplan.bats. Reading the fields by
cutting on the first colon, which is what an IPv6 literal breaks, fails the
three parsing assertions and leaves the four refusals passing.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-29 16:01:34 -03:00
Daniel Hilst 599cd8ac83 Merge pull request #7986 from VersatusHPC/fix/retry-install-transient-icmp
fix(xcat-test): a transient ICMP loss vetoes a node that answers SSH
2026-10-29 15:29:06 -03:00
Daniel Hilst dfad7287f0 Merge pull request #7984 from VersatusHPC/fix/genesis-ubuntu-mawk-rebased
fix(xcat-core): the Ubuntu Genesis image runs its awk programs under mawk
2026-10-29 15:24:52 -03:00
Daniel Hilst d257780576 Merge pull request #7990 from VersatusHPC/fix/genesis-openssl-config-missing
fix(xcat-core): Genesis node stops at "Getting initial certificate"
2026-10-29 14:50:08 -03:00
Daniel Hilst 7f4c7dbda0 Merge pull request #7983 from VersatusHPC/fix/vm-machine-type-unsupported-on-host
fix(xcat-test): libvirt refuses the compute node machine type pseries-rhel7.6.0
2026-10-29 14:32:40 -03:00
Daniel Hilst 5260c899a2 Merge pull request #7987 from VersatusHPC/fix/diskless-mount-snapshot-kernel-mounts
fix(xcat-test): the diskless cases fail when the kernel mounts binfmt_misc
2026-10-29 14:32:18 -03:00
Daniel Hilst d150233cfc Merge pull request #7988 from VersatusHPC/fix/genesis-sshd-privsep-upstream
fix(xcat-core): Genesis on Ubuntu answers no ssh, so every case that reaches a node fails
2026-10-29 14:31:56 -03:00
Daniel Hilst 0ac354f931 fix(sle): an IPv6 install server empties the AutoYaST profile
pre.sle substitutes the install server for XCATNEXTSERVERHOOK in the media_url
that xCAT::Template writes for every install source. The substitution read
sed -e 's!XCATNEXTSERVERHOOK!'$nextserver'!', with the value unquoted, and
shopt -s nullglob is set earlier in the same script. An IPv6 server is bracketed,
so "[2001:db8::1]" is a glob that matches no file and the whole sed script word
is removed. sed then reads the profile as its script and writes nothing, so
/tmp/profile/modified.xml is empty. AutoYaST falls back to the unmodified profile
and stops on "Disk 'XCATPARTITIONHOOK' was not found", because the pre-script
also substitutes the install disk into that profile.

The substitution moves into substitute_nextserver, which quotes the value. An
IPv4 server was never affected, because it carries no bracket.

Captured by xCAT-test/bats/ipv6_pre_sle_nextserver.bats. With the quotes removed
again, assertions 9 and 10 fail and the IPv4 assertion 11 still passes.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-29 11:53:52 -03:00
Daniel Hilst c86de4f7a9 test(sles): the SUSE installer cuts an IPv6 install server at its first colon
pre.sle and pre.sles read the install server out of the kernel command line and put
it back into a URL. pre.sle substitutes it for XCATNEXTSERVERHOOK in the media_url of
every install source, and pre.sles substitutes it into #INSTALL_SOURCES_IN_PRE#.

The derivation cut the authority at the first colon. An IPv6 install server written
"autoyast=http://[2001:db8::1]:80/install/autoinst/node01" yielded "[2001", so the
media_url read "http://[2001:80/install/..." and YaST had no install source. A
portless IPv4 URL kept its path as well, and worked only because xCAT always writes
a port.

The test runs the derivation taken from each script against a command line of its
own, so a change to the derivation is measured here.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-29 08:56:37 -03:00
Daniel Hilst 4de3ea6566 test(install): the xcatd endpoint the post.xcat scripts export is not checked
post.xcat.rhels10 builds XCATSERVER with format_host_port and the other two copies
wrote "$MASTER_IP:3001". The test drives each script's own format_host_port and
asserts that no copy interpolates the address unbracketed.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-28 05:56:59 -03:00
Daniel Hilst c7f3c8aed4 test(install): the post.xcat scripts are not checked for IPv6 URL hosts
post.xcat.rhels10 brackets the management node address before it goes in a URL and
the other two copies did not, and nothing held the three to each other.

The test drives each script's own format_uri_host with one table, and asserts that
no download URL in them interpolates MASTER_IP unbracketed.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-28 02:54:27 -03:00
Daniel Hilst 68d10c5111 feat(xcat-core): write the DHCPv6 client identifier on the installed node
makedhcp builds a DUID-UUID from vpd.uuid and the reservation carries one identifier, but no
network manager derives that identifier in the byte order the firmware sends. NetworkManager has
no option for the SMBIOS UUID at all, and systemd-networkd's DUIDType=uuid uses the decoded
product UUID, which is the other order. So a node whose installed OS speaks DHCPv6 matched no
reservation and took a pool address.

configdhcpv6duid writes the identifier for whichever renderer the node has: the whole DUID for
NetworkManager, and the type by name with the sixteen bytes alone for systemd-networkd, which
composes the two. It is in the default postscript list for Linux, after remoteshell. AIX has
neither renderer and keeps its list.

A diskless or statelite node needs nothing: its address comes from the kernel command line and
configeth writes dhcp6: false, so its image sends no DHCPv6 request.

postscript_dhcpv6_duid.bats pins both forms to the literal the two Genesis images already use,
so the four copies of the byte swap cannot drift apart, and asserts the node fails loudly when
it has no renderer. postscript_dhcpv6_duid_registered.t holds the registration down: dropping it
fails 3 of its 7 assertions.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-28 01:08:42 -03:00
Daniel Hilst f630af04ea fix(xcat-core): a SUSE node never gets its IPv6 default route
configeth guarded the route with "[ a ] -a [ b ]", which is not a shell operator. bash reported
"[: too many arguments" and took the else path on every run, so /etc/sysconfig/network/routes
never received the IPv6 default route of a SUSE node and nothing said so.

The duplicate check behind that guard spelled the character class "[:space:]", which is a
bracket expression matching one of those six characters. It found no route already present, so
fixing the guard alone would have appended the route on every run of the postscript.

The two tests are now a valid shell condition and a correct class, and the logic moved into
add_suse_ipv6_default_route so it can be read without an installed node.

ipv6_configeth_suse_route.bats covers both faults separately. Restoring the operator fails 4 of
its 7 cases, one of which asserts that bash reports nothing on stderr; restoring the class fails
only the case that runs the postscript three times and expects one route.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-27 12:47:34 -03:00
Daniel Hilst dc8c5cefed fix(xcat-core): Genesis sends a DUID the reservation does not hold, and makedns aborts on a /62
Both Genesis images built a DUID-UUID from the nil SMBIOS UUID. makedhcp refuses that UUID,
because nodeimport writes it to every PowerKVM node, and reserves the hardware address instead,
so the client sent an identifier no reservation held and the node took a pool address with no
boot file. genesis-duid and doxcat now keep the DUID-LL for it, which is what Kea reads the
hardware address out of.

getzonesfornet died on an IPv6 prefix that is not a multiple of 4, which took makedns and
makedhcp with it for a /62 or a /126 network. A reverse zone is delegated on a nibble, so the
prefix is rounded down and the enclosing zone is returned. Both copies of the routine are fixed.

The test suite needs socat and jq, and five bats files skipped without them, so the workflow
installs both. Template.pm drops the unused _is_el10, credentials.pm drops a repeated import,
and two comments that recorded bug history are cut to the fact the code cannot show.

Reverting any one fix fails named assertions: 1 of 8 and 1 of 3 bats cases for the two Genesis
images, and 4 of 30 in ddns_ipv6.t, which traps the abort so the file still reports.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-27 10:20:52 -03:00
Daniel Hilst f2688f9d5a fix(xcat-core): Genesis hands an unbracketed IPv6 address to openssl
Parsing the xcatd= argument was only half of it. doxcat re-joined XCATMASTER and
XCATPORT at twenty call sites, and /bin/getcert and /bin/getdestiny pass that string
to openssl s_client -connect, which rejects an unbracketed IPv6 address:

  openssl s_client -connect 2001:db8:190::1:3001
    s_client: -connect argument or target parameter malformed or ambiguous
  openssl s_client -connect [2001:db8:190::1]:3001
    depth=1 CN=xCAT CA

Measured on an IPv6-only node whose cmdline parsed correctly: /etc/xcat held
certkey.pem and privkey.pem but no cert.pem, and nodelist.status stayed empty.

doxcat now derives XCATDEST once, bracketing an address that holds a colon, and every
call site uses it. getcert already honoured XCATDEST as an environment variable.
dodiscovery falls back to the old form when doxcat did not export it.

The mutation keeps the variable and changes only its value: 4 of the 7 bats cases go
red, the IPv6 ones, and the 3 IPv4 and default-port cases pass.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 19:02:41 -03:00
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 df4f3ff729 test(xcat-core): Genesis cannot read an IPv6 xcatd= kernel argument
An IPv6-only node that boots Genesis never reaches xcatd. destiny.pm writes
xcatd=<master>:<port> unbracketed, and doxcat splits the value on the colon, so an
IPv6 master is read as the address 2001 and the port db8. Measured on a throwaway
el10 cluster: the console logged "XCATMASTER is 2001, XCATPORT is db8", the node
hung acquiring its credentials, and nodelist.status stayed empty.

xcatd_cmdline_address.t drives the writer and doxcat_xcatd_address.bats drives
doxcat's own parse loop, extracted by line range rather than re-implemented, so the
test reads the shipped code. The bats file is in bats because the parser is shell.

The graded evidence is the mutation pair recorded in the fix commit, not the red of
this commit alone: without the fix the routine does not exist, and a test that dies
on a missing subroutine only says it is missing.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 17:07:50 -03:00
Daniel Hilst 76630ebc92 test(genesis): keep the legacy doxcat DUID byte order covered
genesis_duid_uuid.bats checks the DUID that the legacy doxcat sends, which the
vpd.uuid rework does not change. The revert that reworked vpd.uuid kept this file
deliberately, so dropping the reverted commits from this branch dropped it too.

Nothing else references the file, so its absence broke no test. It is restored here
so the branch loses no coverage relative to the pull requests it supersedes.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 15:33:21 -03:00
Vinícius Ferrão ef2352db87 test(genesis): cover the UUID that discovery reports
dodiscovery runs in a private namespace with a fixed product_uuid and
stubbed hardware and transport commands. The test reads the UUID from
the discovery request that the script sends and expects product_uuid
unchanged. Before the fix the request held the UUID with its first
three fields swapped.

(cherry picked from commit 21762f21526e0ba71fb3b9a6d3ec314e59feb101)
(cherry picked from commit bff1e7ea93)
2026-10-26 15:27:22 -03:00
Vinícius Ferrão 35bf8eda8a test(genesis): cover the UUID that the OpenEmbedded image reports
The OpenEmbedded discovery sends the product_uuid fixture and expects it
unchanged in the findme request.

(cherry picked from commit 092d78a224ee57af834a74ccfb63185f7120a2b7)
(cherry picked from commit 47fc5cf780)
2026-10-26 15:27:21 -03:00
Daniel Hilst 2371e2a98e fix(xcat-core): a syslog target with a port is bracketed as if it were an IPv6 literal
site.master may carry a port. format_syslog_forward_target in
xCAT/postscripts/syslog bracketed any value containing a colon, so
MASTER=127.0.0.1:1515 rendered the rsyslog line as @[127.0.0.1:1515], which
rsyslog does not accept, and syslog_ng_udp_driver chose udp6 for an IPv4 peer.
format_syslog_server in the dracut_105 rsyslogd-start.sh carries its own copy of
the rule and had the same defect; it runs inside the initramfs and cannot source
the postscript, so the rule is held down twice on purpose.

An IPv4 address or a hostname with a port has exactly one colon and an IPv6
literal has at least two, so the test is now on two colons rather than one. A
value already starting with "[" is left alone whether or not a port follows it,
which the old pattern missed: it required a trailing "]" and so double-bracketed
[2001:db8::1]:514.

ipv6_syslog_forwarding.bats gains four cases. Without the fix, "a target with a
port is not mistaken for an IPv6 literal", "an already-bracketed target with a
port is left alone" and "the initrd launcher does not mistake a port for an IPv6
literal" all fail; the compressed-literal case passes either way and is there to
show the bracketing of ::1 did not regress.

Also: grub2_ipv6.t could not load grub2.pm once xcat-core/#7980 made it use
xCAT::DHCP::BootPolicy, which lives in perl-xCAT. The file died at compile time
and reported no plan at all, which in a prove summary reads as a count
discrepancy rather than a failure. It now puts perl-xCAT and the server perl
directory on @INC, as every other plugin test does.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 15:27:21 -03:00
Daniel Hilst da25345b0c test(ipv6): pre.rhels10 and a dead ddns routine have no assertions
Two gaps from the same branch.

ddns.pm:453 assigned "my @myips = _local_addresses_for_network(...)" and never
read the value, and _local_addresses_for_network had no other caller. The
routine and its three assertions in ddns_ipv6.t are removed: a test on a
routine nothing calls measures nothing and keeps dead code alive.

The commit that moved the shell tests to bats deleted el10_ipv6_runtime.t and
wrote no bats file for pre.rhels10, so its new create_listen_socket, its peer
allow list, its screendump rewrite and extract_url_host had no assertions.
ipv6_pre_rhels10.bats renders the install monitor pre.rhels10 embeds, fills
the two substitution tokens the way xCAT fills them, runs it and speaks its
protocol over each family. It also drives extract_url_host and the expression
that finds the install URL in the kernel command line, read from the script
rather than retyped.

Six reversions of the script were each measured: an AF_INET-only listener, a
missing peer check, the os.popen screendump, the colon split of the URL, a
grep that drops the bracket alternative, and a missing strip on the received
command. Every one fails at least one assertion.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 15:27:20 -03:00
Daniel Hilst 86066cad78 test(ipv6): sixteen IPv6 assertions match source text, not behaviour
Sixteen assertions on this branch matched a regular expression against the
source of the code they test. Such an assertion passes when the code is moved
somewhere it never runs, and fails when the file is reformatted and nothing
has changed: a perltidy respace of updatenode.pm:1606 turned
updatenode_ipv6_endpoint.t red with the behaviour unchanged.

updatenode_ipv6_endpoint.t now runs updatenoderunps and updatenodesoftware
and reads the xdsh command each one dispatched. It also covers the service
node name that has no usable endpoint, which the regular expressions could
not reach.

anaconda.pm built the debug syslog kernel arguments inline inside two large
subs. Move each to its own sub, _netboot_syslog_kcmdline_args and
_install_syslog_kcmdline_args, and render them in the test. An unusable
server name now gives no syslog arguments, where it gave "syslog.server="
with nothing after it.

pping is a program with no sub API, so the nmap and fping command building
moves to xCAT::DSHCore as nmap_ping_command and fping_ping_command, and pping
stays the caller that forks and execs the list.

credentials_ipv6_callback.t read allowcred.awk as text, and ran gawk from a
.t. The awk program is covered by xCAT-test/bats/ipv6_allowcred_awk.bats,
which starts it and speaks the credential protocol to it over both families.
Stubbing Socket6 and IO::Socket::INET6 in %INC also unskips the four
_open_callback_socket assertions, which skipped where the suite runs.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 15:27:20 -03:00
Daniel Hilst 4d5ca9964e test(ipv6): shell under test is written in bats, not in a .t
Seven of the ported unit files drive shell: they run bash -n on a product
script, cut a function out of it with a regex and eval the copy, or write a
fake executable into PATH. A .t runs Perl in process, so each one tested its
own scaffolding as much as the product, and a reformat of the script would
break it while a move of the code would not.

The five bats files replace them and use the existing shell_source helper.
ipv6_endpoint_helpers drives the four separate copies of xcat_endpoint_host
from one table, because the scripts carry a copy each -- xcatroot runs in the
dracut initrd, xcatpostinit1.netboot before /xcatpost exists, xcatinstallpost
in the installer root -- and the copies must agree.
ipv6_xcatdsklspost_endpoints uses XCATDSKLSPOST_SOURCE_ONLY to load the real
parsehttpserver and format_host_port and asserts a bracketed authority
survives a round trip. ipv6_syslog_forwarding covers the rsyslog bracket and
the syslog-ng udp6 driver. ipv6_configeth_install_nic drives
discover_install_nic_ipv6 against recorded "ip -6 addr show" output and pins
that a temporary, tentative, deprecated or dadfailed address is never chosen.
ipv6_updateflag_awk runs updateflag.awk against a loopback listener of each
family and pins the bracket stripping.

Each assertion was run against the unfixed script and fails there. Two gaps
stay: allowcred.awk has no coverage, and the /inet6/ prefix updateflag.awk
chooses cannot be covered, because gawk 5.3.0 reaches an IPv6 literal through
/inet/ as well.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 15:27:19 -03:00
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 af66f78dfd fix(xcat-core): Genesis on Ubuntu answers no ssh, so every case that reaches a node fails
A compute node booted into legacy Genesis on Ubuntu refuses every ssh connection:

  [xcat100-mn]: xcat100-cn: ssh: connect to host xcat100-cn port 22: Connection refused

and on the node's own console, once per boot:

  Missing privilege separation directory

Debian and Ubuntu build sshd with --with-privsep-path=/run/sshd. The payload's own sshd
carries that path and the format string "Missing privilege separation directory: %s", and the
image ships /run holding only rpcbind. So sshd exits at startup and the node is unreachable.
nodeset_shell, nodeset_cmdline, nodeset_runimg and genesis_boot_proof_legacy all fail on it,
while seq_discovery, which needs no ssh, passes.

doxcat already does this for the other family: it creates /usr/share/empty.sshd, the EL
privsep path, with the comment "On some systems /usr/share/empty.sshd needs to be created
before calling sshd". The Debian path was never added, although the tree knows about it twice
-- remoteshell says "prepare the /var/run/sshd for ubuntu" and etc/init.d/functions creates
it. This adds the same lines for /run/sshd and /var/run/sshd.

Created immediately before sshd starts, not baked into the image: /run is a tmpfs on a
running system, so a directory under it does not survive the mount. The mode is set whether
or not the directory had to be created, because sshd refuses a group or world writable
privsep directory with the SAME message as an absent one, so a wrong mode is
indistinguishable from this bug.

genesis_sshd_privsep.bats asserts what sshd imposes -- the path is a directory, owned by the
user that will run sshd, and not group or world writable -- read at the moment sshd runs. The
recorder is bound over /usr/sbin/sshd because doxcat calls that absolute path, and because
recording from a later command cannot see the ORDER: with the recorder on a PATH command
instead, moving the directories after the sshd line still passed.

Five mutations, each red: removing the loop fails 2, never setting the mode fails 1, dropping
/var/run/sshd fails 2, a group-writable mode fails 2, and creating the directories after sshd
starts fails 2. The whole bats suite goes from 21 failures to 19 with this change, the
difference being these two tests; the other 19 are unrelated and fail on the base.

doxcat_sandbox.bash gains chmod, and a third test keeps the next one from being missed. The
sandbox curates PATH without /usr/bin, so a command it does not copy resolves to nothing and
fails SILENTLY: doxcat's chmod did nothing under test for as long as this sandbox has
existed, and any assertion about a mode could never pass. The guard installs bash's
command_not_found_handle through BASH_ENV and fails naming whatever doxcat invoked and could
not resolve, so it needs no list to keep current. With chmod removed again it reports exactly
"chmod". Its reach is the commands doxcat runs on the path the test drives, which is a floor
rather than a completeness check on the helper's list.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 08:11:13 -03:00
Daniel Hilst 0aefdb479b test(xcat-test): a harness path beside an xCAT directory counts as an xCAT denial
selinux_avc_check.sh decides which SELinux denials xCAT answers for by
matching the audit record's path against XCAT_AVC_PATH. The match treats each
entry as a string prefix, so a sibling directory whose name merely starts with
one of them is kept. On build 2 of xcat-test-el10-x86_64-selinux the one
denial the run attributed to xCAT was xcatd executing the CI's own
notification hook under /var/lib/xcat-cluster-test, and
selinux_cn_diskful_enforcing failed on it.

The new bats test classifies that record and asserts nothing is kept. Two
more assert the directories themselves and a file under one are still kept,
so an over-anchored match does not pass silently.

Without the fix 1 of 18 fails, and it is the sibling-path test. The other two
pass before and after.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 08:11:13 -03:00
Daniel Hilst 0e957e654c test(xcat-test): one lost ICMP sample makes retry_install reinstall a working node
retry_install.sh declares a provision successful only when tobooted, pingable
and canruncmd are all 0. pingable came from a single `ping -c 2`, and ICMP to a
node is lossy for a few seconds after it finishes booting.

Measured on an openSUSE Leap 15.6 cluster: one sample reported "2 packets
transmitted, 0 received" while `xdsh <node> date` returned the node's own clock
a second later, so the node was up and answering SSH. The conjunction failed on
ICMP alone, the case ran a second full rinstall, and that cost 401 of the 404
seconds between two runs of the same cell. The second run lost 2 of 3 packets at
a moment that was not the decision point and passed first try. The difference
between the two runs was which side of a two-packet sample landed, not the state
of either node.

The probe is tested in bats, because it is shell. It is driven with a stubbed
ping, so what is measured is how many times the probe asks and what it answers,
not whether the build host can reach anything.

All five assertions fail on this commit, because node_pingable does not exist
yet and sourcing the script still runs lsdef. The graded evidence is the
mutation recorded in the fix commit.

`run` is used rather than a bare call: bats fails a test on any non-zero command
in its body and `set +e` does not suppress that, so asserting on a non-zero
return without `run` aborts the test instead of measuring it.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-24 21:00:06 -03:00
Daniel Hilst 91e6672110 fix(xcat-test): the diskless cases fail when the kernel mounts binfmt_misc
The diskless cases snapshot the mount table before genimage and after it and require the two to
be identical, ignoring only fusectl. The comparison is there to catch a bind mount genimage
leaves inside the root image, which is worth catching.

It also fails for mounts the kernel makes on its own. binfmt_misc is an autofs stub that becomes
a real mount the first time a process reads /proc/sys/fs/binfmt_misc, and tracefs appears under
/sys/kernel/debug the first time anything opens debugfs tracing. On openeuler22.03sp4 both
appeared during genimage and failed reg_linux_diskless_installation_flat four minutes into a
1168 second case, while the provisioning that followed succeeded and the node reached booted.
The single fusectl exclusion shows the same class was met once before and patched by name.

mount_snapshot.sh drops the mounts whose mount POINT is under /proc or /sys, which is where the
kernel keeps its on-demand mounts, and the three cases take their snapshots through it. Dropping
them by filesystem TYPE would hide the leak the comparison exists for, because a leaked genimage
bind is itself a proc or sysfs mount. fusectl needs no exclusion of its own any more.

mount_snapshot.bats covers both directions. Taking the filter out fails the two
ignore-the-kernel assertions and keeps both leak assertions; filtering by type instead of by
mount point fails only the leaked-bind assertion. A test-only commit would skip rather than fail,
because require_repo_file skips when the script is absent, so the proof is those two mutations.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-24 20:36:08 -03:00
Daniel Hilst 1d52b46e29 test(xcat-core): the Ubuntu Genesis image can ship mawk as its awk
The Genesis image runs allowcred.awk, minixcatd.awk and udpcat.awk under its own
/usr/bin/awk. All three open a TCP stream with the gawk |& coprocess and the /inet/
special file, which mawk rejects at parse time. The Ubuntu dracut module stages
/usr/bin/awk from the build root, and on Ubuntu that alternative is mawk.

genesis_ubuntu_awk.bats drives install() from dracut_105/ubuntu/module-setup.sh with the
dracut helpers replaced by stubs, and reads back what the module installs and where awk
in the image points. genesis_ubuntu_build_root.t asks the build root for a gawk package.
genesis_payload_verification.t gives XCAT::GenesisPayload a payload whose awk names
itself mawk.

All three fail on this commit: 3 of 3 bats assertions, 2 of 18 in the build-root test,
3 of 33 in the payload test.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-24 10:01:16 -03:00
Daniel Hilst 9978ff77e3 test(xcat-test): the machine type the case writes is never checked against the vmhost
vm_machine_type_for_arch returns a machine type from a fixed table. Nothing asks
the host that runs the guest whether it accepts that name, so a name that the
host dropped is written and libvirt refuses the domain.

The bats file now stubs virsh and ssh for the vmhost and asserts the name that
comes back: the plain alias when the host accepts it, the host's own default
when it does not, the alias again when the host cannot be reached, and the
architecture and host the probe asks about. ppc64el is covered beside ppc64le
because the Ubuntu cells name the architecture that way.

Nine tests fail against the current script, which answers machine:pseries-rhel7.6.0
for every ppc64 architecture.

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

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

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

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 18:00:10 -03:00
Daniel Hilst 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 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 621c460a21 test(uftp): cover the UFTP receiver of Ubuntu stateless nodes
The Ubuntu xcatroot must receive an image over UFTP under dash and
check it like a download. It must read the UFTP arguments from the
kernel command line, which has them, and not from its environment,
which does not.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão dc84312cd0 test(uftp): cover the UFTP receiver of SLES stateless nodes
The SLES xcatroot must receive an image over UFTP and check it like a
download, and fall back to HTTP in the same cases as the EL scripts.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão d4ea2c6c51 test(uftp): cover the UFTP receiver of EL stateless nodes
genimage must add the helper only for an image with the UFTP 5 receiver
of xcat-dep for its architecture, and remove an older copy otherwise. It
must fail when the built ramdisk lacks the receiver files. The marker
must follow the published ramdisk.

The helper must ask the listener only for a digest that the checksum
file lists for the image, and stop its receiver on every failure.
xcatroot must check a received image like a download. It must fall back
to HTTP when UFTP fails, is not set up, or the image is not checked.
2026-10-21 11:44:22 -03:00
Vinícius Ferrão 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 26be5646f9 test(fips): preserve the policy command contract 2026-10-21 11:29:41 -03:00
Daniel Hilst 9c41bffb96 fix(xcat-test): the postinstall inventory check counts names, not files
postinstall_selinux_config.bats required at least 13 postinstall scripts
that write the SELinux config. Three riscv64 scripts are now symlinks to
the rocky one, and the find uses -type f, which counts a shared file
once, so the list holds 12 entries for 15 names and the check fails on a
tree where nothing is wrong.

Lower the bound to 12 and name the aarch64 script among the
representatives. The bound exists to catch a find that stops matching; a
new script needs no new bound, because every other test in the file
loops over the same list.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:44:04 -03:00
Daniel Hilst cfa3073da7 refactor(fips): generate the shell policy through a module sub
xCAT-test/unit/fips_policy_sources.t ran build-utils/sync-fips-policy as a
subprocess, so a file in the unit directory measured a program rather than a
routine, and it asserted on the diagnostics the script printed instead of on an
answer. buildrpms.pl and builddebs.pl started the same script with system() to
check the generated libraries before packaging xCAT or xCAT-genesis-scripts.

XCAT::BuildUtils gains fips_policy_artifacts, fips_policy_plan and
sync_fips_policy. fips_policy_plan reads the canonical policy and both runtime
libraries and reports what generation would write, without writing.
sync_fips_policy applies that plan in write mode and returns the stale paths,
the paths it rewrote and the diagnostics for its caller to print. The two
builders now call sync_fips_policy in their own process and print the
diagnostics before they stop, which keeps the output xCAT-test/native/
fips_build_guard.t asserts on. build-utils/sync-fips-policy keeps its
--check and --write contract and its exit status, and is now a thin caller.

The unit test calls the sub in-process and asserts on the returned hash. It
also covers a library holding two policy blocks and a library replaced by a
symbolic link, which the subprocess form did not reach. Ten mutants of the
module, one per guard, each fail the assertion that names that guard.

xCAT-test/bats/fips_policy_artifacts.bats copies XCAT::BuildUtils into its
fixture, because the script it runs now loads the module.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:42:37 -03:00
Daniel Hilst dc4fb8f0c2 test(xcat-core): the netboot postinstall SELinux substitution is unanchored
Thirteen netboot postinstall scripts, and the xcat_inventory postinstall fixture,
disable SELinux in the rootimg with
s/SELINUX=enforcing\|permissive/SELINUX=disabled/. The second alternative is a bare
word with no key, so a config that reads SELINUX=permissive becomes
SELINUX=SELINUX=disabled. The same alternative matches the stock comment that names
permissive, which is rewritten on every image. sed returns 0 in both cases.

postinstall_selinux_config.bats runs each script over a scratch image root and reads
the config the script writes. Three of its six tests fail on this tree: the permissive
value, the already-disabled config and the comment.

The other three hold down behaviour the fix must keep. A no-op substitution turns the
enforcing test red, and a dropped -f guard turns the absent-config test red.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:35:52 -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 89dee4de1e fix(xcat-core): the SELinux AVC checks assert no denial of any kind
Eight checks in the selinux testcases asserted ausearch output =~ "<no
matches>", which is zero denials of any kind in the window. A cluster
denies things xCAT has nothing to do with. On an idle enforcing
management node httpd asks the kernel for net_admin on itself every ten
seconds, and the base policy carries no dontaudit rule for that shape.
One node logged 1034 denials in a day, 817 of them that one shape. So
the assertion cannot pass once ausearch is called correctly, and before
--input-logs was added it could not fail.

selinux_avc_check.sh keeps the denials whose subject program or object
path belongs to xCAT and counts those. The cases assert XCAT_AVC=0.
selinux_mn_labels now also plants a denial on purpose: it mislabels
/install/postscripts/xcatdsklspost, shows httpd answering 403, and
requires the check to report XCAT_AVC=[1-9] before restoring the label.
A counting method with no positive control cannot be trusted to find
anything.

restorecon -RnvF reports a difference in the SELinux user as well as the
type, and the files xCAT writes carry unconfined_u. On one node -RnvF
printed 12 lines over /install where -Rnv printed 2. The checks use
-Rnv, which is the type they assert.

The six cases were in no bundle and in no pipeline conf, so none had
ever run, which is why the dead checks were not noticed.
selinux.bundle and selinux_mn.bundle name them, and selinux_bundle.t
fails when a case is in no bundle.

Tests: selinux_avc_check.bats drives the classifier with records
measured on an enforcing management node. Replacing the filter with one
that keeps every record fails 4 of its 8 checks; dropping the
object-path branch fails 2. selinux_bundle.t fails when selinux.bundle
is removed. selinux_kickstart_template.t asserted the relabel order with
a regex that matched wherever the relabel sat; it now compares line
positions, and moving #SELINUXRELABEL# above the xCAT post includes
fails it.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:34:36 -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