An IPv6-only provisioning network cannot deploy a node. The discovery and
credential callbacks open IPv4 sockets, the kickstart and boot templates
render an IPv4 address into every endpoint, and makehosts drops an IPv6
value because hosts.pm gates on isIpv4addr.
NetworkUtils gains the address helpers the rest of the change uses:
format_host_port, parse_host_port and format_uri_host bracket an IPv6
literal, getNodeNetworkCfg6 reads the static IPv6 configuration of a node,
my_ip_facing_family selects the management-node address of one family,
getIPv6ReverseZone builds a nibble-aligned reverse zone, and
node_is_ipv6_only and ipv6_server_for_node answer the two questions the
plugins used to answer for themselves. credentials.pm opens the callback
socket through IO::Socket::INET6 when the modules are present and keeps the
IPv4 path when they are not. Template.pm and anaconda.pm render an IPv6
kickstart network line and bracketed endpoints. The postscripts and the
stateless xcatroot format every endpoint through the bracketing helpers.
xCAT-server requires perl-IO-Socket-INET6 and perl-Socket6 on EL, and
libio-socket-inet6-perl and libsocket6-perl on Debian.
(cherry picked from commits c0a69bb5a and caa8ca790)
Ported onto upstream master ee6b4f532. The two commits are folded because the
second refactors the first. Master is kept where it has a newer form of the
same thing: the getipaddr cache guard, the Kea control_socket_path helper, the
netboot method list, install_device_params, the modern_installer test and the
isValidIp validator, which replaces the isValidIPAddress this branch added.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 3928c04507)
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.
An Ubuntu node that netboots legacy Genesis dies with
Failed to execute /init (error -13)
Kernel panic - not syncing: No working init found.
xCAT-genesis-base/debian/rules is a bare `dh $@`, so dh_fixperms applies its
*.so* rule to the whole package. That is right for a Debian shared library and
wrong for a netboot ROOT FILESYSTEM: the kernel execs the payload's dynamic
loader, and a loader with no execute bit makes open_exec() return EACCES, so
every ELF in the image fails to start. mknb copies the tree verbatim into
genesis.fs.<arch>.lzma, so the mode travels into the image. The pipeline's iPXE
command line carries `quiet`, which hid the reason.
Measured on xcat-master-ub from the installed package:
644 .../netboot/genesis/x86_64/fs/usr/lib64/ld-linux-x86-64.so.2
755 .../netboot/genesis/x86_64/fs/usr/bin/basename
and reproduced away from the lab: that management node's own kernel and image
under qemu panicked at 35 seconds, a repack with no change panicked again, and a
repack with only chmod 0755 on the loader reached /init and started dracut.
The EL rpm is unaffected, because it never runs dh_fixperms. This is why only
the Ubuntu genesis-legacy cell saw it, and why that cell has never had a
non-mock green. It is not a regression: the same recipe builds the published
xcat-genesis-base-amd64.
The bit is restored AFTER dh_fixperms rather than excluding the tree with -X,
which would also skip its chown 0:0 pass and ship the payload owned by the build
user.
genesis_deb_loader_executable.t asserts the override exists, still calls
dh_fixperms, is scoped to the netboot tree, names both the glibc and the ppc64le
loader, and runs the chmod AFTER dh_fixperms. Three of its ten assertions fail
without the override, and the ordering assertion fails if the chmod is moved
first -- which is the mistake that looks correct.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Run the real finalization command with empty, unsigned and differently signed binary repositories, including absent and retained aliases.
Check binary bytes, modes and timestamps across unsigned and repeated signed runs. Verify source package checksums and signatures with a separate source key.
Source-only signing modified retained binary RPMs and repository signatures while leaving the binary index unchanged. It also removed and recreated the bootstrap alias.
Limit signing to the source repository in this mode and leave the existing binary alias unchanged.
Two conflicts, both from xcat-core/#7978 landing on master.
build-utils/lib/XCAT/BuildUtils.pm: both branches added a package_skip_reason,
#7978 with a general @PACKAGE_SKIPS table and this branch with its own
%EL_ONLY_PACKAGES and a second sub. git merges them as separate hunks because
they sit apart in the file, and Perl takes the LAST definition, so keeping both
silently deletes whichever rule came first. There is now one table and one sub.
A rule names either the target prefixes that do NOT build the package, or, with
`only`, the pattern of the targets that DO. The second form is what an EL-only
package needs: naming the families that are not EL means a family added later
tries to build it, which is how openSUSE reached xCAT-selinux and failed
xcat-core-build-opensuse #42 on a missing selinux-policy-devel.
buildrpms.pl: an empty build plan takes upstream's answer, a clean return rather
than this branch's die. That is the decision #7978 exists for -- the dep
pipeline asks for xCAT-genesis-base alone and no openSUSE target builds it -- so
reinstating the die would fail a build that has nothing to do.
selinux_el_only_scope.t is 37 of 37 and opensuse_no_legacy_genesis.t 22 of 22 on
the merged tree, and the whole unit suite passes: 301 files, 9801 tests.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
xcat-core-build-opensuse #42 failed on three packages whose only error was
"No matching package to install: selinux-policy-devel", and took the whole
openSUSE family of xcat-ci #146 down with it. openSUSE Leap ships no
selinux-policy-devel, so the policy module has nothing to compile against.
package_skip_reason in build-utils/lib/XCAT/BuildUtils.pm tested the target
against /\Aopeneuler-/, because openEuler was the one non-EL family buildrpms.pl
targeted when the guard was written. openSUSE was enabled afterwards and matches
no arm of that test, so the EL-only package was selected for it.
The test is now on EL rather than on the families that are not EL, so a family
added later skips an EL-only package instead of trying to build it.
selinux_el_only_scope.t gains the two openSUSE targets. Without this change its
two new assertions fail and the other 35 pass.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Drive the Kea reservation builder and the ISC makedhcp path for grub2
nodes of each architecture. Place the loader links in the site TFTP
directory or in noderes.tftpdir. An aarch64 node with only grub2-<node>
keeps that name. The table stub returns only the requested columns, so
a missing nodetype.arch or noderes.tftpdir read fails the aarch64 cases.
Drive grub2 setstate for the node loader links: both names for an
aarch64 node and one for the others. Cover a repeated nodeset, a node
with only the old link, and removal in the boot, offline and SLES 15
standby states.
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>.
The SELinux page carried the repair in two blocks. The first mapped the
published artifacts and ran restorecon over the image root. The second mapped
the publication directory and excluded both guest trees. An operator with
site.installdir=/srv/xcat-install who reads the page in order therefore
relabels before any mapping covers that tree, and rootimg/etc/shadow resolves to
var_t. The exclusion added afterwards keeps the var_t it finds, because it only
stops the next relabel from changing the label again.
The order also cost the artifacts. file_contexts keeps the expressions in the
order they are read and the last one that matches a path wins, so the exclusions
of the second block beat the artifact mappings of the first. Where the image
root carries a rootimg component in the middle, the exclusion matches the
artifacts as well, and the five expressions with a wildcard, the initrds and the
packed images, resolve <<none>>. kernel and hypervisor carry no wildcard and win
either way, which is why the defect showed on a subset.
The page is now one sequence: the publication directory, both guest exclusions,
the artifact mappings, then one restorecon. It says what each step orders and
why.
xCAT-test/native/selinux_image_repair.t passes 381 of 381 checks on this
sequence and fails 47 on the order of the parent commit. selinux_docs.t fails 3
of 30 on the parent commit.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
selinux_image_repair.t measured a moved publication directory and an image root
with a rootimg component in the middle in separate fixtures, and it called the
mappings of a scenario a repair without running the restorecon the page puts
between them. Neither condition reaches the ordering defect on its own, and the
relabel the procedure runs itself was never measured.
The case now gives each scenario the relabel, so the scenario places it where
the page does. It reads the guest labels straight after the procedure, because a
label the procedure overwrote cannot be recovered by a mapping added afterwards.
It then asserts the mapping and the label of each path after a recursive relabel
and after a reinstall of the module.
A third scenario runs the four documented steps on the layout that needs all of
them: site.installdir is /srv/xcat-images, so no mapping covers the tree until
the procedure adds one, and the image root carries a rootimg component in the
middle, so the guest exclusion matches the published artifacts too.
selinux_docs.t gains three checks on the order of the page: the guest exclusions
come before the artifact mappings, the relabel comes after the last mapping, and
there is one relabel. All three fail against the page at 78f6d65a7.
With the command order of that page, the full sequence fails 47 of 381 checks:
16 guest labels, which go from shadow_t, etc_t and bin_t to var_t, and 15
artifact mappings, which resolve <<none>> for the five expressions that carry a
wildcard.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
xcat-dep-build-opensuse15-x86_64 fails its xCAT-genesis-base step. BuildRequires
resolve, and verify-genesis-payload then reports 566 missing zoneinfo/posix paths,
etc/redhat-release, and 45 EL paths and tool names -- net-tools-deprecated,
kmod-compat, iputils, systemd-sysvinit, timezone, nc, mkdosfs and the lvm symlinks.
The manifest is written for EL, so the package cannot be built on openSUSE.
openSUSE ships no legacy Genesis, so it does not need to be. package_skip_reason names
the pairs a target does not build and why, buildrpms.pl prints each skipped pair, and a
plan that skips everything returns 0 rather than failing: the dep pipeline asks for
xCAT-genesis-base alone, so on openSUSE its whole plan is empty and an empty plan is
the plan.
Dropping the package alone would make xCAT unresolvable there.
xCAT-genesis-scripts.spec requires xCAT-genesis-base-%{tarch} unconditionally and xCAT
requires xCAT-genesis-scripts, so zypper install xCAT would fail on a missing package
-- later than the build and looking like something else. That Requires now stands
behind %if ! 0%{?suse_version}; the Leap chroot's /usr/lib/rpm/suse/macros sets
%suse_version 1500, and no EL or openEuler target defines it.
xCAT-test/unit/opensuse_no_legacy_genesis.t covers the skip, the empty plan and the
conditional Requires.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Nothing holds the openSUSE Genesis scope down. xCAT-genesis-base is built for
every target the dep pipeline names, and xCAT-genesis-scripts requires the
payload on every family.
The test reads the build-plan decision and the payload requirement in the spec.
It fails on this commit: the build plan keeps xCAT-genesis-base for openSUSE,
and the requirement carries no condition.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The SELinux page told the operator to run chcon -R -t public_content_t over the
image root to repair a published artifact that kept an older type. That command
walks into rootimg and rootimg-statelite, so it replaces the labels of the guest
operating system with public_content_t. The xcat.fc comment carried the same
advice. chcon also writes a type that no mapping selects, so the next relabel of
a path that has a mapping reverts it: the repair held only until then.
The page now maps each published artifact with semanage fcontext and applies the
mapping with restorecon. Each expression names one regular file directly below
the image root, so no path in either guest tree matches one, and both trees keep
the <<none>> of the packaged mappings. The procedure reads the publication
directory from site.installdir, and a site that moved it maps the configured
directory and keeps both guest trees out of that mapping. The page says why a
tree mapping over the image root is the same defect as the chcon.
xCAT-test/native/selinux_image_repair.t passes 170 of 170 checks with the
documented procedure. With the chcon of the previous page it fails 101, 36 of
them guest labels. selinux_docs.t fails 7 of 26 on the parent commit.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The SELinux page documents a recursive chcon to repair a published artifact
that carries the wrong type. No case runs that procedure, so nothing measures
what it does to the guest trees of the image root, and nothing measures whether
the repair survives a later relabel.
selinux_image_repair.t starts with default_t on every published artifact of an
image root and with valid types in both rootimg and rootimg-statelite. It runs
the repair, then reads the labels back after a recursive relabel and after a
reinstall of the module. It covers the standard publication directory and one
that site.installdir moved, because the packaged mappings name /install.
semanage writes to the policy store of the host, so the case refuses to run
where SELinux is enabled and removes every mapping it adds. restorecon is a
no-op where SELinux is disabled, so the case applies the mappings with setfiles
and asserts that the merged file_contexts answers what the store answers for
each path.
selinux_docs.t gains the checks that keep the page and the xcat.fc comment from
describing a chcon repair. 7 of its 26 checks fail on this commit.
With the chcon of the page in place of the documented procedure,
selinux_image_repair.t fails 101 of its 170 checks, 36 of them guest labels that
the recursive chcon overwrote.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Execute the complete postscript and check the daemon UID before real UDP
log delivery. Cover fresh and repeated MN/SN setup, restricted directories,
legacy ownership and modes, and a blocked directory path. Keep the upgrade
wrapper and forwarding cases as compatibility controls.
Select older configuration branches through their version-report boundary;
use the installed daemon, without claiming old-daemon qualification.
Run the isolated native cases in CI.
Create missing Debian-family log directories before assigning their owner.
Use mode 0750 for syslog-owned directories. In the legacy reference-owner
path, copy the parent directory mode so group-writing daemons retain access.
Preserve existing directory modes, log files and forwarding policy.
Stop with an error before restarting syslog if the directory cannot be
created. Keep existing ownership-command failures nonfatal.
Run routeop against real kernel routes. Cover repeated add, replacement,
deletion, another device, expanded addresses and failure preservation.
Check SLES, legacy Red Hat and Debian persistent records, including
unscoped records and neighboring interface names. Keep global-gateway
and connected-route controls.
Scope generic Linux route lookup and updates to the supplied interface for
link-local next hops. Retain the device in SLES routes, legacy Red Hat
route6 records and Debian interface commands. Remove matching saved
records without matching neighboring interface names, and migrate older
unscoped records when adding routes.
Keep global gateways, connected routes and NetworkManager policy unchanged.
xCAT-selinux is in the default package set of buildrpms.pl, so every target
builds it. openEuler 20.03sp4 and 22.03sp4 carry selinux-policy 3.14.2, which
defines none of unconfined_server_stream_connectto(), files_map_etc_files() or
chronyd_manage_pid_files(). m4 leaves an undefined interface name in its
output and checkmodule stops with a syntax error, so rpmbuild fails and the
core build for that target publishes no repository at all.
SELinux support is EL only. XCAT::BuildUtils::package_skip_reason names the
packages an openEuler target does not build, and buildrpms.pl prints each pair
it skips. openEuler 24.03sp4 carries selinux-policy 40.7 and does compile the
module. It is excluded as well, so no openEuler release ships a package the
other releases cannot build.
xCAT-server and xCATsn required xCAT-selinux when selinux-policy-targeted was
installed, on openEuler too. openEuler defines %openEuler and no %rhel, so the
condition now names EL 8 and later and Fedora only. Without this an openEuler
management node cannot resolve xCAT-server.
xCAT-test/unit/selinux_el_only_scope.t fails on the parent commit.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Nothing holds the scope of xCAT-selinux down. The package is in the default
set of buildrpms.pl, so every target builds it, and xCAT-server and xCATsn
require it on openEuler as well as on EL.
The test reads the build-plan decision and the two spec conditions. It fails
on this commit: BuildUtils has no build-plan decision, and both conditions
still name openEuler.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>