aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorgrunfink <grunfink@noreply.codeberg.org>2025-01-05 12:16:27 +0000
committergrunfink <grunfink@noreply.codeberg.org>2025-01-05 12:16:27 +0000
commitfced3aa3abae94c97d71ed60bd617c3de47a835d (patch)
tree204900c59f112272a759858e9b7641750f97c330 /data.c
parent3a1cae73265aebdbe678d94fbdc16edf3ccc643f (diff)
parenta0ca57cc670c9c6dad633ba55a73d810ed61e5ce (diff)
Merge pull request 'Port sandboxing to linux via landlock' (#226) from shtrophic/snac2:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/226
Diffstat (limited to 'data.c')
-rw-r--r--data.c39
1 files changed, 1 insertions, 38 deletions
diff --git a/data.c b/data.c
index e5d7258..0fd3528 100644
--- a/data.c
+++ b/data.c
@@ -115,44 +115,7 @@ int srv_open(const char *basedir, int auto_upgrade)
#define st_mtim st_mtimespec
#endif
-#ifdef __OpenBSD__
- if (xs_is_true(xs_dict_get(srv_config, "disable_openbsd_security"))) {
- srv_debug(1, xs_dup("OpenBSD security disabled by admin"));
- }
- else {
- int smail = !xs_is_true(xs_dict_get(srv_config, "disable_email_notifications"));
- const char *address = xs_dict_get(srv_config, "address");
-
- srv_debug(1, xs_fmt("Calling unveil()"));
- unveil(basedir, "rwc");
- unveil("/tmp", "rwc");
- unveil("/etc/resolv.conf", "r");
- unveil("/etc/hosts", "r");
- unveil("/etc/ssl/openssl.cnf", "r");
- unveil("/etc/ssl/cert.pem", "r");
- unveil("/usr/share/zoneinfo", "r");
-
- if (smail)
- unveil("/usr/sbin/sendmail", "x");
-
- if (*address == '/')
- unveil(address, "rwc");
-
- unveil(NULL, NULL);
-
- srv_debug(1, xs_fmt("Calling pledge()"));
-
- xs *p = xs_str_new("stdio rpath wpath cpath flock inet proc dns fattr");
-
- if (smail)
- p = xs_str_cat(p, " exec");
-
- if (*address == '/')
- p = xs_str_cat(p, " unix");
-
- pledge(p, NULL);
- }
-#endif /* __OpenBSD__ */
+ sbox_enter(srv_basedir);
/* read (and drop) emojis.json, possibly creating it */
xs_free(emojis());