commit - b1c090542f4ecaf993fc81468338839febcb8e37
commit + 6fe3b58aaa9bdb466eabad75eb65bce86d7155af
blob - 1355425a306b5f1305bfc75b471bd657c206cbb0
blob + 61fb6877f63be71b25e656fc29c058fc075dcd89
--- gotwebd/gotwebd.c
+++ gotwebd/gotwebd.c
err(1, "gmon.out");
#endif
- if (unveil(env->httpd_chroot, "rwc") == -1)
- err(1, "unveil");
-
- if (unveil(GOT_TMPDIR_STR, "rw") == -1)
+ if (unveil(env->httpd_chroot, "r") == -1)
err(1, "unveil");
if (unveil(GOTWEBD_CONF, "r") == -1)
blob - 341d3774c799acfb106876120fa0e5ae0b9131c0
blob + 41cd91c3bd6c1f4770326a36d2946029e390fb11
--- gotwebd/sockets.c
+++ gotwebd/sockets.c
#include "got_opentemp.h"
#include "got_reference.h"
#include "got_repository.h"
+#include "got_privsep.h"
#include "proc.h"
#include "gotwebd.h"
signal_add(&ps->ps_evsigchld, NULL);
#ifndef PROFILE
- if (pledge("stdio rpath wpath cpath inet recvfd proc exec sendfd",
- NULL) == -1)
+ if (pledge("stdio rpath wpath cpath inet recvfd proc exec sendfd "
+ "unveil", NULL) == -1)
fatal("pledge");
#endif
}
sockets_launch(void)
{
struct socket *sock;
+ struct server *srv;
+ const struct got_error *error;
TAILQ_FOREACH(sock, &gotwebd_env->sockets, entry) {
log_debug("%s: configuring socket %d (%d)", __func__,
log_debug("%s: running socket listener %d", __func__,
sock->conf.id);
}
+
+ TAILQ_FOREACH(srv, &gotwebd_env->servers, entry) {
+ if (unveil(srv->repos_path, "r") == -1)
+ fatal("unveil %s", srv->repos_path);
+ }
+
+ error = got_privsep_unveil_exec_helpers();
+ if (error)
+ fatal("%s", error->msg);
+
+ if (unveil(NULL, NULL) == -1)
+ fatal("unveil");
}
static void