public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Veronika Syncakova <veva.syncakova@gmail.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: test if setroubleshootd process does not cause an AVC when trying to read /root/.rpmmacros
Date: Fri, 11 Sep 2026 13:23:36 GMT	[thread overview]
Message-ID: <178913301669.1.6751896006718205214.tests-selinux-c628fff62211@fedoraproject.org> (raw)

            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

                 reply	other threads:[~2026-09-11 13:23 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=178913301669.1.6751896006718205214.tests-selinux-c628fff62211@fedoraproject.org \
    --to=veva.syncakova@gmail.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