2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-08-28 01:26:41 +00:00
Commit Graph

1908 Commits

Author SHA1 Message Date
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
Vinícius Ferrão 9f33b19214 fix: restore legacy SLES provisioning paths 2026-05-05 17:09:37 -03:00
Vinícius Ferrão 7897f30bfe Modernize xcatd service packaging 2026-05-04 18:13:23 -03:00
Markus Hilger 679bed8926 Merge pull request #7542 from VersatusHPC/fix/apache-disable-directory-indexing
fix: disable Apache directory indexing on /install and /tftpboot
2026-05-04 17:18:39 +02:00
Vinícius Ferrão 5035697e9b fix: disable Apache directory indexing on /install and /tftpboot
The default xCAT Apache configuration shipped with Options Indexes
enabled for the /install and /tftpboot directories. This allowed
unauthenticated users to browse directory listings, disclosing the
full tree of postscripts, boot files, and (in production deployments)
potentially kickstart files with password hashes, custom scripts with
embedded credentials, and cluster topology details.

Replace Options Indexes with -Indexes in all four shipped Apache config
files (MN and SN, Apache 2.2 and 2.4 variants). Direct file access
by known path continues to work, so all provisioning workflows are
unaffected. Directory browsing for /xcat-doc is preserved as it
contains only public documentation.

Additionally, add an Apache hardening guide documenting recommended
permissions for sensitive directories under /install, network binding
best practices, and IP-based access control options.

Addresses #7450
2026-05-03 23:01:01 -03:00
Vinícius Ferrão 4165b26a04 fix: remove Docker container lifecycle management (dead code since 2016)
Docker container lifecycle management (mgt=docker, mkdocker, rmdocker,
lsdocker) was added in 2015-2016 as an experiment targeting Docker API
v1.22 on Ubuntu only. Documentation and man pages were deliberately
removed in 2019 (PRs #6222 and #6324) with the original developer's
approval, noting that "the interface of Docker has become very simple
right now, so there is no value for xCAT to offer such functions."

The plugin was still being shipped but has had no functional code changes
since April 2016, was never listed as a valid mgt value in Schema.pm,
and no user ever filed an issue about it.

Removed:
- xCAT-server/lib/xcat/plugins/docker.pm (1,142 lines)
- xCAT/postscripts/setupdockerhost
- xCAT-server/share/xcat/scripts/setup-dockerhost-cert.sh
- xCAT-test/autotest/testcase/dockercommand/ (test cases)
- Docker attribute definitions in Schema.pm
- Client symlinks (mkdocker, rmdocker, lsdocker)
- Usage entries and dockerhost cert handling in credentials.pm
- Docker attribute documentation in man7 pages

The "Running xCAT in Docker" documentation (dockerized_xcat/) is
retained as it documents containerizing xCAT itself, not the removed
mgt=docker feature.

Closes #7518
2026-05-03 12:11:33 -03:00
Vinícius Ferrão 1f9173f07a Fix some EL9 and EL10 provisioning gaps (#7530)
* Fix EL9 and EL10 provisioning gaps
2026-05-02 04:27:54 +02:00
Vinícius Ferrão 023beff053 Add Ubuntu 26.04 provisioning support 2026-05-01 11:13:45 -03:00
Vinícius Ferrão 6f3d9bb9d1 Add Kea DHCP backend 2026-04-23 02:01:33 -03:00
Daniel Hilst Selli baa2380cd2 fix: Move dracut call to the .spec
This fixes a problem where the dracut image was pulling artifacts from
the build host and not the mock image, e.g. building for EL9 in EL10.

Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
2026-04-14 11:15:56 -03:00
Daniel Hilst Selli fccdc3ec64 fix: Fix genesis-base package build
Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
2026-03-30 20:46:42 -03:00
Daniel Hilst Selli d7e8ec9607 fix: Pull xCAT-genesis-scripts based on the arch
Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
2026-03-18 18:22:37 -03:00
Daniel Hilst Selli 4a1905171d fix: Fix genesis boot in ppc64le
Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
2026-03-11 09:32:35 -03:00
Daniel Hilst Selli 0e0ead786f fix: Fix genesis & sequential node discovery in x86_64
Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
2026-02-25 14:08:40 -03:00
Daniel Hilst Selli 9ce1120356 revert: Revert xCAT.spec adding genesis dependencies again
Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
2026-01-22 11:57:29 -03:00
Daniel Hilst Selli e8b043f7c3 build: Add buildrpms.sh to build RPMs for multiple EL targets
Fix warning in xCAT/xCAT.spec about macro inside comments
Fix missing build dependencies in .spec files
Enable passsing gitinfo as command line argument in perl-xCAT.spec

Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
2025-12-02 15:27:27 -03:00
Daniel Hilst Selli 8c2babfe60 fix!: Drop xCAT-genesis-scripts dependencies
BREAKING CHANGE: This disables the automatic installation of
xCAT genesis packages.

Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
2025-11-27 20:23:15 -03:00
dubmarm ee5479c26f Adjustments to configib to handle Rocky9 precreated connections (#7490)
* take out useless arp_ignore/arp_filter lines

* create logic to use con add if con doesn't exist, else con modify

* swap the con modify vs con add logic so that it matches the test logic

* add back arp_filter and arp_ignore

---------

Co-authored-by: dmarm <dmarm@dmarms-MBP.lan>
2025-05-27 21:15:43 +02:00
Simon Fowler 6d446a55b4 Use default MaxStartups value.
Some versions of openssh (notably 8.9p1, as ships with Ubuntu 22.04) are
buggy with values of MaxStartups >= 1024 (see
https://lists.mindrot.org/pipermail/openssh-bugs/2022-March/023864.html
for details). Rather than try to tweak this setting, use the default
value of '10:30:100'.
2025-04-17 16:23:47 +02:00
Markus Hilger d8ce286412 Merge pull request #7460 from abhishek-sa1/master
Genesis fix for x86_64
2024-09-10 17:17:26 +02:00
Markus Hilger 39664c5d8e Merge pull request #7459 from alexrichert/configib_fix_jul24
configib: fix/clean up el9 support
2024-08-28 01:05:06 +02:00
Alex Richert c89dbe309b configib: don't rm config file for el9/nmcli 2024-08-15 11:30:40 -07:00
sgr 10713bfc6e fix for multiply nameservers in /var/run/NetworkManager/resolv.conf 2024-08-15 15:11:41 +02:00
abhishek-sa1 4346aacfd2 Update configeth 2024-07-26 16:05:22 +05:30
Alex Richert 0a3852e787 configib: fix/clean up el9 support 2024-07-24 18:01:38 -07:00
Markus Hilger 9da20387d7 Fix nicutils syntax, improve regex 2024-06-26 15:48:39 +02:00
Alex Richert 1e22382125 Use 'nmcli con modify' for nicextraparams on RHEL9 (#7444)
* Use 'nmcli con modify' for nicextraparams on RHEL9

* update configeth to support nic extra params for RHEL9

* fix new rc logic

* update configeth to support nic extra params for RHEL9, pt 2

* Add alma9+rocky9 for configeth

* Add alma9+rocky9 to nicutils.sh

* configib: use nmcli calls for el9

* configib: fix tabs

* Fix tabs

---------

Co-authored-by: Markus Hilger <markus.hilger@megware.com>
2024-06-24 23:35:36 +02:00