summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar grunfink2025-01-05 12:16:27 +0000
committerGravatar grunfink2025-01-05 12:16:27 +0000
commitfced3aa3abae94c97d71ed60bd617c3de47a835d (patch)
tree204900c59f112272a759858e9b7641750f97c330 /data.c
parentMoved post language setting to msg_note(), where it really belongs. (diff)
parentupdate landloc.h (diff)
downloadsnac2-fced3aa3abae94c97d71ed60bd617c3de47a835d.tar.gz
snac2-fced3aa3abae94c97d71ed60bd617c3de47a835d.tar.xz
snac2-fced3aa3abae94c97d71ed60bd617c3de47a835d.zip
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)
115#define st_mtim st_mtimespec 115#define st_mtim st_mtimespec
116#endif 116#endif
117 117
118#ifdef __OpenBSD__ 118 sbox_enter(srv_basedir);
119 if (xs_is_true(xs_dict_get(srv_config, "disable_openbsd_security"))) {
120 srv_debug(1, xs_dup("OpenBSD security disabled by admin"));
121 }
122 else {
123 int smail = !xs_is_true(xs_dict_get(srv_config, "disable_email_notifications"));
124 const char *address = xs_dict_get(srv_config, "address");
125
126 srv_debug(1, xs_fmt("Calling unveil()"));
127 unveil(basedir, "rwc");
128 unveil("/tmp", "rwc");
129 unveil("/etc/resolv.conf", "r");
130 unveil("/etc/hosts", "r");
131 unveil("/etc/ssl/openssl.cnf", "r");
132 unveil("/etc/ssl/cert.pem", "r");
133 unveil("/usr/share/zoneinfo", "r");
134
135 if (smail)
136 unveil("/usr/sbin/sendmail", "x");
137
138 if (*address == '/')
139 unveil(address, "rwc");
140
141 unveil(NULL, NULL);
142
143 srv_debug(1, xs_fmt("Calling pledge()"));
144
145 xs *p = xs_str_new("stdio rpath wpath cpath flock inet proc dns fattr");
146
147 if (smail)
148 p = xs_str_cat(p, " exec");
149
150 if (*address == '/')
151 p = xs_str_cat(p, " unix");
152
153 pledge(p, NULL);
154 }
155#endif /* __OpenBSD__ */
156 119
157 /* read (and drop) emojis.json, possibly creating it */ 120 /* read (and drop) emojis.json, possibly creating it */
158 xs_free(emojis()); 121 xs_free(emojis());