public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if setroubleshootd process does not cause an AVC when trying to read /root/.rpmmacros
@ 2026-09-11 13:23 Veronika Syncakova
  0 siblings, 0 replies; only message in thread
From: Veronika Syncakova @ 2026-09-11 13:23 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : c628fff62211567648739e5e3b6dd6b5b96a9e7f
            Author : Veronika Syncakova <veva.syncakova@gmail.com>
            Date   : 2026-03-10T11:34:40+00:00
            Stats  : +101/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/c628fff62211567648739e5e3b6dd6b5b96a9e7f?branch=pr775-checkpolicy-revdeps

            Log:
            test if setroubleshootd process does not cause an AVC when trying to read /root/.rpmmacros

TC covers RHEL-142548 and RHEL-147470

If the setroubleshoot-server package is installed then the SELinux denial appears each time
the setroubleshootd process analyzes any SELinux denial, because the setroubleshootd process
executes the rpm command to find out which package owns some file.

---
diff --git a/selinux-policy/rpm-cant-read-rpmmacros/main.fmf b/selinux-policy/rpm-cant-read-rpmmacros/main.fmf
new file mode 100644
index 0000000..45e948e
--- /dev/null
+++ b/selinux-policy/rpm-cant-read-rpmmacros/main.fmf
@@ -0,0 +1,40 @@
+summary: setroubleshootd process should not cause an AVC when trying to read /root/.rpmmacros
+description: |+
+    setroubleshootd process should not cause an AVC when trying to read /root/.rpmmacros
+
+contact: Veronika Syncakova <vsyncako@redhat.com>
+component:
+  - selinux-policy
+test: ./runtest.sh
+framework: beakerlib
+require:
+  - library(selinux-policy/common)
+  - setroubleshoot-server
+recommend:
+  - audit
+  - libselinux
+  - selinux-policy
+  - selinux-policy-targeted
+environment:
+    AVC_ERROR: +no_avc_check
+check:
+  - how: avc
+    result: xfail
+duration: 10m
+enabled: true
+tag:
+  - NoRHEL4
+  - NoRHEL5
+  - NoRHEL6
+  - NoRHEL7
+  - targeted
+  - NoRHIVOS
+tier: 2
+link:
+  - verifies: https://issues.redhat.com/browse/RHEL-147470
+  - verifies: https://issues.redhat.com/browse/RHEL-142548
+adjust+:
+  - enabled: false
+    when: distro < rhel-9.9
+    continue: false
+    because: RHEL-147470 is fixed in RHEL-9.9 and RHEL-142548 in RHEL-10.3

diff --git a/selinux-policy/rpm-cant-read-rpmmacros/runtest.sh b/selinux-policy/rpm-cant-read-rpmmacros/runtest.sh
new file mode 100755
index 0000000..2f75068
--- /dev/null
+++ b/selinux-policy/rpm-cant-read-rpmmacros/runtest.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of selinux-policy/rpm-cant-read-rpmmacros
+#   Description: setroubleshootd process should not cause an AVC when trying to read /root/.rpmmacros
+#   Author: Veronika Syncakova <vsyncako@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2026 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="setroubleshoot-server"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "rlImport 'selinux-policy/common'" 0,1
+        rlAssertRpm ${PACKAGE}
+
+        rlSESetEnforce
+        rlSEStatus
+        rlSESetTimestamp
+        rlRun "rlFileBackup --clean /root/.rpmmacros"
+    rlPhaseEnd
+
+    rlPhaseStartTest "RHEL-142548 + RHEL-147470"
+        # check that sedispatch is running and therefore setroubleshoot-server is installed
+        rlRun "ps -efZ | grep sedispatch"
+        rlSESearchRule "dontaudit setroubleshootd_t admin_home_t : file { read } [ ]"
+        rlRun "touch /root/.rpmmacros"
+        # trigger selinux denial
+        rlRun "passwd --help >& /root/output.txt"
+        sleep 5
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlSECheckAVC --ignore 'type=AVC .* denied  { write } .*:passwd_t.* ' \
+                     --ignore '.*passwd.*'
+        rlRun "rlFileRestore"
+    rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
\ No newline at end of file

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

only message in thread, other threads:[~2026-09-11 13:23 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:23 [tests/selinux] pr775-checkpolicy-revdeps: test if setroubleshootd process does not cause an AVC when trying to read /root/.rpmmacros Veronika Syncakova

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