1
0
mirror of https://github.com/systemd/systemd.git synced 2025-09-17 21:45:23 +03:00

test: switch SELinux to permissive in the config file

The config file has (unfortunately) precedence over the kernel command
line, so let's tweak the config file if necessary.
This commit is contained in:
Frantisek Sumsal
2023-11-14 10:52:24 +01:00
parent 8c5f6494bc
commit bbe865b2fe
2 changed files with 4 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ test -f /usr/share/selinux/devel/include/system/systemd.if && find /etc/selinux
. "${TEST_BASE_DIR:?}/test-functions"
SETUP_SELINUX=yes
KERNEL_APPEND="${KERNEL_APPEND:=} selinux=1 security=selinux"
KERNEL_APPEND="${KERNEL_APPEND:=} selinux=1 security=selinux enforcing=0"
test_append_files() {
local workspace="${1:?}"
@@ -53,6 +53,9 @@ test_append_files() {
image_install -o /usr/libexec/selinux/hll/pp # Fedora/RHEL/...
image_install -o /usr/lib/selinux/hll/pp # Debian/Ubuntu/...
# Config file has (unfortunately) always precedence, so let's switch it there as well
sed -i '/^SELINUX=disabled$/s/disabled/permissive/' "$workspace/etc/selinux/config"
if ! chroot "$workspace" make -C /systemd-test-module -f /usr/share/selinux/devel/Makefile clean load systemd_test.pp QUIET=n; then
dfatal "Failed to build the systemd test module"
exit 1

View File

@@ -3,12 +3,6 @@
set -eux
set -o pipefail
echo 1 >/sys/fs/selinux/enforce || {
echo "Can't make selinux enforcing, skipping test"
touch /testok
exit
}
runcon -t systemd_test_start_t systemctl start hola
runcon -t systemd_test_reload_t systemctl reload hola
runcon -t systemd_test_stop_t systemctl stop hola