summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-06-23 08:30:03 +1000
committerDamien Miller <djm@mindrot.org>2011-06-23 08:30:03 +1000
commit69ff1df952eebf0489b775a60ede094eaf596a05 (patch)
tree6eb76b4632b7c131e0fbb52d8ce7cccf658b6bfa /servconf.c
parent82c558761d0fa42dc954d62812b9e4b4a94f64bd (diff)
- djm@cvs.openbsd.org 2011/06/22 21:57:01
[servconf.c servconf.h sshd.c sshd_config.5 sandbox-rlimit.c] [sandbox-systrace.c sandbox.h configure.ac Makefile.in] introduce sandboxing of the pre-auth privsep child using systrace(4). This introduces a new "UsePrivilegeSeparation=sandbox" option for sshd_config that applies mandatory restrictions on the syscalls the privsep child can perform. This prevents a compromised privsep child from being used to attack other hosts (by opening sockets and proxying) or probing local kernel attack surface. The sandbox is implemented using systrace(4) in unsupervised "fast-path" mode, where a list of permitted syscalls is supplied. Any syscall not on the list results in SIGKILL being sent to the privsep child. Note that this requires a kernel with the new SYSTR_POLICY_KILL option. UsePrivilegeSeparation=sandbox will become the default in the future so please start testing it now. feedback dtucker@; ok markus@
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/servconf.c b/servconf.c
index 03b974617..91986e55d 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: servconf.c,v 1.221 2011/06/22 21:47:28 djm Exp $ */ 1/* $OpenBSD: servconf.c,v 1.222 2011/06/22 21:57:01 djm Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -280,7 +280,7 @@ fill_default_server_options(ServerOptions *options)
280 280
281 /* Turn privilege separation on by default */ 281 /* Turn privilege separation on by default */
282 if (use_privsep == -1) 282 if (use_privsep == -1)
283 use_privsep = 1; 283 use_privsep = PRIVSEP_ON;
284 284
285#ifndef HAVE_MMAP 285#ifndef HAVE_MMAP
286 if (use_privsep && options->compression == 1) { 286 if (use_privsep && options->compression == 1) {
@@ -701,6 +701,12 @@ static const struct multistate multistate_gatewayports[] = {
701 { "no", 0 }, 701 { "no", 0 },
702 { NULL, -1 } 702 { NULL, -1 }
703}; 703};
704static const struct multistate multistate_privsep[] = {
705 { "sandbox", PRIVSEP_SANDBOX },
706 { "yes", PRIVSEP_ON },
707 { "no", PRIVSEP_OFF },
708 { NULL, -1 }
709};
704 710
705int 711int
706process_server_config_line(ServerOptions *options, char *line, 712process_server_config_line(ServerOptions *options, char *line,
@@ -1066,7 +1072,8 @@ process_server_config_line(ServerOptions *options, char *line,
1066 1072
1067 case sUsePrivilegeSeparation: 1073 case sUsePrivilegeSeparation:
1068 intptr = &use_privsep; 1074 intptr = &use_privsep;
1069 goto parse_flag; 1075 multistate_ptr = multistate_privsep;
1076 goto parse_multistate;
1070 1077
1071 case sAllowUsers: 1078 case sAllowUsers:
1072 while ((arg = strdelim(&cp)) && *arg != '\0') { 1079 while ((arg = strdelim(&cp)) && *arg != '\0') {
@@ -1574,6 +1581,8 @@ fmt_intarg(ServerOpCodes code, int val)
1574 return fmt_multistate_int(val, multistate_gatewayports); 1581 return fmt_multistate_int(val, multistate_gatewayports);
1575 case sCompression: 1582 case sCompression:
1576 return fmt_multistate_int(val, multistate_compression); 1583 return fmt_multistate_int(val, multistate_compression);
1584 case sUsePrivilegeSeparation:
1585 return fmt_multistate_int(val, multistate_privsep);
1577 case sProtocol: 1586 case sProtocol:
1578 switch (val) { 1587 switch (val) {
1579 case SSH_PROTO_1: 1588 case SSH_PROTO_1: