public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if blueman-mechanism can read ~/.local/lib/python*/site-packages/
@ 2026-09-11 13:20 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:20 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 7eff6e0a4759874c161623e43bddbbd4b1f88b11
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2022-09-23T12:38:51+02:00
            Stats  : +12/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/7eff6e0a4759874c161623e43bddbbd4b1f88b11?branch=pr775-checkpolicy-revdeps

            Log:
            test if blueman-mechanism can read ~/.local/lib/python*/site-packages/

The use of blueman-mechanism service revealed that SELinux prevents
the blueman-mechanism process from reading the content of
/root/.local/lib/python3.10/site-packages/ directory. The TC reproduces
the situation.

Because the blueman-mechanism program is written in Python, it makes
sense to look for locally installed Python modules. In order to
support the basic Python principles, I believe that SELinux policy
should allow this access. The TC looks for appropriate policy rules
and file context patterns.

The TC covers BZ#2027044.

---
diff --git a/selinux-policy/blueman-and-similar/Makefile b/selinux-policy/blueman-and-similar/Makefile
index 79f0160..5b1d70a 100644
--- a/selinux-policy/blueman-and-similar/Makefile
+++ b/selinux-policy/blueman-and-similar/Makefile
@@ -62,6 +62,7 @@ $(METADATA): Makefile
 	@echo "Destructive:     no" >> $(METADATA)
 	@echo "Releases:        -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7" >> $(METADATA)
 	@echo "Bug:             1470501" >> $(METADATA) # Fedora
+	@echo "Bug:             2027044" >> $(METADATA) # Fedora 35
 
 	rhts-lint $(METADATA)
 

diff --git a/selinux-policy/blueman-and-similar/main.fmf b/selinux-policy/blueman-and-similar/main.fmf
index d405840..ced85dd 100644
--- a/selinux-policy/blueman-and-similar/main.fmf
+++ b/selinux-policy/blueman-and-similar/main.fmf
@@ -32,6 +32,7 @@ tag:
   - targeted
 link:
   - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1470501
+  - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2027044
 adjust:
   - enabled: false
     when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-alt-7, rhel-8, rhel-9

diff --git a/selinux-policy/blueman-and-similar/runtest.sh b/selinux-policy/blueman-and-similar/runtest.sh
index 5ef0cac..f10bf19 100755
--- a/selinux-policy/blueman-and-similar/runtest.sh
+++ b/selinux-policy/blueman-and-similar/runtest.sh
@@ -83,13 +83,22 @@ rlJournalStart
     rlPhaseEnd
     fi
 
+    rlPhaseStartTest "bz#2027044"
+        rlSEMatchPathCon "/usr/libexec/blueman-mechanism" "blueman_exec_t"
+        rlSEMatchPathCon "/root/.local/lib/python3.10/site-packages" "gconf_home_t"
+        rlSESearchRule "allow blueman_t gconf_home_t : dir { read } [ ]"
+    rlPhaseEnd
+
     rlPhaseStartTest "real scenario -- standalone service"
         rlRun "echo ${ROOT_PASSWORD} | passwd --stdin root"
         if ! rlSEDefined ${PROCESS_CONTEXT} ; then
             # for RHELs where the SELinux domain does not exist yet
             PROCESS_CONTEXT="initrc_t"
         fi
-        rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status restart status stop status" 1
+        rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status" 1
+        PYTHON_VERSION=`python --version | tr -d ' ' | cut -d . -f 1,2 | tr '[:upper:]' '[:lower:]'`
+        rlRun "mkdir -p ~/.local/lib/${PYTHON_VERSION}/site-packages/"
+        rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "restart status stop status" 1
     rlPhaseEnd
 
     rlPhaseStartCleanup

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

only message in thread, other threads:[~2026-09-11 13:20 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:20 [tests/selinux] pr775-checkpolicy-revdeps: test if blueman-mechanism can read ~/.local/lib/python*/site-packages/ Milos Malik

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