$OpenBSD$

Pledge oscp and worker processes.
chroot(2) not (yet) hoisted, so pledge main process iff not used.

Index: src/hitch.c
--- src/hitch.c.orig
+++ src/hitch.c
@@ -2979,6 +2979,10 @@ start_workers(int start_index, int count)
 				change_root();
 			if (CONFIG->UID >= 0 || CONFIG->GID >= 0)
 				drop_privileges();
+			if (pledge("stdio rpath inet dns", NULL) == -1) {
+				ERR("pledge\n");
+				_exit(1);
+			}
 			if (geteuid() == 0) {
 				ERR("{core} ERROR: "
 				    "Refusing to run workers as root.\n");
@@ -3004,6 +3008,10 @@ start_ocsp_proc(void)
 	} else if (ocsp_proc_pid == 0) {
 		if (CONFIG->UID >= 0 || CONFIG->GID >= 0)
 			drop_privileges();
+		if (pledge("stdio rpath wpath cpath inet dns", NULL) == -1) {
+			ERR("pledge\n");
+			_exit(1);
+		}
 		if (geteuid() == 0) {
 			ERR("{core} ERROR: "
 			    "Refusing to run workers as root.\n");
@@ -3735,6 +3743,12 @@ main(int argc, char **argv)
 		return (rv);
 	}
 
+	if (!CONFIG->CHROOT) {
+		if (pledge("stdio rpath wpath cpath inet flock dns getpw proc"
+		    " id", NULL) == -1)
+			fail("pledge\n");
+	}
+
 	if (CONFIG->TEST) {
 		fprintf(stderr, "Trying to initialize SSL contexts with your"
 		    " certificates\n");
@@ -3821,6 +3835,8 @@ main(int argc, char **argv)
 			    CONFIG->PIDFILE, strerror(errno));
 			exit(1);
 		}
+		if (pledge("stdio rpath wpath cpath inet dns getpw proc id", NULL) == -1)
+			fail("pledge\n");
 
 		AZ(VPF_Write(pfh));
 		atexit(remove_pfh);
