public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: Test semanage operation with /var/lib/selinux on NFS
@ 2026-09-11 13:22 Petr Lautrbach
  0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 2026-09-11 13:22 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 68d3f4d812f68981a7ce332fa75b84e7ff4ae914
            Author : Petr Lautrbach <lautrbach@redhat.com>
            Date   : 2024-11-11T13:42:47+01:00
            Stats  : +55/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/68d3f4d812f68981a7ce332fa75b84e7ff4ae914?branch=pr775-checkpolicy-revdeps

            Log:
            Test semanage operation with /var/lib/selinux on NFS

Verifies: RHEL-60503

---
diff --git a/libsemanage/semanage-root-on-nfs/main.fmf b/libsemanage/semanage-root-on-nfs/main.fmf
new file mode 100644
index 0000000..20e219d
--- /dev/null
+++ b/libsemanage/semanage-root-on-nfs/main.fmf
@@ -0,0 +1,11 @@
+summary: Test semanage operation with /var/lib/selinux on NFS
+test: ./test.sh
+framework: beakerlib
+component: libsemanage
+requires:
+  - nfs-utils
+  - policycoreutils-python-utils
+duration: 10m
+enabled: true
+link:
+  - verifies: https://issues.redhat.com/browse/RHEL-60503

diff --git a/libsemanage/semanage-root-on-nfs/test.sh b/libsemanage/semanage-root-on-nfs/test.sh
new file mode 100755
index 0000000..d7c944a
--- /dev/null
+++ b/libsemanage/semanage-root-on-nfs/test.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+STORE_ROOT=$( grep -E '^store-root' /etc/selinux/semanage.conf | tr -d ' ' | cut -d '=' -f 2 )
+if [ -z "$STORE_ROOT" ]; then
+    STORE_ROOT=/var/lib/selinux
+fi
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+        rlRun "pushd $tmp"
+        rlRun "set -o pipefail"
+        rlAssertRpm nfs-utils
+        rlAssertRpm policycoreutils-python-utils
+        rlRun "mkdir -p /srv/nfs/selinux"
+        rlRun "cp -r $STORE_ROOT /srv/selinux"
+        rlRun "mount --bind /srv/selinux /srv/nfs/selinux"
+        rlRun "sed -i 's%.*rootdir.*=.*%rootdir=/srv/nfs%' /etc/nfs.conf"
+        rlRun "systemctl enable nfs-server --now"
+        rlRun "cat > /etc/exports <<EOF
+/selinux *(rw,sync,no_root_squash)
+EOF"
+        rlRun "exportfs -a"
+        rlRun "showmount -e 127.0.0.1"
+        rlRun "mount 127.0.0.1:/selinux $STORE_ROOT"
+    rlPhaseEnd
+
+    rlPhaseStartTest "semanage root on nfs"
+        rlRun "semanage fcontext -a -e /home /tmp/testdir"
+        rlRun "semanage fcontext -d -e /home /tmp/testdir"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "umount $STORE_ROOT"
+        rlRun "systemctl disable nfs-server --now"
+        rlRun "umount /srv/nfs/selinux"
+        rlRun "rm -rf /srv"
+        rlRun "popd"
+        rlRun "rm -r $tmp" 0 "Remove tmp directory"
+    rlPhaseEnd
+rlJournalEnd

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

only message in thread, other threads:[~2026-09-11 13:22 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:22 [tests/selinux] pr775-checkpolicy-revdeps: Test semanage operation with /var/lib/selinux on NFS Petr Lautrbach

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