Run the rendered %post --nochroot blocks of each kickstart template
whose %pre writes /tmp/pre-install.log the way anaconda runs them: in
the installer, with its own /tmp and the installed system at
/mnt/sysimage. Each run must append the log to a new or an existing
xcat.log. The riscv64 profile test now keeps the installer's /tmp out
of the installed root too. Both fail on the old templates, whose chroot
%post reads a /tmp that does not hold the log.
Run the new test in the profile artifact job.
Render the rhels9 and rhels10 kickstarts with no partitionfile, a custom
partitionfile and a custom partition script, each with xcatdebugmode 0,
1 and 2, and run %pre in a sandbox. The custom input holds credentials
in the =, separated, quoted, escaped and split option forms, a boot
loader password and a root password. The pre-install log must show the
generated partition scheme, or a notice for custom input, with neither a
credential nor a traced decoded byte of the custom input, and anaconda
must still get the custom partition definitions.
Run the new test in the profile artifact job.
The riscv64 profile test runs every rendered %post block as if it ran in
the installed system. Anaconda runs a --nochroot block in the installer,
with the installed system at /mnt/sysimage, so give such a block that
view.
The stateless xcatroot of dracut_047, run in a chroot with NetworkManager
leases of the dhclient and internal clients in the initrd, must copy
both into the root under their own names. CI now runs the xcatroot test
as root.
imgutils_staged_boot_files.t covers the publication of boot files. The
remaining checks of the unit test openeuler_genimage_bootfiles.t cover
disable_vendor_repositories, so the file now has that name.
The native EL cases checked that genimage keeps copying the kernel into
place before dracut runs, which the next change removes.
The test runs both detect_dhcpd scripts with a fake tcpdump, and its
capture cases need private mount and network namespaces. It now lives in
xCAT-test/native with the other namespace tests, and the pull-request
workflow runs it in its own step. The capture cases keep their own unshare
call, because they add a default route on the loopback interface.
The unit test ran the Debian init helpers in the host shell, with fake
ucf, update-rc.d, systemctl and mv first in the host PATH. It now runs them
with sandbox_run in xCAT-test/native, with the compatibility root apart from
the /etc of the sandbox, and the Debian package lifecycle step runs it.
The unit test sourced scriptlib in the host Bash, with a fake nmcli first
in the host PATH. It now runs the helper with sandbox_run in
xCAT-test/native, and the pull-request workflow runs it in its own step.
A layout without a match that follows a disk file gets a match on the
disk the file selects, resolved when it is a link, and a use_gap layout
that follows a disk file stops the install. A layout with its own match
and a layout without a disk entry are kept as written.
A disk script or layout script that fails, or that writes no disk or
layout, and a disk file or layout file that holds only blank lines,
comments or an empty storage section each stop the pre-install script and
leave no storage config for Subiquity. A layout file that starts a YAML
document still leaves autoinstall.yaml one document.
A layout file followed by a disk script and a layout script followed by a
disk file each replace the default storage config with the administrator
layout. A layout file after a layout script and a disk file after a disk
script are read as files, on Subiquity and in the debian-installer recipe
step.
Render the node's pre-install script through the Template entry point and
run its partitioning under dash. Without a partitionfile the storage config
keeps the disk getinstdisk chose. A disk file puts its first disk there,
resolved when it is a link, a disk script puts the disk it writes there,
and a layout file or layout script replaces the default storage config.
The rendered compute and service %post, run in a sandbox through the
downloaded postscript, must leave the kdump.service drop-in that stateless
images get. A system without kdump.service must get none.
An image with kdump.service must get the dump-memory drop-in, once, next
to any site drop-in, and an image without it must get none. systemd itself
must start kdump.service with crashkernel= or fadump= on the command line,
and skip it with neither.
The EL10 kickstart must not render without the passwd row, and must
carry the hash of the configured password when the row exists. The
Ubuntu autoinstall must still lock a password that has no row. The
first case fails with the earlier code, which rendered an empty rootpw.
The EL10 fix-up must keep the boot entry of a system on another disk,
and must remove nothing when lsblk reports no ESP partition GUID. Both
cases fail with the earlier code, which removed every matching entry.
The efibootmgr fixture printed HD(1,GPT,...) without a partition GUID or
the tab that ends an entry label, and the lsblk fixture could not answer
a PARTUUID query, so no test could tell which partition a boot entry
points at. The fixtures now print real GUIDs and labels, and lsblk
reports the ESP partition GUID.
xCAT-server now asks for the perl(DB_File) capability on openSUSE,
because no openSUSE release ships a package named perl-DB_File. The
native package relation test still counted perl-DB_File in the SLES12
and SLES15 requirements, so both checks failed in xcat_pr_test.
Expect perl(DB_File) on the SLES platforms and keep perl-DB_File for
the others. The test fails against the upstream master spec and
passes with this branch.
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>
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.
Compare Debian and shared lookup priorities through their production
entry points and real files. Exercise Debian genimage consumers in
isolated filesystems, including custom-directory precedence and
unchanged postinstall paths.
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>
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.
The file contexts leave the published kernel of a middle-rootimg image
root out of the relabel. The comment and the SELinux page read that as
the kernel being unlabeled, httpd refusing to serve it, and that osimage
losing netboot, with restorecon as the repair. Three of those four
claims are wrong.
Measured. An entry of <<none>> keeps the label a path has: restorecon
-R, restorecon -RF and setfiles -F all left a kernel at default_t, while
the same setfiles call relabeled a path that has a rule. A new file
inherits the type of its directory, so a kernel that genimage writes
into an image root already made public_content_t is public_content_t. In
the policy with the xcat module loaded, httpd_t holds one allow rule to
read public_content_t and none for default_t. So the ordinary case
serves and netboot works, and restorecon is not the repair for the case
that does not: chcon -R -t public_content_t over the image root is, and
a later relabel leaves that value alone.
selinux_file_contexts.t now starts half the custom roots at
public_content_t, which is what genimage produces, and half at
default_t, and requires each to keep its own type. It fails 324 of its
618 checks against the previous xcat.fc.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The published-name rules for an image root called rootimg end with two
recursive entries, common(/.*)? and overlay(/.*)?. A recursive entry
below the rootimg component matches a guest tree as well: with
rootimgdir=/install/rootimg/common/compute, the guest file
/install/rootimg/common/compute/rootimg/etc/shadow resolves to
public_content_t, and so does a directory called common at the root of
any guest tree.
selinux_file_contexts.t covers neither shape. Add three case groups: an
image root that holds a rootimg component in the middle, a guest tree
that holds a common or an overlay directory at its own root, and the
published files of such an image root. Each new path is measured in the
lookup and in both relabel passes.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Execute each profile through /bin/sh. Check both firewalld entries as
regular files, valid links, dangling links, directories and missing paths.
Preserve unit targets, unrelated links and the older profiles without this
cleanup.
Execute all affected owners and their aliases in isolated image roots. Check
policy contents and metadata, missing files, repeated runs and host
sentinels. Run the cases in Ubuntu and EL CI.
%post writes /etc/xcat/xcatroot.env and %preun removes it, so the file
is absent on rpm --justdb, before %post runs, and after an interrupted
install. Both subtests of xcatd_relocated_startup.t have the file
present, so neither reads what happens without it.
Add a subtest that removes the file: each EnvironmentFile of the unit
carries a leading -, which makes a missing file not an error, XCATROOT
is the default of the unit, and the daemon starts with that default
instead of the installed prefix. Dropping the default XCATROOT from the
unit fails checks 4 and 7 of that subtest.
Record the trade the file contexts make for a rootimg component in the
middle of an image root: the guest labels are kept, which leaves the
published kernel of that one layout unlabeled, so httpd cannot serve it
and that osimage cannot netboot. The note names the recovery.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>