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

6978 Commits

Author SHA1 Message Date
Daniel Hilst f2f96b67fc Merge pull request #7728 from VersatusHPC/fix/xml-external-entity
fix(xcatd): block XML external entities on the legacy parser path
2026-08-24 14:23:48 -03:00
Daniel Hilst 5ca148889c Merge pull request #7749 from VersatusHPC/fix/nodestat-usefping-option
fix(nodestat): accept the fping option that the usage message gives
2026-08-24 12:42:21 -03:00
Daniel Hilst bcf6f9059a Merge pull request #7750 from VersatusHPC/fix/dbobjutils-exact-only-if-values
fix(dbobjutils): match exact only-if values
2026-08-24 12:39:34 -03:00
Daniel Hilst 14feebce2f Merge pull request #7753 from VersatusHPC/fix/genesis-lzma-via-xz
fix(mknb): compress the genesis image with xz when lzma is absent
2026-08-24 12:36:26 -03:00
Daniel Hilst a7f4c770b5 Merge pull request #7631 from VersatusHPC/refactor/ipmi-rmcp-response-identity
refactor(ipmi): centralize RMCP response identity check
2026-08-24 12:27:17 -03:00
Vinícius Ferrão d5f882291d fix(nodestat): accept the fping option that the usage message gives
The manual page and the usage message of nodestat give the option
-f|--usefping. The preprocessor of the request knows no option f, and the
handler of the request spells the long name useping, so --usefping does
nothing. An administrator who follows the manual page gets the nmap path, and
gets no message that says why.

The two places also read different specifications, so an option that one
place accepts can reach the other place and take a different meaning. Put the
specification in one routine, and let both places read that routine.

Give the name usefping to the option, and keep useping as a second name. That
spelling has worked since 2.14.2, so a site can have it in a script.

The long name of the fping option starts with the same letters as usemon, so
--use and --us become names that Getopt::Long cannot decide. Those two
abbreviations select usemon today. Keep them with usemon, or an administrator
who monitors with them loses the monitoring and gets no message.

The change has two other effects. The abbreviations --use and --us no longer
select fping as well, which they did only because the two places read
different specifications. The bundles -mf and -fm now select both options,
which they did not do before.

Recovered from the lenovobuild branch.
2026-08-23 22:38:41 -03:00
Vinícius Ferrão c390570e95 fix(mknb): compress the genesis image with xz when lzma is absent
The genesis image goes into a file whose name ends with .lzma. The plugin
writes that file only when /usr/bin/lzma is there, and it falls back to gzip
when it is not.

Red Hat ships no lzma binary. On AlmaLinux 9 and on AlmaLinux 10 that test
fails, the plugin falls back to gzip, and it gives no message that says why.
The image is larger on each run of mknb. Debian and Ubuntu ship lzma as a
second name for xz, so those systems still get the smaller image.

Ask xz for the same container when lzma is absent. The command
"xz --format=lzma" writes the same bytes as "lzma", so the file keeps its
name, its container and its size. Keep the gzip fallback for a system that
has neither program.

Recovered from the lenovobuild branch, which asked xz for the xz container.
That container is not the lzma container, and the name of the file says lzma.
2026-08-23 22:38:41 -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 6e43843712 refactor(utils): centralize comma-list membership 2026-08-23 11:08:24 -03:00
Vinícius Ferrão bae92ffc47 fix(credentials): audit delegated certificate signing 2026-08-20 17:37:19 -03:00
Vinícius Ferrão 109f587a7f fix(credentials): delegate node certificates through service nodes 2026-08-20 16:50:27 -03:00
Daniel Hilst c6549352b9 Merge pull request #7724 from VersatusHPC/feat/mknb-exported-genesis
feat(mknb): install exported Genesis images
2026-08-20 13:00:24 -03:00
Daniel Hilst d7d71b2c5e Merge pull request #7735 from VersatusHPC/fix/redact-command-log-arguments
fix(xcatd): redact command-log arguments per element
2026-08-19 15:44:02 -03:00
Vinícius Ferrão 7fa755719a fix(xcatd): redact command-log arguments per element
The daemon redacted secret attributes on the joined command string. The
match failed when a value held a space. The match also failed for a "+="
splice assignment. The validate() path did not quote the arguments, so a
multi-word secret value kept its later words in syslog and in the
auditlog table. A password that a command receives through an option or
a positional operand was not redacted at all. The debug dispatch trace
wrote the raw arguments to syslog when site.xcatdebugmode was set.

Redact the argument vector before the daemon joins it. Add
redact_password_args for this task. The routine masks the value of a
secret attribute in any argument, at the start or embedded after another
token. An embedded secret assignment masks to the end of the argument,
because a shell value may hold quotes and spaces. The routine allows
spaces around the operator. It accepts the "=", "+=", ",=", "^=", "!=",
"=~" and "!~" operators that chdef, nodech and node selection use. It
masks a password option value in each form that Getopt::Long accepts: a
separate argument, a compact short option, a bundle of short options
with the "?" help letter, a "+" option prefix, a single-letter option
with two dashes, a long option, a long option with an equals sign, and
an abbreviated long option. The long-name match runs first, so a long
option keeps its name and masks its value. A walk over each bundle then
finds the first secret letter, so the mask always starts at the option
and the result does not depend on hash order. The walk knows which
other letters of a command take a value, so a secret letter inside such
a value does not redact and the audit text stays correct. The walk also
knows which letters take an integer, because the z/VM cpu option
consumes only its signed digits and the parser then continues the
bundle into the password option. The value stops match letter case,
because a bundle keeps short options case sensitive and an unknown
capital letter does not absorb the rest. The mkvm secret match ignores
letter case, because the z/VM parser keeps the Getopt::Long default for
long names. The mkhwconn match keeps letter case, because -p
is the hardware control point and -P is the password. The routine knows
the password options of bmcdiscover, switchdiscover, mkhwconn, mkvm,
createvcluster, lsvcluster and rmvcluster, the rspconfig password
assignments, the mkvm clone pw= operand, and the positional password
operands of chvm. It masks the site.value argument of tabch and chtab
when a selector or a site.key assignment names snmpc. An exact short
option that takes a non-secret value stays visible, so the PPC mkvm -p
profile is not an abbreviation of --password. The dispatch trace builds
its text from the redacted vector.

Add snmpc, productkey, prodkey.key, tokenid and token.tokenid to the
secret list, with community and pdu.community. The secret list holds
only attributes that map to a secret column, so key and sshkeydir stay
visible.

redact_password keeps a second pass over the joined string. This pass
masks an embedded secret assignment to the end of the line, because the
argument boundaries are gone after the join.

The commands.log response classifier marks a response sensitive when the
request was redacted. The argument vector pass sets that signal, so a
secret whose name has no "passw" text still marks its response.
2026-08-19 13:43:23 -03:00
Daniel Hilst 73fbf10e6b Merge pull request #7716 from VersatusHPC/fix/syncfiles-explicit-root-identity
fix(syncfiles): name root explicitly on the xdcp subrequest
2026-08-19 07:19:11 -03:00
Daniel Hilst 11c55ae8ad Merge pull request #7717 from VersatusHPC/fix/makedhcp-restrict-sn-dispatch
fix(dhcp): only dispatch makedhcp to the service nodes serving the nodes
2026-08-19 07:05:03 -03:00
Daniel Hilst 33a400d37d Merge pull request #7715 from VersatusHPC/cleanup/deprecated-provisioning-deadcode
fix(xcat-server): remove the unreachable deprecated provisioning paths
2026-08-19 06:58:48 -03:00
Daniel Hilst 4e0c0f384c Merge pull request #7714 from VersatusHPC/fix/confluent-explicit-nodes
fix(confluent): configure nodes named explicitly without a console method
2026-08-19 06:52:16 -03:00
Daniel Hilst a5953cbc3d Merge pull request #7713 from VersatusHPC/fix/destiny-boot-sticky
fix(destiny): keep a node on boot when its destiny is advanced again
2026-08-19 06:49:26 -03:00
Daniel Hilst 91505a2141 Merge pull request #7719 from VersatusHPC/fix/redact-password-attributes
fix(xcatd): redact node passwords from the command logs
2026-08-18 16:35:46 -03:00
Vinícius Ferrão 6c70a5e66c fix(xcatd): block XML external entities on the legacy parser path
xCAT::XML wraps XML::Simple. It blocks XML external entities. An external
entity can read a local file or a network resource.

XML::Simple with new_xml_parser() installs an ExternEnt handler. The
handler returns the system id, not the content.

XML::Simple 2.20 to 2.24 has no new_xml_parser(). On these versions xCAT
uses build_tree_xml_parser() instead. This function did not install the
handler. A SYSTEM entity then expanded. It leaked a local file into the
parsed data.

This change adds the same handler to build_tree_xml_parser(). Both paths
pass parser options in an array reference. XML::Parser->new ignores that
reference. The handler is therefore the real defense. This fix keeps
#6917, which retains the compatibility path for those releases.

This fix was recovered from the lenovobuild branch. See PR #6505.
2026-08-17 11:59:56 -03:00
Vinícius Ferrão 8f2c508950 fix(mknb): reject incomplete exports 2026-08-11 20:18:27 -03:00
Vinícius Ferrão 05e35a12e8 fix(mknb): identify exported Genesis images 2026-08-11 20:12:51 -03:00
Vinícius Ferrão 2ba1048f24 build(server): require Digest::SHA 2026-08-11 20:10:40 -03:00
Vinícius Ferrão 26b4aec340 feat(mknb): install exported Genesis images 2026-08-11 20:10:22 -03:00
Vinícius Ferrão caa4e838eb fix(dhcp): boot unknown xNBA clients with Kea 2026-08-10 17:12:17 -03:00
Vinícius Ferrão aeb07dce85 fix(mknb): render Genesis boot paths correctly 2026-08-10 15:07:49 -03:00
Vinícius Ferrão 65f7b21265 fix(xcatd): redact the arguments stored in the auditlog table
Only syslog received the redacted arguments. The auditlog table was given the
raw string, so a password removed from syslog and from commands.log was still
written to the database, which persists and is readable by anything with access
to it.

Use the redacted text for both. This also covers the mkvm --password and -w
masking a few lines above, which the table did not have either.
2026-08-09 14:01:11 -03:00
Vinícius Ferrão 49149bb922 fix(xcatd): redact node password attributes from logged commands
redact_password only knew about bmcdiscover, mkhwconn and rspconfig, so setting
a password the ordinary way left it in the clear:

    [Request]    chdef node01 'bmcpassword=SEKRET'

Those secrets are carried as an assignment on whichever command happens to set
them, so match them by name rather than by command. The names are every
attribute Schema.pm maps to a password, passwd, authkey or privkey column, and
the columns themselves, since a table qualified assignment such as
passwd.password= is accepted too. An assignment may be written with spaces
around the equals sign and the value may contain spaces, so a quoted argument is
redacted to its closing quote.

Attributes such as key, which names a monitoring attribute, and sshkeydir, which
is a directory, are not secrets and are left readable. The existing per-command
table is kept for a flag like bmcdiscover -p, which carries its secret in the
following argument where there is no name to match.
2026-08-09 14:01:11 -03:00
Vinícius Ferrão 02f963cbf3 fix(dhcp): only dispatch makedhcp to the service nodes serving the nodes
makedhcp on a noderange sends the request to every service node running a dhcp
server, whether or not it serves any of the named nodes. On a cluster with many
service nodes each one does the work and reports on nodes that are not its
responsibility, for example warning that a node it does not serve has no mac
address.

Map the named nodes to their service nodes and skip the rest. Regenerating the
networks with -n still reaches every dhcp server, since a dynamic range is not
tied to a node, and if none of the named nodes can be mapped the request goes to
all of them as before rather than risk leaving one out.

The node to service node mapping reuses getSNformattedhash, which the
disjointdhcps path in this same function already uses.

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-08-08 23:56:27 -03:00
Vinícius Ferrão e22bcf54d4 fix(syncfiles): name root explicitly on the xdcp subrequest
syncfiles builds an xdcp subrequest with no username. xdcp takes its user from
-l, then from DSH_FROM_USERID, and otherwise leaves it unset, so the sync ends
up running as whatever identity xcatd happens to have rather than one the
request states.

That gap dates from 2c9bdf848, which removed the forceroot flag because any
caller could set it, and replaced it by passing the real username through.
updatenode was updated to do that; syncfiles was not. Its request comes from the
node, so there is no calling user to carry through, and root is what the sync
has to run as.

Name it explicitly, the same way updatenode does. This is a consistency and
hardening change: on a management node running as root the resulting identity is
the same either way, and no behavior difference is observable today.

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-08-08 20:47:05 -03:00
Vinícius Ferrão 2a3af4c34a fix(packimage): report the missing image name instead of a rejected option
packimage rejects -o, -p and -a before anything else runs, which leaves three
things below it that cannot be reached. The branch handling a missing image
name asks for -o and reports "Please specify a os version with the -o flag",
so passing the option is rejected and omitting it is reported as the option
being absent. The check for those options alongside an image name re-tests a
condition already rejected, and the block that built an image from them can no
longer be entered.

Report the missing image name instead, and drop the parts that cannot run.
Passing -o, -p or -a is rejected exactly as before, and packing a named image
is unchanged.
2026-08-08 01:08:52 -03:00
Vinícius Ferrão 7572adaf22 refactor(destiny): drop the unreachable legacy nodeset path
setdestiny reports the deprecated install, netboot and statelite states and
returns, and the legacy path that set nodetype.provmethod from the target sits
directly after that return. It has not run since the deprecation landed in
57aa41798, and it still reads like live code when following setdestiny.

Remove it. The deprecated states are still rejected exactly as before, and the
osimage path is untouched.
2026-08-08 01:08:04 -03:00
Vinícius Ferrão cc71816b90 fix(confluent): configure nodes named explicitly without a console method
preprocess_request skips any node whose nodehm entry has neither cons nor
serialport. That is the right default while scanning the whole table, but it
also drops nodes the administrator named on the command line, leaving the
dispatched node list empty. makeconfluentcfg then falls back to reading every
node, so naming one console-less node quietly configures the whole cluster
instead of the node that was asked for.

A named node with no nodehm row at all is worse: both the selection here and
the second lookup in makeconfluentcfg produce an undefined entry, which reaches
confluent as an empty node name.

Apply the skip only to the full table scan, and carry the node name through
both lookups when the nodehm row is missing. Nodes without a console method are
already handled downstream, where makeconfluentcfg keeps explicitly named
entries and donodeent falls back to hardware management credentials.

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-08-07 22:32:43 -03:00
Vinícius Ferrão 445257c500 fix(destiny): keep a node on boot when its destiny is advanced again
When a chain has run down to a single remaining step, nextdestiny replaces that
step with 'standby'. For a completed provision the remaining step is 'boot',
which setdestiny writes into chain.currchain once an install or netboot destiny
is applied, so the replacement discards the destiny that boots the node.

Some installers advance the destiny more than once. On the extra advance the
node silently moves from 'boot' to 'standby' and no longer has a destiny that
boots the system it just installed.

Keep 'boot' when it is the remaining step, and leave every other exhausted
chain falling to 'standby' as before, so a finished install still does not
reinstall the node on its next boot.

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
2026-08-06 23:30:25 -03:00
Vinícius Ferrão 6d26cf7fff fix(dhcp): correct inconsistent Kea reservation updates 2026-07-31 22:29:58 -03:00
Vinícius Ferrão 287ed79b62 Merge pull request #7706 from VersatusHPC/fix/kea-makedhcp-noip-reservation
fix(xcat-core): skip *NOIP* NICs when building Kea DHCP reservations
2026-07-31 20:15:43 -03:00
Daniel Hilst 9125d4da3c fix(xcat-core): skip *NOIP* NICs when building Kea DHCP reservations
makedhcp using the Kea backend fails for any node whose mac table entry
uses the *NOIP* sentinel to mark a secondary NIC that has no IP address
(e.g. "mac1|mac2!*NOIP*|mac3!*NOIP*"). kea_node_reservations() and
kea_node_reservations6() split each NIC's hostname and pass it straight
to getipaddr(), so the literal string "*NOIP*" is treated as a host to
resolve. It cannot resolve, and the reservation is reported as unresolved
-- which aborts the whole makedhcp run, leaving the node with no Kea
reservation at all and therefore no DHCP lease.

This breaks provisioning on distros that use the Kea backend (e.g. EL10,
which has no ISC dhcp-server): the node never gets an address and is
unreachable, while the ISC backend has always handled *NOIP* and is
unaffected.

Skip *NOIP* NICs in both the DHCPv4 and DHCPv6 reservation builders, the
same way the ISC path does -- there is no address to reserve for them.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-07-31 19:29:20 -03:00
Daniel Hilst 2c9d0a3523 Merge pull request #7703 from VersatusHPC/fix/kea-preserve-reservations-on-makedhcp-n
fix(dhcp): preserve Kea reservations on makedhcp -n
2026-07-31 17:32:04 -03:00
Vinícius Ferrão 781d5e4163 fix(dhcp): preserve Kea reservations on makedhcp -n 2026-07-31 15:22:19 -03:00
Vinícius Ferrão 90c6eeae55 fix(dhcp): report unresolved Kea reservations 2026-07-31 15:12:41 -03:00
Daniel Hilst c811f2b1bd Merge pull request #7677 from VersatusHPC/fix/xcat-core-matrix-build
fix(xcat-core) Fixes to get internal CI green
2026-07-28 16:33:08 -03:00
Daniel Hilst 9e7b281519 Merge pull request #7640 from VersatusHPC/refactor/openbmc-reuse-retry-after
refactor(openbmc): reuse retry scheduler for 503 responses
2026-07-28 15:53:10 -03:00
Daniel Hilst cf159d31aa Merge pull request #7691 from VersatusHPC/harvest/pxelinux
fix(xnba): warn instead of failing when pxelinux.0 is unavailable
2026-07-28 11:03:39 -03:00
Vinícius Ferrão ebe0649699 refactor(ipmi): centralize RMCP response identity check 2026-07-28 04:33:57 -03:00
Daniel Hilst c8562284ee Merge pull request #7672 from VersatusHPC/harvest/blade-findme-nodetype
fix(blade): only scan a node MPA during discovery if it is a blade
2026-07-27 15:30:16 -03:00
Vinícius Ferrão 42e8ef64cc fix(xnba): warn only when pxelinux is required
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-07-27 15:22:12 -03:00
Daniel Hilst 7ebb7ffc9a Merge pull request #7678 from VersatusHPC/refactor/ipmi-sha1-fallback
refactor(ipmi): centralize RMCP+ SHA1 fallback
2026-07-27 15:22:01 -03:00
Daniel Hilst d4d9d5c859 Merge pull request #7690 from VersatusHPC/harvest/port80
fix(netboot): omit the default HTTP port from generated boot URLs
2026-07-27 15:15:18 -03:00
Daniel Hilst c7c548fbb3 Merge pull request #7628 from VersatusHPC/harvest/xnba-ipxe-mac-format
fix(xnba): use the iPXE-native MAC format on the BIOS boot path
2026-07-27 15:12:06 -03:00