diff options
author | bptato <nincsnevem662@gmail.com> | 2024-04-03 18:54:07 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-04-03 19:08:34 +0200 |
commit | 5cf524958fc73d6912aef4866500b0cc46fa1bc6 (patch) | |
tree | acc298fe143f5f9cfd9eff591fd52e5fb1e3866b /src/server/forkserver.nim | |
parent | af92dd1711181586a58843216e5fdd9c48876e59 (diff) | |
download | chawan-5cf524958fc73d6912aef4866500b0cc46fa1bc6.tar.gz |
sandbox: add OpenBSD pledge/unveil support
pledge is a bit more fine-grained than Capsicum's capability mode, so the buffer & http ("network") sandboxes are now split up into two parts. I applied the same hack as in FreeBSD for overriding the buffer selector kqueue, because a) I didn't want to request sysctl promise b) I'm not sure if it would even work and c) if it breaks on OpenBSD, then it's broken on FreeBSD too, so there's a greater chance of discovering the bug.
Diffstat (limited to 'src/server/forkserver.nim')
-rw-r--r-- | src/server/forkserver.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server/forkserver.nim b/src/server/forkserver.nim index d972958a..a5a9ff64 100644 --- a/src/server/forkserver.nim +++ b/src/server/forkserver.nim @@ -153,8 +153,9 @@ proc forkBuffer(ctx: var ForkServerContext; r: var BufferedReader): int = closeStdout() # must call before entering the sandbox, or capsicum cries because of Nim # calling sysctl + # also lets us deny sysctl call with pledge let selector = newSelector[int]() - enterSandbox() + enterBufferSandbox(sockDir) let pid = getCurrentProcessId() let ssock = initServerSocket(sockDir, sockDirFd, pid) gssock = ssock |