public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if smtpd can manipulate the /run/smtpd.pid file
@ 2026-09-11 13:21 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:21 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : ea51c052195a1702b1b2013a0c77a3c6efc40e2a
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2023-12-05T13:19:25+00:00
            Stats  : +9/-2 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/ea51c052195a1702b1b2013a0c77a3c6efc40e2a?branch=pr775-checkpolicy-revdeps

            Log:
            test if smtpd can manipulate the /run/smtpd.pid file

A recent opensmtpd testing revealed that SELinux prevents the smtpd
process from creating and manipulating the /run/smtpd.pid file. The
TC reproduces the situation.

In order to successfully start and run the opensmtpd service, I believe
that SELinux policy should allow these actions. The TC looks for
appropriate policy rules.

The TC covers RHEL-15175.

---
diff --git a/selinux-policy/opensmtpd-and-similar/Makefile b/selinux-policy/opensmtpd-and-similar/Makefile
index a59edb8..a053a8f 100644
--- a/selinux-policy/opensmtpd-and-similar/Makefile
+++ b/selinux-policy/opensmtpd-and-similar/Makefile
@@ -54,7 +54,7 @@ $(METADATA): Makefile
 	@echo "Type:            Regression" >> $(METADATA)
 	@echo "TestTime:        10m" >> $(METADATA)
 	@echo "RunFor:          selinux-policy" >> $(METADATA)
-	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console opensmtpd /usr/sbin/service mailx" >> $(METADATA)
+	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console opensmtpd /usr/sbin/service /usr/bin/mailx" >> $(METADATA)
 	@echo "RhtsRequires:    library(selinux-policy/common)" >> $(METADATA)
 	@echo "Environment:     AVC_ERROR=+no_avc_check" >> $(METADATA)
 	@echo "Priority:        Normal" >> $(METADATA)
@@ -64,6 +64,7 @@ $(METADATA): Makefile
 	@echo "Releases:        -RHEL4 -RHEL5 -RHEL6 -RHEL7 -RHEL8" >> $(METADATA)
 	@echo "Bug:             2208696" >> $(METADATA) # Fedora 38
 	@echo "Bug:             2246115" >> $(METADATA) # Fedora rawhide
+	@echo "Bug:             RHEL-15175" >> $(METADATA) # RHEL-9
 
 	rhts-lint $(METADATA)
 

diff --git a/selinux-policy/opensmtpd-and-similar/main.fmf b/selinux-policy/opensmtpd-and-similar/main.fmf
index b014b17..1e8c31e 100644
--- a/selinux-policy/opensmtpd-and-similar/main.fmf
+++ b/selinux-policy/opensmtpd-and-similar/main.fmf
@@ -17,7 +17,7 @@ recommend:
   - setools-console
   - opensmtpd
   - /usr/sbin/service
-  - mailx
+  - /usr/bin/mailx
 environment:
     AVC_ERROR: +no_avc_check
 duration: 10m
@@ -31,6 +31,7 @@ tag:
 link:
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2208696
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2246115
+  - verifies: https://issues.redhat.com/browse/RHEL-15175
 adjust:
   - enabled: false
     when: distro == rhel-4, rhel-5, rhel-6, rhel-7

diff --git a/selinux-policy/opensmtpd-and-similar/runtest.sh b/selinux-policy/opensmtpd-and-similar/runtest.sh
index bb1b4d6..ea750ad 100755
--- a/selinux-policy/opensmtpd-and-similar/runtest.sh
+++ b/selinux-policy/opensmtpd-and-similar/runtest.sh
@@ -67,6 +67,11 @@ rlJournalStart
         rlSEMatchPathCon "/run/smtpd.sock" "sendmail_var_run_t"
         rlSESearchRule "allow sendmail_t sendmail_t : unix_stream_socket { connectto } [ ]"
     rlPhaseEnd
+
+    rlPhaseStartTest "RHEL-15175"
+        # actions on the /var/run/smtpd.pid file
+        rlSESearchRule "allow sendmail_t sendmail_var_run_t : file { create getattr open unlink write } [ ]"
+    rlPhaseEnd
     fi
 
     rlPhaseStartTest "real scenario -- standalone service"

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 13:21 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:21 [tests/selinux] pr775-checkpolicy-revdeps: test if smtpd can manipulate the /run/smtpd.pid file Milos Malik

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