summaryrefslogtreecommitdiff
path: root/src/core/namespace.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-20 01:38:28 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-20 14:08:41 -0400
commitd34cd374905a40e65769351a2808b741b5418bf1 (patch)
tree5dbd6761c13de63a6d5b1c0733d82990abb46aef /src/core/namespace.c
parent1f048a6b6bcc30d2e157711b3d231d7a944e6ffb (diff)
Make PrivateTmp dirs also inaccessible from the outside
Currently, PrivateTmp=yes means that the service cannot see the /tmp shared by rest of the system and is isolated from other services using PrivateTmp, but users can access and modify /tmp as seen by the service. Move the private /tmp and /var/tmp directories into a 0077-mode directory. This way unpriviledged users on the system cannot see (or modify) /tmp as seen by the service.
Diffstat (limited to 'src/core/namespace.c')
-rw-r--r--src/core/namespace.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/core/namespace.c b/src/core/namespace.c
index ceeed2e1a..972380abc 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -183,22 +183,20 @@ int setup_tmpdirs(char **tmp_dir,
assert(tmp_dir);
assert(var_tmp_dir);
- r = create_tmp_dir(tmp_dir_template, 0000, true, tmp_dir);
+ r = create_tmp_dir(tmp_dir_template, tmp_dir);
if (r < 0)
- goto fail2;
+ return r;
- r = create_tmp_dir(var_tmp_dir_template, 0000, true, var_tmp_dir);
- if (r < 0)
- goto fail1;
-
- return 0;
+ r = create_tmp_dir(var_tmp_dir_template, var_tmp_dir);
+ if (r == 0)
+ return 0;
-fail1:
+ /* failure */
rmdir(*tmp_dir);
+ rmdir(tmp_dir_template);
free(*tmp_dir);
*tmp_dir = NULL;
-fail2:
return r;
}