summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-03-07 18:31:24 +1100
committerDamien Miller <djm@mindrot.org>2008-03-07 18:31:24 +1100
commit76e95daad1f38e0ba8e7bf0554cadd6e3aaf5235 (patch)
treed578b6faed195267a3b5d6dd036a1862c3ca79a3 /sshd.c
parent757a38a43b0820c3fb13dfbd0ab7d8e1f5a6eee1 (diff)
- djm@cvs.openbsd.org 2008/02/13 22:38:17
[servconf.h session.c sshd.c] rekey arc4random and OpenSSL RNG in postauth child closefrom fds > 2 before shell/command execution ok markus@
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sshd.c b/sshd.c
index 345ee4315..2920b26cf 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.353 2007/12/31 15:27:04 dtucker Exp $ */ 1/* $OpenBSD: sshd.c,v 1.354 2008/02/13 22:38:17 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -585,11 +585,12 @@ privsep_preauth_child(void)
585{ 585{
586 u_int32_t rnd[256]; 586 u_int32_t rnd[256];
587 gid_t gidset[1]; 587 gid_t gidset[1];
588 int i; 588 u_int i;
589 589
590 /* Enable challenge-response authentication for privilege separation */ 590 /* Enable challenge-response authentication for privilege separation */
591 privsep_challenge_enable(); 591 privsep_challenge_enable();
592 592
593 arc4random_stir();
593 for (i = 0; i < 256; i++) 594 for (i = 0; i < 256; i++)
594 rnd[i] = arc4random(); 595 rnd[i] = arc4random();
595 RAND_seed(rnd, sizeof(rnd)); 596 RAND_seed(rnd, sizeof(rnd));
@@ -664,6 +665,9 @@ privsep_preauth(Authctxt *authctxt)
664static void 665static void
665privsep_postauth(Authctxt *authctxt) 666privsep_postauth(Authctxt *authctxt)
666{ 667{
668 u_int32_t rnd[256];
669 u_int i;
670
667#ifdef DISABLE_FD_PASSING 671#ifdef DISABLE_FD_PASSING
668 if (1) { 672 if (1) {
669#else 673#else
@@ -695,6 +699,11 @@ privsep_postauth(Authctxt *authctxt)
695 /* Demote the private keys to public keys. */ 699 /* Demote the private keys to public keys. */
696 demote_sensitive_data(); 700 demote_sensitive_data();
697 701
702 arc4random_stir();
703 for (i = 0; i < 256; i++)
704 rnd[i] = arc4random();
705 RAND_seed(rnd, sizeof(rnd));
706
698 /* Drop privileges */ 707 /* Drop privileges */
699 do_setusercontext(authctxt->pw); 708 do_setusercontext(authctxt->pw);
700 709