pre.rhels8 and pre.rhels10 print /tmp/partitionfile into the
pre-install log, so that the partition scheme can be inspected after
the installation. A custom partitionfile can hold credentials, such as
the --passphrase of an encrypted partition or a boot loader --password,
and the log then holds them in clear text. With site.xcatdebugmode 1 or
2, %pre also traces the decoding of a custom partitionfile or partition
script, and the trace spells out every decoded byte.
The pre-install log now shows the partition scheme only when xCAT
generated it, and says that a custom partition file is not logged. The
decoding of a custom partitionfile or partition script runs untraced.
/tmp/partitionfile, which anaconda reads, is unchanged.
geninitrd ran genimage --onlyinitrd for netboot and statelite images and
ignored its exit status. When genimage failed, geninitrd still exited
with 0. The errors that the genimage client writes to stderr did not
reach the user.
geninitrd now passes the genimage output to the client with stderr
included. When genimage ends with a status other than 0, geninitrd
reports an error and exits with the genimage exit code, or with 1 when
genimage could not run.
linuximage.partitionfile takes a comma-separated list of layout, d: disk
and c: configuration entries, any of them prefixed with s: for a script.
The Ubuntu layout step chose between decoding a layout file and running a
layout script by the s: prefix of the last entry in the whole list, so a
layout file followed by an s:d: disk script was run as a script, and a
layout script followed by a d: disk file was copied into the layout as
text. The parser also kept a script flag set by an earlier entry of the
same kind after a later entry replaced it.
Give each kind the prefix of the entry that is used, the last one of that
kind, and decode the Ubuntu layout by it.
openEuler publishes RVA20 and RVA23 builds of each riscv64 release. Both
carry the same .treeinfo identity, so copycds copies the second one into
the directory of the first, and the result is a repository with packages
of two builds.
copycds now compares the .discinfo description, RVA23 or empty, with the
copy already in the target directory, and refuses a different build. Media
of the same build, and every other architecture, copy as before.
genimage and packimage admit openEuler images only for x86_64 and
ppc64le. For the riscv64 osimage that copycds creates, genimage stops with
"Unsupported openEuler release or architecture" and packimage with
"Unsupported openEuler image release or architecture".
Admit riscv64 in both commands.
copycds looks for EFI/BOOT/grubriscv64.efi on riscv64 media. openEuler
media carry the same image as EFI/BOOT/grubriscv64.EFI, so copycds
publishes no grub2.riscv64. A management node with only openEuler media
then has no riscv64 network boot loader.
Match the image name case-insensitively, as UEFI does.
openEuler publishes 24.03 LTS installation media for riscv64, but the
openEuler media check admits only x86_64 and ppc64le. copycds stops with
"Unsupported openEuler architecture in .treeinfo".
Admit riscv64 as well. aarch64 stays refused.
A #CRYPT# template entry rendered as an empty string when the passwd
table had no row for its key. An EL kickstart then held a bare
"rootpw --iscrypted", and anaconda stopped with "A single argument is
expected for the rootpw command". nodeset reported no error.
nodeset now reports the missing passwd row and writes no boot
configuration for the node, as it does for a missing #TABLE# field.
#CRYPTORLOCKED# still renders a locked password.
rinv, rvitals and reventlog stopped with "SDR reservation unsupported." when
Get SDR Repository Info did not set the reservation bit. An OpenBMC build
clears that bit but grants Reserve SDR Repository, so these commands failed on
a server that ipmitool reads.
Send Reserve SDR Repository in every case. When the bit is clear and the BMC
rejects the command as invalid, the error stays "SDR reservation
unsupported." Other refusals report their completion code.
When Get Device ID or a step of the SDR read failed, the plugin reported the
error through sendoutput. Seven of these calls passed an array reference,
which sendoutput takes as its return code, so the error was dropped. The other
five named the node BADCODE. A refused SDR reservation also went on to read
records with no reservation ID.
Report these errors with sendmsg against the node, as the rest of the plugin
does, and stop after a refused reservation.
xCAT-server/lib/xcat/plugins/anaconda.pm conflicted in the module
imports: this branch adds "use xCAT::MediaPerms" and master adds
"use xCAT::SELinux" on the same line. Both imports are kept. The two
modules are used in different subs, and no other hunk conflicted.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
With nodeauthentication off and no peer name, getpostscript used
_xcat_authname as the client identity and expanded it with noderange.
becomeuser and tokens set _xcat_authname to an account name, so a user
named after a node group received the postscripts of the first node in
that group.
xcatd now records the CN of the validated client certificate as
_xcat_certname, and only while no becomeuser or token replaced it. It
deletes any _xcat_certname the client sent. getpostscript uses that
name only when it names exactly one node, with no group or range
expansion. _xcat_authname is no longer a candidate.
getpostscript_client_identity.t drives the plugin with these requests.
On the previous head the group and node login checks fail, and
dropping the exact match fails the group and range checks.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The comment carried a date, a node, and the request counts from one run. The code
standard keeps bug history out of source comments: the fact a reader needs is that
the peer host is a reverse lookup and can be empty, which the remaining two sentences
state.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
A diskless openEuler 22.03sp4 node netbooted, took a lease, reached a login
prompt and answered ping, and then every xdsh and ssh answered
"root@xcat59-cn: Permission denied (publickey)" while the node never reported
"booted". reg_linux_diskless_installation_flat failed after 7072 s.
xcatd on that management node logged "xCAT: Allowing getpostscript xcat59-cn"
with no "from <peerhost>", then "Received malformed getpostscript requesting,
ignore it." -- 100 times, with 0 "Sending scripts data" in the whole log. The
green openEuler 24.03sp4 cell beside it logged 3 sends and 0 malformed. The
client certificate named the node correctly; only the reverse lookup of the
peer socket failed.
getpostscript read _xcat_clienthost and nothing else, so it dropped every
request. No postscript ran: remoteshell never installed root's
authorized_keys, which is the ssh failure, and nothing updated node status,
which is the stuck "powering-on". One cause, both symptoms.
process_request now tries each name xCAT::DiscoveryUtils::request_client_names
offers and takes the first that correlates to a node. A request that offers no
name at all, and one whose names correlate to nothing, are now reported as what
they are; the old message said the request was malformed, which sent two
investigations into DNS and the netboot image.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Twelve conflicts, all from xcat-core/#7970 landing.
Eleven are the one sed line in the netboot postinstall profiles, where #7970 and
this branch replaced the same line with different patterns. Master's wins: it
anchors on optional leading blanks and preserves a trailing comment, which this
branch's `s/^SELINUX=.*$/SELINUX=disabled/` would have eaten. This branch's own
postinstall_selinux_config.bats asserts "the comment that names permissive keeps
its text", so the better pattern is the one its test already wanted -- 6 of 6
pass on master's version. What master's pattern does not catch is a value
outside enforcing|permissive, which nothing here tests and no stock config
ships.
The twelfth is .github/workflows/xcat_test.yml: master added a step to the
existing job and this branch adds a whole selinux_policy_test job after it.
Resolved as the union, with master's step where it put it; the file still parses
and names three jobs.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Substring and regular-expression matches can mistake a different boot state
or image name for a completed chain. Compare the full state values while
preserving the completed boot exception.
Rejected protocols, unresolved addresses and missing loaders can leave a
partial configuration after removing the previous files. Check these inputs
before replacing the node configuration and its aliases.
Some aarch64 UEFI firmware ignores a DHCP boot file name that does not
end in .efi and requests grubaa64.efi from the TFTP root instead. xCAT
names grub2-<node>, so these nodes stop with a TFTP error before grub2
runs.
For an aarch64 node, nodeset now links grub2-<node>.efi to
grub2.aarch64 beside grub2-<node>. Both DHCP backends name the .efi
link once it exists in the node's TFTP directory (noderes.tftpdir, or
the site one). A node set by an older xCAT keeps grub2-<node> until its
next nodeset, so makedhcp after an upgrade does not name a missing
file. With site.sharedtftp off, every server that runs nodeset for the
node creates both links. This relies on service nodes running the same
xCAT version as the management node, which xCAT requires.
The old link stays for DHCP configurations that makedhcp did not
write. The boot and offline states remove both links. Other
architectures keep grub2-<node>.
guest_os stated <loader secure='yes'/> alone for a node with
vm.othersettings firmware:efi-secureboot. libvirt reads that element as
the secure-boot feature, and a firmware with secure-boot and an empty key
store boots an unsigned binary. The two x86_64 descriptors of an EL 10
host name the same OVMF_CODE.secboot.fd and differ in the nvram template,
OVMF_VARS.secboot.fd against OVMF_VARS.fd, so only descriptor priority
picked the one that holds keys. Commit 772b2c656 of this branch says that
element selects the descriptor with enrolled keys. It does not.
firmware_features names secure-boot and enrolled-keys for a Secure Boot
guest, and add_firmware_features writes them into the <os> of the domain.
guest_os cannot carry the element: the firmware attribute of <os> and the
<firmware> child of <os> are one key of one hash for XMLout, and the
attribute is the one that starts the selection. firmware:efi asks for no
feature and is unchanged.
Measured with libvirt 11.10.0 on an x86_64 host, with the enrolled
descriptor masked for one connection: the old XML starts on OVMF_VARS.fd
with enrolled-keys resolved to no, and the new XML is refused with
"Unable to find 'efi' firmware that is compatible with the current
configuration". virt-xml-validate accepts the new XML.
kvm_secureboot_firmware.t covers the features and the element. Two
mutations turn it red: dropping enrolled-keys from firmware_features, and
making add_firmware_features return its argument.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Keep the original client name for the rejection diagnostic. Use the resolved
node only for dispatch, without changing identity or copy-command handling.
guest_arch_profile moves an x86_64 node that asks for efi to q35, because
every x86_64 OVMF descriptor targets pc-q35-* only. guest_os then writes
a machine: setting of vm.othersettings over that machine type, so a node
with firmware:efi and machine:pc reaches libvirt asking for a UEFI
firmware on i440fx. libvirt answers "Unable to find 'efi' firmware that
is compatible with the current configuration" and names neither the node
nor either setting, and rpower boot fails with no way to see why.
firmware_machine_error refuses the pair, and build_xmldesc returns it
before the domain is built. The message names the node, both settings and
the machine type to use. A node that names no machine type, a q35 of any
version, and the machine types of another architecture are all unchanged.
kvm_secureboot_firmware.t covers the refusal and the five values that are
not refused.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
A node with netboot=ipxe and Secure Boot on fetches the shim of its
install source over HTTP, and the server answers 403. EL media ships the
EFI binaries of its boot loader mode 0700, copycds copies the media with
the modes the media carries, and xCAT serves the install directory over
HTTP. Measured on an AlmaLinux 10 tree: EFI/BOOT/grub.cfg is 0444 and
answers 200, and BOOTX64.EFI, grubx64.efi and mmx64.efi are 0700 and
answer 403. The node reports "Verification failed: Security Policy
Violation" for its kernel and then "Operation not permitted" for the
shim, and boots nothing.
copycd gave the top directory of the copy mode 0755 and left every path
under it as the media had it. Both copycd plugins now call
xCAT::MediaPerms::make_readable on the copied tree, which adds read
permission for the group and for others, and search permission on a
directory. It adds no write permission, it adds no execute permission to
a file, and it leaves a path that is already group and other readable
alone, so a second call changes nothing.
On the same AlmaLinux 10 tree it walks 5850 paths, 5835 files and 15
directories, and changes 3 of them: the three files above, each from 0700
to 0744. An install tree that is already copied keeps its modes until
copycds runs again for that osimage, so an operator with an existing tree
re-runs copycds or gives those files read permission.
media_perms_readable.t covers the modes and the idempotence. Three
mutations of the module each turn it red.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
vm.othersettings now takes firmware:efi-secureboot. guest_os puts
<loader secure='yes'/> on the domain beside firmware="efi". libvirt
reads that element while it selects the firmware and keeps only the
descriptors that carry secure-boot, so a hypervisor with no such
firmware refuses the domain instead of starting the node on a firmware
that verifies nothing.
firmware:efi keeps its meaning and states no requirement.
Measured with libvirt 11.10.0 on an x86_64 host: the domain resolves to
OVMF_CODE.secboot.fd with <smm state='on'/>, and the same domain with
secure-boot asked off resolves to OVMF_CODE.fd.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
nodeset refuses a uftp image unless the marker that genimage wrote
matches its initial ramdisk. imgexport did not carry the marker, so an
imported image could not use UFTP until genimage ran again. imgexport
and imgimport now carry it like the root image check marker.
imgimport refuses a bundle that names the marker but lacks it, before
it replaces any boot file.
nodeset adds xcat.uftp= and xcat.uftpfp= to the kernel command line of
a stateless node whose image has rootimgtransport uftp, directly or
from site.rootimgtransport. The node then receives the root image over
UFTP and downloads it over HTTP when that fails.
nodeset refuses a node when its image cannot use UFTP. That is the case
when the root image check is off, the image URL uses https, or the
image has a BitTorrent .metainfo file. It is also the case when the
listener does not serve the image directory, or the initial ramdisk
that nodes will boot is not the one that genimage marked as having the
receiver. nodeset also refuses a node whose linuximage.addkcmdline or
bootparams.addkcmdline sets either argument. nodeset checks this before
it copies the boot files to TFTP, so a refused node keeps its current
boot entry and the kernel and initial ramdisk that the entry names.
Statelite images ignore the attribute, as it applies to stateless
images only.
Booting nodes need a server that sends a published root image once to
every node that asks for it in a short window.
xcat-uftp-listener accepts HTTP/1.0 GET requests that name an image
path and its digest. It serves only an archive that packimage published
under the configured image roots, for a digest that the checksum file
lists. It keeps the archive open from the first request, so a later
packimage does not change the bytes of a queued batch. It collects the
requests for the same inode, digest and port for batch_delay seconds,
then runs one closed-group uftp session for the batch. Connections,
queued jobs, senders and receivers per job are limited.
The sender gets an argument vector built only from the configuration,
and signs the encrypted session with a persistent server key. It drops a
receiver that misses nearly every block of a section, so one node
without multicast cannot hold the session open. A sender that is not the
UFTP 5 build of xcat-dep is refused.
block_size allows larger packets on jumbo frame networks, up to the
8800-byte limit of uftp.
xCAT::UFTP holds the decisions of the listener: request checks, batches,
limits, timeouts and the runtime check. The script holds the sockets,
the key commands and the sender processes.
The packages install the service but do not enable it. Package removal
stops and disables it.
netboot_supported() answered 1 for rhels8 and later and for every
openEuler, so mknetboot wrote no selinux= argument and a stateless node
was asked to run SELinux enforcing. It does not boot.
A stateless root is a cpio archive unpacked into tmpfs, and cpio carries
no SELinux label, so the root starts unlabelled. Three boots of an
AlmaLinux 10.1 image on an enforcing node measured both ways out of
that, on cluster xcat163:
- With the stock dracut selinux module, which this branch added to the
module list, the policy loads at pre-pivot 50 over the unlabelled
initramfs. 61 Permission denied lines follow, setfiles returns 126 and
the node loops. That module ships with check() returning 255, so no
image enables it by accident.
- Without it, and with the relabel hook corrected, setfiles labels the
root: /usr/lib/systemd/systemd reads init_exec_t. systemd then loads
the policy after switch_root, cannot relabel /dev or /run, and stops
with "Failed to allocate manager object. Freezing execution".
The hook could not have worked as written either. It read the mode with
sed piped into tail, and the initramfs has neither tail nor chroot:
chroot arrived with the selinux module. The console reported "tail:
command not found" twice and relabelled nothing.
So netboot_supported() answers 0, mknetboot writes selinux=0 for every
stateless node and nodeset says why. The code that only serves a
stateless node with SELinux on is removed with it: the relabel hook and
its two installers, the selinux dracut module, write_image_config, and
the squashfs label machinery that stored labels nothing reads. The
netboot postinstalls and the stateless xcatroot write SELINUX=disabled
again, so the image says what the kernel command line does.
What stays is what was measured working: a diskful node provisioned
enforcing with zero xCAT denials, the kickstart templates, the policy
package, and the service node mount options.
Tests: selinux_netboot_kcmdline.t fails 34 of its 69 checks on the
parent commit. selinux_cn_diskless_disabled_by_design in cases1
provisions a stateless node asked for enforcing and requires selinux=0
on its command line and getenforce Disabled. selinux_image_config.t and
selinux_squashfs_labels.t go with the subs they tested.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
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>
Booting nodes, nodeset, genimage and the transfer listener need one
definition of the root image that a node may receive over UFTP and of
how a request names it. xCAT::UFTP resolves a request inside the
configured image roots to the archive that packimage published with its
checksum file, and the digest that the node names must be a line of that
file. The module also reads the listener configuration and the server
key fingerprint, builds the uftp command, checks the UFTP receiver of an
image, records the initial ramdisk that genimage built with it, and
builds the nodeset kernel arguments. It accepts a uftp sender or
receiver only when it is the UFTP 5 build of xcat-dep, which marks its
version string. That build carries fixes that stock UFTP 5.0.4 lacks.
The design follows the UFTP transport that Richard Ray proposed in
xcat2/xcat-core#3560.
Share line normalization and directive filtering across the legacy text
reader, its include reader and the record reader. Keep leading whitespace
in legacy includes and leave each parser expansion policy unchanged.
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
UFTP multicast distribution of the root image needs a switch for each
image and a default for the cluster, as the root image checksum has.
site.rootimgtransport sets the default, which is http when it is unset.
The rootimgtransport attribute of an osimage overrides it.
rootimg_transport returns http or uftp, and refuses any other value with
the name of the attribute that holds it.