]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tests: Add capability tests for ProtectKernelLogs
authorKevin Kuehler <keur@xcf.berkeley.edu>
Tue, 5 Nov 2019 01:20:47 +0000 (17:20 -0800)
committerKevin Kuehler <keur@xcf.berkeley.edu>
Mon, 11 Nov 2019 20:12:02 +0000 (12:12 -0800)
test/meson.build
test/test-execute/exec-protectkernellogs-no-capabilities.service [new file with mode: 0644]
test/test-execute/exec-protectkernellogs-yes-capabilities.service [new file with mode: 0644]

index 24ab4d1deef400c7b066e7b3d5d5e120d9e5b7cc..eeb3c5f8f0bc45028af3ddce27b1de31e723c84c 100644 (file)
@@ -109,6 +109,8 @@ test_data_files = '''
         test-execute/exec-privatetmp-no.service
         test-execute/exec-privatetmp-yes.service
         test-execute/exec-protecthome-tmpfs-vs-protectsystem-strict.service
+        test-execute/exec-protectkernellogs-yes-capabilities.service
+        test-execute/exec-protectkernellogs-no-capabilities.service
         test-execute/exec-protectkernelmodules-no-capabilities.service
         test-execute/exec-protectkernelmodules-yes-capabilities.service
         test-execute/exec-protectkernelmodules-yes-mount-propagation.service
diff --git a/test/test-execute/exec-protectkernellogs-no-capabilities.service b/test/test-execute/exec-protectkernellogs-no-capabilities.service
new file mode 100644 (file)
index 0000000..f0c7d4d
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=Test CAP_SYSLOG for ProtectKernelLogs=no
+
+[Service]
+ProtectKernelLogs=no
+ExecStart=/bin/sh -x -c 'capsh --print | grep cap_syslog'
+Type=oneshot
diff --git a/test/test-execute/exec-protectkernellogs-yes-capabilities.service b/test/test-execute/exec-protectkernellogs-yes-capabilities.service
new file mode 100644 (file)
index 0000000..803ba7d
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=Test CAP_SYSLOG for ProtectKernelLogs=yes
+
+[Service]
+ProtectKernelLogs=yes
+ExecStart=/bin/sh -x -c '! capsh --print | grep cap_syslog'
+Type=oneshot