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: add new test which covers various ABRT services
Date: Fri, 11 Sep 2026 13:21:34 GMT	[thread overview]
Message-ID: <178913289462.1.2387503129607934066.tests-selinux-f10ccbe5cbe9@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : f10ccbe5cbe97dc66835ee213abf554491428333
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2024-04-16T12:58:37+00:00
            Stats  : +204/-0 in 4 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/f10ccbe5cbe97dc66835ee213abf554491428333?branch=pr775-checkpolicy-revdeps

            Log:
            add new test which covers various ABRT services

A lot of recently filed BZs revealed and confirmed that SELinux
prevents the abrt-dump-journal-core processes from:
 * writing to /run/systemd/userdb/io.systemd.* sockets
 * connecting to various UNIX streams owned by systemd* processes

The TC reproduces the situation.

In order to support the expected ABRT functions, I believe that
SELinux policy should allow above-mentioned actions. The TC looks
for appropriate SELinux policy rules and file context patterns.

The TC covers BZ#2274709 and other duplicates.

---
diff --git a/selinux-policy/abrt-services/Makefile b/selinux-policy/abrt-services/Makefile
new file mode 100644
index 0000000..1984edd
--- /dev/null
+++ b/selinux-policy/abrt-services/Makefile
@@ -0,0 +1,69 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Makefile of /CoreOS/selinux-policy/Regression/abrt-services
+#   Description: SELinux interferes with various ABRT services
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2024 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/selinux-policy/Regression/abrt-services
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile PURPOSE
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+	./runtest.sh
+
+build: $(BUILT_FILES)
+	chmod a+x runtest.sh
+	chcon -t bin_t runtest.sh
+
+clean:
+	rm -f *~ $(BUILT_FILES)
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+	@echo "Owner:           Milos Malik <mmalik@redhat.com>" > $(METADATA)
+	@echo "Name:            $(TEST)" >> $(METADATA)
+	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
+	@echo "Path:            $(TEST_DIR)" >> $(METADATA)
+	@echo "Description:     SELinux interferes with various ABRT services" >> $(METADATA)
+	@echo "Type:            Regression" >> $(METADATA)
+	@echo "TestTime:        10m" >> $(METADATA)
+	@echo "RunFor:          selinux-policy" >> $(METADATA)
+	@echo "RunFor:          abrt" >> $(METADATA)
+	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console psmisc abrt abrt-addon-ccpp abrt-addon-coredump-helper abrt-addon-kerneloops abrt-addon-pstoreoops abrt-addon-upload-watch abrt-addon-vmcore abrt-addon-xorg /usr/sbin/service" >> $(METADATA)
+	@echo "RhtsRequires:    library(selinux-policy/common)" >> $(METADATA)
+	@echo "Priority:        Normal" >> $(METADATA)
+	@echo "License:         GPLv2" >> $(METADATA)
+	@echo "Confidential:    no" >> $(METADATA)
+	@echo "Destructive:     no" >> $(METADATA)
+	@echo "Environment:     AVC_ERROR=+no_avc_check" >> $(METADATA)
+	@echo "Releases:        -RHEL4 -RHEL5 -RHEL6 -RHEL9" >> $(METADATA)
+	@echo "Bug:             2274709" >> $(METADATA) # Fedora 40
+
+	rhts-lint $(METADATA)
+

diff --git a/selinux-policy/abrt-services/PURPOSE b/selinux-policy/abrt-services/PURPOSE
new file mode 100644
index 0000000..0416559
--- /dev/null
+++ b/selinux-policy/abrt-services/PURPOSE
@@ -0,0 +1,5 @@
+PURPOSE of /CoreOS/selinux-policy/Regression/abrt-services
+Author: Milos Malik <mmalik@redhat.com>
+
+SELinux interferes with various ABRT services.
+

diff --git a/selinux-policy/abrt-services/main.fmf b/selinux-policy/abrt-services/main.fmf
new file mode 100644
index 0000000..864e175
--- /dev/null
+++ b/selinux-policy/abrt-services/main.fmf
@@ -0,0 +1,51 @@
+summary: SELinux interferes with various ABRT services
+description: |+
+    SELinux interferes with various ABRT services
+
+contact: Milos Malik <mmalik@redhat.com>
+component:
+  - abrt
+  - selinux-policy
+require:
+  - library(selinux-policy/common)
+recommend:
+  - audit
+  - libselinux
+  - libselinux-utils
+  - policycoreutils
+  - selinux-policy
+  - selinux-policy-targeted
+  - setools-console
+  - psmisc
+  - abrt
+  - abrt-addon-ccpp
+  - abrt-addon-coredump-helper
+  - abrt-addon-kerneloops
+  - abrt-addon-pstoreoops
+  - abrt-addon-upload-watch
+  - abrt-addon-vmcore
+  - abrt-addon-xorg
+  - /usr/sbin/service
+environment:
+    AVC_ERROR: +no_avc_check
+duration: 10m
+enabled: true
+tag:
+  - NoRHEL4
+  - NoRHEL5
+  - NoRHEL6
+  - NoRHEL9
+  - targeted
+link:
+  - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2274709
+adjust:
+  - enabled: false
+    when: distro >= rhel-9
+    because: the abrt* packages are not available there
+  - enabled: false
+    when: distro >= centos-stream-9
+    because: the abrt* packages are not available there
+extra-summary: /CoreOS/selinux-policy/Regression/abrt-services
+extra-task: /CoreOS/selinux-policy/Regression/abrt-services
+extra-nitrate: TC#0617419
+id: ca742967-9ac5-4f16-be93-d95eb7932224

diff --git a/selinux-policy/abrt-services/runtest.sh b/selinux-policy/abrt-services/runtest.sh
new file mode 100755
index 0000000..220c1c6
--- /dev/null
+++ b/selinux-policy/abrt-services/runtest.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/selinux-policy/Regression/abrt-services
+#   Description: SELinux interferes with various ABRT services
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2024 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="selinux-policy"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "rlImport 'selinux-policy/common'" 0,1
+        rlSESatisfyRequires
+        rlAssertRpm ${PACKAGE}
+        rlAssertRpm ${PACKAGE}-targeted
+        rlRun "rpm -qa | grep abrt | sort"
+
+        rlSESetEnforce
+        rlSEStatus
+        rlSESetTimestamp
+        sleep 2
+    rlPhaseEnd
+
+    if rlIsFedora ; then
+    rlPhaseStartTest "bz#2274709"
+        rlSEMatchPathCon "/usr/bin/abrt-dump-journal-core" "abrt_dump_oops_exec_t"
+        rlSEMatchPathCon "/run/systemd/userdb/io.systemd.DynamicUser" "systemd_userdbd_runtime_t"
+        rlSEMatchPathCon "/run/systemd/userdb/io.systemd.DropIn" "systemd_userdbd_runtime_t"
+        rlSEMatchPathCon "/run/systemd/userdb/io.systemd.Home" "systemd_userdbd_runtime_t"
+        rlSESearchRule "allow abrt_dump_oops_t systemd_userdbd_runtime_t : sock_file { write } [ ]"
+        rlSESearchRule "allow abrt_dump_oops_t systemd_userdbd_t : unix_stream_socket { connectto } [ ]"
+        rlSESearchRule "allow abrt_dump_oops_t init_t : unix_stream_socket { connectto } [ ]"
+    rlPhaseEnd
+    fi
+
+    rlPhaseStartTest "real scenario -- bz#2274709"
+        for SERVICE_NAME in abrtd abrt-journal-core abrt-oops abrt-pstoreoops abrt-upload-watch abrt-vmcore abrt-xorg ; do
+            rlRun "service ${SERVICE_NAME} start"
+        done
+        sleep 60 &
+        sleep 10
+        rlRun "killall --signal SIGABRT sleep"
+        rlRun "restorecon -Rv /var /run -e /var/ARTIFACTS" 0-255
+        for SERVICE_NAME in abrtd abrt-journal-core abrt-oops abrt-pstoreoops abrt-upload-watch abrt-vmcore abrt-xorg ; do
+            rlRun "service ${SERVICE_NAME} stop"
+        done
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        sleep 2
+        rlSECheckAVC
+    rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
+

                 reply	other threads:[~2026-09-11 13:21 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=178913289462.1.2387503129607934066.tests-selinux-f10ccbe5cbe9@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