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 root user can run rpmdb successfully
Date: Fri, 11 Sep 2026 13:18:28 GMT	[thread overview]
Message-ID: <178913270800.1.11471287490284583664.tests-selinux-72f35b9876cc@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 72f35b9876ccc405e72952581c3548723b63a431
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2020-11-25T08:37:47+00:00
            Stats  : +16/-0 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/72f35b9876ccc405e72952581c3548723b63a431?branch=pr775-checkpolicy-revdeps

            Log:
            test if root user can run rpmdb successfully

Based on SELinux policy rules, the root/unconfined_t user is expected
to run the rpmdb program. A new test phase tests if such a scenario
works successfully or not. Of course, the rpmdb program recognizes
a lot of options, only the basic ones will be tested here.

---
diff --git a/selinux-policy/rpmdb-and-similar/runtest.sh b/selinux-policy/rpmdb-and-similar/runtest.sh
index 50f1b3e..a40bd81 100755
--- a/selinux-policy/rpmdb-and-similar/runtest.sh
+++ b/selinux-policy/rpmdb-and-similar/runtest.sh
@@ -38,6 +38,8 @@ PROCESS_NAME="rpmdb"
 PROCESS_CONTEXT="rpmdb_t"
 
 rlJournalStart
+    rlLog "If this test fails, please contact mmalik or IRC #selinux"
+    rlLog "This test should fail if tested bugs are NOT fixed yet"
     rlPhaseStartSetup
         rlRun "rlImport 'selinux-policy/common'"
         rlSESatisfyRequires
@@ -68,6 +70,20 @@ rlJournalStart
         rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} - ${PROCESS_CONTEXT} "restart status stop status" 1
     rlPhaseEnd
 
+    rlPhaseStartTest "rpmdb executed by root/unconfined_t"
+        rlRun "restorecon -Rv /var/lib/rpm"
+        rlRun "rpmdb --help"
+        OUTPUT_FILE=`mktemp`
+        rlRun "rpmdb --exportdb >& ${OUTPUT_FILE}"
+        rlRun "ls -l ${OUTPUT_FILE}"
+        rlRun "ls -dZ /var/lib/rpm | grep :rpm_var_lib_t"
+        rlRun "ls -Z /var/lib/rpm"
+        rlRun "cat ${OUTPUT_FILE} | rpmdb --importdb"
+        rlRun "ls -dZ /var/lib/rpm | grep :rpm_var_lib_t"
+        rlRun "ls -Z /var/lib/rpm"
+        rm -f ${OUTPUT_FILE}
+    rlPhaseEnd
+
     rlPhaseStartCleanup
         sleep 2
         rlSECheckAVC

                 reply	other threads:[~2026-09-11 13:18 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=178913270800.1.11471287490284583664.tests-selinux-72f35b9876cc@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