2 1a49166d 2021-01-23 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
4 e29dbd72 2021-01-23 op * Permission to use, copy, modify, and distribute this software for any
5 e29dbd72 2021-01-23 op * purpose with or without fee is hereby granted, provided that the above
6 e29dbd72 2021-01-23 op * copyright notice and this permission notice appear in all copies.
8 e29dbd72 2021-01-23 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 e29dbd72 2021-01-23 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 e29dbd72 2021-01-23 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 e29dbd72 2021-01-23 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 e29dbd72 2021-01-23 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 e29dbd72 2021-01-23 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 e29dbd72 2021-01-23 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 dafb57b8 2021-01-15 op #include "gmid.h"
18 281a8852 2023-06-06 op #include "logger.h"
20 0b62f484 2023-05-08 op #if defined(__OpenBSD__)
22 71b7eb2f 2021-01-17 op #include <unistd.h>
25 1e0b9745 2023-05-08 op sandbox_server_process(void)
27 fdea6aa0 2021-04-30 op struct vhost *h;
28 fdea6aa0 2021-04-30 op struct location *l;
30 b8e64ccd 2021-03-31 op TAILQ_FOREACH(h, &hosts, vhosts) {
31 fdea6aa0 2021-04-30 op TAILQ_FOREACH(l, &h->locations, locations) {
32 534afd0d 2022-10-05 op if (*l->dir == '\0')
35 b24c6fcc 2022-11-27 op if (unveil(l->dir, "rw") == -1)
36 fdea6aa0 2021-04-30 op fatal("unveil %s for domain %s",
42 b24c6fcc 2022-11-27 op if (pledge("stdio recvfd rpath unix inet dns", NULL) == -1)
43 8e56d6ad 2021-02-11 op fatal("pledge");
47 62e001b0 2021-03-20 op sandbox_logger_process(void)
49 e952c505 2021-06-15 op if (pledge("stdio recvfd", NULL) == -1)
50 62e001b0 2021-03-20 op err(1, "pledge");
55 62e001b0 2021-03-20 op #warning "No sandbox method known for this OS"
58 1e0b9745 2023-05-08 op sandbox_server_process(void)
64 62e001b0 2021-03-20 op sandbox_logger_process(void)