diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-08-19 17:42:33 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-08-20 10:18:02 +0200 |
commit | 3242980582d501ec2adbcc0f794c7161056812e8 (patch) | |
tree | 04182f66b098c67a39d99f6204983193c8b0eb10 /src/login/user-runtime-dir.c | |
parent | 00e64c6d064c1024d57d0e5b6cfd83944e9e626b (diff) | |
download | systemd-3242980582d501ec2adbcc0f794c7161056812e8.tar.gz |
core: create per-user inaccessible node from the service manager
Previously, we'd create them from user-runtime-dir@.service. That has
one benefit: since this service runs privileged, we can create the full
set of device nodes. It has one major drawback though: it security-wise
problematic to create files/directories in directories as privileged
user in directories owned by unprivileged users, since they can use
symlinks to redirect what we want to do. As a general rule we hence
avoid this logic: only unpriv code should populate unpriv directories.
Hence, let's move this code to an appropriate place in the service
manager. This means we lose the inaccessible block device node, but
since there's already a fallback in place, this shouldn't be too bad.
Diffstat (limited to 'src/login/user-runtime-dir.c')
-rw-r--r-- | src/login/user-runtime-dir.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/login/user-runtime-dir.c b/src/login/user-runtime-dir.c index a56c527df8..c5d27b215d 100644 --- a/src/login/user-runtime-dir.c +++ b/src/login/user-runtime-dir.c @@ -49,7 +49,6 @@ static int user_mkdir_runtime_path( uint64_t runtime_dir_size, uint64_t runtime_dir_inodes) { - const char *p; int r; assert(runtime_path); @@ -84,7 +83,8 @@ static int user_mkdir_runtime_path( goto fail; } - log_debug_errno(errno, "Failed to mount per-user tmpfs directory %s.\n" + log_debug_errno(errno, + "Failed to mount per-user tmpfs directory %s.\n" "Assuming containerized execution, ignoring: %m", runtime_path); r = chmod_and_chown(runtime_path, 0700, uid, gid); @@ -99,10 +99,6 @@ static int user_mkdir_runtime_path( log_warning_errno(r, "Failed to fix label of \"%s\", ignoring: %m", runtime_path); } - /* Set up inaccessible nodes now so they're available if we decide to use them with user namespaces. */ - p = strjoina(runtime_path, "/systemd"); - (void) mkdir(p, 0755); - (void) make_inaccessible_nodes(p, uid, gid); return 0; fail: |