vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/entropy.c.entropy openssh-5.9p0/entropy.c
Jan F. Chadima 69dd72
--- openssh-5.9p0/entropy.c.entropy	2011-08-31 13:20:59.660150441 +0200
Jan F. Chadima 69dd72
+++ openssh-5.9p0/entropy.c	2011-08-31 13:21:05.072024970 +0200
Jan F. Chadima 69dd72
@@ -232,6 +232,9 @@ seed_rng(void)
Jan F. Chadima 69dd72
 	memset(buf, '\0', sizeof(buf));
Jan F. Chadima 69dd72
 
Jan F. Chadima 69dd72
 #endif /* OPENSSL_PRNG_ONLY */
Jan F. Chadima 69dd72
+#ifdef __linux__
Jan F. Chadima 69dd72
+	linux_seed();
Jan F. Chadima 69dd72
+#endif /* __linux__ */
Jan F. Chadima 69dd72
 	if (RAND_status() != 1)
Jan F. Chadima 69dd72
 		fatal("PRNG is not seeded");
Jan F. Chadima 69dd72
 }
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/openbsd-compat/Makefile.in.entropy openssh-5.9p0/openbsd-compat/Makefile.in
Jan F. Chadima 69dd72
--- openssh-5.9p0/openbsd-compat/Makefile.in.entropy	2011-08-31 13:20:54.000000000 +0200
Jan F. Chadima 69dd72
+++ openssh-5.9p0/openbsd-compat/Makefile.in	2011-08-31 13:44:25.138151565 +0200
Jan F. Chadima 69dd72
@@ -20,7 +20,7 @@ OPENBSD=base64.o basename.o bindresvport
Jan F. Chadima 69dd72
 
Jan F. Chadima 69dd72
 COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o
Jan F. Chadima 69dd72
 
Jan F. Chadima 69dd72
-PORTS=port-aix.o port-irix.o port-linux.o port-linux_part_2.o port-solaris.o port-tun.o port-uw.o
Jan F. Chadima 69dd72
+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
Jan F. Chadima 69dd72
 
Jan F. Chadima 69dd72
 .c.o:
Jan F. Chadima 69dd72
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/openbsd-compat/port-linux-prng.c.entropy openssh-5.9p0/openbsd-compat/port-linux-prng.c
Jan F. Chadima 69dd72
--- openssh-5.9p0/openbsd-compat/port-linux-prng.c.entropy	2011-08-31 13:21:05.382024083 +0200
Jan F. Chadima 69dd72
+++ openssh-5.9p0/openbsd-compat/port-linux-prng.c	2011-08-31 13:21:05.386024776 +0200
Jan F. Chadima 69dd72
@@ -0,0 +1,59 @@
Jan F. Chadima 69dd72
+/* $Id: port-linux.c,v 1.11.4.2 2011/02/04 00:43:08 djm Exp $ */
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+/*
Jan F. Chadima 69dd72
+ * Copyright (c) 2011 Jan F. Chadima <jchadima@redhat.com>
Jan F. Chadima 69dd72
+ *
Jan F. Chadima 69dd72
+ * Permission to use, copy, modify, and distribute this software for any
Jan F. Chadima 69dd72
+ * purpose with or without fee is hereby granted, provided that the above
Jan F. Chadima 69dd72
+ * copyright notice and this permission notice appear in all copies.
Jan F. Chadima 69dd72
+ *
Jan F. Chadima 69dd72
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
Jan F. Chadima 69dd72
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
Jan F. Chadima 69dd72
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
Jan F. Chadima 69dd72
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
Jan F. Chadima 69dd72
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
Jan F. Chadima 69dd72
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
Jan F. Chadima 69dd72
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Jan F. Chadima 69dd72
+ */
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+/*
Jan F. Chadima 69dd72
+ * Linux-specific portability code - prng support
Jan F. Chadima 69dd72
+ */
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+#include "includes.h"
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+#include <errno.h>
Jan F. Chadima 69dd72
+#include <stdarg.h>
Jan F. Chadima 69dd72
+#include <string.h>
Jan F. Chadima 69dd72
+#include <stdio.h>
Jan F. Chadima 69dd72
+#include <openssl/rand.h>
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+#include "log.h"
Jan F. Chadima 69dd72
+#include "xmalloc.h"
Jan F. Chadima 69dd72
+#include "servconf.h"
Jan F. Chadima 69dd72
+#include "port-linux.h"
Jan F. Chadima 69dd72
+#include "key.h"
Jan F. Chadima 69dd72
+#include "hostfile.h"
Jan F. Chadima 69dd72
+#include "auth.h"
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+void
Jan F. Chadima 69dd72
+linux_seed(void)
Jan F. Chadima 69dd72
+{
Jan F. Chadima 69dd72
+	int len;
Jan F. Chadima 69dd72
+	char *env = getenv("SSH_USE_STRONG_RNG");
Jan F. Chadima 69dd72
+	char *random = "/dev/random";
Jan F. Chadima 69dd72
+	size_t ienv, randlen = 6;
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+	if (!env || !strcmp(env, "0"))
Jan F. Chadima 69dd72
+		random = "/dev/urandom";
Jan F. Chadima 69dd72
+	else if ((ienv = atoi(env)) > 6)
Jan F. Chadima 69dd72
+		randlen = ienv;
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+	errno = 0;
Jan F. Chadima 69dd72
+	if ((len = RAND_load_file(random, randlen)) != randlen) {
Jan F. Chadima 69dd72
+		if (errno)
Jan F. Chadima 69dd72
+			fatal ("cannot read from %s, %s", random, strerror(errno));
Jan F. Chadima 69dd72
+		else
Jan F. Chadima 69dd72
+			fatal ("EOF reading %s", random);
Jan F. Chadima 69dd72
+	}
Jan F. Chadima 69dd72
+}
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/ssh-add.1.entropy openssh-5.9p0/ssh-add.1
Jan F. Chadima 69dd72
--- openssh-5.9p0/ssh-add.1.entropy	2010-11-05 00:20:14.000000000 +0100
Jan F. Chadima 69dd72
+++ openssh-5.9p0/ssh-add.1	2011-08-31 13:21:05.597122030 +0200
Jan F. Chadima 69dd72
@@ -158,6 +158,20 @@ Identifies the path of a
Jan F. Chadima 69dd72
 .Ux Ns -domain
Jan F. Chadima 69dd72
 socket used to communicate with the agent.
Jan F. Chadima 69dd72
 .El
Jan F. Chadima 69dd72
+.It Ev SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+The reseeding of the OpenSSL random generator is usually done from
Jan F. Chadima 69dd72
+.Cm /dev/urandom .
Jan F. Chadima 69dd72
+If the 
Jan F. Chadima 69dd72
+.Cm SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+environment variable is set to value other than
Jan F. Chadima 69dd72
+.Cm 0
Jan F. Chadima 69dd72
+the OpenSSL random generator is reseeded from
Jan F. Chadima 69dd72
+.Cm /dev/random .
Jan F. Chadima 69dd72
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F. Chadima 69dd72
+Minimum is 6 bytes.
Jan F. Chadima 69dd72
+This setting is not recommended on the computers without the hardware
Jan F. Chadima 69dd72
+random generator because insufficient entropy causes the connection to 
Jan F. Chadima 69dd72
+be blocked until enough entropy is available.
Jan F. Chadima 69dd72
 .Sh FILES
Jan F. Chadima 69dd72
 .Bl -tag -width Ds
Jan F. Chadima 69dd72
 .It Pa ~/.ssh/identity
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/ssh-agent.1.entropy openssh-5.9p0/ssh-agent.1
Jan F. Chadima 69dd72
--- openssh-5.9p0/ssh-agent.1.entropy	2010-12-01 01:50:35.000000000 +0100
Jan F. Chadima 69dd72
+++ openssh-5.9p0/ssh-agent.1	2011-08-31 13:21:05.735150196 +0200
Jan F. Chadima 69dd72
@@ -198,6 +198,24 @@ sockets used to contain the connection t
Jan F. Chadima 69dd72
 These sockets should only be readable by the owner.
Jan F. Chadima 69dd72
 The sockets should get automatically removed when the agent exits.
Jan F. Chadima 69dd72
 .El
Jan F. Chadima 69dd72
+.Sh ENVIRONMENT
Jan F. Chadima 69dd72
+.Bl -tag -width Ds -compact
Jan F. Chadima 69dd72
+.Pp
Jan F. Chadima 69dd72
+.It Pa SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+The reseeding of the OpenSSL random generator is usually done from
Jan F. Chadima 69dd72
+.Cm /dev/urandom .
Jan F. Chadima 69dd72
+If the 
Jan F. Chadima 69dd72
+.Cm SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+environment variable is set to value other than
Jan F. Chadima 69dd72
+.Cm 0
Jan F. Chadima 69dd72
+the OpenSSL random generator is reseeded from
Jan F. Chadima 69dd72
+.Cm /dev/random .
Jan F. Chadima 69dd72
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F. Chadima 69dd72
+Minimum is 6 bytes.
Jan F. Chadima 69dd72
+This setting is not recommended on the computers without the hardware
Jan F. Chadima 69dd72
+random generator because insufficient entropy causes the connection to 
Jan F. Chadima 69dd72
+be blocked until enough entropy is available.
Jan F. Chadima 69dd72
+.El
Jan F. Chadima 69dd72
 .Sh SEE ALSO
Jan F. Chadima 69dd72
 .Xr ssh 1 ,
Jan F. Chadima 69dd72
 .Xr ssh-add 1 ,
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/ssh-keygen.1.entropy openssh-5.9p0/ssh-keygen.1
Jan F. Chadima 69dd72
--- openssh-5.9p0/ssh-keygen.1.entropy	2011-08-31 13:20:59.200212619 +0200
Jan F. Chadima 69dd72
+++ openssh-5.9p0/ssh-keygen.1	2011-08-31 13:21:06.077150115 +0200
Jan F. Chadima 69dd72
@@ -669,6 +669,24 @@ Contains Diffie-Hellman groups used for
Jan F. Chadima 69dd72
 The file format is described in
Jan F. Chadima 69dd72
 .Xr moduli 5 .
Jan F. Chadima 69dd72
 .El
Jan F. Chadima 69dd72
+.Sh ENVIRONMENT
Jan F. Chadima 69dd72
+.Bl -tag -width Ds -compact
Jan F. Chadima 69dd72
+.Pp
Jan F. Chadima 69dd72
+.It Pa SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+The reseeding of the OpenSSL random generator is usually done from
Jan F. Chadima 69dd72
+.Cm /dev/urandom .
Jan F. Chadima 69dd72
+If the 
Jan F. Chadima 69dd72
+.Cm SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+environment variable is set to value other than
Jan F. Chadima 69dd72
+.Cm 0
Jan F. Chadima 69dd72
+the OpenSSL random generator is reseeded from
Jan F. Chadima 69dd72
+.Cm /dev/random .
Jan F. Chadima 69dd72
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F. Chadima 69dd72
+Minimum is 6 bytes.
Jan F. Chadima 69dd72
+This setting is not recommended on the computers without the hardware
Jan F. Chadima 69dd72
+random generator because insufficient entropy causes the connection to 
Jan F. Chadima 69dd72
+be blocked until enough entropy is available.
Jan F. Chadima 69dd72
+.El
Jan F. Chadima 69dd72
 .Sh SEE ALSO
Jan F. Chadima 69dd72
 .Xr ssh 1 ,
Jan F. Chadima 69dd72
 .Xr ssh-add 1 ,
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/ssh-keysign.8.entropy openssh-5.9p0/ssh-keysign.8
Jan F. Chadima 69dd72
--- openssh-5.9p0/ssh-keysign.8.entropy	2010-08-31 14:41:14.000000000 +0200
Jan F. Chadima 69dd72
+++ openssh-5.9p0/ssh-keysign.8	2011-08-31 13:21:06.207024356 +0200
Jan F. Chadima 69dd72
@@ -78,6 +78,24 @@ must be set-uid root if host-based authe
Jan F. Chadima 69dd72
 If these files exist they are assumed to contain public certificate
Jan F. Chadima 69dd72
 information corresponding with the private keys above.
Jan F. Chadima 69dd72
 .El
Jan F. Chadima 69dd72
+.Sh ENVIRONMENT
Jan F. Chadima 69dd72
+.Bl -tag -width Ds -compact
Jan F. Chadima 69dd72
+.Pp
Jan F. Chadima 69dd72
+.It Pa SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+The reseeding of the OpenSSL random generator is usually done from
Jan F. Chadima 69dd72
+.Cm /dev/urandom .
Jan F. Chadima 69dd72
+If the 
Jan F. Chadima 69dd72
+.Cm SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+environment variable is set to value other than
Jan F. Chadima 69dd72
+.Cm 0
Jan F. Chadima 69dd72
+the OpenSSL random generator is reseeded from
Jan F. Chadima 69dd72
+.Cm /dev/random .
Jan F. Chadima 69dd72
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F. Chadima 69dd72
+Minimum is 6 bytes.
Jan F. Chadima 69dd72
+This setting is not recommended on the computers without the hardware
Jan F. Chadima 69dd72
+random generator because insufficient entropy causes the connection to 
Jan F. Chadima 69dd72
+be blocked until enough entropy is available.
Jan F. Chadima 69dd72
+.El
Jan F. Chadima 69dd72
 .Sh SEE ALSO
Jan F. Chadima 69dd72
 .Xr ssh 1 ,
Jan F. Chadima 69dd72
 .Xr ssh-keygen 1 ,
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/ssh.1.entropy openssh-5.9p0/ssh.1
Jan F. Chadima 69dd72
--- openssh-5.9p0/ssh.1.entropy	2011-08-31 13:21:00.835103535 +0200
Jan F. Chadima 69dd72
+++ openssh-5.9p0/ssh.1	2011-08-31 13:21:05.482032754 +0200
Jan F. Chadima 69dd72
@@ -1255,6 +1255,23 @@ For more information, see the
Jan F. Chadima 69dd72
 .Cm PermitUserEnvironment
Jan F. Chadima 69dd72
 option in
Jan F. Chadima 69dd72
 .Xr sshd_config 5 .
Jan F. Chadima 69dd72
+.Sh ENVIRONMENT
Jan F. Chadima 69dd72
+.Bl -tag -width Ds -compact
Jan F. Chadima 69dd72
+.It Ev SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+The reseeding of the OpenSSL random generator is usually done from
Jan F. Chadima 69dd72
+.Cm /dev/urandom .
Jan F. Chadima 69dd72
+If the 
Jan F. Chadima 69dd72
+.Cm SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+environment variable is set to value other than
Jan F. Chadima 69dd72
+.Cm 0
Jan F. Chadima 69dd72
+the OpenSSL random generator is reseeded from
Jan F. Chadima 69dd72
+.Cm /dev/random .
Jan F. Chadima 69dd72
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F. Chadima 69dd72
+Minimum is 6 bytes.
Jan F. Chadima 69dd72
+This setting is not recommended on the computers without the hardware
Jan F. Chadima 69dd72
+random generator because insufficient entropy causes the connection to 
Jan F. Chadima 69dd72
+be blocked until enough entropy is available.
Jan F. Chadima 69dd72
+.El
Jan F. Chadima 69dd72
 .Sh FILES
Jan F. Chadima 69dd72
 .Bl -tag -width Ds -compact
Jan F. Chadima 69dd72
 .It Pa ~/.rhosts
Jan F. Chadima 69dd72
diff -up openssh-5.9p0/sshd.8.entropy openssh-5.9p0/sshd.8
Jan F. Chadima 69dd72
--- openssh-5.9p0/sshd.8.entropy	2011-08-31 13:21:00.000000000 +0200
Jan F. Chadima 69dd72
+++ openssh-5.9p0/sshd.8	2011-08-31 13:46:27.341025537 +0200
Jan F. Chadima 69dd72
@@ -940,6 +940,24 @@ concurrently for different ports, this c
Jan F. Chadima 69dd72
 started last).
Jan F. Chadima 69dd72
 The content of this file is not sensitive; it can be world-readable.
Jan F. Chadima 69dd72
 .El
Jan F. Chadima 69dd72
+.Sh ENVIRONMENT
Jan F. Chadima 69dd72
+.Bl -tag -width Ds -compact
Jan F. Chadima 69dd72
+.Pp
Jan F. Chadima 69dd72
+.It Pa SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+The reseeding of the OpenSSL random generator is usually done from
Jan F. Chadima 69dd72
+.Cm /dev/urandom .
Jan F. Chadima 69dd72
+If the 
Jan F. Chadima 69dd72
+.Cm SSH_USE_STRONG_RNG
Jan F. Chadima 69dd72
+environment variable is set to value other than
Jan F. Chadima 69dd72
+.Cm 0
Jan F. Chadima 69dd72
+the OpenSSL random generator is reseeded from
Jan F. Chadima 69dd72
+.Cm /dev/random .
Jan F. Chadima 69dd72
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F. Chadima 69dd72
+Minimum is 6 bytes.
Jan F. Chadima 69dd72
+This setting is not recommended on the computers without the hardware
Jan F. Chadima 69dd72
+random generator because insufficient entropy causes the connection to 
Jan F. Chadima 69dd72
+be blocked until enough entropy is available.
Jan F. Chadima 69dd72
+.El
Jan F. Chadima 69dd72
 .Sh IPV6
Jan F. Chadima 69dd72
 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.
Jan F. Chadima 69dd72
 .Sh SEE ALSO