]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add a custom SELinux file context 18478/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 5 Feb 2021 15:59:38 +0000 (16:59 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 5 Feb 2021 16:08:58 +0000 (17:08 +0100)
Since the test suite overhaul, the test units are now under
/usr/lib/systemd/tests/testdata/tetsuite-06.units with
system_u:object_r:lib_t context. This causes an AVC denial, since the
systemd unit files are expected to have the
system_u:object_r:systemd_unit_file_t context. Let's fix this by using a
custom file context definition.

test/TEST-06-SELINUX/systemd_test.fc [new file with mode: 0644]
test/TEST-06-SELINUX/test.sh

diff --git a/test/TEST-06-SELINUX/systemd_test.fc b/test/TEST-06-SELINUX/systemd_test.fc
new file mode 100644 (file)
index 0000000..249c679
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/systemd/tests/testdata/testsuite-06\.units(/.*)?   system_u:object_r:systemd_unit_file_t:s0
index 37528a1a26ca11fb01bad7ced796c0f836407ec9..f05cd355938bfa1ba9ab5af05e55daa6d6d87a48 100755 (executable)
@@ -37,6 +37,7 @@ test_append_files() {
         mkdir $1/systemd-test-module
         cp systemd_test.te $1/systemd-test-module
         cp systemd_test.if $1/systemd-test-module
+        cp systemd_test.fc $1/systemd-test-module
         dracut_install -o sesearch
         dracut_install runcon
         dracut_install checkmodule semodule semodule_package m4 make load_policy sefcontext_compile