public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Milos Malik <mmalik@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: test if blueman-mechanism can read ~/.local/lib/python*/site-packages/
Date: Fri, 11 Sep 2026 13:20:13 GMT	[thread overview]
Message-ID: <178913281311.1.8459382034058499164.tests-selinux-7eff6e0a4759@fedoraproject.org> (raw)

            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

                 reply	other threads:[~2026-09-11 13:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178913281311.1.8459382034058499164.tests-selinux-7eff6e0a4759@fedoraproject.org \
    --to=mmalik@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox