A file context of <<none>> stops restorecon changing the label. It does
not clear it. A tree that genimage creates under an image root that is
already public_content_t inherits that type, measured on an enforcing
el10 host: mkdir -p rootimg/common/sub under a public_content_t parent
gives every new component public_content_t, and the same tree under a
default_t parent gives default_t.
Say what the label is, and name the case that costs something: a tree
older than the package keeps default_t, and restorecon -RF over the
image root sets it.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The SELinux cases marked their audit window with date "+%H:%M:%S" and
gave it to selinux_avc_check.sh. Two failures follow from the time
window. The body of selinux_mn_labels runs inside one second, so an el9
run reported SEARCHED=0 and the guard called a quiet node a usage error.
And ausearch -ts has one second of granularity, so the denials that the
positive control of selinux_mn_labels creates on purpose landed in the
window of selinux_restapi_avc, which failed with XCAT_AVC=2 on two
httpd_t getattr records it did not cause.
selinux_avc_check.sh takes a checkpoint file: --init consumes the
records written so far and prints BASELINE, --since reports the denials
after that point. A checkpoint is an offset, so an empty answer has one
meaning and two cases cannot read one record. Each case opens its own
checkpoint, and the positive control opens a second one, which also
removes the sleep 1 that the granularity needed.
The count refuses an answer that is neither a record nor '<no matches>',
so an ausearch error message cannot read as a clean window. The -ts form
stays for the keywords boot and today, and now asks for today's records
before it calls an empty window a usage error.
/xcatpost is reported and no longer asserted on a compute or service
node. The kickstart relabel runs in %post, the xCAT post scripts write
that tree at the first boot, and the node carries no xCAT-selinux, so a
clean restorecon -Rnv there is not what the design promises.
selinux_avc_check.bats fails 7 of its 15 checks without this change, on
rome01.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
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 case ran xcatprobe xcatmn through grep -i selinux and checked the rc
of the pipeline. Nothing in the output named SELinux, so grep exited 1,
the case failed with an empty output, and the log carries no checkpoint
and no reason. The probe prints every checkpoint, so the diagnostics
existed and the filter threw them away.
The case now runs the probe with -H, which runs the checks on this node
instead of dispatching them, and keeps the whole output. It asserts that
the SELinux checkpoint is marked [ OK ] and is not marked [FAIL], which
xcatprobe writes for a checkpoint that passes and one that fails. It no
longer asserts the rc of the probe: a management node under test can
report another checkpoint as a problem, and that is not this case.
probe_xcatmn_selinux_case.t fails 3 of its 11 checks without this change,
on rome01.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
xcatprobe_xcatmn_selinux runs the probe through grep -i selinux. grep
keeps the lines that name SELinux and discards every other checkpoint,
so the one CI failure of this case reported rc 1 with an empty output
and said nothing about which checkpoint the probe stopped at. The second
check, on the word FAIL, read that empty output and passed.
probe_xcatmn_selinux_case.t requires the case to keep the whole output,
to assert at least one pattern the output must hold, and to name the
SELinux checkpoint in every pattern. It takes the marks of a checkpoint
from probe_utils->send_msg, and requires each pattern to tell a passing
checkpoint from a failing one.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The security page said xcatd runs in unconfined_service_t and that
xCAT-selinux defines no type. The module defines xcat_t for xcatd and
the client commands, and xcat_image_t for the image build, and declares
both permissive. The older page placed a service node and a compute node
outside the scope because xCAT does not select their mode, and the branch
ships noderes.selinux and site.selinux.
Both pages now state what the module does: the two permissive domains,
the transitions to tftpd_t and chronyd_t for the services xCAT starts,
the mode a node resolves, and the goal of an enforcing management node.
The scope page also records that a published common or overlay directory
of an image root called rootimg is unlabeled, for the same reason as a
published kernel there.
selinux_docs.t fails 6 of its 18 checks without this change, on rome01.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Two pages describe SELinux, and both disagree with xCAT-selinux. The
security page says the package defines no type and that xcatd runs in
unconfined_service_t. The older page says a service node and a compute
node are out of scope because xCAT does not select their mode, and the
branch ships noderes.selinux.
selinux_docs.t reads the permissive domains out of xcat.te and requires
each page to name them, to call them permissive, and to leave out the
two claims above. Nothing held the pages to the module before.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The published-name rules end with /install(/.*)?/rootimg(-statelite)?/common(/.*)?
and the same entry for overlay. The trailing (/.*)? takes a whole
subtree, so the entry matches a guest tree as well as a published
directory. With rootimgdir=/install/rootimg/common/compute, the guest
files rootimg/etc/shadow and rootimg-statelite/etc/shadow resolve to
public_content_t, and so does a directory called common or overlay at
the root of any guest tree. %posttrans runs restorecon -R /install, so
an install or an upgrade of the package overwrites the labels of the
guest operating system.
A common or an overlay directory one component below a rootimg component
has the same path as the same directory at the root of a guest tree, so
no rule can keep one and leave the other. Remove both entries. The
remaining entries each name one file and cannot take a tree with them.
A published common or overlay of an image root called rootimg is left
unlabeled, which restorecon over the image root repairs.
selinux_file_contexts.t fails 360 of its 618 checks without this change,
measured in a privileged almalinux:10 container on rome01.
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>
The policy was measured on EL10. An enforcing AlmaLinux 9.8 management
node running the same bundle logged 38 denials in xcat_t that the EL10
node did not log at all. The domain is permissive, so nothing failed,
but each one has to be granted before the domain can enforce.
Three causes, all of them EL9 running ISC DHCP where EL10 runs Kea:
- omshell reads /proc/sys/net/ipv4/ip_local_port_range before it opens
the OMAPI socket, which is 9 read, 9 open, 9 getattr on sysctl_net_t
and 8 dir search. makedhcp runs omshell on every ISC backend.
kernel_read_net_sysctls covers it.
- makedhcp asks systemd to start and query dhcpd.service, whose unit
carries dhcpd_unit_file_t. The Kea units carry systemd_unit_file_t,
which the policy already grants, so EL10 recorded nothing.
- copycds loop-mounts the install DVD, and mount asks the kernel for the
iso9660 and loop modules. kernel_request_load_module covers it.
The module compiles against the EL9 and the EL10 policy headers.
selinux_file_contexts.t keeps its 224 checks on EL10.
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>
%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>
The page states that the context belongs to the file in /opt/xcat. The
prefix is now recorded at install time, so a relocated package starts
the daemon of its own tree, and the file contexts still name /opt/xcat.
Say both, so a reader of a relocated installation knows the entrypoints
need their own entries.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
xcatd.service sets XCATROOT and PATH to the literal /opt/xcat. The
previous ExecStart sourced xcat.sh, which %post generates from
RPM_INSTALL_PREFIX0, so a relocated package got its own prefix. With the
package installed under /srv/xcat the daemon symlink reaches
/srv/xcat/sbin/xcatd and the Perl search path still names /opt/xcat, so
xcatd cannot load its own modules unless the administrator overrides the
environment or a default installation is left behind.
%post writes /etc/xcat/xcatroot.env with XCATROOT and PATH built from
RPM_INSTALL_PREFIX0, and the unit reads it with EnvironmentFile. The
order is the default in the unit, then that file, then
/etc/sysconfig/xcat, so the recorded prefix replaces the default and the
site file keeps the last word. ExecStart stays a direct call, so the
kernel still enters xcat_t on the xcatd script. %preun removes the file
on erase. The file is not in %files, so rpm --verify is unaffected.
xcatd_relocated_startup.t fails 3 checks of its /srv/xcat subtest
without this change.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
xcatd_service_direct_exec.t reads the shipped unit on a default install,
where the prefix in the unit and the prefix of the installation are the
same path. It cannot fail when they differ, which is the case the
systemd startup has to get right.
xcatd_relocated_startup.t installs the built xCAT-server package twice,
once with the default prefix and once with rpm --prefix /srv/xcat. For
each one it composes the environment the unit gives ExecStart, in the
order the unit lists Environment and EnvironmentFile, then asserts
XCATROOT, that every xCAT directory on PATH is under that prefix, and
that the daemon the start command runs receives the prefix. The
/srv/xcat subtest fails 3 of its 11 checks before the next commit; the
/opt/xcat subtest passes either way.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The exclusions match the component name rootimg anywhere under /install.
A profile may be called rootimg, and the image root is then
/install/netboot/<os>/<arch>/rootimg. The files genimage and packimage
publish in that image root, among them kernel and the initrds, sit one
component below a name the exclusions match, so each resolves to
<<none>> instead of public_content_t and httpd cannot serve it. The same
happens for a profile called rootimg-statelite.
Name each published file in the image root: kernel, hypervisor, the
initrds, the rootimg archives, rootimgtree, litefile.csv,
common.filelist, common and overlay. The entry names the component
directly below the rootimg component, so a guest file deeper in the tree
matches none of them and keeps the label of its own operating system.
selinux_file_contexts.t fails 54 of its 224 checks without this change.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The file contexts exclude a guest tree by the name rootimg at any depth
under /install. The native lookup case has no image whose profile is
rootimg, so nothing measured what happens when the image root itself
carries that name.
Add three images: a profile called rootimg, one called rootimg-statelite
and one whose name only contains rootimg. Each contributes its guest
files and its published files, so the case asks for both answers on the
same path depth. Record the choice for a rootimg component inside an
image root, which is ambiguous, and add four guest files whose own names
are published names.
54 of the 224 checks fail against the file contexts before the next
commit.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Run the complete discovery postscript in the shared shell sandbox. Keep the
key-generation, exit-status and listener side-effect checks. Preserve the
dedicated CI step and its cancellation condition.
openEuler stateless images use the rh genimage and dracut modules,
which add the UFTP receiver, and xcat-dep now builds uftp for the
openEuler targets. List openEuler with the supported images and the
uftp package.
Describe how genimage, nodeset, the listener and the booting node work
together, the supported images, the cases that nodeset refuses, and
what a transfer trusts. Describe the listener setup, the firewall and
multicast requirements, service nodes, and the transfer rate and jumbo
frame settings. Add the rootimgtransport attributes of the site and
the osimage to the reference pages.
The export of an image must name the UFTP marker of its initial
ramdisk, and the import must place the marker next to the ramdisk. An
import from a bundle that names the marker but lacks it must fail and
leave the published files.
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.
The anaconda, sles and debian plugins must pass the listener port and
the server key fingerprint only for a stateless image set to uftp,
directly or from the site value. They must refuse a node for a managed
argument in addkcmdline, a turned off check, an https image URL, an
initial ramdisk without the receiver, a missing listener
configuration, or an unknown transport. A refused node must keep the
kernel and initial ramdisk in TFTP. A statelite ramdisk image must
ignore site.rootimgtransport.
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.
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 gives the stateless dracut initial ramdisk of an Ubuntu image
the same UFTP receiver as an EL image, under the same conditions.
xcatroot receives the first copy of the image over UFTP when nodeset
asks for it, and checks it like an HTTP download.
The kernel does not pass an argument with a dot, such as xcat.uftp=,
to init as a variable. The Ubuntu xcatroot reads these arguments with
the dracut getarg function, in a subshell, so its other variables keep
their sources.
genimage gives the stateless initial ramdisk of a SLES or openSUSE Leap
image with dracut 033 or later the same UFTP receiver as an EL image. It
adds the helper and uftpd when the image has the UFTP 5 receiver of
xcat-dep for its architecture, checks the built ramdisk, and marks it
for nodeset. xcatroot receives the first copy of the image over UFTP
when nodeset asks for it, and checks it like an HTTP download.
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.
genimage adds the UFTP fetch helper and uftpd to the stateless initial
ramdisk of an EL image that has the UFTP 5 receiver of xcat-dep for its
architecture. It checks that the built ramdisk holds the receiver files.
It writes a marker with the digest of the published ramdisk, which
nodeset compares before it asks for UFTP. Without a usable receiver,
genimage removes the helper and the marker.
When nodeset passes xcat.uftp=, xcatroot receives the first copy of the
image over UFTP. The helper asks the listener for the archive that the
checksum file names, as fetched before the request. xcatroot checks the
received file against the checksum file like an HTTP download. A
mismatch or a failed transfer is followed by the HTTP download loop.
UFTP is used only together with rootimgchecksum=yes.
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.
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.
A request must resolve only to an archive that packimage published with
its checksum, under an image root, owned by root and not writable by
others, and only for a digest that the checksum file lists. An open
archive must keep the bytes of its batch after the next publication. The
UFTP checks must accept only the marked UFTP 5 build of xcat-dep, and a
receiver only for the image architecture. nodeset must refuse an image
without the checksum, with https or --tracker, outside the image roots
of the listener, or with a path that a request cannot name. It must also
refuse a statelite image, an initial ramdisk without the receiver, and a
managed argument in the addkcmdline of the image or the node.
A shorter node identity leaves the prefix of the previous text on screen.
Pad the field on each redraw to erase that prefix.
Limit the field to the context buffer before padding. This keeps leading
spaces from truncating the identity on wide terminals.
selinux_cn_statelite_disabled_by_design ran nodeset against the
statelite osimage without building it. copycds declares the osimage, and
nodeset needs the image tree and the litefile links that genimage and
liteimg create, so the case failed on a fresh cluster for a reason that
has nothing to do with SELinux.
Build the image in the case.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>