From 8bd0b51140f24f253e8da91112a5e44b53837964 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 1 Feb 2021 14:47:32 -0500 Subject: Drop pledge privileges after daemonization --- daemon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon.c b/daemon.c index 59215f6..f36e277 100644 --- a/daemon.c +++ b/daemon.c @@ -307,6 +307,11 @@ int main(int argc, char *argv[]) { if (len < 0) syslog(LOG_WARNING, "%s: %m", pidPath); } +#ifdef __OpenBSD__ + error = pledge("stdio cpath rpath proc exec id", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + signal(SIGHUP, signalHandler); signal(SIGINT, signalHandler); signal(SIGTERM, signalHandler); -- cgit 1.4.1