summaryrefslogtreecommitdiffstats
path: root/src/privsep-root.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-06-05 20:24:21 +0100
committerRoy Marples <roy@marples.name>2020-06-05 20:24:21 +0100
commit7ef3d6a703f5c3b1fa537ae324f7d79f085f31f9 (patch)
tree096d27b660b63c09ff2d66c183ab3a21b1fbea6f /src/privsep-root.c
parentff6831723b04b617f73e88cf84387f46eea1faf5 (diff)
downloaddhcpcd-7ef3d6a703f5c3b1fa537ae324f7d79f085f31f9.tar.xz
privsep: Limit rights generically rather than Capsicum specifc
You never know when another sandbox tech comes around. While here, add limits for every socket in the unpriviledged processes. Some were absent before. Also, note that RLIMIT_NOFILE breaks our control socket so temporary disable that.
Diffstat (limited to 'src/privsep-root.c')
-rw-r--r--src/privsep-root.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/privsep-root.c b/src/privsep-root.c
index 5f5e2861..8ff32303 100644
--- a/src/privsep-root.c
+++ b/src/privsep-root.c
@@ -777,6 +777,12 @@ ps_root_start(struct dhcpcd_ctx *ctx)
if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_CXNB, 0, fd) == -1)
return -1;
+ if (ps_setbuf_fdpair(fd) == -1)
+ return -1;
+#ifdef PRIVSEP_RIGHTS
+ if (ps_rights_limit_fdpair(fd) == -1)
+ return -1;
+#endif
pid = ps_dostart(ctx, &ctx->ps_root_pid, &ctx->ps_root_fd,
ps_root_recvmsg, NULL, ctx,