summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-08-22 16:21:00 +0200
committerGitHub <noreply@github.com>2023-08-22 16:21:00 +0200
commit88328d997a6159ab324916972603d0db8afef7aa (patch)
treedddc9992594b14b9ab6db32d52bd6e38b68f1152 /test
parentsysext: fix a memory leak (diff)
parenttest-execute: add tests for credentials directory with mount namespace (diff)
downloadsystemd-88328d997a6159ab324916972603d0db8afef7aa.tar.xz
systemd-88328d997a6159ab324916972603d0db8afef7aa.zip
Merge pull request #28787 from yuwata/credential-next
core: do not leak mount for credentials directory if possible
Diffstat (limited to 'test')
-rw-r--r--test/test-execute/exec-load-credential-with-mount-namespace.service9
-rw-r--r--test/test-execute/exec-load-credential-with-seccomp.service9
-rw-r--r--test/test-execute/exec-set-credential-with-mount-namespace.service9
-rw-r--r--test/test-execute/exec-set-credential-with-seccomp.service9
4 files changed, 36 insertions, 0 deletions
diff --git a/test/test-execute/exec-load-credential-with-mount-namespace.service b/test/test-execute/exec-load-credential-with-mount-namespace.service
new file mode 100644
index 0000000000..fd71cf6717
--- /dev/null
+++ b/test/test-execute/exec-load-credential-with-mount-namespace.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Unit]
+Description=Test for LoadCredential=
+
+[Service]
+ExecStart=/bin/sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
+Type=oneshot
+LoadCredential=test-execute.load-credential
+PrivateMounts=yes
diff --git a/test/test-execute/exec-load-credential-with-seccomp.service b/test/test-execute/exec-load-credential-with-seccomp.service
new file mode 100644
index 0000000000..67303f2713
--- /dev/null
+++ b/test/test-execute/exec-load-credential-with-seccomp.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Unit]
+Description=Test for LoadCredential=
+
+[Service]
+ExecStart=/bin/sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
+Type=oneshot
+LoadCredential=test-execute.load-credential
+SystemCallFilter=~open_tree move_mount
diff --git a/test/test-execute/exec-set-credential-with-mount-namespace.service b/test/test-execute/exec-set-credential-with-mount-namespace.service
new file mode 100644
index 0000000000..67d15e5dbb
--- /dev/null
+++ b/test/test-execute/exec-set-credential-with-mount-namespace.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Unit]
+Description=Test for SetCredential=
+
+[Service]
+ExecStart=/bin/sh -x -c 'test "$$(cat %d/test-execute.set-credential)" = "hoge"'
+Type=oneshot
+SetCredential=test-execute.set-credential:hoge
+PrivateMounts=yes
diff --git a/test/test-execute/exec-set-credential-with-seccomp.service b/test/test-execute/exec-set-credential-with-seccomp.service
new file mode 100644
index 0000000000..778777b947
--- /dev/null
+++ b/test/test-execute/exec-set-credential-with-seccomp.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Unit]
+Description=Test for SetCredential=
+
+[Service]
+ExecStart=/bin/sh -x -c 'test "$$(cat %d/test-execute.set-credential)" = "hoge"'
+Type=oneshot
+SetCredential=test-execute.set-credential:hoge
+SystemCallFilter=~open_tree move_mount