public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if semanage can import port definitions correctly
@ 2026-09-11 13:20 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:20 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 09061d27391c6f1e445b19d903ceb2f99aff0137
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2022-07-27T10:12:11+02:00
            Stats  : +41/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/09061d27391c6f1e445b19d903ceb2f99aff0137?branch=pr775-checkpolicy-revdeps

            Log:
            test if semanage can import port definitions correctly

Recent testing revealed that `semanage import` cannot import
SELinux port definitions correctly if `port -D` is present
among them. The TC reproduces the situation.

The TC covers BZ#2063353 and BZ#2108174.

---
diff --git a/policycoreutils/semanage-imports-port-defs/main.fmf b/policycoreutils/semanage-imports-port-defs/main.fmf
new file mode 100644
index 0000000..b06c827
--- /dev/null
+++ b/policycoreutils/semanage-imports-port-defs/main.fmf
@@ -0,0 +1,19 @@
+summary: Can semanage import SELinux port definitions correctly?
+test: ./test.sh
+contact: Milos Malik <mmalik@redhat.com>
+framework: beakerlib
+component:
+  - policycoreutils
+recommend:
+  - policycoreutils
+  - /usr/sbin/semanage
+duration: 10m
+enabled: true
+tier: 1
+link:
+  - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2063353
+  - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2108174
+adjust:
+  - enabled: false
+    when: distro == rhel-4, rhel-5, rhel-6
+    because: the test is not relevant there

diff --git a/policycoreutils/semanage-imports-port-defs/test.sh b/policycoreutils/semanage-imports-port-defs/test.sh
new file mode 100755
index 0000000..29a0ae3
--- /dev/null
+++ b/policycoreutils/semanage-imports-port-defs/test.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlAssertRpm policycoreutils
+        rlRun "rpm -qf /usr/sbin/semanage"
+        rlRun "semanage port -a -t http_cache_port_t -r s0 -p tcp 3024"
+    rlPhaseEnd
+
+    rlPhaseStartTest "bz#2063353 + bz#2108174"
+        rlRun "semanage port -E"
+        rlRun "echo -e 'port -D\nport -a -t http_cache_port_t -r s0 -p tcp 3024'  | semanage import"
+        rlRun "semanage port -E"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "semanage port -d -t http_cache_port_t -r s0 -p tcp 3024"
+    rlPhaseEnd
+rlJournalEnd
+

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

only message in thread, other threads:[~2026-09-11 13:20 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:20 [tests/selinux] pr775-checkpolicy-revdeps: test if semanage can import port definitions correctly Milos Malik

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