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: unset the default context for /var/ARTIFACTS
Date: Fri, 11 Sep 2026 13:19:54 GMT	[thread overview]
Message-ID: <178913279404.1.7295027146723406220.tests-selinux-58ae65cd1e79@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 58ae65cd1e7916c33ef061d73abca1636a61d7bc
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2022-04-26T13:18:49+00:00
            Stats  : +7/-0 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/58ae65cd1e7916c33ef061d73abca1636a61d7bc?branch=pr775-checkpolicy-revdeps

            Log:
            unset the default context for /var/ARTIFACTS

Many automated tests run the "restorecon -Rv /run /var" command
to ensure that file-system objects stored in these locations are
labeled correctly. Unfortunately, the command affects SELinux
contexts of files/directories stored under /var/ARTIFACTS/. For
example: the rlFileBackup function uses this location as well.
To avoid such unpleasant effects, the default SELinux context for
/var/ARTIFACTS directory is now set to /proc equivalent (meaning:
no default context).

---
diff --git a/selinux-policy/Library/common/lib.sh b/selinux-policy/Library/common/lib.sh
index 149e1a2..22a7b31 100644
--- a/selinux-policy/Library/common/lib.sh
+++ b/selinux-policy/Library/common/lib.sh
@@ -1995,6 +1995,13 @@ rlSELibraryLoaded() {
     else
         rlRun "dnf -y --skip-broken install $rlSE_REQUIRES"
     fi
+
+    # make sure that restorecon does not change SELinux contexts under /var/ARTIFACTS
+    # otherwise SELinux context of backed up files/directories will be affected
+    if matchpathcon /var/ARTIFACTS/something | grep -q :var_t: ; then
+        semanage fcontext -a -e /proc /var/ARTIFACTS
+    fi
+
     if rlCheckRequirements $rlSE_REQUIRES; then
         SETOOLS_MAJOR_VERSION=`sesearch --version 2>&1| sed -n 's/sesearch //;s/\..*$//p'`
         rlLogDebug "FUNCNAME(): sesearch --version: $(sesearch --version 2>&1)"

                 reply	other threads:[~2026-09-11 13:19 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=178913279404.1.7295027146723406220.tests-selinux-58ae65cd1e79@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