2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-05 12:37:54 +00:00
Commit Graph

1934 Commits

Author SHA1 Message Date
Daniel Hilst efdb06f641 Merge pull request #7789 from VersatusHPC/refactor/package-manager-discovery
refactor(postscripts): share RPM package manager discovery
2026-08-31 15:33:17 -03:00
Daniel Hilst b0a0893cb3 Merge pull request #7798 from VersatusHPC/refactor/xcatdsklspost-mypostscript-fetch
refactor(xcatdsklspost): share mypostscript fetch pipeline
2026-08-31 12:05:59 -03:00
Daniel Hilst 443a776fd6 Merge pull request #7783 from VersatusHPC/refactor/package-modular-predicate
refactor(postscripts): share modular package directory predicate
2026-08-31 11:43:37 -03:00
Daniel Hilst 3d8e647ee9 Merge pull request #7788 from VersatusHPC/refactor/apache-config-sources
build(httpd): centralize Apache configuration sources
2026-08-31 11:36:33 -03:00
Vinícius Ferrão 3d5a1b7dd8 refactor(xcatdsklspost): share mypostscript fetch pipeline 2026-08-30 23:37:44 -03:00
Vinícius Ferrão a551510566 refactor(postscripts): centralize EL9 version check
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-08-30 21:33:37 -03:00
Vinícius Ferrão 4317b5ec75 refactor(postscripts): share RPM package manager discovery
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-08-30 19:19:20 -03:00
Vinícius Ferrão 5b5fa69791 build(httpd): centralize Apache configuration sources 2026-08-30 18:52:44 -03:00
Vinícius Ferrão 41a0a7c613 Merge pull request #7778 from VersatusHPC/fix/rpm-preserve-xcat-conf
fix(rpm): preserve local xcat.conf changes across upgrades
2026-08-29 16:46:09 -03:00
Vinícius Ferrão d2fec89988 refactor(postscripts): share modular package directory predicate 2026-08-28 19:21:25 -03:00
Vinícius Ferrão c00ed7c181 feat(postscripts): require package utility loading 2026-08-28 15:51:59 -03:00
Vinícius Ferrão 2487faa678 fix(rpm): preserve local xcat.conf changes across upgrades
xcat.conf was installed as an ordinary payload file and then deleted and
recreated from the Apache-version template in %post. rpm therefore held
no record of what was on disk, and an upgrade replaced an edited file
silently, leaving neither .rpmnew nor .rpmsave. A site that had added
Indexes to the /install block lost it on upgrade and directory listings
began returning 403.

Select the Apache 2.2 or 2.4 configuration at build time, using the same
distribution macros the rest of the spec already relies on, and mark
both /etc/httpd/conf.d/xcat.conf and /etc/apache2/conf.d/xcat.conf as
%config(noreplace). rpm then keeps a modified file and installs the new
vendor version alongside it as xcat.conf.rpmnew.

The old payload recorded the 2.2 file while %post wrote the 2.4 one, so
rpm cannot distinguish a stock file from an edited one across the
transition. A migration compares the active file with the templates the
outgoing package saved under conf.orig and removes it only when it is a
regular file still byte-for-byte identical to one of them. A stock
upgrade then completes without an unnecessary .rpmnew, and anything that
differs is left untouched.

That migration runs in %pretrans, not %pre. rpm fixes each config file's
fate before %pre, so removing the active file there can happen after rpm
has already resolved to write only xcat.conf.rpmnew, leaving the system
with no active configuration at all. %pretrans runs before that decision.
It is an embedded Lua scriptlet because a pre-transaction scriptlet
cannot rely on any dependency being unpacked yet, which also means the
comparison needs no external tool.

bc was needed only by the version check the service-node package no
longer performs.

The Apache directives are unchanged. Document a later-loading conf.d
file as the place for site rules, since that survives upgrades without a
merge.
2026-08-27 01:46:17 -03:00
Vinícius Ferrão b2ad18137b Merge pull request #7766 from VersatusHPC/refactor/routeop-helper-reuse
refactor(routeop): reuse route classification helpers
2026-08-26 11:11:44 -03:00
Vinícius Ferrão 79e3570d84 fix(genesis): keep RPM 4.11 packages parseable 2026-08-25 11:26:44 -03:00
Vinícius Ferrão 735951fefe feat(genesis): enable shared package repository 2026-08-25 11:26:44 -03:00
Vinícius Ferrão 309247f41f refactor(routeop): reuse route classification helpers
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-08-24 18:54:52 -03:00
Vinícius Ferrão 0f37c0500a Merge pull request #7756 from VersatusHPC/fix/ubuntu-2604-support
fix(xcat-core): make xCAT work on Ubuntu 26.04 (resolute)
2026-08-24 18:43:34 -03:00
Daniel Hilst c2f3de2289 fix(xcat-core): make xCAT work on Ubuntu 26.04 (resolute)
Promote bind9 from Recommends to Depends on the xcat and xcatsn metapackages. bind9 is
required by makedns, so it must be a hard dependency regardless of the system's APT
recommendation policy -- xCAT manages the cluster DNS through makedns/named, which
makes a DNS server as essential to a management or a service node as the DHCP backend
already declared beside it ("isc-dhcp-server | kea"). As a Recommends it was installed
only while that policy asked for it: an Ubuntu 26.04 management node came up with no
/usr/sbin/named and makedns failing with "failed to start named".

Strip only a trailing third component when deriving the debootstrap suite in the
Ubuntu netboot genimage. The previous s/\.\d+$// also removed the minor from a
two-part osvers, so an initial release with no point-release ISO -- ubuntu26.04, but
equally an initial-release 18.04/20.04/22.04 -- reached debootstrap as a bare major.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-24 18:15:41 -03:00
Daniel Hilst 1e4242174f Merge pull request #7730 from VersatusHPC/fix/enablekdump-staging
fix(enablekdump): stage the NFS dump setup under a per-node directory
2026-08-24 14:36:48 -03:00
Daniel Hilst 0330224009 Merge pull request #7718 from VersatusHPC/fix/mknb-upgrade-failure-visibility
build(packaging): report a failed mknb at the end of an upgrade
2026-08-19 07:08:17 -03:00
Vinícius Ferrão 6b9891b6de fix(enablekdump): anchor the root= strip on a token boundary
The strip used \b, a regex word boundary, which also exists after
punctuation such as - and . inside a token. An unrelated option ending
in root=, for example foo-root=bar or rd.foo.root=bar, lost its tail
and left garbage like foo- behind.

Require a real command-line token boundary instead: the opening quote
or whitespace. The captured delimiter is kept and the substitution
loops, so consecutive stale root= tokens are still all removed.
2026-08-18 14:04:18 -03:00
Vinícius Ferrão cdb7c4b80a fix(enablekdump): drop any stale root= before adding the per-node one
The per-node root= was inserted after the opening quote of
KDUMP_COMMANDLINE_APPEND, keeping whatever the line already held. On a
RHEL 7 node configured by the previous script that leaves the legacy
shared-root value in place after the new one, and dracut takes the last
root= on the command line, so the stale shared root kept winning and the
crash initrd still pointed at the export root. Re-running also stacked a
duplicate per-node token each time.

Strip any existing root= token from the line before inserting this
node's own, so re-running enablekdump migrates a legacy config and is
idempotent. The strip anchors on the same opening quote as the insert
and honors word boundaries, so options such as rootflags=nofail from
the stock RHEL 7 file are left alone.
2026-08-18 13:37:08 -03:00
Vinícius Ferrão 38cad9c5bb fix(enablekdump): stage the NFS dump setup under a per-node directory
For the RHEL 7/8 NFS path, enablekdump created var/crash and a dummy proc
file at the root of the shared dump export, from every node, at deploy.
It also mounted the export over a general-purpose directory such as /mnt.

kdump checks that the dump path exists on the target when it builds the
initrd, so the path has to exist at deploy time. Create only this node's
own subdirectory, $NODE/var/crash, and point kdump.conf at
path /$NODE/var/crash. Each node now writes only under its own subdir, so
nodes no longer share or collide at the export root, and the dump lands in
the node's directory. The setup mounts a dedicated /mnt/kdumpsetup rather
than a general-purpose directory.

The dummy proc file only ever mattered to the RHEL 7 dracut check, which
wants root= to look like a real filesystem. Keep it for RHEL 7, per node,
and point root= at $KDIP:$KDPATH/$NODE. RHEL 8 no longer writes it.

This design was identified by a lenovobuild change and validated on a
running node: a real kernel panic saved the vmcore under the node's own
directory, and nothing was written to the export root.
2026-08-17 14:34:37 -03:00
Vinícius Ferrão 49340254c6 build(debian): report a failed mknb at the end of an xCAT upgrade
The Debian upgrade path sends xcatconfig output to /var/log/xcat/upgrade.log the
same way the rpm one does, so a failed mknb is recorded and never seen.

Apply the same treatment: keep this run's output separately, repeat the failure
on the terminal, and leave the log itself unchanged.
2026-08-09 12:26:37 -03:00
Vinícius Ferrão b95cfdc301 build(spec): report a failed mknb at the end of an xCAT upgrade
xcatconfig checks what mknb returned and logs the failure, but the upgrade
sends its output to /var/log/xcat/upgrade.log, so the line scrolls past and the
management node is left without a current Genesis image for no visible reason.

Repeat it on the terminal. The output of this run is kept separately from the
log so that a failure recorded by an earlier upgrade cannot raise the warning
again, since the log is appended to.
2026-08-09 12:26:36 -03:00
Vinícius Ferrão 8a22d04ff9 fix(otherpkgs): restrict the package upgrade to the xCAT repositories
The otherpkgs postscript ran a bare "yum -y upgrade" after configuring the
xcat-otherpkgs* repositories. That upgrades every installed package from every
enabled repository, so installing a handful of extra packages could also pull
an unrelated distribution update onto the node, at provision time and without
the administrator asking for it.

Scope the upgrade to the repositories the postscript just wrote, which is what
the surrounding code already implies it does. The package install path is left
untouched, so dependencies still resolve against the full repository set.

Only the yum/dnf branch is changed. The zypper and apt branches have the same
unbounded behavior but no equivalent one-flag fix, so they are left alone
rather than half-converted.

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-08-06 23:26:42 -03:00
Vinícius Ferrão 4c82e02a7b fix(httpd): reload hardened config after RPM upgrades 2026-07-27 17:19:26 -03:00
Vinícius Ferrão f6ba29ef80 build(spec): activate the hardened Apache headers on SUSE
The security response headers added to xcat.conf are wrapped in
<IfModule mod_headers.c>, so they only take effect where mod_headers is loaded.
EL loads it by default and the Debian postinst enables it with a2enmod, but SUSE
apache2 does not load it by default, so the headers stayed inactive there. Enable
it in the RPM %post for the apache2 case, guarded so it is a no-op on EL (where
a2enmod is absent and mod_headers is already loaded).

Verified on openSUSE Leap 15.6: mod_headers is off by default, the hardened
config still starts, and after a2enmod the served response carries all four
security headers. The need to load mod_headers on SUSE was identified in the
lenovobuild branch (660df81379 / xcat.conf.apach24.sles), here done via
a2enmod rather than a separate config file.

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-27 17:18:57 -03:00
Vinícius Ferrão 9261a765bd fix(httpd): harden the xCAT Apache configuration
Add standard security response headers (X-Frame-Options, X-Content-Type-
Options, Content-Security-Policy, X-Permitted-Cross-Domain-Policies) to the
/install and /tftpboot directories, mask the server banner with
"ServerTokens Prod", and drop the Includes (SSI) and MultiViews options from
those file-serving directories. Indexes on /install/postscripts, /install/post
and the doc directory are left intact so directory browsing still works where
xCAT relies on it.

The Header directives are wrapped in <IfModule mod_headers.c> so a server
whose mod_headers is not loaded still starts cleanly instead of failing on an
unknown directive. On Debian/Ubuntu, where mod_headers is not enabled by
default, the xCAT and xCATsn package postinst scripts run "a2enmod headers"
before restarting Apache so the headers take effect there as well; on
RHEL/SLES the module is loaded by default and needs no action.

Recovered from the unmerged lenovobuild branch (originals 7ee0c129, 85c8bc09,
d4d1783a), adapted: the deprecated X-XSS-Protection header and the
mod_allowmethods-dependent AllowMethods directive are omitted, and the Header
directives use "set" rather than "append".

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-27 17:18:57 -03:00
Daniel Hilst 433bdf015b Merge pull request #7693 from VersatusHPC/harvest/cfglocorig
fix(xcatserver): keep the server-provided cfgloc before rewriting host=
2026-07-27 11:27:38 -03:00
Daniel Hilst 5bae5b2700 Merge pull request #7675 from VersatusHPC/harvest/reboot-systemd-timer-suse
fix(postscripts): schedule the reboot with a systemd timer on SUSE
2026-07-27 11:21:49 -03:00
Vinícius Ferrão 3967b83290 Merge pull request #7622 from VersatusHPC/harvest/xcatconfig-upgrade-log-stderr 2026-07-27 11:14:36 -03:00
Vinícius Ferrão 415ed2cb76 fix(xcatserver): keep the server-provided cfgloc before rewriting host=
The postscript rewrites host= in the freshly fetched /etc/xcat/cfgloc to point
at MASTER, discarding the database location the credentials came with. That is
the only record of it when the database does not live on the management node.

Keep it as cfgloc.orig; the existing chmod 600 /etc/xcat/cfgloc* covers it.

Recovered from the unmerged lenovobuild branch (10090a9d). The original also
replaced the atomic write with mv-then-sed, which leaves cfgloc truncated if
sed fails, so the write itself is left alone.

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-25 21:30:38 -03:00
Vinícius Ferrão 760b538552 fix(postscripts): schedule the reboot with a systemd timer on SUSE
The reboot postscript backgrounds "(sleep 75; reboot) &". On SUSE that can
fire while the installer is still finishing, rebooting the node mid-install.
Use a systemd timer (systemd-run --on-active=90 /sbin/reboot) on SUSE, which
the installer teardown does not race; EL and Ubuntu keep the existing
backgrounded sleep.

Gated on SUSE and the presence of systemd-run, so no other platform changes.

Recovered from the unmerged lenovobuild branch (6785eb3a, 4fe2a72c, ac04f5ad;
net effect, consolidated).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-23 21:38:44 -03:00
Vinícius Ferrão f05d0cd672 Merge pull request #7648 from VersatusHPC/harvest/drop-elilo-xcat-requires
build(spec): drop the mandatory elilo-xcat dependency
2026-07-23 17:21:43 -03:00
Vinícius Ferrão f20727ed2a build(spec): drop the mandatory elilo-xcat dependency
xCAT and xCATsn hard-required elilo-xcat on every non-s390x install. elilo only
provides the ia64 (Itanium) UEFI loader; modern x86-64 UEFI netboot uses
xnba.efi and aarch64 uses grub2, so the dependency pulls a loader no current
platform needs. Drop the Requires (xnba-undi, which the UEFI path does use, is
kept). elilo-xcat can still be installed by hand for legacy ia64.

An OVMF x86-64 UEFI client netboots through xnba.efi with no elilo involved.

Recovered from the unmerged lenovobuild branch (e53b62e0).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-23 01:32:16 -03:00
Vinícius Ferrão b9f4cff645 fix(packaging): install the xcat logrotate config with sane permissions
The etc.tar.gz payload is unpacked into the buildroot and the resulting
etc/logrotate.d/xcat inherits whatever mode the build umask produced.
logrotate silently skips (and warns about) config files that are group- or
world-writable, so a loose umask can disable xCAT log rotation entirely.

chmod the file to 644 after extraction so the shipped config is always
honored.

Recovered from the unmerged lenovobuild branch (original cb8d671d).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-21 18:34:23 -03:00
Vinícius Ferrão 90d2b30b13 fix(packaging): capture xcatconfig stderr in the upgrade log
The RPM %post runs `xcatconfig -u -V >> /var/log/xcat/upgrade.log` with only
stdout redirected, so any errors or warnings the upgrade emits go to the
package manager's output and are lost from the log a later diagnosis relies
on.

Redirect stderr into the same log with 2>&1.

Recovered from the unmerged lenovobuild branch (original 51d87d4d).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-07-21 17:45:32 -03:00
Daniel Hilst 529c821177 fix(packaging): install-time DHCP rich dep + genesis-base out of flat core
The single flat xcat-core repo serves el8/el9/el10 from one build, but two spec
decisions were resolved at BUILD time and so were wrong for the other ELs that
share the same repo.

1. DHCP backend. xCAT.spec and xCATsn.spec selected the dhcp provider with a
   build-time %if (rhel >= 10 -> kea, else dhcpd), so an el10 build wrongly
   required kea on el8/el9 (and an el8/el9 build wrongly required dhcpd on
   el10). Replace it with an install-time RPM rich dependency:

     Requires: (kea if (system-release >= 10) else /usr/sbin/dhcpd)
     Requires: (kea-hooks if (system-release >= 10))

   dnf now resolves it per client: kea on el10+ (which dropped ISC dhcp from the
   distro), dhcpd on el8/el9. SLES has no "system-release" provide, so the
   condition is false there and it falls back to /usr/sbin/dhcpd, preserving
   prior behavior. system-release is versioned per release package
   (el10=10.x, el9=9.x, el8=8.x).

2. openssl. Make the xCAT-server openssl Requires uniform across EL (non-SUSE)
   instead of el10-only, so the produced package set does not depend on which EL
   the build host happened to be.

Also drop xCAT-genesis-base from the default @PACKAGES set in buildrpms.pl: its
initramfs bundles the build-chroot kernel/glibc and is therefore OS- and
arch-dependent, so it cannot ship in the single flat core. It is now built per
target by the xcat-dep pipeline (mockbuild-all.pl, via
`buildrpms.pl --package xCAT-genesis-base`) and ships in xcat-dep/rh<N>. The
explicit `--package xCAT-genesis-base` build path is retained.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-06-30 19:19:33 -03:00
Daniel Hilst 37212eea3c fix(xcat): drop unsatisfiable ppc64 genesis-scripts dependency
xcat and xcatsn declared a hard dependency on xcat-genesis-scripts-ppc64. In
an amd64-only build that package is never produced, so apt could not satisfy
the dependency and refused to install xcat. Depend only on the amd64
genesis-scripts package.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-06-24 14:20:26 -03:00
Daniel Hilst 638f0d75c4 Fix xCAT 2.18 EL10 x86_64 package build issues
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-06-20 18:48:14 -03:00
Markus Hilger a10f0ccc38 Merge pull request #7571 from VersatusHPC/fix/confignetwork-remove-option
feat: confignetwork: add -r option to remove undefined NICs
2026-05-08 09:41:44 +02:00
Vinícius Ferrão b69d9ca1f8 confignetwork: add -r option to remove undefined NICs
Port the -r option from the deprecated confignics postscript to
confignetwork. This allows removing network configuration for NICs
that are not defined in xCAT, useful when nodes have extra interfaces
that get DHCP addresses by default.

Safety checks ported from confignics:
- Skip non-ethernet interfaces
- Skip bridge members
- Skip xCAT-defined NICs
- Skip install NIC
- Skip VLAN interfaces
- Skip bonding members (SLAVE/MASTER)

Closes: https://github.com/xcat2/xcat-core/issues/6142
Supersedes: https://github.com/xcat2/xcat-core/pull/7092

Co-Authored-By: Christopher Walker <cjw1006@gmail.com>
2026-05-07 23:45:34 -03:00
Vinícius Ferrão adb93b3eac Fix nicutils IPv4 address validation
Co-authored-by: JDiprose <3533220+JDiprose@users.noreply.github.com>
2026-05-07 23:00:07 -03:00
Vinícius Ferrão 64ebf8c96e fix: harden nmcli connection handling against spaces in NM profile names
NetworkManager auto-generates connection names that can contain spaces
(e.g. "Wired connection 2"). Multiple devices can also share the same
auto-generated name. Both cases cause failures when names are passed
to nmcli in bridge and bond setup paths.

Resolve active connection UUID via nmcli device show (GENERAL.CON-UUID)
instead of by name, which avoids both word-splitting on spaces and
ambiguity when multiple connections share the same name.

Changes:
- Bridge slave setup: resolve UUID via device show instead of by name
- Bond slave setup: same UUID-via-device approach for con down/mod
- Bridge rollback: preserve original xcat-prefixed connection name so
  rollback paths restore the correct name instead of a UUID
- Utility functions: quote connection name arguments in
  is_nmcli_connection_exist, is_connection_activate_intime, and
  wait_nic_connect_intime for defensive correctness
- Add -F flag to grep in is_nmcli_connection_exist for literal matching
- Log both human-readable name and UUID when reusing existing connections

Tested on EL10 host with duplicate "Ethernet connection 1/2" profiles
across multiple NICs — UUID resolution via device returns exactly one
UUID per device regardless of name collisions.

Follows up on #7562 and #7483.

Co-authored-by: OliverTUBAF <86062666+OliverTUBAF@users.noreply.github.com>
2026-05-07 17:55:07 -03:00
Markus Hilger 155e58e4ed Merge pull request #7562 from VersatusHPC/fix/nicutils-bridge-quoting
fix: use connection UUID in bridge slave setup in NetworkManager
2026-05-07 11:57:17 +02:00
Markus Hilger 5bd7bd2112 Merge pull request #7561 from VersatusHPC/fix/confignetwork-typo
fix: typo in confignetwork preventing SETINSTALLNIC from working
2026-05-07 11:55:55 +02:00
Vinícius Ferrão a6c2bc3790 fix: use connection UUID in bridge slave setup to handle spaces in NM profile names
NetworkManager can auto-generate connection names with spaces (e.g.
"Wired connection 2"). The bridge slave setup in create_bridge_interface_nmcli
stored this name in a variable that was later expanded unquoted in nmcli
commands, breaking both the initial con mod and all downstream operations
(con up, con delete on rollback). Resolve the connection to its UUID
before use, which is space-safe and valid for all nmcli operations.

Closes: #7483
2026-05-07 03:06:41 -03:00
Vinícius Ferrão 1e341d941a fix: typo in confignetwork preventing SETINSTALLNIC from working
bool_install_nic on line 99 should be boot_install_nic, matching
the variable used everywhere else in the script. This caused the
SETINSTALLNIC environment variable to have no effect.

Fixes: xcat2/xcat-core#7472
2026-05-07 03:02:07 -03:00
Vinícius Ferrão dd15d5abb5 fix: detect dnf as package manager in ospkgs and otherpkgs postscripts
On RHEL 9.x minimal installs, the yum package may not exist as a
separate RPM — only dnf is present with /usr/bin/yum as a symlink.
The previous detection using rpm -q yum would fail, causing hasyum
to remain 0 and skipping repo file creation entirely.

Replace rpm -q based detection with executable checks for /usr/bin/dnf
and /usr/bin/yum. Introduce yumcmd variable to carry the actual command
name through all package operations instead of hardcoding yum.

Fixes: xcat2/xcat-core#7497
2026-05-07 02:54:44 -03:00