diff options
author | Omar Polo <op@omarpolo.com> | 2023-06-08 13:59:31 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-06-08 13:59:31 +0000 |
commit | c26f2460e42aa0822c283c805958989f339e7d8b (patch) | |
tree | 423410fae4de90b2b753ccad621d364c4641bed2 /sandbox.c | |
parent | 99f1fbb0c73b6f62b966760181b3d97f54bbe73b (diff) |
rework the daemon to do fork+exec
It uses the 'common' proc.c from various OpenBSD-daemons.
gmid grew organically bit by bit and it was also the first place where I
tried to implement privsep. It wasn't done very well, in fact the
parent process (that retains root privileges) just fork()s a generation
of servers, all sharing *exactly* the same address space. No good!
Now, we fork() and re-exec() ourselves, so that each process has a fresh
address space.
Some features (require client ca for example) are temporarly disabled,
will be fixed in subsequent commits. The "ge" program is also
temporarly disabled as it needs tweaks to do privsep too.
Diffstat (limited to 'sandbox.c')
-rw-r--r-- | sandbox.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -22,6 +22,13 @@ #include <unistd.h> void +sandbox_main_process(void) +{ + if (pledge("stdio rpath inet dns sendfd proc", NULL) == -1) + fatal("pledge"); +} + +void sandbox_server_process(void) { struct vhost *h; |