vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/entropy.c.entropy openssh-7.4p1/entropy.c
Jakub Jelen 6cf9b8
--- openssh-7.4p1/entropy.c.entropy	2016-12-19 05:59:41.000000000 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/entropy.c	2016-12-23 18:34:27.769753570 +0100
Jakub Jelen 6cf9b8
@@ -229,6 +229,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
 }
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/openbsd-compat/Makefile.in.entropy openssh-7.4p1/openbsd-compat/Makefile.in
Jakub Jelen 6cf9b8
--- openssh-7.4p1/openbsd-compat/Makefile.in.entropy	2016-12-23 18:34:53.715762155 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/openbsd-compat/Makefile.in	2016-12-23 18:35:15.890769493 +0100
Jakub Jelen 6cf9b8
@@ -20,7 +20,7 @@ OPENBSD=base64.o basename.o bcrypt_pbkdf
Jan F. Chadima 69dd72
 
Jakub Jelen 5b55d0
 COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-err.o bsd-getpagesize.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-malloc.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xcrypt.o kludge-fd_set.o
Jan F. Chadima 69dd72
 
Petr Lautrbach 94c6f8
-PORTS=port-aix.o port-irix.o port-linux.o port-linux-sshd.o port-solaris.o port-tun.o port-uw.o
Petr Lautrbach 94c6f8
+PORTS=port-aix.o port-irix.o port-linux.o port-linux-sshd.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 $<
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/openbsd-compat/port-linux.h.entropy openssh-7.4p1/openbsd-compat/port-linux.h
Jakub Jelen 6cf9b8
--- openssh-7.4p1/openbsd-compat/port-linux.h.entropy	2016-12-23 18:34:27.747753563 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/openbsd-compat/port-linux.h	2016-12-23 18:34:27.769753570 +0100
Jakub Jelen 6cf9b8
@@ -34,4 +34,6 @@ void oom_adjust_restore(void);
Jakub Jelen 6cf9b8
 void oom_adjust_setup(void);
Jakub Jelen 6cf9b8
 #endif
Jakub Jelen 6cf9b8
 
Jakub Jelen 6cf9b8
+void linux_seed(void);
Jakub Jelen 6cf9b8
+
Jakub Jelen 6cf9b8
 #endif /* ! _PORT_LINUX_H */
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/openbsd-compat/port-linux-prng.c.entropy openssh-7.4p1/openbsd-compat/port-linux-prng.c
Jakub Jelen 6cf9b8
--- openssh-7.4p1/openbsd-compat/port-linux-prng.c.entropy	2016-12-23 18:34:27.769753570 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/openbsd-compat/port-linux-prng.c	2016-12-23 18:34:27.769753570 +0100
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"
Petr Lautrbach 190035
+#include "misc.h"      /* servconf.h needs misc.h for struct ForwardOptions */
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
+	char *env = getenv("SSH_USE_STRONG_RNG");
Jan F. Chadima 69dd72
+	char *random = "/dev/random";
Petr Lautrbach 190035
+	size_t len, ienv, randlen = 14;
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
+	if (!env || !strcmp(env, "0"))
Jan F. Chadima 69dd72
+		random = "/dev/urandom";
Petr Lautrbach 9acec0
+	else if ((ienv = atoi(env)) > randlen)
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
+}
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/ssh.1.entropy openssh-7.4p1/ssh.1
Jakub Jelen 6cf9b8
--- openssh-7.4p1/ssh.1.entropy	2016-12-23 18:34:27.754753565 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/ssh.1	2016-12-23 18:34:27.770753571 +0100
Jakub Jelen 6cf9b8
@@ -1441,6 +1441,23 @@ For more information, see the
Jakub Jelen 6cf9b8
 .Cm PermitUserEnvironment
Jakub Jelen 6cf9b8
 option in
Jakub Jelen 6cf9b8
 .Xr sshd_config 5 .
Jakub Jelen 6cf9b8
+.Sh ENVIRONMENT
Jakub Jelen 6cf9b8
+.Bl -tag -width Ds -compact
Jakub Jelen 6cf9b8
+.It Ev SSH_USE_STRONG_RNG
Jakub Jelen 6cf9b8
+The reseeding of the OpenSSL random generator is usually done from
Jakub Jelen 6cf9b8
+.Cm /dev/urandom .
Jakub Jelen 6cf9b8
+If the 
Jakub Jelen 6cf9b8
+.Cm SSH_USE_STRONG_RNG
Jakub Jelen 6cf9b8
+environment variable is set to value other than
Jakub Jelen 6cf9b8
+.Cm 0
Jakub Jelen 6cf9b8
+the OpenSSL random generator is reseeded from
Jakub Jelen 6cf9b8
+.Cm /dev/random .
Jakub Jelen 6cf9b8
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jakub Jelen 6cf9b8
+Minimum is 14 bytes.
Jakub Jelen 6cf9b8
+This setting is not recommended on the computers without the hardware
Jakub Jelen 6cf9b8
+random generator because insufficient entropy causes the connection to 
Jakub Jelen 6cf9b8
+be blocked until enough entropy is available.
Jakub Jelen 6cf9b8
+.El
Jakub Jelen 6cf9b8
 .Sh FILES
Jakub Jelen 6cf9b8
 .Bl -tag -width Ds -compact
Jakub Jelen 6cf9b8
 .It Pa ~/.rhosts
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/ssh-add.1.entropy openssh-7.4p1/ssh-add.1
Jakub Jelen 6cf9b8
--- openssh-7.4p1/ssh-add.1.entropy	2016-12-19 05:59:41.000000000 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/ssh-add.1	2016-12-23 18:34:27.770753571 +0100
Jakub Jelen 6cf9b8
@@ -171,6 +171,20 @@ to make this work.)
Petr Lautrbach 251c8d
 Identifies the path of a
Petr Lautrbach 65ba94
 .Ux Ns -domain
Petr Lautrbach 65ba94
 socket used to communicate with the agent.
Petr Lautrbach 65ba94
+.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. 
Petr Lautrbach 9acec0
+Minimum is 14 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.
Petr Lautrbach 251c8d
 .El
Petr Lautrbach 65ba94
 .Sh FILES
Petr Lautrbach 65ba94
 .Bl -tag -width Ds
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/ssh-agent.1.entropy openssh-7.4p1/ssh-agent.1
Jakub Jelen 6cf9b8
--- openssh-7.4p1/ssh-agent.1.entropy	2016-12-19 05:59:41.000000000 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/ssh-agent.1	2016-12-23 18:34:27.770753571 +0100
Jakub Jelen 6cf9b8
@@ -214,6 +214,24 @@ sockets used to contain the connection t
Petr Lautrbach 65ba94
 These sockets should only be readable by the owner.
Petr Lautrbach 65ba94
 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. 
Petr Lautrbach 9acec0
+Minimum is 14 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 ,
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/sshd.8.entropy openssh-7.4p1/sshd.8
Jakub Jelen 6cf9b8
--- openssh-7.4p1/sshd.8.entropy	2016-12-23 18:34:27.755753566 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/sshd.8	2016-12-23 18:34:27.770753571 +0100
Jakub Jelen 6cf9b8
@@ -920,6 +920,24 @@ concurrently for different ports, this c
Jakub Jelen 6cf9b8
 started last).
Jakub Jelen 6cf9b8
 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. 
Petr Lautrbach 9acec0
+Minimum is 14 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
Jakub Jelen 6cf9b8
 .Sh IPV6
Jakub Jelen 6cf9b8
 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
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/ssh-keygen.1.entropy openssh-7.4p1/ssh-keygen.1
Jakub Jelen 6cf9b8
--- openssh-7.4p1/ssh-keygen.1.entropy	2016-12-19 05:59:41.000000000 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/ssh-keygen.1	2016-12-23 18:34:27.770753571 +0100
Jakub Jelen 6cf9b8
@@ -848,6 +848,24 @@ Contains Diffie-Hellman groups used for
Jakub Jelen 6cf9b8
 The file format is described in
Jakub Jelen 6cf9b8
 .Xr moduli 5 .
Petr Lautrbach 65ba94
 .El
Jan F. Chadima 69dd72
+.Sh ENVIRONMENT
Jan F. Chadima 69dd72
+.Bl -tag -width Ds -compact
Petr Lautrbach 65ba94
+.Pp
Petr Lautrbach 65ba94
+.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. 
Petr Lautrbach 9acec0
+Minimum is 14 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
Petr Lautrbach 65ba94
 .Sh SEE ALSO
Petr Lautrbach 65ba94
 .Xr ssh 1 ,
Jakub Jelen 6cf9b8
 .Xr ssh-add 1 ,
Jakub Jelen 6cf9b8
diff -up openssh-7.4p1/ssh-keysign.8.entropy openssh-7.4p1/ssh-keysign.8
Jakub Jelen 6cf9b8
--- openssh-7.4p1/ssh-keysign.8.entropy	2016-12-19 05:59:41.000000000 +0100
Jakub Jelen 6cf9b8
+++ openssh-7.4p1/ssh-keysign.8	2016-12-23 18:34:27.770753571 +0100
Jakub Jelen 6cf9b8
@@ -80,6 +80,24 @@ must be set-uid root if host-based authe
Jakub Jelen 6cf9b8
 If these files exist they are assumed to contain public certificate
Jakub Jelen 6cf9b8
 information corresponding with the private keys above.
Petr Lautrbach 94c6f8
 .El
Petr Lautrbach 8a29de
+.Sh ENVIRONMENT
Petr Lautrbach 8a29de
+.Bl -tag -width Ds -compact
Petr Lautrbach 94c6f8
+.Pp
Petr Lautrbach 94c6f8
+.It Pa SSH_USE_STRONG_RNG
Petr Lautrbach 8a29de
+The reseeding of the OpenSSL random generator is usually done from
Petr Lautrbach 8a29de
+.Cm /dev/urandom .
Petr Lautrbach 8a29de
+If the 
Petr Lautrbach 8a29de
+.Cm SSH_USE_STRONG_RNG
Petr Lautrbach 8a29de
+environment variable is set to value other than
Petr Lautrbach 8a29de
+.Cm 0
Petr Lautrbach 8a29de
+the OpenSSL random generator is reseeded from
Petr Lautrbach 8a29de
+.Cm /dev/random .
Petr Lautrbach 8a29de
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Petr Lautrbach 9acec0
+Minimum is 14 bytes.
Petr Lautrbach 8a29de
+This setting is not recommended on the computers without the hardware
Petr Lautrbach 8a29de
+random generator because insufficient entropy causes the connection to 
Petr Lautrbach 8a29de
+be blocked until enough entropy is available.
Petr Lautrbach 8a29de
+.El
Petr Lautrbach 94c6f8
 .Sh SEE ALSO
Jakub Jelen 6cf9b8
 .Xr ssh 1 ,
Jakub Jelen 6cf9b8
 .Xr ssh-keygen 1 ,