public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if systemd-modules-load can read /run/modprobe.d/*.conf
@ 2026-09-11 13:22 Milos Malik
0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:22 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 6b1406c6b2bec9400b6b7de8eee9b84134a64a33
Author : Milos Malik <mmalik@redhat.com>
Date : 2024-10-03T12:55:42+00:00
Stats : +16/-3 in 3 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/6b1406c6b2bec9400b6b7de8eee9b84134a64a33?branch=pr775-checkpolicy-revdeps
Log:
test if systemd-modules-load can read /run/modprobe.d/*.conf
A recent cockpit CI + selinux-policy + FIPS testing revealed that
SELinux prevents the systemd-modules-load processes from reading
files stored in the /run/modprobe.d/ directory. The TC reproduces
the situation.
In order to support the documented locations for modprobe config
files, I believe that SELinux policy should allow the action. The
TC looks for appropriate policy rules and file context patterns.
The TC covers RHEL-54591.
---
diff --git a/selinux-policy/systemd-modules-load-and-similar/Makefile b/selinux-policy/systemd-modules-load-and-similar/Makefile
index d53ce0c..610e027 100644
--- a/selinux-policy/systemd-modules-load-and-similar/Makefile
+++ b/selinux-policy/systemd-modules-load-and-similar/Makefile
@@ -55,7 +55,7 @@ $(METADATA): Makefile
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: selinux-policy" >> $(METADATA)
@echo "RunFor: systemd" >> $(METADATA)
- @echo "Requires: audit initscripts libselinux libselinux-utils policycoreutils rdma-core selinux-policy selinux-policy-targeted setools-console openssh-clients systemd-udev" >> $(METADATA)
+ @echo "Requires: audit /usr/sbin/service libselinux libselinux-utils policycoreutils rdma-core selinux-policy selinux-policy-targeted setools-console openssh-clients systemd-udev" >> $(METADATA)
@echo "RhtsRequires: library(selinux-policy/common)" >> $(METADATA)
@echo "Environment: AVC_ERROR=+no_avc_check" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@@ -84,6 +84,7 @@ $(METADATA): Makefile
@echo "Bug: 1972372" >> $(METADATA) # RHEL 9
@echo "Bug: 2088257" >> $(METADATA) # RHEL-9
@echo "Bug: 2088258" >> $(METADATA) # RHEL-9
+ @echo "Bug: RHEL-54591" >> $(METADATA) # RHEL-10
rhts-lint $(METADATA)
diff --git a/selinux-policy/systemd-modules-load-and-similar/main.fmf b/selinux-policy/systemd-modules-load-and-similar/main.fmf
index aa1b202..fd3339c 100644
--- a/selinux-policy/systemd-modules-load-and-similar/main.fmf
+++ b/selinux-policy/systemd-modules-load-and-similar/main.fmf
@@ -9,7 +9,7 @@ require:
- library(selinux-policy/common)
recommend:
- audit
- - initscripts
+ - /usr/sbin/service
- libselinux
- libselinux-utils
- policycoreutils
@@ -55,6 +55,7 @@ link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1850953
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2088257
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2088258
+ - verifies: https://issues.redhat.com/browse/RHEL-54591
adjust:
- enabled: false
when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-alt-7
diff --git a/selinux-policy/systemd-modules-load-and-similar/runtest.sh b/selinux-policy/systemd-modules-load-and-similar/runtest.sh
index a7a862c..9288bb6 100755
--- a/selinux-policy/systemd-modules-load-and-similar/runtest.sh
+++ b/selinux-policy/systemd-modules-load-and-similar/runtest.sh
@@ -105,15 +105,19 @@ rlJournalStart
rlPhaseEnd
rlPhaseStartTest "real scenario -- standalone service"
+ rlRun "mkdir -p /run/modprobe.d"
+ rlRun "echo 'blacklist cipher_null' > /run/modprobe.d/test.conf"
+ rlRun "restorecon -Rv /run/modprobe.d"
rlRun "echo ${ROOT_PASSWORD} | passwd --stdin root"
rlRun "echo ${KERNEL_MODULE} > /etc/modules-load.d/${KERNEL_MODULE}.conf"
rlRun "lsmod"
rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} - ${PROCESS_CONTEXT} "start status" 1
rlRun "lsmod | grep ${KERNEL_MODULE}"
- rlRun "restorecon -Rv /run /var -e /var/ARTIFACTS" 0-255
+ rlRun "restorecon -Rv /etc /run /var -e /var/ARTIFACTS" 0-255
rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} - ${PROCESS_CONTEXT} "stop status" 1
rlRun "lsmod"
rlRun "rm -f /etc/modules-load.d/${KERNEL_MODULE}.conf"
+ rlRun "rm -f /run/modprobe.d/test.conf"
rlPhaseEnd
if modinfo `grep ^ib /etc/rdma/modules/rdma.conf` >& /dev/null ; then
@@ -137,6 +141,13 @@ rlJournalStart
rlSESearchRule "allow systemd_modules_load_t syslogd_t : unix_dgram_socket { sendto } [ ]"
rlSESearchRule "allow systemd_modules_load_t kmsg_device_t : chr_file { write } [ ]"
rlPhaseEnd
+
+ rlPhaseStartTest "RHEL-54591"
+ rlSEMatchPathCon "/usr/lib/systemd/systemd-modules-load" "systemd_modules_load_exec_t"
+ rlSEMatchPathCon "/run/modprobe.d" "modules_conf_t"
+ rlSEMatchPathCon "/run/modprobe.d/fips.conf" "modules_conf_t"
+ rlSESearchRule "allow systemd_modules_load_t modules_conf_t : file { getattr open read } [ ]"
+ rlPhaseEnd
fi
rlPhaseStartCleanup
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 13:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 13:22 [tests/selinux] pr775-checkpolicy-revdeps: test if systemd-modules-load can read /run/modprobe.d/*.conf Milos Malik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox