public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: semanage-port-add-delete-problems: Check for MAC_POLICY_LOAD after semanage
@ 2026-09-11 13:17 Petr Lautrbach
  0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 2026-09-11 13:17 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 9d4050e61ea31c063a37359d3bc276643d5ec06c
            Author : Petr Lautrbach <plautrba@redhat.com>
            Date   : 2019-03-13T16:33:04+01:00
            Stats  : +4/-10 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/9d4050e61ea31c063a37359d3bc276643d5ec06c?branch=pr775-checkpolicy-revdeps

            Log:
            semanage-port-add-delete-problems: Check for MAC_POLICY_LOAD after semanage

We need to check whether a new policy is loaded after 'semanage port -a ...'.
The best way to do it is to check whether kernel reported MAC_POLICY_LOAD.

The original check was error prone.

Fixes:
[   PASS   ] :: Command 'ausearch -m user_avc -ts 03/13/2019 08:10:47 > /tmp/tmp.3RAR6INhvL' (Expected 0,1, got 0)
[  BEGIN   ] :: Running 'cat /tmp/tmp.3RAR6INhvL'
----
time->Wed Mar 13 08:10:53 2019
type=USER_AVC msg=audit(1552479053.819:1407): pid=698 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  received policyload notice (seqno=65)  exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'
[   FAIL   ] :: number of lines in /tmp/tmp.3RAR6INhvL should be 0 (Assert: expected 0, got 3)

---
diff --git a/policycoreutils/semanage-port-add-delete-problems/runtest.sh b/policycoreutils/semanage-port-add-delete-problems/runtest.sh
index 2bd9c9a..ef13e5f 100755
--- a/policycoreutils/semanage-port-add-delete-problems/runtest.sh
+++ b/policycoreutils/semanage-port-add-delete-problems/runtest.sh
@@ -82,11 +82,8 @@ rlJournalStart
         rlRun "semanage port -a -p tcp -t $PORT_TYPE 5005"
         sleep 2
 
-        # Check for user_avc
-        rlRun "ausearch -m user_avc -ts ${START_DATE_TIME} > ${OUTPUT_FILE}" 0,1
-        LINE_COUNT=`wc -l < ${OUTPUT_FILE}`
-        rlRun "cat ${OUTPUT_FILE}"
-        rlAssert0 "number of lines in ${OUTPUT_FILE} should be 0" ${LINE_COUNT}
+        # Check for MAC_POLICY_LOAD
+        rlRun "ausearch -m MAC_POLICY_LOAD -ts ${START_DATE_TIME}" 0
 
         # deleting a port number from a type
         START_DATE_TIME=`date "+%m/%d/%Y %T"`
@@ -94,11 +91,8 @@ rlJournalStart
         rlRun "semanage port -d -p tcp -t $PORT_TYPE 5005"
         sleep 2
 
-        # Check for user_avc
-        rlRun "ausearch -m user_avc -ts ${START_DATE_TIME} > ${OUTPUT_FILE}" 0,1
-        LINE_COUNT=`wc -l < ${OUTPUT_FILE}`
-        rlRun "cat ${OUTPUT_FILE}"
-        rlAssert0 "number of lines in ${OUTPUT_FILE} should be 0" ${LINE_COUNT}
+        # Check for MAC_POLICY_LOAD
+        rlRun "ausearch -m MAC_POLICY_LOAD -ts ${START_DATE_TIME}" 0
     rlPhaseEnd
     fi
 

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

only message in thread, other threads:[~2026-09-11 13:17 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:17 [tests/selinux] pr775-checkpolicy-revdeps: semanage-port-add-delete-problems: Check for MAC_POLICY_LOAD after semanage Petr Lautrbach

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