rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone
f09e2e
diff -up openssh-6.2p1/entropy.c.entropy openssh-6.2p1/entropy.c
f09e2e
--- openssh-6.2p1/entropy.c.entropy	2013-03-25 19:31:42.737611051 +0100
f09e2e
+++ openssh-6.2p1/entropy.c	2013-03-25 19:31:42.797611433 +0100
f09e2e
@@ -237,6 +237,9 @@ seed_rng(void)
f09e2e
 	memset(buf, '\0', sizeof(buf));
f09e2e
 
f09e2e
 #endif /* OPENSSL_PRNG_ONLY */
f09e2e
+#ifdef __linux__
f09e2e
+	linux_seed();
f09e2e
+#endif /* __linux__ */
f09e2e
 	if (RAND_status() != 1)
f09e2e
 		fatal("PRNG is not seeded");
f09e2e
 }
f09e2e
diff -up openssh-6.2p1/openbsd-compat/Makefile.in.entropy openssh-6.2p1/openbsd-compat/Makefile.in
f09e2e
--- openssh-6.2p1/openbsd-compat/Makefile.in.entropy	2013-03-25 19:31:42.798611440 +0100
f09e2e
+++ openssh-6.2p1/openbsd-compat/Makefile.in	2013-03-25 19:33:02.042116876 +0100
f09e2e
@@ -20,7 +20,7 @@ OPENBSD=base64.o basename.o bindresvport
f09e2e
 
f09e2e
 COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o
f09e2e
 
f09e2e
-PORTS=port-aix.o port-irix.o port-linux.o port-linux_part_2.o port-solaris.o port-tun.o port-uw.o
f09e2e
+PORTS=port-aix.o port-irix.o port-linux.o port-linux_part_2.o port-linux-prng.o port-solaris.o port-tun.o port-uw.o
f09e2e
 
f09e2e
 .c.o:
f09e2e
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
f09e2e
diff -up openssh-6.2p1/openbsd-compat/port-linux-prng.c.entropy openssh-6.2p1/openbsd-compat/port-linux-prng.c
f09e2e
--- openssh-6.2p1/openbsd-compat/port-linux-prng.c.entropy	2013-03-25 19:31:42.798611440 +0100
f09e2e
+++ openssh-6.2p1/openbsd-compat/port-linux-prng.c	2013-03-25 19:31:42.798611440 +0100
f09e2e
@@ -0,0 +1,59 @@
f09e2e
+/* $Id: port-linux.c,v 1.11.4.2 2011/02/04 00:43:08 djm Exp $ */
f09e2e
+
f09e2e
+/*
f09e2e
+ * Copyright (c) 2011 Jan F. Chadima <jchadima@redhat.com>
f09e2e
+ *
f09e2e
+ * Permission to use, copy, modify, and distribute this software for any
f09e2e
+ * purpose with or without fee is hereby granted, provided that the above
f09e2e
+ * copyright notice and this permission notice appear in all copies.
f09e2e
+ *
f09e2e
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
f09e2e
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
f09e2e
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
f09e2e
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
f09e2e
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
f09e2e
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
f09e2e
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
f09e2e
+ */
f09e2e
+
f09e2e
+/*
f09e2e
+ * Linux-specific portability code - prng support
f09e2e
+ */
f09e2e
+
f09e2e
+#include "includes.h"
f09e2e
+
f09e2e
+#include <errno.h>
f09e2e
+#include <stdarg.h>
f09e2e
+#include <string.h>
f09e2e
+#include <stdio.h>
f09e2e
+#include <openssl/rand.h>
f09e2e
+
f09e2e
+#include "log.h"
f09e2e
+#include "xmalloc.h"
f09e2e
+#include "servconf.h"
f09e2e
+#include "port-linux.h"
f09e2e
+#include "key.h"
f09e2e
+#include "hostfile.h"
f09e2e
+#include "auth.h"
f09e2e
+
f09e2e
+void
f09e2e
+linux_seed(void)
f09e2e
+{
f09e2e
+	int len;
f09e2e
+	char *env = getenv("SSH_USE_STRONG_RNG");
f09e2e
+	char *random = "/dev/random";
f09e2e
+	size_t ienv, randlen = 14;
f09e2e
+
f09e2e
+	if (!env || !strcmp(env, "0"))
f09e2e
+		random = "/dev/urandom";
f09e2e
+	else if ((ienv = atoi(env)) > randlen)
f09e2e
+		randlen = ienv;
f09e2e
+
f09e2e
+	errno = 0;
f09e2e
+	if ((len = RAND_load_file(random, randlen)) != randlen) {
f09e2e
+		if (errno)
f09e2e
+			fatal ("cannot read from %s, %s", random, strerror(errno));
f09e2e
+		else
f09e2e
+			fatal ("EOF reading %s", random);
f09e2e
+	}
f09e2e
+}
f09e2e
diff -up openssh-6.2p1/ssh-add.0.entropy openssh-6.2p1/ssh-add.0
f09e2e
--- openssh-6.2p1/ssh-add.0.entropy	2013-03-22 00:38:29.000000000 +0100
f09e2e
+++ openssh-6.2p1/ssh-add.0	2013-03-25 19:31:42.799611446 +0100
f09e2e
@@ -82,6 +82,16 @@ ENVIRONMENT
f09e2e
              Identifies the path of a UNIX-domain socket used to communicate
f09e2e
              with the agent.
f09e2e
 
f09e2e
+     SSH_USE_STRONG_RNG
f09e2e
+             The reseeding of the OpenSSL random generator is usually done
f09e2e
+             from /dev/urandom.  If the SSH_USE_STRONG_RNG environment vari-
f09e2e
+             able is set to value other than 0 the OpenSSL random generator is
f09e2e
+             reseeded from /dev/random.  The number of bytes read is defined
f09e2e
+             by the SSH_USE_STRONG_RNG value.  Minimum is 14 bytes.  This set-
f09e2e
+             ting is not recommended on the computers without the hardware
f09e2e
+             random generator because insufficient entropy causes the connec-
f09e2e
+             tion to be blocked until enough entropy is available.
f09e2e
+
f09e2e
 FILES
f09e2e
      ~/.ssh/identity
f09e2e
              Contains the protocol version 1 RSA authentication identity of
f09e2e
diff -up openssh-6.2p1/ssh-add.1.entropy openssh-6.2p1/ssh-add.1
f09e2e
--- openssh-6.2p1/ssh-add.1.entropy	2012-12-07 03:06:13.000000000 +0100
f09e2e
+++ openssh-6.2p1/ssh-add.1	2013-03-25 19:31:42.799611446 +0100
f09e2e
@@ -160,6 +160,20 @@ to make this work.)
f09e2e
 Identifies the path of a
f09e2e
 .Ux Ns -domain
f09e2e
 socket used to communicate with the agent.
f09e2e
+.It Ev SSH_USE_STRONG_RNG
f09e2e
+The reseeding of the OpenSSL random generator is usually done from
f09e2e
+.Cm /dev/urandom .
f09e2e
+If the 
f09e2e
+.Cm SSH_USE_STRONG_RNG
f09e2e
+environment variable is set to value other than
f09e2e
+.Cm 0
f09e2e
+the OpenSSL random generator is reseeded from
f09e2e
+.Cm /dev/random .
f09e2e
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
f09e2e
+Minimum is 14 bytes.
f09e2e
+This setting is not recommended on the computers without the hardware
f09e2e
+random generator because insufficient entropy causes the connection to 
f09e2e
+be blocked until enough entropy is available.
f09e2e
 .El
f09e2e
 .Sh FILES
f09e2e
 .Bl -tag -width Ds
f09e2e
diff -up openssh-6.2p1/ssh-agent.1.entropy openssh-6.2p1/ssh-agent.1
f09e2e
--- openssh-6.2p1/ssh-agent.1.entropy	2010-12-01 01:50:35.000000000 +0100
f09e2e
+++ openssh-6.2p1/ssh-agent.1	2013-03-25 19:31:42.800611452 +0100
f09e2e
@@ -198,6 +198,24 @@ sockets used to contain the connection t
f09e2e
 These sockets should only be readable by the owner.
f09e2e
 The sockets should get automatically removed when the agent exits.
f09e2e
 .El
f09e2e
+.Sh ENVIRONMENT
f09e2e
+.Bl -tag -width Ds -compact
f09e2e
+.Pp
f09e2e
+.It Pa SSH_USE_STRONG_RNG
f09e2e
+The reseeding of the OpenSSL random generator is usually done from
f09e2e
+.Cm /dev/urandom .
f09e2e
+If the 
f09e2e
+.Cm SSH_USE_STRONG_RNG
f09e2e
+environment variable is set to value other than
f09e2e
+.Cm 0
f09e2e
+the OpenSSL random generator is reseeded from
f09e2e
+.Cm /dev/random .
f09e2e
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
f09e2e
+Minimum is 14 bytes.
f09e2e
+This setting is not recommended on the computers without the hardware
f09e2e
+random generator because insufficient entropy causes the connection to 
f09e2e
+be blocked until enough entropy is available.
f09e2e
+.El
f09e2e
 .Sh SEE ALSO
f09e2e
 .Xr ssh 1 ,
f09e2e
 .Xr ssh-add 1 ,
f09e2e
diff -up openssh-6.2p1/sshd.8.entropy openssh-6.2p1/sshd.8
f09e2e
--- openssh-6.2p1/sshd.8.entropy	2013-03-25 19:31:42.752611146 +0100
f09e2e
+++ openssh-6.2p1/sshd.8	2013-03-25 19:31:42.800611452 +0100
f09e2e
@@ -945,6 +945,24 @@ concurrently for different ports, this c
f09e2e
 started last).
f09e2e
 The content of this file is not sensitive; it can be world-readable.
f09e2e
 .El
f09e2e
+.Sh ENVIRONMENT
f09e2e
+.Bl -tag -width Ds -compact
f09e2e
+.Pp
f09e2e
+.It Pa SSH_USE_STRONG_RNG
f09e2e
+The reseeding of the OpenSSL random generator is usually done from
f09e2e
+.Cm /dev/urandom .
f09e2e
+If the 
f09e2e
+.Cm SSH_USE_STRONG_RNG
f09e2e
+environment variable is set to value other than
f09e2e
+.Cm 0
f09e2e
+the OpenSSL random generator is reseeded from
f09e2e
+.Cm /dev/random .
f09e2e
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
f09e2e
+Minimum is 14 bytes.
f09e2e
+This setting is not recommended on the computers without the hardware
f09e2e
+random generator because insufficient entropy causes the connection to 
f09e2e
+be blocked until enough entropy is available.
f09e2e
+.El
f09e2e
 .Sh IPV6
f09e2e
 IPv6 address can be used everywhere where IPv4 address. In all entries must be the IPv6 address enclosed in square brackets. Note: The square brackets are metacharacters for the shell and must be escaped in shell.
f09e2e
 .Sh SEE ALSO
f09e2e
diff -up openssh-6.2p1/ssh-keygen.1.entropy openssh-6.2p1/ssh-keygen.1
f09e2e
--- openssh-6.2p1/ssh-keygen.1.entropy	2013-01-20 12:35:06.000000000 +0100
f09e2e
+++ openssh-6.2p1/ssh-keygen.1	2013-03-25 19:31:42.801611459 +0100
f09e2e
@@ -806,6 +806,24 @@ Contains Diffie-Hellman groups used for
f09e2e
 The file format is described in
f09e2e
 .Xr moduli 5 .
f09e2e
 .El
f09e2e
+.Sh ENVIRONMENT
f09e2e
+.Bl -tag -width Ds -compact
f09e2e
+.Pp
f09e2e
+.It Pa SSH_USE_STRONG_RNG
f09e2e
+The reseeding of the OpenSSL random generator is usually done from
f09e2e
+.Cm /dev/urandom .
f09e2e
+If the 
f09e2e
+.Cm SSH_USE_STRONG_RNG
f09e2e
+environment variable is set to value other than
f09e2e
+.Cm 0
f09e2e
+the OpenSSL random generator is reseeded from
f09e2e
+.Cm /dev/random .
f09e2e
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
f09e2e
+Minimum is 14 bytes.
f09e2e
+This setting is not recommended on the computers without the hardware
f09e2e
+random generator because insufficient entropy causes the connection to 
f09e2e
+be blocked until enough entropy is available.
f09e2e
+.El
f09e2e
 .Sh SEE ALSO
f09e2e
 .Xr ssh 1 ,
f09e2e
 .Xr ssh-add 1 ,
f09e2e
diff -up openssh-6.2p1/ssh-keysign.8.entropy openssh-6.2p1/ssh-keysign.8
f09e2e
--- openssh-6.2p1/ssh-keysign.8.entropy	2010-08-31 14:41:14.000000000 +0200
f09e2e
+++ openssh-6.2p1/ssh-keysign.8	2013-03-25 19:31:42.801611459 +0100
f09e2e
@@ -78,6 +78,24 @@ must be set-uid root if host-based authe
f09e2e
 If these files exist they are assumed to contain public certificate
f09e2e
 information corresponding with the private keys above.
f09e2e
 .El
f09e2e
+.Sh ENVIRONMENT
f09e2e
+.Bl -tag -width Ds -compact
f09e2e
+.Pp
f09e2e
+.It Pa SSH_USE_STRONG_RNG
f09e2e
+The reseeding of the OpenSSL random generator is usually done from
f09e2e
+.Cm /dev/urandom .
f09e2e
+If the 
f09e2e
+.Cm SSH_USE_STRONG_RNG
f09e2e
+environment variable is set to value other than
f09e2e
+.Cm 0
f09e2e
+the OpenSSL random generator is reseeded from
f09e2e
+.Cm /dev/random .
f09e2e
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
f09e2e
+Minimum is 14 bytes.
f09e2e
+This setting is not recommended on the computers without the hardware
f09e2e
+random generator because insufficient entropy causes the connection to 
f09e2e
+be blocked until enough entropy is available.
f09e2e
+.El
f09e2e
 .Sh SEE ALSO
f09e2e
 .Xr ssh 1 ,
f09e2e
 .Xr ssh-keygen 1 ,
f09e2e
diff -up openssh-6.2p1/ssh.1.entropy openssh-6.2p1/ssh.1
f09e2e
--- openssh-6.2p1/ssh.1.entropy	2013-03-25 19:31:42.752611146 +0100
f09e2e
+++ openssh-6.2p1/ssh.1	2013-03-25 19:31:42.799611446 +0100
f09e2e
@@ -1277,6 +1277,23 @@ For more information, see the
f09e2e
 .Cm PermitUserEnvironment
f09e2e
 option in
f09e2e
 .Xr sshd_config 5 .
f09e2e
+.Sh ENVIRONMENT
f09e2e
+.Bl -tag -width Ds -compact
f09e2e
+.It Ev SSH_USE_STRONG_RNG
f09e2e
+The reseeding of the OpenSSL random generator is usually done from
f09e2e
+.Cm /dev/urandom .
f09e2e
+If the 
f09e2e
+.Cm SSH_USE_STRONG_RNG
f09e2e
+environment variable is set to value other than
f09e2e
+.Cm 0
f09e2e
+the OpenSSL random generator is reseeded from
f09e2e
+.Cm /dev/random .
f09e2e
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
f09e2e
+Minimum is 14 bytes.
f09e2e
+This setting is not recommended on the computers without the hardware
f09e2e
+random generator because insufficient entropy causes the connection to 
f09e2e
+be blocked until enough entropy is available.
f09e2e
+.El
f09e2e
 .Sh FILES
f09e2e
 .Bl -tag -width Ds -compact
f09e2e
 .It Pa ~/.rhosts