2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-22 07:38:08 +00:00
Commit Graph

28646 Commits

Author SHA1 Message Date
Daniel Hilst 87cd06e4e5 test(xcat-core): the ipxe shim case reports a pass after leaving a node configured for installation
restore_state in ipxe_secureboot_shim.sh matched the saved nodeset state against
boot, offline, shell and standby. nodeset stat reports chain.currstate verbatim,
so runcmd=bmcsetup, osimage=<name>, runimage=<task> and the deprecated install,
netboot and statelite all fall past that list. The helper then restored nothing
and still printed IPXE_SHIM_OK, so the node kept the installation the case
configured and the next case on that node measured it.

The lookups hide the same failure one layer down. lsdef and nodeset run in a
pipeline, so the exit status comes from sed or head and is always zero, and an
attribute that is unset prints the same empty string as a lookup that failed.
The helper clears the provmethod and the netboot method it reads as unset, so a
failed lookup makes it delete a value the node really had.

The tests drive the helper through nine states and lookups. Against the unfixed
helper, all four refusal cases exit 0 and print IPXE_SHIM_OK after calling
nodeset osimage= on the node, and the provmethod case prints
"provmethod=unset" for a provmethod the stub holds set.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-08 13:16:56 -03:00
Daniel Hilst 74954c9bc6 fix(kvm): reading vm.othersettings creates a vm row for a node that has none
requested_firmware was called as
requested_firmware($confdata->{vm}->{$node}->[0]->{othersettings}). An rvalue
dereference chain autovivifies its intermediate links, so that read makes
$confdata->{vm}->{$node} exist, as an arrayref holding an empty hashref, for a
node with no vm row. A later truth test on that row then answers yes for a node
that is not a VM.

vm_othersettings reads the column one link at a time and returns undef at the
first link that is absent, so the read leaves $confdata as it was. Both call
sites use it.

Three checks in kvm_uefi_firmware.t hold this down, and all three fail when
vm_othersettings is changed back to the dereference chain: the read creates no
vm table, creates no row for the node, and leaves confdata equal to its
starting value.

build_xmldesc and build_diskstruct still autovivify the same row through their
own older reads of vm.storagemodel and vm.host. That is unchanged by this
commit and is measurable: the confdata both routines leave for a node with no
vm row is identical with and without the firmware code.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-08 00:33:46 -03:00
Daniel Hilst bcc60a3132 fix(kvm): an x86_64 KVM guest cannot be defined with UEFI firmware
guest_arch_profile reaches the firmware selection only for riscv64, so an
x86_64 KVM guest always comes up on SeaBIOS. A node that must boot the UEFI
shim has no way to ask for UEFI.

vm.othersettings takes a sixth key, firmware:efi. requested_firmware reads it,
and guest_arch_profile then puts firmware="efi" on <os>. libvirt selects the
firmware files from that attribute and writes <loader> and <nvram> itself. The
guest also moves to q35, because every x86_64 OVMF descriptor targets pc-q35-*
and libvirt finds no efi firmware for the i440fx machine it defaults to. q35
has no IDE controller, so the disks and the optical drive move to scsi. A
machine type the node names for itself still wins. A firmware value other than
efi is refused by name.

No node asks for a firmware by default, so a guest that does not ask comes out
as before, on SeaBIOS with ide disks. <bios useserial='yes'/> stays in place
for the UEFI guest, which keeps its boot on the serial console.

kvm_guest_arch.t, kvm_diskstruct_bus.t and kvm_createstorage_model.t extract
routines from this file by name and eval a copy, so each one names
requested_firmware now.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 23:43:59 -03:00
Daniel Hilst ad91ffee51 test(kvm): no test can define an x86_64 KVM guest with UEFI firmware
build_xmldesc reaches its UEFI path only for riscv64, so no test covers an
x86_64 guest that asks for UEFI. The existing kvm unit tests cannot cover it
either: they read kvm.pm, extract four routines with a regex and eval a copy,
which keeps passing when the original changes.

kvm_uefi_firmware.t loads the plugin itself, with Perl stubs for the database,
the monitoring dispatcher, the thread helper and the libvirt binding. It calls
build_xmldesc and reconfigvm, and reads the domain XML they return.

process_request already set $parser, $node, $confdata and $updatetable before
it called the domain builder. They are package variables now, so the test sets
them the same way. The plugin reads them unchanged.

Six checks fail on this commit. The guest states no firmware and no machine
type, its disks stay on a bus q35 cannot carry, the rewritten guest asks for no
firmware, and a firmware value libvirt cannot select is accepted in silence.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 23:36:44 -03:00
Daniel Hilst 0378d8b424 fix(xcat-core): the ipxe shim case reports a pass without reading a script
The case accepted IPXE_SHIM_SKIPPED, so a cell whose compute node is not
declared netboot=ipxe passed it without reading a boot script. Four of the six
confs that carry the case declare netboot=xnba, so four cells reported a pass
for a shim line nothing had measured.

The case now asserts IPXE_SHIM_OK and declares arch:x86_64, which keeps it off
another architecture through xcattest rather than through a token that passes.
The helper sets netboot=ipxe when the node is declared another way, and puts the
method back before the nodeset that restores the state. A netboot method that
cannot be put back is reported like the provmethod and the nodeset state. The
two conditions that used to skip now fail and name what the case could not read.

xCAT-test/bats/ipxe_secureboot_shim_restore.bats fails 5 of 9 without this
change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 19:13:42 -03:00
Daniel Hilst fd3a21335b test(xcat-core): capture a skipped ipxe shim case that reports a pass
The case asserts output =~ IPXE_SHIM_(OK|SKIPPED), so the helper's skip path
passes it. The skip is not rare: the case is in rhels_x86_daily_flat.bundle,
which six confs use, and four of them declare netboot=xnba on their compute
node. Those four cells pass the case without reading a boot script.

Five tests capture it. The lsdef stub now reports the netboot method and the
arch from variables, and the chdef stub can fail the netboot call alone. The
tests require the helper to set the netboot method it needs, to measure, to put
the method back before the restoring nodeset, to report a netboot that cannot
be put back, and never to exit 0 without IPXE_SHIM_OK.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 19:08:58 -03:00
Daniel Hilst 325504962a fix(xcat-core): fail the ipxe shim case when the node stays unrestored
restore_state dropped the exit status of chdef and nodeset, and the helper
printed IPXE_SHIM_OK after it. A node left with provmethod set and nodeset
osimage reads as a pass, and the next case on that node runs against the
state this one set.

restore_state now reports which command failed and returns non-zero, and the
helper exits non-zero in place of the pass token. An EXIT trap holds the
restoration, armed immediately before the nodeset call that changes the state,
so no later branch can leave the node behind. A skip above that line changes
nothing and calls neither command.

Two assertions of five in ipxe_secureboot_shim_restore.bats fail without this
change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 15:08:45 -03:00
Daniel Hilst 30cc10424b test(xcat-core): capture a silent restoration failure in the ipxe shim case
ipxe_secureboot_shim.sh calls nodeset to reconfigure one node for
installation, reads the UEFI script, and then puts the nodeset state back.
restore_state ignores the exit status of chdef and nodeset, so the case prints
IPXE_SHIM_OK and returns 0 while the node is still configured for
installation. The next case on that node measures the state this one left.

The test drives the helper with lsdef, nodeset and chdef stubbed, and records
every call. Two assertions of five fail: with either restoration command
returning non-zero the helper exits 0 and prints IPXE_SHIM_OK.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 15:08:38 -03:00
Daniel Hilst e41ac50f12 fix(xcat-core): name the shim only in the iPXE discovery script
process_request walks xcat/ipxe/nets and xcat/xnba/nets in one loop and wrote
the shim line into the UEFI script of both. netboot=xnba is out of scope: no
key signs xnba.efi, and its loader does not know the shim command, so the line
stops the discovery of a node that never asked for Secure Boot.

The loop now carries the method name beside the directory, and the shim line
goes only into the script of the ipxe method. xnba.pm already gates the node
scripts the same way.

One assertion of nine in secureboot_genesis_shim.t fails without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 15:08:26 -03:00
Daniel Hilst 7440ed33c9 test(xcat-core): keep the shim out of the xNBA discovery script
mknb writes the UEFI discovery scripts of both netboot methods in one loop,
over xcat/ipxe/nets and xcat/xnba/nets. The shim line reaches both. The loader
of xnba does not know the shim command, so the line stops a legacy xNBA
discovery even with Secure Boot off.

secureboot_genesis_shim.t now reads the xnba script of the same run that reads
the ipxe one. One assertion of nine fails: the xnba UEFI script names
/tftpboot/xcat/ipxe/x86_64-sb/shimx64.efi.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 15:08:20 -03:00
Daniel Hilst c10c30d342 fix(xcat-core): verify the Genesis kernel with the shim of ipxe-xcat
setstate writes the Genesis kernel into the UEFI script of a node for the
shell, discover, standby and runcmd destinies. It asked for a shim with the os
of the node, so a management node that ran copycds named the shim of that
install source. That shim trusts the vendor certificate of the distribution,
which signs no Genesis kernel, and the node stops at the same Security Policy
Violation.

shim_url_path takes the kernel of the boot script. A Genesis kernel skips the
install source and takes the shim of ipxe-xcat, which reads the MOK list. An
osimage kernel keeps the install source first. mknb already named the loader
shim, because it passes no os.

Two assertions of twelve in secureboot_ipxe_node_shim.t fail without this
change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 14:52:03 -03:00
Daniel Hilst ebcc2e1d0e test(xcat-core): capture the install source shim in the Genesis boot script
The shell, discover, standby and runcmd destinies load the Genesis kernel
through the same UEFI script as an osimage kernel. setstate asks for a shim
with the os of the node, so an install source answers for a kernel that no
distribution signed.

The new node keeps the install source of the first node of the test, so both
shims are on disk and the order decides the answer. Two assertions of twelve
fail: the script names /install/alma9.8/x86_64/EFI/BOOT/BOOTX64.EFI.

The nodeset helper takes currstate and provmethod, so the node reads as the
shell destiny it is.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 14:49:28 -03:00
Daniel Hilst 24701cc23e test(xcat-core): measure the shim line in the UEFI script of an ipxe node
The unit tests in this branch call the plugins in their own process against a
scratch TFTP root. No xcattest case reads a script that nodeset wrote on a
management node, so a cell whose compute node has netboot=ipxe runs this code
and asserts nothing about it. el9-x86_64-devel is such a cell.

nodeset_ipxe_secureboot_shim runs nodeset against the compute node of the conf,
reads /tftpboot/xcat/ipxe/nodes/<node>.uefi, and reports whether the line after
imgload names a shim that the web server serves. It puts the nodeset state back
afterwards. A node that is not an x86_64 ipxe node prints IPXE_SHIM_SKIPPED and
passes, so a bundle can carry the case on every cell. Where no provisioning case
has set nodetype.provmethod, the case names the stateful image of the node.

Measured on an AlmaLinux 9.8 management node: with the plugins of this branch
the case reports the shim of the install source and passes. With xnba.pm and
ipxe.pm from the branch point it reports imgargs kernel as the line after
imgload and fails.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 13:59:11 -03:00
Daniel Hilst 022a80f351 feat(xcat-core): load the kernel of an ipxe node through a Secure Boot shim
This PR adds a shim to the UEFI boot scripts of netboot=ipxe nodes, so a node
with Secure Boot on reaches its kernel.

The firmware signature database does not hold the keys of a Linux
distribution. A UEFI node with netboot=ipxe loads snponly-shim.efi and
snponly.efi, both signed, and then stops at the kernel with "Verification
failed: Security Policy Violation".

xCAT::SecureBoot::shim_url_path names a shim for one node. The shim of the
install source comes first, because its vendor certificate signs the kernel of
its own distribution. copycds keeps the names of the DVD, so the module tries
EFI/BOOT/BOOTX64.EFI, EFI/BOOT/bootx64.efi and EFI/boot/bootx64.efi: EL and
openEuler ship the first, openSUSE the second and Ubuntu the third. When no
install source carries a shim, the module names the shim of ipxe-xcat, which
verifies a kernel that a MOK key signs.

xnba.pm writes the shim line after imgload in the UEFI script of an ipxe node,
and mknb.pm writes it in the UEFI discovery scripts. iPXE fetches the shim only
when it cannot load the kernel itself, so a node with Secure Boot off reads no
shim. netboot=xnba is unchanged: no key signs xnba.efi.

The elilo and ESXi paths and the Genesis kernel stay unsigned, and the iPXE
documentation now says so. The validation matrix gets a row for a UEFI install,
a netboot image and discovery with Secure Boot on.

secureboot_ipxe_node_shim.t and secureboot_genesis_shim.t drive nodeset and
mknb into a scratch TFTP root. Four assertions of ten and two of seven fail
without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 11:57:07 -03:00
Daniel Hilst 7b518ca742 test(xcat-core): capture the missing Secure Boot shim in the iPXE boot scripts
With netboot=ipxe a UEFI node loads snponly-shim.efi, which Microsoft signs,
and reaches iPXE with Secure Boot on. The boot scripts then load the kernel
with imgfetch and imgload, and the firmware refuses it: the signature
database does not hold the keys of the distribution, and nothing signs the
Genesis kernel. The node stops with "Verification failed: Security Policy
Violation".

The two tests drive nodeset and mknb into a scratch TFTP root and read the
UEFI scripts they write. Four assertions of nine and two of seven fail on
master: no script names a shim.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-07 11:46:50 -03:00
Daniel Hilst 5952dc04a2 Merge pull request #7594 from VersatusHPC/feat/fips-support
feat(fips): support installation on FIPS-enabled systems
2026-10-07 10:34:18 -03:00
Daniel Hilst e469015227 Merge pull request #7902 from VersatusHPC/test/r26-routeop-behavior
test(routeop): exercise the complete postscript
2026-10-07 10:33:41 -03:00
Daniel Hilst 332e054516 Merge pull request #7897 from VersatusHPC/fix/openeuler-ppc64le-core-mock-resultdir
fix(xcat-core): the openEuler ppc64le core build cannot write its own resultdir
2026-10-07 10:31:05 -03:00
Daniel Hilst 644dd3d4d1 Merge pull request #7901 from VersatusHPC/fix/openeuler-encrypted-passwd-openssl
fix(xcat-core): encrypted_passwd_openssl_diskfull reports no password on openEuler
2026-10-07 10:30:30 -03:00
Daniel Hilst 1a0cebb7df Merge pull request #7904 from middelkoopt/tm-genimage-gpgcheck-v3
feat(genimage): opt-in package signature checks for EL images
2026-10-07 10:24:26 -03:00
Daniel Hilst 324507651c fix(xcat-core): the chrootuid comment and its assertion describe mock wrongly
build-utils/lib/XCAT/BuildUtils.pm said the inherited chrootuid 1000 stays in
effect for the chroot. A mock configuration is Python, so the later assignment
replaces the value and nothing reads 1000 afterwards. The in-chroot build user
becomes uid 0.

buildrpms_mock_resultdir_uid.t asserted that the inherited line is still
present. The pattern is a line of the test's own fixture and mock_config_text
only appends, so the assertion passes even when the function returns the base
text unchanged. It is removed.

The comment now states the replacement and its consequence, and records why
chrootgid is left unset. Without the chrootuid assignment the file fails 2 of
10.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-06 22:05:25 -03:00
Timothy Middelkoop d1faba077c feat(genimage): opt-in package signature checks for EL images
Add the linuximage gpgcheck attribute. When it is set to 1 or yes,
genimage passes --gpgcheck to the shared RPM image builder, which
exports the builder's trusted RPM keys exactly as it does for openEuler
and writes gpgcheck=1 with that gpgkey for the pkgdir, kerneldir and
otherpkgdir repositories. Unset keeps the existing unverified
configuration, openEuler stays always verified, and builders without
the option reject the attribute instead of ignoring it.

Collect the otherpkgs repositories in imgutils so that an otherpkgdir
holding only URLs no longer adds a file:/// repository that fails to
download metadata on EL.

Signed-off-by: Timothy Middelkoop <tmiddelkoop@internet2.edu>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 11:24:33 -05:00
Vinícius Ferrão 6fc1f332cb docs(test): document routeop sandbox prerequisites 2026-10-06 12:21:47 -03:00
Vinícius Ferrão ca33542789 test(routeop): exercise the complete postscript
Replace the extracted-function Perl runner with BATS tests that invoke
routeop in isolated Linux namespaces. Check route commands, persistent
entries, matching routes, and replacement failures.
2026-10-06 12:21:47 -03:00
Daniel Hilst edb7d3217a fix(xcat-core): encrypted_passwd_openssl_diskfull reports no password on openEuler
The case failed on openeuler20.03sp4, openeuler22.03sp4 and openeuler24.03sp4, 3 occurrences
in xcat-ci build 89. The diff check failed, not the extraction.

encrypted_passwd_openssl_diskfull is the only case in passwd/case0 that selects the extraction
by distribution. It greps /etc/*release for SUSE, then for "Red Hat|CentOS|Rocky|Alma", then for
Ubuntu. On an openEuler management node all three miss and openEuler matches, so the case takes
the final arm, prints "Sorry,this is not supported os", writes nothing to
/tmp/instcryptedpasswd, and the diff against the password table reports rc=2.

openEuler now takes the Red Hat arm. compute.openeuler.tmpl writes
"rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#", which is byte-identical
to every EL template, so field 3 holds the hash and the EL cells already pass with that arm.

The diff check is unchanged, so the case still fails when the extraction reads the wrong field:
field 3 of the expanded line gives diff rc=0 and field 4 gives rc=1.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit a1b9372c413f54d18ba6a60d3839e9f75d7b8261)
2026-10-06 10:32:33 -03:00
Daniel Hilst 93322cd0f4 Merge pull request #7899 from VersatusHPC/fix/xcat-ws-conf-module-path
fix(xCAT-server): xcat-ws.conf names a SUSE module path and never matches its package
2026-10-06 10:21:57 -03:00
Daniel Hilst 74f0267ca1 Merge pull request #7898 from VersatusHPC/fix/openeuler-nicextraparams-ifcfg-persist
fix(configeth): a nicextraparams key never reaches an ifcfg NIC profile
2026-10-06 10:21:31 -03:00
Vinícius Ferrão 3976dd96b3 docs(fips): describe installation and validation boundaries 2026-10-05 22:56:35 -03:00
Vinícius Ferrão cb70af1e16 test(discovery): exercise bootstrap signing and reused keys 2026-10-05 22:56:00 -03:00
Vinícius Ferrão 3908b13960 fix(discovery): use FIPS-compatible bootstrap keys 2026-10-05 22:55:27 -03:00
Vinícius Ferrão 923fe01d2d test(dhcp): cover conditional SHA client requirements 2026-10-05 22:54:53 -03:00
Vinícius Ferrão b633f669c4 fix(dhcp): check SHA support only when OMAPI requires it 2026-10-05 22:54:27 -03:00
Vinícius Ferrão 6cd25ac453 test(kea): cover FIPS key errors and legacy compatibility 2026-10-05 22:53:43 -03:00
Vinícius Ferrão 45d773d5cd fix(kea): propagate invalid FIPS key policy 2026-10-05 22:53:29 -03:00
Vinícius Ferrão f095e5da81 test(dhcp): cover shared FIPS defaults and BIND signing 2026-10-05 22:52:49 -03:00
Vinícius Ferrão d01cb679eb fix(dhcp): share SHA-256 key policy in FIPS mode 2026-10-05 22:52:34 -03:00
Vinícius Ferrão dc2f83a2de test(ssh): exercise FIPS policy and optional host keys 2026-10-05 18:14:20 -03:00
Vinícius Ferrão 750ed7e5a5 fix(ssh): skip optional DSA host keys in FIPS mode 2026-10-05 18:14:20 -03:00
Vinícius Ferrão 449c52acfe test(dhcp): isolate compatibility fixtures from host FIPS mode 2026-10-05 18:14:20 -03:00
Daniel Hilst 86aaceb714 fix(xcat-core): read the NIC configuration from the file NetworkManager reports
confignetwork_secondarynic_nicextraparams_updatenode fails on EL8 because the dump
nic_cfg.sh prints carries no extra params, although configeth wrote CONNECTED_MODE and the
node has it.

nm_show resolves the connection's backend file by globbing
/etc/NetworkManager/system-connections for the UUID. The keyfile plugin keeps a connection
there, and on EL9 and EL10 it is the only plugin. On EL8 the ifcfg-rh plugin owns the
connection and keeps it under /etc/sysconfig/network-scripts, so the glob matches nothing and
no file is dumped. Every check that greps the dump for a value nm_show does not normalize
then sees nothing.

Ask NetworkManager for the path through the UUID,FILENAME fields and keep the glob as a
fallback. Read the MTU from either spelling, because a keyfile writes "mtu=" and an ifcfg
file "MTU=".

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 14:07:47 -03:00
Daniel Hilst b1d3190298 fix(xcat-core): the nicextraparams repair keeps a stale value and joins lines
xcat_persist_nic_extra_param only appended a key that was absent. When the profile already held
CONNECTED_MODE=no, a request for yes left no. It appended after the last line, so a profile with
no final newline got NAME=xcat-ens4CONNECTED_MODE=yes. In a keyfile it appended at the end of the
file, which is not the [user] section when another section follows it.

The function now rewrites the profile with awk. It replaces the line of the exact key, or inserts
the key at the end of [user] for a keyfile and at the end of an ifcfg file. It adds [user] when the
keyfile has none.

The repair block of configeth moves into xcat_nm_persist_nic_extra_params, so a test can reach the
store decision. configeth calls it after the last nmcli con up. xcat_uses_nm_keyfile now calls
xcat_nm_conn_file instead of repeating its two nmcli calls.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 14:07:47 -03:00
Daniel Hilst 2228479cac test(xcat-core): capture the nicextraparams repair on an ifcfg profile
The persist test sourced only xcatlib.sh and never reached the gate in configeth that skipped an
ifcfg profile, so putting that gate back left every test green. Its refusal test also passed on a
127 from a missing function.

The test now calls the repair through xcat_nm_persist_nic_extra_params with nmcli stubbed to
report an ifcfg file and a keyfile. It also captures three faults of xcat_persist_nic_extra_param:
it keeps an old value, it joins the key to a last line with no newline, and it appends a keyfile
key after a section that follows [user].

nic_cfg.bats captures that nm_show prints no profile when NM reports an ifcfg file, so the xcattest
case cannot match CONNECTED_MODE=yes there. nic_cfg.sh returns before its dispatch when sourced.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 14:07:36 -03:00
Daniel Hilst 6bc7800bba fix(xcat-core): deny the REST aliases when mod_rewrite is not loaded
xcat-ws.conf sends /xcatws and /xcatwsv2 to https only when mod_rewrite is
loaded. Without that module the aliases run the REST CGI on any port.

An IfModule !mod_rewrite.c block now answers 403 for both aliases.
RedirectMatch comes from mod_alias, which the ScriptAlias lines of the
same file already require. Other paths, such as /install, are not changed.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 14:03:14 -03:00
Daniel Hilst 469e108ff4 Merge upstream master into fix/xcat-ws-conf-module-path
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 13:50:47 -03:00
Daniel Hilst 4f6938c6b2 test(xcat-core): check the REST aliases when mod_rewrite is not loaded
xcat-ws.conf keeps its https redirect inside an IfModule mod_rewrite.c
block. No test starts Apache with the fragment, so nothing checks what the
REST aliases answer when that module is not loaded.

wsapi_apache_access.t starts a private Apache on a free port with the
fragment from the source tree. Without mod_rewrite it expects 403 from
/xcatws and /xcatwsv2. With mod_rewrite it expects the 302 to https. In
both cases /install is still served.

The Debian packages do not install xcat-ws.conf, so the GitHub action runs
the test from the source tree after install. The installed copy skips.

The test fails without mod_rewrite: both aliases answer 200 and run the CGI.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 13:38:52 -03:00
Daniel Hilst 4df004ee2d Merge pull request #7857 from VersatusHPC/test/r26-redaction-behavior
test(xcatd): exercise loaded password redaction
2026-10-05 11:27:27 -03:00
Daniel Hilst 74d5184963 fix(xcat-core): xcat-ws.conf names a SUSE module path and never matches its package
`rpm -V xCAT-server` reports /etc/httpd/conf.d/xcat-ws.conf and
/etc/apache2/conf.d/xcat-ws.conf changed on every EL, openEuler and SUSE
management node, for the life of the install. %install shipped the Apache 2.2
fragment as the payload, and %post replaced it with the Apache 2.4 fragment
whenever httpd, apachectl or apache2ctl reported 2.4. Every supported
distribution runs Apache 2.4, so the file on disk never matched the package
digest. The drift is a permanent false positive for anyone who verifies an
installed xCAT before trusting it.

Both fragments also began with
`LoadModule rewrite_module /usr/lib64/apache2-prefork/mod_rewrite.so`. That
file exists only on SUSE under the prefork MPM. Apache tolerates it on EL and
openEuler because conf.modules.d loaded mod_rewrite first, and logs AH01574;
where the module is not loaded first, the missing file stops Apache from
starting.

xcat-ws.conf.apache22 and xcat-ws.conf.apache24 are replaced by one
xcat-ws.conf that serves both generations: the redirect sits behind
<IfModule mod_rewrite.c>, and the authorization directives behind
<IfModule mod_authz_core.c> and its negation. %install copies that one file to
both conf.d paths and %post no longer names them, so the payload is the final
file. %post runs a2enmod rewrite where a2enmod manages modules, which is how
SUSE gets the module the removed LoadModule used to pull in.

xCAT-test/unit/wsapi_apache_conf_portable.t fails 22 of its 30 assertions
without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 11:25:38 -03:00
Daniel Hilst ff9b74805c test(xcat-core): capture the xcat-ws.conf module path and the rpm -V drift
`rpm -V xCAT-server` reports /etc/httpd/conf.d/xcat-ws.conf and
/etc/apache2/conf.d/xcat-ws.conf changed on every EL, openEuler and SUSE
management node, for ever. %install ships the Apache 2.2 fragment as the
payload and %post replaces it with the Apache 2.4 fragment on any server that
reports 2.4, which is every supported distribution.

Both fragments also start with
`LoadModule rewrite_module /usr/lib64/apache2-prefork/mod_rewrite.so`. That
file is absent on EL and openEuler, and absent on SUSE under any MPM but
prefork. Apache skips the line today only because the distribution loaded
mod_rewrite first, and logs AH01574.

The new test parses each shipped fragment into directives and enclosing
sections, and the spec into its scriptlet sections. It asserts the fragment
declares no LoadModule and no absolute path, that the redirect and both
generations of the authorization directives sit behind their own <IfModule>
guard, and that %post never names the installed conf.

22 of its 30 assertions fail on this commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 11:25:38 -03:00
Daniel Hilst 7a2cbf66f6 test(xcat-core): two negative checks in the persist test cannot fail
bash ignores errexit for a command inverted with "!", so a "! grep" that is not the last line of
a bats test never fails it. The ifcfg test wrote two of them, and the first could not report a
[user] section appearing in an ifcfg profile.

Both now call refute_grep, the helper that exists for this. Restoring the keyfile-only write
fails that test on both assertions.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 11:25:10 -03:00
Daniel Hilst 46fd59f26d fix(xcat-core): a nicextraparams key never reaches an ifcfg NIC profile
confignetwork_secondarynic_nicextraparams_updatenode fails on openEuler 20.03sp4, 22.03sp4 and
24.03sp4 and on el8, while its sibling confignetwork_secondarynic_updatenode passes everywhere.
The only failing check is CONNECTED_MODE=yes, twice. The run log shows configeth receives the
value -- "array_nic_params 0=CONNECTED_MODE=yes" -- and the profile NetworkManager reports,
/etc/sysconfig/network-scripts/ifcfg-xcat-ens4-1, does not contain it afterwards.

configeth writes nicextraparams in configipv4 and then activates the connection. The comment on
the late persistence block states why that write does not survive: the nmcli con reload/up in the
restart phase re-serializes the connection from NetworkManager's in-memory model and drops
anything NetworkManager does not model. The block repairs it after activation, but its gate
requires xcat_uses_nm_keyfile, so it runs for a keyfile store only. el8 never reaches that test,
and openEuler reaches it and fails it because NetworkManager there reports an ifcfg file. Those
are the two families on the ifcfg path and the two that fail.

The block now runs for both stores. xcat_nm_conn_file asks NetworkManager which file holds the
connection rather than composing the name, because NetworkManager suffixes it when a file of the
plain name exists. xcat_persist_nic_extra_param writes the key as the profile spells it -- under
[user] with an xcat. prefix in a keyfile, plain in an ifcfg file -- and appends only when the key
is absent.

xcatlib_nic_extra_param_persist.bats covers both stores with nmcli stubbed. Two behavioural
mutants were run against it: restoring the keyfile-only behaviour fails the three ifcfg
assertions and leaves the keyfile ones passing, and composing the filename fails only the
resolution assertion.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 11:25:09 -03:00