summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-02-01 12:36:02 -0500
committerJune McEnroe <june@causal.agency>2021-02-01 12:36:02 -0500
commit1f51dfbad6710b28f244a8df6e5489c14e3c295b (patch)
tree3463d1793c21479d37f05fbb49f2abb1ee647e8a
parentAdd Repology links to README (diff)
downloadpounce-1f51dfbad6710b28f244a8df6e5489c14e3c295b.tar.gz
pounce-1f51dfbad6710b28f244a8df6e5489c14e3c295b.zip
Drop pledge capabilities after binding and connecting
-rw-r--r--bounce.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/bounce.c b/bounce.c
index 31ca4a6..d0bccfc 100644
--- a/bounce.c
+++ b/bounce.c
@@ -356,7 +356,7 @@ int main(int argc, char *argv[]) {
 	error = unveil(tls_default_ca_cert_file(), "r");
 	if (error) err(EX_OSFILE, "%s", tls_default_ca_cert_file());
 
-	error = pledge("stdio rpath wpath cpath inet flock unix dns recvfd", NULL);
+	error = pledge("stdio rpath wpath cpath flock inet dns unix recvfd", NULL);
 	if (error) err(EX_OSERR, "pledge");
 #endif
 
@@ -423,6 +423,16 @@ int main(int argc, char *argv[]) {
 	serverConfig(insecure, trust, clientCert, clientPriv);
 	int server = serverConnect(serverBindHost, host, port);
 
+#ifdef __OpenBSD__
+	char promises[64];
+	snprintf(
+		promises, sizeof(promises), "stdio rpath inet%s",
+		(bindPath[0] ? " cpath unix recvfd" : "")
+	);
+	error = pledge(promises, NULL);
+	if (error) err(EX_OSERR, "pledge");
+#endif
+
 #ifdef __FreeBSD__
 	error = cap_enter();
 	if (error) err(EX_OSERR, "cap_enter");
Enroe 2019-07-29Pass original command to dispatchJune McEnroe 2019-07-29Rename wrapper to dispatchJune McEnroe 2019-07-29Track only the max client fdJune McEnroe 2019-07-28Do basic multiplexing in ingestJune McEnroe 2019-07-28Add empty commandsJune McEnroe 2019-07-28Rename ptee streamJune McEnroe 2019-07-28Remove ptee keybindsJune McEnroe 2019-07-28Import ptee from srcJune McEnroe 2019-07-28Remove old commandsJune McEnroe 2018-04-20Clean up pteeJune McEnroe 2018-04-20Uncommitted changes from months ago :(June McEnroe 2018-02-25Remove winchJune McEnroe 2018-02-25Echo at end of outputJune McEnroe 2018-02-25Add stopJune McEnroe 2018-02-25Switch back to static window sizingJune McEnroe 2018-02-25Add missing includeJune McEnroe 2018-02-25Define rules for multi-object binariesJune McEnroe 2018-02-25Rewrite everythingJune McEnroe 2018-02-22Hardcode path lengths in setupJune McEnroe 2018-02-22Add setup, start commandJune McEnroe 2018-02-22Indent list of streamsJune McEnroe 2018-02-22Add welcome message to ssh-commandJune McEnroe 2018-02-22Sleep before truncationJune McEnroe To give viewers a chance to catch up. I wonder how bad this will be. 2018-02-22List streams if none givenJune McEnroe 2018-02-22Set ForceCommand ssh-commandJune McEnroe 2018-02-22Rename command to ssh-commandJune McEnroe 2018-02-22Add command.shJune McEnroe 2018-02-22Factor out STREAM_SIZE for ingest and broadcastJune McEnroe 2018-02-22Handle EINTR from keventJune McEnroe 2018-02-22Include libutil in chroot.tarJune McEnroe