summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-03-22 02:42:37 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-03-22 02:42:37 +0000
commit7a7edf77ed9e9c982beedb84f2bd384acb7cfcdb (patch)
tree1f05666fcea178a3034ee7fbb9fd14a830bedcd9
parent01426a67c86850a06af757c2661409f87ed05414 (diff)
- stevesk@cvs.openbsd.org 2002/03/19 03:03:43
[pathnames.h servconf.c servconf.h sshd.c] _PATH_PRIVSEP_CHROOT_DIR; ok provos@
-rw-r--r--ChangeLog5
-rw-r--r--pathnames.h5
-rw-r--r--servconf.c12
-rw-r--r--servconf.h3
-rw-r--r--sshd.c7
5 files changed, 15 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index d70c27a78..73f7ac006 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -75,6 +75,9 @@
75 [servconf.c] 75 [servconf.c]
76 UnprivUser/UnprivGroup usable now--specify numeric user/group; ok 76 UnprivUser/UnprivGroup usable now--specify numeric user/group; ok
77 provos@ 77 provos@
78 - stevesk@cvs.openbsd.org 2002/03/19 03:03:43
79 [pathnames.h servconf.c servconf.h sshd.c]
80 _PATH_PRIVSEP_CHROOT_DIR; ok provos@
78 81
7920020317 8220020317
80 - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted, 83 - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted,
@@ -7921,4 +7924,4 @@
7921 - Wrote replacements for strlcpy and mkdtemp 7924 - Wrote replacements for strlcpy and mkdtemp
7922 - Released 1.0pre1 7925 - Released 1.0pre1
7923 7926
7924$Id: ChangeLog,v 1.1946 2002/03/22 02:40:03 mouring Exp $ 7927$Id: ChangeLog,v 1.1947 2002/03/22 02:42:37 mouring Exp $
diff --git a/pathnames.h b/pathnames.h
index 002c313a5..943830c08 100644
--- a/pathnames.h
+++ b/pathnames.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pathnames.h,v 1.11 2002/02/09 17:37:34 deraadt Exp $ */ 1/* $OpenBSD: pathnames.h,v 1.12 2002/03/19 03:03:43 stevesk Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -139,6 +139,9 @@
139#ifndef _PATH_SFTP_SERVER 139#ifndef _PATH_SFTP_SERVER
140#define _PATH_SFTP_SERVER "/usr/libexec/sftp-server" 140#define _PATH_SFTP_SERVER "/usr/libexec/sftp-server"
141#endif 141#endif
142
143/* chroot directory for unprivileged user when UsePrivilegeSeparation=yes */
144#define _PATH_PRIVSEP_CHROOT_DIR "/var/empty"
142#ifndef _PATH_LS 145#ifndef _PATH_LS
143#define _PATH_LS "ls" 146#define _PATH_LS "ls"
144#endif 147#endif
diff --git a/servconf.c b/servconf.c
index 72d75cc98..085854908 100644
--- a/servconf.c
+++ b/servconf.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: servconf.c,v 1.103 2002/03/18 23:52:51 stevesk Exp $"); 13RCSID("$OpenBSD: servconf.c,v 1.104 2002/03/19 03:03:43 stevesk Exp $");
14 14
15#if defined(KRB4) || defined(KRB5) 15#if defined(KRB4) || defined(KRB5)
16#include <krb.h> 16#include <krb.h>
@@ -115,7 +115,6 @@ initialize_server_options(ServerOptions *options)
115 115
116 options->unprivileged_user = -1; 116 options->unprivileged_user = -1;
117 options->unprivileged_group = -1; 117 options->unprivileged_group = -1;
118 options->unprivileged_dir = NULL;
119 118
120 /* Needs to be accessable in many places */ 119 /* Needs to be accessable in many places */
121 use_privsep = -1; 120 use_privsep = -1;
@@ -252,8 +251,6 @@ fill_default_server_options(ServerOptions *options)
252 options->unprivileged_user = 32767; 251 options->unprivileged_user = 32767;
253 if (options->unprivileged_group == -1) 252 if (options->unprivileged_group == -1)
254 options->unprivileged_group = 32767; 253 options->unprivileged_group = 32767;
255 if (options->unprivileged_dir == NULL)
256 options->unprivileged_dir = "/var/empty";
257} 254}
258 255
259/* Keyword tokens. */ 256/* Keyword tokens. */
@@ -286,7 +283,7 @@ typedef enum {
286 sBanner, sVerifyReverseMapping, sHostbasedAuthentication, 283 sBanner, sVerifyReverseMapping, sHostbasedAuthentication,
287 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval, 284 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval,
288 sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2, 285 sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2,
289 sUsePrivilegeSeparation, sUnprivUser, sUnprivGroup, sUnprivDir, 286 sUsePrivilegeSeparation, sUnprivUser, sUnprivGroup,
290 sDeprecated 287 sDeprecated
291} ServerOpCodes; 288} ServerOpCodes;
292 289
@@ -365,7 +362,6 @@ static struct {
365 { "useprivilegeseparation", sUsePrivilegeSeparation}, 362 { "useprivilegeseparation", sUsePrivilegeSeparation},
366 { "unprivuser", sUnprivUser}, 363 { "unprivuser", sUnprivUser},
367 { "unprivgroup", sUnprivGroup}, 364 { "unprivgroup", sUnprivGroup},
368 { "unprivdir", sUnprivDir},
369 { NULL, sBadOption } 365 { NULL, sBadOption }
370}; 366};
371 367
@@ -754,10 +750,6 @@ parse_flag:
754 intptr = &options->unprivileged_group; 750 intptr = &options->unprivileged_group;
755 goto parse_int; 751 goto parse_int;
756 752
757 case sUnprivDir:
758 charptr = &options->unprivileged_dir;
759 goto parse_filename;
760
761 case sAllowUsers: 753 case sAllowUsers:
762 while ((arg = strdelim(&cp)) && *arg != '\0') { 754 while ((arg = strdelim(&cp)) && *arg != '\0') {
763 if (options->num_allow_users >= MAX_ALLOW_USERS) 755 if (options->num_allow_users >= MAX_ALLOW_USERS)
diff --git a/servconf.h b/servconf.h
index b5d110a5a..06afaa3c8 100644
--- a/servconf.h
+++ b/servconf.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: servconf.h,v 1.55 2002/03/18 17:50:31 provos Exp $ */ 1/* $OpenBSD: servconf.h,v 1.56 2002/03/19 03:03:43 stevesk Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -133,7 +133,6 @@ typedef struct {
133 133
134 int unprivileged_user; /* User unprivileged child uses */ 134 int unprivileged_user; /* User unprivileged child uses */
135 int unprivileged_group; /* Group unprivileged child uses */ 135 int unprivileged_group; /* Group unprivileged child uses */
136 char *unprivileged_dir; /* Chroot dir for unprivileged user */
137} ServerOptions; 136} ServerOptions;
138 137
139void initialize_server_options(ServerOptions *); 138void initialize_server_options(ServerOptions *);
diff --git a/sshd.c b/sshd.c
index c82603d58..c788ac016 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.231 2002/03/18 17:50:31 provos Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.232 2002/03/19 03:03:43 stevesk Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -533,8 +533,9 @@ privsep_preauth_child(void)
533 demote_sensitive_data(); 533 demote_sensitive_data();
534 534
535 /* Change our root directory*/ 535 /* Change our root directory*/
536 if (chroot(options.unprivileged_dir) == -1) 536 if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1)
537 fatal("chroot(/var/empty)"); 537 fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR,
538 strerror(errno));
538 if (chdir("/") == -1) 539 if (chdir("/") == -1)
539 fatal("chdir(/)"); 540 fatal("chdir(/)");
540 541