diff options
author | Topi Miettinen <toiwoton@gmail.com> | 2021-01-16 12:49:32 +0100 |
---|---|---|
committer | Topi Miettinen <topimiettinen@users.noreply.github.com> | 2021-01-29 13:40:52 +0100 |
commit | ddc155b2fd7807cda088c437dc836eebbcf79cea (patch) | |
tree | 512024b3042da520bffd77e1b7e0e64e0405df68 /src/test/test-execute.c | |
parent | ci: build the Fedora RPMs with -Werror (diff) | |
download | systemd-ddc155b2fd7807cda088c437dc836eebbcf79cea.tar.xz systemd-ddc155b2fd7807cda088c437dc836eebbcf79cea.zip |
New directives NoExecPaths= ExecPaths=
Implement directives `NoExecPaths=` and `ExecPaths=` to control `MS_NOEXEC`
mount flag for the file system tree. This can be used to implement file system
W^X policies, and for example with allow-listing mode (NoExecPaths=/) a
compromised service would not be able to execute a shell, if that was not
explicitly allowed.
Example:
[Service]
NoExecPaths=/
ExecPaths=/usr/bin/daemon /usr/lib64 /usr/lib
Closes: #17942.
Diffstat (limited to 'src/test/test-execute.c')
-rw-r--r-- | src/test/test-execute.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 01e2443777..c0e046b5e2 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -408,6 +408,11 @@ static void test_exec_inaccessiblepaths(Manager *m) { test(m, "exec-inaccessiblepaths-mount-propagation.service", can_unshare ? 0 : EXIT_FAILURE, CLD_EXITED); } +static void test_exec_noexecpaths(Manager *m) { + + test(m, "exec-noexecpaths-simple.service", can_unshare ? 0 : EXIT_FAILURE, CLD_EXITED); +} + static void test_exec_temporaryfilesystem(Manager *m) { test(m, "exec-temporaryfilesystem-options.service", can_unshare ? 0 : EXIT_NAMESPACE, CLD_EXITED); @@ -865,6 +870,7 @@ int main(int argc, char *argv[]) { entry(test_exec_ignoresigpipe), entry(test_exec_inaccessiblepaths), entry(test_exec_ioschedulingclass), + entry(test_exec_noexecpaths), entry(test_exec_oomscoreadjust), entry(test_exec_passenvironment), entry(test_exec_personality), |