2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-20 09:22:17 +00:00
Commit Graph

298 Commits

Author SHA1 Message Date
Daniel Hilst 37de3e634e fix(xcat-probe): a terminal tput cannot measure erases every checkpoint message
xcatprobe asks 'tput cols' for the screen width whenever TERM is set. The
GitHub Actions container sets TERM=unknown, terminfo carries no such
terminal, and tput writes nothing. The width became 0 and the layout cut
every checkpoint message to the empty string, so the probe printed a
column of bare [ OK ], [WARN] and [FAIL] marks with no text beside them.

xcatprobe_xcatmn_selinux failed on that output. It asserts that the
SELinux checkpoint reports [ OK ], and no checkpoint text reached the log.
The rest of the probe diagnostics were unreadable for the same reason, so
the one [FAIL] in the run named no checkpoint.

probe_format::screen_width keeps the 80 column default when 'tput cols'
gives no usable number. probe_xcatmn_selinux_case.t renders the checkpoint
at that width and three of its assertions fail without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 08:49:45 -03:00
Daniel Hilst f38418bd75 test(xcat-probe): the probe case measures a checkpoint line the test wrote itself
xcatprobe_xcatmn_selinux asserts the text of the SELinux checkpoint, and
probe_xcatmn_selinux_case.t built that line by hand. The line xcatprobe
prints in the GitHub Actions container carries no text, so the test passed
while the case failed.

xcatprobe held the layout in format_cmd_output, which no test can call.
This moves the layout to probe_format and leaves xcatprobe the printing.
The rendering is unchanged at every width: an identical column of output
for widths 7, 40, 79, 80, 120, 121 and 200, truncated and wrapped, with
and without colour.

The test now renders the checkpoint through probe_format at the width the
container gives, and it fails here. screen_width returns 0 for a terminal
'tput cols' cannot measure, the message is cut to the empty string, and
three assertions read '[ OK ]' where they expect the checkpoint text.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 08:49:37 -03:00
Daniel Hilst fabfaedc89 feat(xcat-core): provision compute and service nodes with SELinux enabled
Every compute and service node was provisioned with SELinux disabled.
mknetboot added selinux=0, the kickstart templates said selinux
--disable, and the genimage postinstall and the dracut hooks wrote
SELINUX=disabled into the image. noderes.selinux and site.selinux had no
consumer on the node side.

The mode that xCAT::SELinux->node_modes resolves now reaches the node:

- Kernel command line: mknetboot appends kcmdline_selinux(): selinux=0
  for disabled, enforcing=0 for permissive, nothing for enforcing. An
  image built without the relabel hook (EL7 and older), and a squashfs
  image without labels, boot with selinux=0 and nodeset says why.
  Test: selinux_netboot_kcmdline.t.
- Kickstart: #SELINUXMODE# and #SELINUXRELABEL# in xCAT::Template. The
  rh el8/9/10, riscv64 and openEuler templates use them; the %post ends
  with restorecon -RF over the paths the xCAT scripts write. mkinstall
  warns when a template cannot express the mode of the node.
  Test: selinux_kickstart_template.t.
- genimage: the el8-10 postinstalls no longer write SELINUX=disabled, and
  the stateless xcatroot no longer writes /etc/sysconfig/selinux. genimage
  sets SELINUX=enforcing in the image, adds dracut 98selinux, and installs
  a pre-pivot hook that runs setfiles with the image file_contexts unless
  selinux=0 is set. Tests: selinux_image_config.t, selinux_relabel_hook.bats.
- packimage -m squashfs stores the labels of the image policy through
  mksquashfs pseudo xattr definitions (squashfs-tools 4.6 or later), and
  writes rootimg.sfs.selinux beside the image. Test:
  selinux_squashfs_labels.t.
- Service nodes mount /install and /tftpboot from the management node with
  context=public_content_t and tftpdir_t when SELinux is on.
  Test: selinux_sn_mount_options.t.
- makedns no longer warns about SELinux. xcatprobe xcatmn checks the xcat
  module and the labels of installdir and tftpdir instead of failing on
  enforcing. Test: probe_utils_selinux_policy.t.

The selinux/cases1 xcattest cases provision a diskful, a stateless and a
squashfs node enforcing, and a stateless node with site.selinux=disabled.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:33:16 -03:00
Daniel Hilst 37a25b0fbc Merge master into feat/selinux-netboot
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-19 16:11:59 -03:00
Daniel Hilst db07a23349 fix(xcat-core): rpm does not own the probe subcmds/bin directory
The %post of xCAT-probe created /opt/xcat/probe/subcmds/bin, so the
directory belonged to no package and carried usr_t from its parent rather
than the bin_t the policy gives /opt/.*/bin. It was the only path under
/opt/xcat that restorecon reported as pending, on every management node.

%install now creates the directory, so rpm owns it and labels it from the
policy at install, as the Debian package already does through debian/dirs.
The %post keeps removing the obsolete switchprobe file it finds there.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-15 12:06:01 -03:00
Vinícius Ferrão be8ce8b975 fix(probe): preserve Debian library directory permissions
The Debian package set the xCAT helper directory to 0644, preventing
unprivileged users from loading the probe modules.

Set library directories to 0755 and regular files to 0644. Repair the old
helper-directory mode during configuration because dpkg preserves existing
modes. Leave administrator overrides, other modes, and symlinks unchanged.
2026-10-14 12:37:33 -03:00
Vinícius Ferrão cce001abb8 refactor(dhcp): share the packet capture lifecycle
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-10-11 01:29:22 -03:00
Vinícius Ferrão c3c2351fd9 fix(probe): check the discovery scripts of the upstream loader
An unknown x86 client now fetches its Genesis script from
xcat/ipxe/nets. xcatprobe discovery checked the scripts of each network
under xcat/xnba/nets, and marked the boot loader stage only for a
download from there. It now checks xcat/ipxe/nets, and marks the stage
for a download from either directory.
2026-10-02 23:58:13 -03:00
Vinícius Ferrão fae705d969 fix(probe): recognize the upstream loader download
osdeploy marked a node as loading its boot loader only when it fetched a
file under xcat/xnba, the POWER grub2 image, or yaboot. A node on the
upstream loader fetches xcat/ipxe/..., so osdeploy missed that stage.

Move the match into probe_utils and add xcat/ipxe/.
2026-10-02 23:58:13 -03:00
Vinícius Ferrão 955713c4b2 fix(detect_dhcpd): capture into a private file and stop only its own tcpdump
Both copies wrote the capture to /tmp/dhcpdumpfile.log, so a file left by
another user or an earlier root run blocked the probe and two runs
overwrote each other. tcpdump ran behind a shell, so the script killed it
by searching the process table for any tcpdump on the interface, and a
tcpdump that failed to start left an empty file that read as zero DHCP
servers. An interrupt left the capture running.

The capture file is now a private temporary file removed on every exit.
The child execs tcpdump itself, so the script stops and reaps exactly that
pid, and a tcpdump that ended before the window did fails the run. A
failed send and an INT or TERM stop the capture and exit 1 as well.

Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-09-10 03:12:16 -03:00
Vinícius Ferrão 20eef6d224 fix(detect_dhcpd): find tcpdump through PATH
Both copies refused to run unless /usr/sbin/tcpdump existed. Debian and Ubuntu
install it as /usr/bin/tcpdump, so the rogue DHCP detector never ran there and
the probe reported its tcpdump check as failed.

Resolve tcpdump through PATH and the standard system directories with
CommandUtils::find_executable, run the resolved path, and match that path when
the capture process is killed at the end.
2026-09-08 11:43:00 -03:00
Vinícius Ferrão 77c1694b03 refactor(utils): centralize executable lookup 2026-09-02 22:57:05 -03:00
Vinícius Ferrão 33d9ac6eeb refactor(networkutils): rename isIpaddr to isIpv4addr 2026-09-01 11:18:05 -03:00
Vinícius Ferrão b6d9bc6643 refactor(network): reuse shared netmask helpers 2026-08-23 13:50:00 -03:00
Vinícius Ferrão b22a19876a refactor(probe): reuse command capture for netplan 2026-07-22 23:30:45 -03:00
Vinícius Ferrão 6d59e60331 build(xcatprobe): declare listener tool dependency 2026-07-17 14:32:16 -03:00
Vinícius Ferrão 73b9368ff3 fix(xcatprobe): report listener inspection errors 2026-07-17 14:31:01 -03:00
Vinícius Ferrão 888f5360b8 fix(xcatprobe): prefer ss for listener checks 2026-07-16 21:31:08 -03:00
Vinícius Ferrão 701e9e00c0 Fix xcatprobe TFTP check failure with restrictive umask
The is_tftp_ready() function creates test files that inherit the
shell's umask. With umask 027, files get 640 permissions and the
TFTP daemon (running as nobody/tftp) cannot read them, causing a
false negative even when TFTP service is healthy.

Temporarily set umask to 022 during test file creation so files
are world-readable (644), then restore the original umask.

Fixes: https://github.com/xcat2/xcat-core/issues/7487
2026-05-11 13:13:05 -03:00
Vinícius Ferrão 219b0f1f5d Add networkd fallback for netplan static IP probe
Detect static netplan addresses on older Ubuntu netplan releases by falling back to generated systemd-networkd configuration when netplan get is unavailable. Keep netplan get authoritative when supported.

Co-authored-by: karcaw <663031+karcaw@users.noreply.github.com>
2026-05-07 13:46:33 -03:00
Vinícius Ferrão 1babd7b0e4 fix: improve Ubuntu LTS provisioning support 2026-04-29 18:19:12 -03:00
Vinícius Ferrão c2a90293ea Address DHCP backend review findings 2026-04-23 18:41:42 -03:00
Vinícius Ferrão 6f3d9bb9d1 Add Kea DHCP backend 2026-04-23 02:01:33 -03:00
Markus Hilger f42011a493 Unify shebang lines 2024-05-07 16:43:07 +02:00
Mark Gurevich 5b5b54c3c3 Eliminate some duplicate output lines from xcatprobe osdeploy 2023-01-12 16:08:31 -05:00
Mark Gurevich 6f12483b79 Prevent rpmbuild from checking and modifying interpreter directives(2) 2022-08-12 08:38:29 -04:00
Mark Gurevich da113964b1 Better file linking for xCAT-probe 2022-06-10 10:46:17 -04:00
Mark Gurevich 47ec9264a1 Better formatting fox xcatprobe output 2022-06-06 10:06:44 -04:00
Mark Gurevich 4a6ccf0ca5 Update docker build containers to CentOS8 (3) 2022-05-13 13:05:11 -04:00
Mark Gurevich 47c02f43f4 Support xcat-core builds on CentOS8 2022-05-12 14:38:12 -04:00
Mark Gurevich 4614bbe515 Detect SLES15 when running detect_dhcpd xcatprobe 2022-03-07 15:17:07 -05:00
Mark Gurevich bc3894e6e1 Missing quote when checking for externaldns in xcatprobe 2021-10-04 12:56:58 -04:00
Mark Gurevich f6a81f14dd Better xcatprobe message when makedhpc -q returns no output 2021-09-27 10:21:58 -04:00
besawn fb036608aa Merge pull request #6953 from gurevichmark/iptables_xcatprobe
Improve xcatprobe check for firewall
2021-04-27 08:04:45 -04:00
Mark Gurevich 28fe1dfaad Improve xcatprobe check for firewall 2021-04-23 14:49:56 -04:00
Mark Gurevich af4507bc31 Make xcatprobe xcatmn recognize default SQLite DB 2021-04-13 16:01:02 -04:00
besawn aa087c98ef Merge pull request #6930 from gurevichmark/xcatprobe
xcatprobe fixes
2021-04-08 14:48:02 -04:00
Mark Gurevich f90883b31f Fixes after review 2021-04-06 13:44:26 -04:00
Mark Gurevich e4619859c0 Use correct Perl string compare operator 2021-04-02 13:13:27 -04:00
Mark Gurevich d1108776cd xcatprobe fixes 2021-03-25 16:02:51 -04:00
Mark Gurevich 272200b3e8 Install xCAT-client before xCAT-probe package 2020-07-27 11:03:25 -04:00
Mark Gurevich 465a4c90dc Add debug to xCAT-probe rpm installation 2020-07-14 15:28:02 -04:00
Mark Gurevich bb09d801df Enable clusterstatus xcatprobe on Perl 5.23 2020-07-08 13:59:33 -04:00
cxhong 42915fefe0 Use option type=A for nslookup 2019-11-13 09:24:57 -05:00
Mark Gurevich a93262d79c Just testing 2019-05-16 14:53:38 -04:00
Mark Gurevich 0aa94b362b Link switchprobe file when building xcatprobe on Ubuntu 2019-05-16 10:27:26 -04:00
Kurt H Maier e8aa0c8599 probe_utils: simplify selinux enforcing check 2019-05-07 14:05:25 -07:00
Kurt H Maier 59f8845d37 probe_utils: remove extraneous else block 2019-05-07 13:52:34 -07:00
Kurt H Maier e8fbb1e8af Merge branch 'master' into refactor-switch-statement 2019-05-07 13:04:19 -07:00
Kurt H Maier f89f611ca9 probe-utils.pm: refactor switch statement
switch() is only available if explicitly declared.  switch to
a for block using elsif to return a value.
2019-05-07 13:01:17 -07:00