xcatroot writes the netplan of the booted system from the interface it found,
and it always wrote "dhcp4: true". An IPv6-only node has no DHCPv4 server, so it
reached its login prompt with no address: Ubuntu 24.04.5 reported
"[FAILED] Failed to start systemd-networkd-w... Wait for Network to be
Configured." and "[FAILED] Failed to start xcatpostinit.service", and the node
answered no ssh.
The address is already on the kernel command line, in the static form dracut
takes. xcat_static_ip6_fields reads it and the netplan carries the address, the
prefix and a default route through the gateway. A node whose command line holds
an IPv4 form keeps dhcp4, because the fields are read only from a bracketed
literal.
Captured by xCAT-test/bats/ipv6_xcatroot_netplan.bats. Reading the fields by
cutting on the first colon, which is what an IPv6 literal breaks, fails the
three parsing assertions and leaves the four refusals passing.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
pre.sle substitutes the install server for XCATNEXTSERVERHOOK in the media_url
that xCAT::Template writes for every install source. The substitution read
sed -e 's!XCATNEXTSERVERHOOK!'$nextserver'!', with the value unquoted, and
shopt -s nullglob is set earlier in the same script. An IPv6 server is bracketed,
so "[2001:db8::1]" is a glob that matches no file and the whole sed script word
is removed. sed then reads the profile as its script and writes nothing, so
/tmp/profile/modified.xml is empty. AutoYaST falls back to the unmodified profile
and stops on "Disk 'XCATPARTITIONHOOK' was not found", because the pre-script
also substitutes the install disk into that profile.
The substitution moves into substitute_nextserver, which quotes the value. An
IPv4 server was never affected, because it carries no bracket.
Captured by xCAT-test/bats/ipv6_pre_sle_nextserver.bats. With the quotes removed
again, assertions 9 and 10 fail and the IPv4 assertion 11 still passes.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
pre.sle and pre.sles read the install server out of the kernel command line and put
it back into a URL. pre.sle substitutes it for XCATNEXTSERVERHOOK in the media_url of
every install source, and pre.sles substitutes it into #INSTALL_SOURCES_IN_PRE#.
The derivation cut the authority at the first colon. An IPv6 install server written
"autoyast=http://[2001:db8::1]:80/install/autoinst/node01" yielded "[2001", so the
media_url read "http://[2001:80/install/..." and YaST had no install source. A
portless IPv4 URL kept its path as well, and worked only because xCAT always writes
a port.
The test runs the derivation taken from each script against a command line of its
own, so a change to the derivation is measured here.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
post.xcat.rhels10 builds XCATSERVER with format_host_port and the other two copies
wrote "$MASTER_IP:3001". The test drives each script's own format_host_port and
asserts that no copy interpolates the address unbracketed.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
post.xcat.rhels10 brackets the management node address before it goes in a URL and
the other two copies did not, and nothing held the three to each other.
The test drives each script's own format_uri_host with one table, and asserts that
no download URL in them interpolates MASTER_IP unbracketed.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
makedhcp builds a DUID-UUID from vpd.uuid and the reservation carries one identifier, but no
network manager derives that identifier in the byte order the firmware sends. NetworkManager has
no option for the SMBIOS UUID at all, and systemd-networkd's DUIDType=uuid uses the decoded
product UUID, which is the other order. So a node whose installed OS speaks DHCPv6 matched no
reservation and took a pool address.
configdhcpv6duid writes the identifier for whichever renderer the node has: the whole DUID for
NetworkManager, and the type by name with the sixteen bytes alone for systemd-networkd, which
composes the two. It is in the default postscript list for Linux, after remoteshell. AIX has
neither renderer and keeps its list.
A diskless or statelite node needs nothing: its address comes from the kernel command line and
configeth writes dhcp6: false, so its image sends no DHCPv6 request.
postscript_dhcpv6_duid.bats pins both forms to the literal the two Genesis images already use,
so the four copies of the byte swap cannot drift apart, and asserts the node fails loudly when
it has no renderer. postscript_dhcpv6_duid_registered.t holds the registration down: dropping it
fails 3 of its 7 assertions.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
configeth guarded the route with "[ a ] -a [ b ]", which is not a shell operator. bash reported
"[: too many arguments" and took the else path on every run, so /etc/sysconfig/network/routes
never received the IPv6 default route of a SUSE node and nothing said so.
The duplicate check behind that guard spelled the character class "[:space:]", which is a
bracket expression matching one of those six characters. It found no route already present, so
fixing the guard alone would have appended the route on every run of the postscript.
The two tests are now a valid shell condition and a correct class, and the logic moved into
add_suse_ipv6_default_route so it can be read without an installed node.
ipv6_configeth_suse_route.bats covers both faults separately. Restoring the operator fails 4 of
its 7 cases, one of which asserts that bash reports nothing on stderr; restoring the class fails
only the case that runs the postscript three times and expects one route.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Both Genesis images built a DUID-UUID from the nil SMBIOS UUID. makedhcp refuses that UUID,
because nodeimport writes it to every PowerKVM node, and reserves the hardware address instead,
so the client sent an identifier no reservation held and the node took a pool address with no
boot file. genesis-duid and doxcat now keep the DUID-LL for it, which is what Kea reads the
hardware address out of.
getzonesfornet died on an IPv6 prefix that is not a multiple of 4, which took makedns and
makedhcp with it for a /62 or a /126 network. A reverse zone is delegated on a nibble, so the
prefix is rounded down and the enclosing zone is returned. Both copies of the routine are fixed.
The test suite needs socat and jq, and five bats files skipped without them, so the workflow
installs both. Template.pm drops the unused _is_el10, credentials.pm drops a repeated import,
and two comments that recorded bug history are cut to the fact the code cannot show.
Reverting any one fix fails named assertions: 1 of 8 and 1 of 3 bats cases for the two Genesis
images, and 4 of 30 in ddns_ipv6.t, which traps the abort so the file still reports.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Parsing the xcatd= argument was only half of it. doxcat re-joined XCATMASTER and
XCATPORT at twenty call sites, and /bin/getcert and /bin/getdestiny pass that string
to openssl s_client -connect, which rejects an unbracketed IPv6 address:
openssl s_client -connect 2001:db8:190::1:3001
s_client: -connect argument or target parameter malformed or ambiguous
openssl s_client -connect [2001:db8:190::1]:3001
depth=1 CN=xCAT CA
Measured on an IPv6-only node whose cmdline parsed correctly: /etc/xcat held
certkey.pem and privkey.pem but no cert.pem, and nodelist.status stayed empty.
doxcat now derives XCATDEST once, bracketing an address that holds a colon, and every
call site uses it. getcert already honoured XCATDEST as an environment variable.
dodiscovery falls back to the old form when doxcat did not export it.
The mutation keeps the variable and changes only its value: 4 of the 7 bats cases go
red, the IPv6 ones, and the 3 IPv4 and default-port cases pass.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The OpenEmbedded Genesis image sets ipv6.dhcp-duid=ll, so NetworkManager sends a
DUID-LL. makedhcp builds a DUID-UUID from vpd.uuid, and kea_node_reservations6 puts
either a duid or a hw-address in a reservation, never both. A node that reported an
SMBIOS UUID therefore gets a DUID-only reservation that its DUID-LL cannot match: it
takes a pool address with no bootfile-url and does not netboot over IPv6. The legacy
image is correct here, because doxcat writes a DUID-UUID in firmware order.
genesis_openembedded_duid.bats asserts the image turns the SMBIOS UUID into the same
DUID that xCAT-test/bats/genesis_duid_uuid.bats pins for the legacy image, and that a
node with no SMBIOS UUID keeps the DUID-LL, which is what a hw-address reservation
needs. genesis_openembedded_duid.t covers the unit that writes it before
NetworkManager, and genesis_metadata.py covers the installed files.
All 15 assertions fail on this commit: there is no genesis-duid script and no unit.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
An IPv6-only node that boots Genesis never reaches xcatd. destiny.pm writes
xcatd=<master>:<port> unbracketed, and doxcat splits the value on the colon, so an
IPv6 master is read as the address 2001 and the port db8. Measured on a throwaway
el10 cluster: the console logged "XCATMASTER is 2001, XCATPORT is db8", the node
hung acquiring its credentials, and nodelist.status stayed empty.
xcatd_cmdline_address.t drives the writer and doxcat_xcatd_address.bats drives
doxcat's own parse loop, extracted by line range rather than re-implemented, so the
test reads the shipped code. The bats file is in bats because the parser is shell.
The graded evidence is the mutation pair recorded in the fix commit, not the red of
this commit alone: without the fix the routine does not exist, and a test that dies
on a missing subroutine only says it is missing.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
genesis_duid_uuid.bats checks the DUID that the legacy doxcat sends, which the
vpd.uuid rework does not change. The revert that reworked vpd.uuid kept this file
deliberately, so dropping the reverted commits from this branch dropped it too.
Nothing else references the file, so its absence broke no test. It is restored here
so the branch loses no coverage relative to the pull requests it supersedes.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
dodiscovery runs in a private namespace with a fixed product_uuid and
stubbed hardware and transport commands. The test reads the UUID from
the discovery request that the script sends and expects product_uuid
unchanged. Before the fix the request held the UUID with its first
three fields swapped.
(cherry picked from commit 21762f21526e0ba71fb3b9a6d3ec314e59feb101)
(cherry picked from commit bff1e7ea93)
The OpenEmbedded discovery sends the product_uuid fixture and expects it
unchanged in the findme request.
(cherry picked from commit 092d78a224ee57af834a74ccfb63185f7120a2b7)
(cherry picked from commit 47fc5cf780)
site.master may carry a port. format_syslog_forward_target in
xCAT/postscripts/syslog bracketed any value containing a colon, so
MASTER=127.0.0.1:1515 rendered the rsyslog line as @[127.0.0.1:1515], which
rsyslog does not accept, and syslog_ng_udp_driver chose udp6 for an IPv4 peer.
format_syslog_server in the dracut_105 rsyslogd-start.sh carries its own copy of
the rule and had the same defect; it runs inside the initramfs and cannot source
the postscript, so the rule is held down twice on purpose.
An IPv4 address or a hostname with a port has exactly one colon and an IPv6
literal has at least two, so the test is now on two colons rather than one. A
value already starting with "[" is left alone whether or not a port follows it,
which the old pattern missed: it required a trailing "]" and so double-bracketed
[2001:db8::1]:514.
ipv6_syslog_forwarding.bats gains four cases. Without the fix, "a target with a
port is not mistaken for an IPv6 literal", "an already-bracketed target with a
port is left alone" and "the initrd launcher does not mistake a port for an IPv6
literal" all fail; the compressed-literal case passes either way and is there to
show the bracketing of ::1 did not regress.
Also: grub2_ipv6.t could not load grub2.pm once xcat-core/#7980 made it use
xCAT::DHCP::BootPolicy, which lives in perl-xCAT. The file died at compile time
and reported no plan at all, which in a prove summary reads as a count
discrepancy rather than a failure. It now puts perl-xCAT and the server perl
directory on @INC, as every other plugin test does.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Two gaps from the same branch.
ddns.pm:453 assigned "my @myips = _local_addresses_for_network(...)" and never
read the value, and _local_addresses_for_network had no other caller. The
routine and its three assertions in ddns_ipv6.t are removed: a test on a
routine nothing calls measures nothing and keeps dead code alive.
The commit that moved the shell tests to bats deleted el10_ipv6_runtime.t and
wrote no bats file for pre.rhels10, so its new create_listen_socket, its peer
allow list, its screendump rewrite and extract_url_host had no assertions.
ipv6_pre_rhels10.bats renders the install monitor pre.rhels10 embeds, fills
the two substitution tokens the way xCAT fills them, runs it and speaks its
protocol over each family. It also drives extract_url_host and the expression
that finds the install URL in the kernel command line, read from the script
rather than retyped.
Six reversions of the script were each measured: an AF_INET-only listener, a
missing peer check, the os.popen screendump, the colon split of the URL, a
grep that drops the bracket alternative, and a missing strip on the received
command. Every one fails at least one assertion.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Sixteen assertions on this branch matched a regular expression against the
source of the code they test. Such an assertion passes when the code is moved
somewhere it never runs, and fails when the file is reformatted and nothing
has changed: a perltidy respace of updatenode.pm:1606 turned
updatenode_ipv6_endpoint.t red with the behaviour unchanged.
updatenode_ipv6_endpoint.t now runs updatenoderunps and updatenodesoftware
and reads the xdsh command each one dispatched. It also covers the service
node name that has no usable endpoint, which the regular expressions could
not reach.
anaconda.pm built the debug syslog kernel arguments inline inside two large
subs. Move each to its own sub, _netboot_syslog_kcmdline_args and
_install_syslog_kcmdline_args, and render them in the test. An unusable
server name now gives no syslog arguments, where it gave "syslog.server="
with nothing after it.
pping is a program with no sub API, so the nmap and fping command building
moves to xCAT::DSHCore as nmap_ping_command and fping_ping_command, and pping
stays the caller that forks and execs the list.
credentials_ipv6_callback.t read allowcred.awk as text, and ran gawk from a
.t. The awk program is covered by xCAT-test/bats/ipv6_allowcred_awk.bats,
which starts it and speaks the credential protocol to it over both families.
Stubbing Socket6 and IO::Socket::INET6 in %INC also unskips the four
_open_callback_socket assertions, which skipped where the suite runs.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Seven of the ported unit files drive shell: they run bash -n on a product
script, cut a function out of it with a regex and eval the copy, or write a
fake executable into PATH. A .t runs Perl in process, so each one tested its
own scaffolding as much as the product, and a reformat of the script would
break it while a move of the code would not.
The five bats files replace them and use the existing shell_source helper.
ipv6_endpoint_helpers drives the four separate copies of xcat_endpoint_host
from one table, because the scripts carry a copy each -- xcatroot runs in the
dracut initrd, xcatpostinit1.netboot before /xcatpost exists, xcatinstallpost
in the installer root -- and the copies must agree.
ipv6_xcatdsklspost_endpoints uses XCATDSKLSPOST_SOURCE_ONLY to load the real
parsehttpserver and format_host_port and asserts a bracketed authority
survives a round trip. ipv6_syslog_forwarding covers the rsyslog bracket and
the syslog-ng udp6 driver. ipv6_configeth_install_nic drives
discover_install_nic_ipv6 against recorded "ip -6 addr show" output and pins
that a temporary, tentative, deprecated or dadfailed address is never chosen.
ipv6_updateflag_awk runs updateflag.awk against a loopback listener of each
family and pins the bracket stripping.
Each assertion was run against the unfixed script and fails there. Two gaps
stay: allowcred.awk has no coverage, and the /inet6/ prefix updateflag.awk
chooses cannot be covered, because gawk 5.3.0 reaches an IPv6 literal through
/inet/ as well.
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 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.
selinux_avc_check.sh refuses a window that holds no audit record, and
calls it a usage error. On a quiet node that answer is wrong: the body of
selinux_mn_labels runs inside one second, so an el9 run of the case
failed with SEARCHED=0 AVC=0 XCAT_AVC=0 while the search was working.
The guard has no way to tell the two apart, and no check names which
guard fires.
The time window has a second defect that no check covers. ausearch -ts
has one second of granularity, so the denials the positive control of
selinux_mn_labels creates on purpose land in the window of the case that
runs next: selinux_restapi_avc failed with SEARCHED=50 AVC=6
XCAT_AVC=2, and both kept records were the control's httpd_t getattr on
/install/postscripts/xcatdsklspost.
selinux_avc_check.bats now requires a checkpoint interface, --init and
--since, and requires the count to refuse an ausearch error message
while it accepts an empty read. It also requires the time window to
consult today before it calls an empty window a usage error.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The cases marked the start of their window with date "+%x %T" and gave
it to ausearch. audit 4.0.3 takes a bare HH:MM:SS and rejects that
format: it prints nothing and exits 0. Measured on an enforcing
AlmaLinux 10.2 management node, with the raw log holding 4197 records:
"-ts 10/21/2026 20:59:08" returned 0 records, "-ts 20:59:08" returned
22 and "-ts today" returned 4006. So selinux_avc_check.sh searched
nothing and reported XCAT_AVC=0 whatever the node did.
The positive control of selinux_mn_labels is what found it. The case
mislabels /install/postscripts/xcatdsklspost, shows httpd answering 403
and requires the check to report XCAT_AVC=[1-9]; it reported
SEARCHED=0 AVC=0 XCAT_AVC=0 and the case failed on an enforcing el10
node.
The four cases now write date "+%H:%M:%S". selinux_avc_check.sh refuses
a window that holds no audit record at all, because that is not a
credible answer on a running node, and names the format in the message.
selinux_avc_check.bats fails its ninth check against the unguarded
script.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The Ubuntu xcatroot must receive an image over UFTP under dash and
check it like a download. It must read the UFTP arguments from the
kernel command line, which has them, and not from its environment,
which does not.
genimage must add the helper only for an image with the UFTP 5 receiver
of xcat-dep for its architecture, and remove an older copy otherwise. It
must fail when the built ramdisk lacks the receiver files. The marker
must follow the published ramdisk.
The helper must ask the listener only for a digest that the checksum
file lists for the image, and stop its receiver on every failure.
xcatroot must check a received image like a download. It must fall back
to HTTP when UFTP fails, is not set up, or the image is not checked.
The listener must send the requests for one archive with one sender. It
must refuse paths outside the image roots, archives without a checksum,
and digests that the checksum file does not list. A queued batch must
keep its archive after the next publication. The limits on
connections, queued jobs, senders, receivers and time must hold. Package
removal must stop and disable the service, and an upgrade must leave it
alone.
The unit test calls the listener subs of xCAT::UFTP in process, with a
fixed clock and a sender start that it records. native/uftp_listener.t
runs the listener script with uftp and uftp_keymgt fixtures. It covers
key creation, a read-only log directory, sender processes, shutdown and
connection limits. The pull-request workflow runs it.
postinstall_selinux_config.bats required at least 13 postinstall scripts
that write the SELinux config. Three riscv64 scripts are now symlinks to
the rocky one, and the find uses -type f, which counts a shared file
once, so the list holds 12 entries for 15 names and the check fails on a
tree where nothing is wrong.
Lower the bound to 12 and name the aarch64 script among the
representatives. The bound exists to catch a find that stops matching; a
new script needs no new bound, because every other test in the file
loops over the same list.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
xCAT-test/unit/fips_policy_sources.t ran build-utils/sync-fips-policy as a
subprocess, so a file in the unit directory measured a program rather than a
routine, and it asserted on the diagnostics the script printed instead of on an
answer. buildrpms.pl and builddebs.pl started the same script with system() to
check the generated libraries before packaging xCAT or xCAT-genesis-scripts.
XCAT::BuildUtils gains fips_policy_artifacts, fips_policy_plan and
sync_fips_policy. fips_policy_plan reads the canonical policy and both runtime
libraries and reports what generation would write, without writing.
sync_fips_policy applies that plan in write mode and returns the stale paths,
the paths it rewrote and the diagnostics for its caller to print. The two
builders now call sync_fips_policy in their own process and print the
diagnostics before they stop, which keeps the output xCAT-test/native/
fips_build_guard.t asserts on. build-utils/sync-fips-policy keeps its
--check and --write contract and its exit status, and is now a thin caller.
The unit test calls the sub in-process and asserts on the returned hash. It
also covers a library holding two policy blocks and a library replaced by a
symbolic link, which the subprocess form did not reach. Ten mutants of the
module, one per guard, each fail the assertion that names that guard.
xCAT-test/bats/fips_policy_artifacts.bats copies XCAT::BuildUtils into its
fixture, because the script it runs now loads the module.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Thirteen netboot postinstall scripts, and the xcat_inventory postinstall fixture,
disable SELinux in the rootimg with
s/SELINUX=enforcing\|permissive/SELINUX=disabled/. The second alternative is a bare
word with no key, so a config that reads SELINUX=permissive becomes
SELINUX=SELINUX=disabled. The same alternative matches the stock comment that names
permissive, which is rewritten on every image. sed returns 0 in both cases.
postinstall_selinux_config.bats runs each script over a scratch image root and reads
the config the script writes. Three of its six tests fail on this tree: the permissive
value, the already-disabled config and the comment.
The other three hold down behaviour the fix must keep. A no-op substitution turns the
enforcing test red, and a dropped -f guard turns the absent-config test red.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
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>
Eight checks in the selinux testcases asserted ausearch output =~ "<no
matches>", which is zero denials of any kind in the window. A cluster
denies things xCAT has nothing to do with. On an idle enforcing
management node httpd asks the kernel for net_admin on itself every ten
seconds, and the base policy carries no dontaudit rule for that shape.
One node logged 1034 denials in a day, 817 of them that one shape. So
the assertion cannot pass once ausearch is called correctly, and before
--input-logs was added it could not fail.
selinux_avc_check.sh keeps the denials whose subject program or object
path belongs to xCAT and counts those. The cases assert XCAT_AVC=0.
selinux_mn_labels now also plants a denial on purpose: it mislabels
/install/postscripts/xcatdsklspost, shows httpd answering 403, and
requires the check to report XCAT_AVC=[1-9] before restoring the label.
A counting method with no positive control cannot be trusted to find
anything.
restorecon -RnvF reports a difference in the SELinux user as well as the
type, and the files xCAT writes carry unconfined_u. On one node -RnvF
printed 12 lines over /install where -Rnv printed 2. The checks use
-Rnv, which is the type they assert.
The six cases were in no bundle and in no pipeline conf, so none had
ever run, which is why the dead checks were not noticed.
selinux.bundle and selinux_mn.bundle name them, and selinux_bundle.t
fails when a case is in no bundle.
Tests: selinux_avc_check.bats drives the classifier with records
measured on an enforcing management node. Replacing the filter with one
that keeps every record fails 4 of its 8 checks; dropping the
object-path branch fails 2. selinux_bundle.t fails when selinux.bundle
is removed. selinux_kickstart_template.t asserted the relabel order with
a regex that matched wherever the relabel sat; it now compares line
positions, and moving #SELINUXRELABEL# above the xCAT post includes
fails it.
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>
Source the unchanged selector with explicit partition and udev fixtures.
Bound awk discovery to the fixture so runner filesystem size cannot delay
selection. Keep rendered-installer coverage and independent CI failures.
stage_genesis_payload() runs restorecon and discards its exit status, so a
relabel that fails returns 0 and the kernel keeps the context of the install
tree. mknb_genesis_selinux_context.t asserted that rc, so the test held the
defect in place. It now requires the failure to reach the caller, with the
kernel path and a message that names the relabel.
selinux_context.sh reads only the output of restorecon -F -n -v, so a non-zero
exit with no output reports GENESIS_SELINUX_OK.
The helper also builds genesis.kernel.<arch> from the architecture it was
given. With legacy Genesis, mknb ppc64le resolves share/xcat/netboot/genesis/
ppc64 and writes genesis.kernel.ppc64, so the helper fails on a kernel mknb
never staged. Three ppc64le cells run this case.
genesis_kernel_selinux_context.bats drives the helper with lsdef, mknb,
selinuxenabled and restorecon shadowed and XCATROOT in a scratch tree. Three of
its four checks fail without the fix that follows, and the fourth fails when the
OpenEmbedded branch is removed.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>