public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if samba-bgqd can talk to cupsd via socket
@ 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 : 0109a9a414a2708ed07c74527ade5bb08293043e
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2025-01-07T14:11:32+01:00
            Stats  : +16/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/0109a9a414a2708ed07c74527ade5bb08293043e?branch=pr775-checkpolicy-revdeps

            Log:
            test if samba-bgqd can talk to cupsd via socket

Recent cups + samba + selinux-policy testing revealed SELinux
denials which appear when a samba-bgqd process communicates
with the cupsd process via the /run/cups/cups.sock file. The
TC reproduces the situation.

In order to support the use case and avoid these SELinux denials,
I believe that SELinux policy should allow the necessary actions.
The TC looks for appropriate policy rules and file context patterns.

The TC covers RHEL-72860 and RHEL-72861.

---
diff --git a/selinux-policy/samba-bgqd-and-similar/Makefile b/selinux-policy/samba-bgqd-and-similar/Makefile
index 614f246..df25be8 100644
--- a/selinux-policy/samba-bgqd-and-similar/Makefile
+++ b/selinux-policy/samba-bgqd-and-similar/Makefile
@@ -54,7 +54,7 @@ $(METADATA): Makefile
 	@echo "Type:            Regression" >> $(METADATA)
 	@echo "TestTime:        15m" >> $(METADATA)
 	@echo "RunFor:          selinux-policy" >> $(METADATA)
-	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console samba samba-client samba-common-tools cups" >> $(METADATA)
+	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console samba samba-client samba-common-tools cups /usr/sbin/service" >> $(METADATA)
 	@echo "RhtsRequires:    library(selinux-policy/common)" >> $(METADATA)
 	@echo "Environment:     AVC_ERROR=+no_avc_check" >> $(METADATA)
 	@echo "Priority:        Normal" >> $(METADATA)
@@ -66,6 +66,8 @@ $(METADATA): Makefile
 	@echo "Bug:             RHEL-64908" >> $(METADATA) # RHEL-10
 	@echo "Bug:             RHEL-69512" >> $(METADATA) # RHEL-10
 	@echo "Bug:             RHEL-69517" >> $(METADATA) # RHEL-9
+	@echo "Bug:             RHEL-72860" >> $(METADATA) # RHEL-9
+	@echo "Bug:             RHEL-72861" >> $(METADATA) # RHEL-10
 
 	rhts-lint $(METADATA)
 

diff --git a/selinux-policy/samba-bgqd-and-similar/main.fmf b/selinux-policy/samba-bgqd-and-similar/main.fmf
index cb06aa6..ecf1d9c 100644
--- a/selinux-policy/samba-bgqd-and-similar/main.fmf
+++ b/selinux-policy/samba-bgqd-and-similar/main.fmf
@@ -19,6 +19,7 @@ recommend:
   - samba-client
   - samba-common-tools
   - cups
+  - /usr/sbin/service
 environment:
     AVC_ERROR: +no_avc_check
 duration: 15m
@@ -36,9 +37,12 @@ link:
   - verifies: https://issues.redhat.com/browse/RHEL-64908
   - verifies: https://issues.redhat.com/browse/RHEL-69512
   - verifies: https://issues.redhat.com/browse/RHEL-69517
+  - verifies: https://issues.redhat.com/browse/RHEL-72860
+  - verifies: https://issues.redhat.com/browse/RHEL-72861
 adjust:
   - enabled: false
     when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8
     continue: false
 extra-summary: /CoreOS/selinux-policy/Regression/samba-bgqd-and-similar
 extra-task: /CoreOS/selinux-policy/Regression/samba-bgqd-and-similar
+extra-nitrate: TC#0617974

diff --git a/selinux-policy/samba-bgqd-and-similar/runtest.sh b/selinux-policy/samba-bgqd-and-similar/runtest.sh
index ea4b805..476534d 100755
--- a/selinux-policy/samba-bgqd-and-similar/runtest.sh
+++ b/selinux-policy/samba-bgqd-and-similar/runtest.sh
@@ -49,6 +49,7 @@ rlJournalStart
         rlAssertRpm ${PACKAGE}
         rlAssertRpm ${PACKAGE}-targeted
         rlAssertRpm ${SERVICE_PACKAGE}
+        rlAssertRpm cups
 
         rlFileBackup /etc/shadow
         rlServiceStop ${SERVICE_NAME}
@@ -80,9 +81,16 @@ rlJournalStart
         rlSESearchRule "allow samba_bgqd_t cupsd_etc_t : dir { search } [ ]"
         rlSESearchRule "allow samba_bgqd_t cupsd_var_run_t : dir { search } [ ]"
     rlPhaseEnd
+
+    rlPhaseStartTest "RHEL-72860 + RHEL-72861"
+        rlSEMatchPathCon "/run/cups/cups.sock" "cupsd_var_run_t"
+        rlSESearchRule "allow samba_bgqd_t cupsd_var_run_t : sock_file { read write } [ ]"
+        rlSESearchRule "allow samba_bgqd_t cupsd_t : unix_stream_socket { connectto } [ ]"
+    rlPhaseEnd
     fi
 
     rlPhaseStartTest "real scenario"
+        rlRun "service cups start"
         USER_NAME="smbuser${RANDOM}"
         USER_SECRET="S3kr3T${RANDOM}"
         rlRun "useradd ${USER_NAME}"
@@ -98,6 +106,7 @@ rlJournalStart
         rlRun "systemctl stop samba-bgqd"
         rlRun "smbpasswd -x ${USER_NAME}"
         rlRun "userdel -rf ${USER_NAME}"
+        rlRun "service cups stop"
     rlPhaseEnd
 
     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 samba-bgqd can talk to cupsd via socket Milos Malik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox