2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 08:52:15 +00:00

test(xcat-core): capture the client exec that SELinux refuses

A client command run from unconfined_t fails under enforcing:

    /opt/xcat/bin/lsxcatd: /usr/bin/perl: bad interpreter: Permission denied

Measured on xcat162-mn-tmp-286, AlmaLinux 10.2, with the module loaded and
the entrypoints labelled. The same command returns 0 under setenforce 0.
The transition computes unconfined_u:unconfined_r:xcat_t, and the module
does not authorize unconfined_r for xcat_t, so the context is invalid and
the kernel refuses the exec. The permissive declaration does not help,
because an invalid context is not a permission check. The record is
SELINUX_ERR, op=security_compute_sid, which no AVC query finds.

xcat_selinux_package.t asserts the role statement, and check 49 of 60
fails on this commit. selinux_client_domain asserts that lsxcatd returns 0
and prints its version under enforcing, that seinfo reports xcat_t for
unconfined_r, and that the run leaves no invalid_context record.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-14 17:28:02 -03:00
parent 167f04d2e9
commit 7b92b95034
2 changed files with 18 additions and 0 deletions
@@ -20,6 +20,8 @@ label:mn_only,selinux
cmd:getenforce
check:rc==0
check:output=~^Enforcing$
cmd:sh -c 'date "+%x %T" > /tmp/selinux_client_domain.start'
check:rc==0
cmd:ls -Z /opt/xcat/bin/xcatclient
check:rc==0
check:output=~:xcat_client_exec_t:
@@ -36,8 +38,16 @@ check:rc==0
check:output=~xcat_t
cmd:sesearch -T -s unconfined_t -t bin_t -c process
check:output!~xcat_t
cmd:sh -c 'seinfo -runconfined_r -x | grep -w xcat_t'
check:rc==0
cmd:lsxcatd -v
check:rc==0
check:output=~^Version
cmd:sh -c 'ausearch --input-logs -m SELINUX_ERR -ts "$(cat /tmp/selinux_client_domain.start)" 2>&1 | grep -F invalid_context | wc -l'
check:rc==0
check:output=~^0$
cmd:rm -f /tmp/selinux_client_domain.start
check:rc==0
end
start:selinux_mn_labels
+8
View File
@@ -211,6 +211,14 @@ my @domtrans = $te =~ /^\s*domtrans_pattern\((\w+), xcat_client_exec_t, xcat_t\)
is_deeply(\@domtrans, ['unconfined_t'],
'only the unconfined domain transitions into xcat_t');
# The transition computes unconfined_u:unconfined_r:xcat_t. Without this
# statement that context is invalid, and the kernel refuses the exec with
# EACCES whether or not xcat_t is permissive. A permissive domain does not
# help: an invalid context is not a permission check, and the record is
# SELINUX_ERR, which no AVC query finds.
like($te, qr/^\s*role unconfined_r types xcat_t;$/m,
'unconfined_r is authorized for xcat_t');
# A confined user domain that entered a permissive xcat_t would leave its own
# confinement, so the module gives it no transition.
foreach my $domain (qw(user_t staff_t sysadm_t guest_t xguest_t)) {