Merge pull request #8303 from yuwata/fix-8276

test: use synthesize_nobody() in test-execute
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-03-02 12:53:11 +01:00
committed by GitHub
15 changed files with 196 additions and 49 deletions
+7
View File
@@ -47,8 +47,10 @@ test_data_files = '''
sysinit.target
test-execute/exec-bindpaths.service
test-execute/exec-capabilityambientset-merge-nfsnobody.service
test-execute/exec-capabilityambientset-merge-nobody.service
test-execute/exec-capabilityambientset-merge.service
test-execute/exec-capabilityambientset-nfsnobody.service
test-execute/exec-capabilityambientset-nobody.service
test-execute/exec-capabilityambientset.service
test-execute/exec-capabilityboundingset-invert.service
test-execute/exec-capabilityboundingset-merge.service
@@ -68,6 +70,7 @@ test_data_files = '''
test-execute/exec-environment.service
test-execute/exec-environmentfile.service
test-execute/exec-group-nfsnobody.service
test-execute/exec-group-nobody.service
test-execute/exec-group-nogroup.service
test-execute/exec-group.service
test-execute/exec-ignoresigpipe-no.service
@@ -113,6 +116,8 @@ test_data_files = '''
test-execute/exec-restrictnamespaces-yes.service
test-execute/exec-runtimedirectory-mode.service
test-execute/exec-runtimedirectory-owner-nfsnobody.service
test-execute/exec-runtimedirectory-owner-nobody.service
test-execute/exec-runtimedirectory-owner-nogroup.service
test-execute/exec-runtimedirectory-owner.service
test-execute/exec-runtimedirectory.service
test-execute/exec-specifier-interpolation.service
@@ -133,6 +138,7 @@ test_data_files = '''
test-execute/exec-systemcallfilter-not-failing.service
test-execute/exec-systemcallfilter-not-failing2.service
test-execute/exec-systemcallfilter-system-user-nfsnobody.service
test-execute/exec-systemcallfilter-system-user-nobody.service
test-execute/exec-systemcallfilter-system-user.service
test-execute/exec-systemcallfilter-with-errno-name.service
test-execute/exec-systemcallfilter-with-errno-number.service
@@ -144,6 +150,7 @@ test_data_files = '''
test-execute/exec-umask-default.service
test-execute/exec-unsetenvironment.service
test-execute/exec-user-nfsnobody.service
test-execute/exec-user-nobody.service
test-execute/exec-user.service
test-execute/exec-workingdirectory.service
test-path/basic.target
@@ -0,0 +1,9 @@
[Unit]
Description=Test for AmbientCapabilities
[Service]
ExecStart=/bin/sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000003000"'
Type=oneshot
User=nobody
AmbientCapabilities=CAP_NET_ADMIN
AmbientCapabilities=CAP_NET_RAW
@@ -1,9 +1,9 @@
[Unit]
Description=Test for AmbientCapabilities
Description=Test for AmbientCapabilities (daemon)
[Service]
ExecStart=/bin/sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000003000"'
Type=oneshot
User=nobody
User=daemon
AmbientCapabilities=CAP_NET_ADMIN
AmbientCapabilities=CAP_NET_RAW
@@ -0,0 +1,8 @@
[Unit]
Description=Test for AmbientCapabilities
[Service]
ExecStart=/bin/sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000003000"'
Type=oneshot
User=nobody
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW
@@ -1,8 +1,8 @@
[Unit]
Description=Test for AmbientCapabilities
Description=Test for AmbientCapabilities (daemon)
[Service]
ExecStart=/bin/sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000003000"'
Type=oneshot
User=nobody
User=daemon
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW
@@ -0,0 +1,7 @@
[Unit]
Description=Test for Group
[Service]
ExecStart=/bin/sh -x -c 'test "$$(id -n -g)" = "nobody"'
Type=oneshot
Group=nobody
+3 -3
View File
@@ -1,7 +1,7 @@
[Unit]
Description=Test for Group
Description=Test for Group (daemon)
[Service]
ExecStart=/bin/sh -x -c 'test "$$(id -n -g)" = "nobody"'
ExecStart=/bin/sh -x -c 'test "$$(id -n -g)" = "daemon"'
Type=oneshot
Group=nobody
Group=daemon
@@ -0,0 +1,9 @@
[Unit]
Description=Test for RuntimeDirectory owner (must not be the default group of the user if Group is set)
[Service]
ExecStart=/bin/sh -x -c 'group=$$(stat -c %%G %t/test-exec_runtimedirectory-owner); test "$$group" = "nobody"'
Type=oneshot
Group=nobody
User=root
RuntimeDirectory=test-exec_runtimedirectory-owner
@@ -0,0 +1,9 @@
[Unit]
Description=Test for RuntimeDirectory owner (must not be the default group of the user if Group is set)
[Service]
ExecStart=/bin/sh -x -c 'group=$$(stat -c %%G %t/test-exec_runtimedirectory-owner); test "$$group" = "nogroup"'
Type=oneshot
Group=nogroup
User=root
RuntimeDirectory=test-exec_runtimedirectory-owner
@@ -2,8 +2,8 @@
Description=Test for RuntimeDirectory owner (must not be the default group of the user if Group is set)
[Service]
ExecStart=/bin/sh -x -c 'group=$$(stat -c %%G %t/test-exec_runtimedirectory-owner); test "$$group" = "nobody"'
ExecStart=/bin/sh -x -c 'group=$$(stat -c %%G %t/test-exec_runtimedirectory-owner-daemon); test "$$group" = "daemon"'
Type=oneshot
Group=nobody
Group=daemon
User=root
RuntimeDirectory=test-exec_runtimedirectory-owner
RuntimeDirectory=test-exec_runtimedirectory-owner-daemon
@@ -0,0 +1,11 @@
[Unit]
Description=Test for SystemCallFilter in system mode with User set
[Service]
ExecStart=/bin/sh -c 'echo "Foo bar"'
Type=oneshot
User=nobody
SystemCallFilter=~read write open execve ioperm
SystemCallFilter=ioctl
SystemCallFilter=read write open execve
SystemCallFilter=~ioperm
@@ -1,10 +1,10 @@
[Unit]
Description=Test for SystemCallFilter in system mode with User set
Description=Test for SystemCallFilter in system mode with User set (daemon)
[Service]
ExecStart=/bin/sh -c 'echo "Foo bar"'
Type=oneshot
User=nobody
User=daemon
SystemCallFilter=~read write open execve ioperm
SystemCallFilter=ioctl
SystemCallFilter=read write open execve
@@ -0,0 +1,7 @@
[Unit]
Description=Test for User
[Service]
ExecStart=/bin/sh -x -c 'test "$$USER" = "nobody"'
Type=oneshot
User=nobody
+3 -3
View File
@@ -1,7 +1,7 @@
[Unit]
Description=Test for User
Description=Test for User (daemon)
[Service]
ExecStart=/bin/sh -x -c 'test "$$USER" = "nobody"'
ExecStart=/bin/sh -x -c 'test "$$USER" = "daemon"'
Type=oneshot
User=nobody
User=daemon