public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if systemd-run can run interactive shell
@ 2026-09-11 13:19 Milos Malik
0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:19 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 9ff6e590c0ac5c8c560d17b1b56be3e9390f2bcb
Author : Milos Malik <mmalik@redhat.com>
Date : 2022-05-17T09:11:33+02:00
Stats : +188/-0 in 4 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/9ff6e590c0ac5c8c560d17b1b56be3e9390f2bcb?branch=pr775-checkpolicy-revdeps
Log:
test if systemd-run can run interactive shell
New automated test which covers basic functions of the systemd-run program.
Based on bugs filed in the past, SELinux interferes with systemd-run
often, which indicates that such an automated test is definitely needed.
The TC covers BZ#1647162 and BZ#1980241.
---
diff --git a/selinux-policy/systemd-run-and-similar/Makefile b/selinux-policy/systemd-run-and-similar/Makefile
new file mode 100644
index 0000000..db39990
--- /dev/null
+++ b/selinux-policy/systemd-run-and-similar/Makefile
@@ -0,0 +1,68 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Makefile of /CoreOS/selinux-policy/Regression/systemd-run-and-similar
+# Description: SELinux interferes with systemd-run and related programs
+# Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2022 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 2 of
+# the License, or (at your option) any later version.
+#
+# 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, see http://www.gnu.org/licenses/.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/selinux-policy/Regression/systemd-run-and-similar
+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)
+ test -x runtest.sh || chmod a+x 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 systemd-run and related programs" >> $(METADATA)
+ @echo "Type: Regression" >> $(METADATA)
+ @echo "TestTime: 10m" >> $(METADATA)
+ @echo "RunFor: selinux-policy" >> $(METADATA)
+ @echo "Requires: audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console systemd" >> $(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 -RHEL7" >> $(METADATA)
+ @echo "Bug: 1559409" >> $(METADATA) # Fedora 27
+ @echo "Bug: 1647162" >> $(METADATA) # Fedora 29
+ @echo "Bug: 1980241" >> $(METADATA) # Fedora 34
+
+ rhts-lint $(METADATA)
+
diff --git a/selinux-policy/systemd-run-and-similar/PURPOSE b/selinux-policy/systemd-run-and-similar/PURPOSE
new file mode 100644
index 0000000..8aee928
--- /dev/null
+++ b/selinux-policy/systemd-run-and-similar/PURPOSE
@@ -0,0 +1,5 @@
+PURPOSE of /CoreOS/selinux-policy/Regression/systemd-run-and-similar
+Author: Milos Malik <mmalik@redhat.com>
+
+SELinux interferes with systemd-run and related programs
+
diff --git a/selinux-policy/systemd-run-and-similar/main.fmf b/selinux-policy/systemd-run-and-similar/main.fmf
new file mode 100644
index 0000000..30fce17
--- /dev/null
+++ b/selinux-policy/systemd-run-and-similar/main.fmf
@@ -0,0 +1,44 @@
+summary: SELinux interferes with systemd-run and related programs
+description: |+
+ SELinux interferes with systemd-run and related programs.
+
+contact: Milos Malik <mmalik@redhat.com>
+component:
+ - selinux-policy
+test: ./runtest.sh
+framework: beakerlib
+require:
+ - library(selinux-policy/common)
+recommend:
+ - audit
+ - libselinux
+ - libselinux-utils
+ - policycoreutils
+ - selinux-policy
+ - selinux-policy-targeted
+ - setools-console
+ - systemd
+environment:
+ AVC_ERROR: +no_avc_check
+duration: 10m
+enabled: true
+tag:
+ - NoRHEL4
+ - NoRHEL5
+ - NoRHEL6
+ - NoRHEL7
+ - Tier2
+ - Tier2se
+ - targeted
+tier: '2'
+link:
+ - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1559409
+ - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1647162
+ - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1980241
+adjust:
+ - enabled: false
+ when: distro == rhel-4, rhel-5, rhel-6, rhel-7
+ continue: false
+extra-summary: /CoreOS/selinux-policy/Regression/systemd-run-and-similar
+extra-task: /CoreOS/selinux-policy/Regression/systemd-run-and-similar
+extra-nitrate: TC#0613618
diff --git a/selinux-policy/systemd-run-and-similar/runtest.sh b/selinux-policy/systemd-run-and-similar/runtest.sh
new file mode 100755
index 0000000..b594138
--- /dev/null
+++ b/selinux-policy/systemd-run-and-similar/runtest.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# runtest.sh of /CoreOS/selinux-policy/Regression/systemd-run-and-similar
+# Description: SELinux interferes with systemd-run and related programs
+# Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2022 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 2 of
+# the License, or (at your option) any later version.
+#
+# 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, see http://www.gnu.org/licenses/.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="selinux-policy"
+
+rlJournalStart
+ rlPhaseStartSetup
+ rlRun "rlImport 'selinux-policy/common'"
+ rlSESatisfyRequires
+ rlAssertRpm ${PACKAGE}
+ rlAssertRpm ${PACKAGE}-targeted
+ rlAssertRpm systemd
+
+ rlSESetEnforce
+ rlSEStatus
+ rlSESetTimestamp
+ sleep 2
+ rlPhaseEnd
+
+ rlPhaseStartTest "bz#1559409 + bz#1647162"
+ rlSEMatchPathCon "/usr/bin/systemd-run" "bin_t"
+ rlSESearchRule "allow init_t user_devpts_t : chr_file { setattr open } [ ]"
+ rlPhaseEnd
+
+ rlPhaseStartTest "bz#1980241"
+ rlSESearchRule "allow init_t user_devpts_t : chr_file { watch watch_reads } [ ]"
+ rlPhaseEnd
+
+ rlPhaseStartTest "real scenario"
+ rlWatchdog "systemd-run -p IPAddressDeny=127.0.0.1 -t /bin/sh" 10
+ rlWatchdog "systemd-run --user --pty bash -i" 10
+ rlWatchdog "systemd-run --system --pty bash -i" 10
+ if systemd-run --help | grep -q -- --shell ; then
+ rlWatchdog "systemd-run --shell" 10
+ fi
+ rlPhaseEnd
+
+ rlPhaseStartCleanup
+ sleep 2
+ rlSECheckAVC
+ rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
+
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 13:19 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:19 [tests/selinux] pr775-checkpolicy-revdeps: test if systemd-run can run interactive shell Milos Malik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox