From edaaa7bf2f0b5ce874b24101100d02d3f3d0747f Mon Sep 17 00:00:00 2001 From: doug <> Date: Sat, 10 Oct 2015 22:28:51 +0000 Subject: Initial support for pledges in openssl(1) commands. openssl(1) has two mechanisms for operating: either a single execution of one command (looking at argv[0] or argv[1]) or as an interactive session than may execute any number of commands. We already have a top level pledge that should cover all commands and that's what interactive mode must continue using. However, we can tighten up the pledges when only executing one command. This is an initial stab at support and may contain regressions. Most commands only need "stdio rpath wpath cpath". The pledges could be further restricted by evaluating the situation after parsing options. deraadt@ and beck@ are roughly fine with this approach. --- src/usr.bin/openssl/ciphers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/usr.bin/openssl/ciphers.c') diff --git a/src/usr.bin/openssl/ciphers.c b/src/usr.bin/openssl/ciphers.c index 18b8d3e4d9..caa40854ea 100644 --- a/src/usr.bin/openssl/ciphers.c +++ b/src/usr.bin/openssl/ciphers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciphers.c,v 1.6 2015/08/19 18:25:31 deraadt Exp $ */ +/* $OpenBSD: ciphers.c,v 1.7 2015/10/10 22:28:51 doug Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -81,6 +81,11 @@ ciphers_main(int argc, char **argv) int i, rv = 0; char *desc; + if (single_execution) { + if (pledge("stdio rpath", NULL) == -1) + perror("pledge"); + } + memset(&ciphers_config, 0, sizeof(ciphers_config)); if (options_parse(argc, argv, ciphers_options, &cipherlist, -- cgit v1.2.3-55-g6feb