vishalmishra434 / rpms / openssh

Forked from rpms/openssh 3 months ago
Clone
Jan F 3657ad
diff -up openssh-5.8p1/entropy.c.entropy openssh-5.8p1/entropy.c
Jan F 3657ad
--- openssh-5.8p1/entropy.c.entropy	2011-01-13 11:05:29.000000000 +0100
Jan F 8ecc9b
+++ openssh-5.8p1/entropy.c	2011-04-01 10:23:58.318648953 +0200
Jan F 8ecc9b
@@ -50,6 +50,7 @@
Jan F 8ecc9b
 #include "pathnames.h"
Jan F 8ecc9b
 #include "log.h"
Jan F 8ecc9b
 #include "buffer.h"
Jan F 8ecc9b
+#include "openbsd-compat/port-linux.h"
Jan F 8ecc9b
 
Jan F 8ecc9b
 /*
Jan F 8ecc9b
  * Portable OpenSSH PRNG seeding:
Jan F 8ecc9b
@@ -144,6 +145,9 @@ seed_rng(void)
Jan F 3657ad
 	memset(buf, '\0', sizeof(buf));
Jan F 3657ad
 
Jan F 3657ad
 #endif /* OPENSSL_PRNG_ONLY */
Jan F 3657ad
+#ifdef __linux__
Jan F 3657ad
+	linux_seed();
Jan F 3657ad
+#endif /* __linux__ */
Jan F 3657ad
 	if (RAND_status() != 1)
Jan F 3657ad
 		fatal("PRNG is not seeded");
Jan F 3657ad
 }
Jan F 3657ad
diff -up openssh-5.8p1/openbsd-compat/Makefile.in.entropy openssh-5.8p1/openbsd-compat/Makefile.in
Jan F 3657ad
--- openssh-5.8p1/openbsd-compat/Makefile.in.entropy	2010-10-07 13:19:24.000000000 +0200
Jan F 8ecc9b
+++ openssh-5.8p1/openbsd-compat/Makefile.in	2011-04-01 10:21:38.251648364 +0200
Jan F 3657ad
@@ -20,7 +20,7 @@ OPENBSD=base64.o basename.o bindresvport
Jan F 3657ad
 
Jan F 3657ad
 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 3657ad
 
Jan F 3657ad
-PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o
Jan F 3657ad
+PORTS=port-aix.o port-irix.o port-linux.o port-linux-prng.o port-solaris.o port-tun.o port-uw.o
Jan F 3657ad
 
Jan F 3657ad
 .c.o:
Jan F 3657ad
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
Jan F 8ecc9b
diff -up openssh-5.8p1/openbsd-compat/port-linux.h.entropy openssh-5.8p1/openbsd-compat/port-linux.h
Jan F 8ecc9b
--- openssh-5.8p1/openbsd-compat/port-linux.h.entropy	2011-04-01 10:22:10.165648950 +0200
Jan F 8ecc9b
+++ openssh-5.8p1/openbsd-compat/port-linux.h	2011-04-01 10:22:36.965648719 +0200
Jan F 8ecc9b
@@ -19,6 +19,8 @@
Jan F 8ecc9b
 #ifndef _PORT_LINUX_H
Jan F 8ecc9b
 #define _PORT_LINUX_H
Jan F 8ecc9b
 
Jan F 8ecc9b
+void linux_seed(void);
Jan F 8ecc9b
+
Jan F 8ecc9b
 #ifdef WITH_SELINUX
Jan F 8ecc9b
 int ssh_selinux_enabled(void);
Jan F 8ecc9b
 void ssh_selinux_setup_pty(char *, const char *);
Jan F 3657ad
diff -up openssh-5.8p1/openbsd-compat/port-linux-prng.c.entropy openssh-5.8p1/openbsd-compat/port-linux-prng.c
Jan F 8ecc9b
--- openssh-5.8p1/openbsd-compat/port-linux-prng.c.entropy	2011-04-01 10:21:38.302648133 +0200
Jan F 8ecc9b
+++ openssh-5.8p1/openbsd-compat/port-linux-prng.c	2011-04-01 10:21:38.311648282 +0200
Jan F 8ecc9b
@@ -0,0 +1,56 @@
Jan F 3657ad
+/* $Id: port-linux.c,v 1.11.4.2 2011/02/04 00:43:08 djm Exp $ */
Jan F 3657ad
+
Jan F 3657ad
+/*
Jan F 11896a
+ * Copyright (c) 2011 Jan F. Chadima <jchadima@redhat.com>
Jan F 3657ad
+ *
Jan F 3657ad
+ * Permission to use, copy, modify, and distribute this software for any
Jan F 3657ad
+ * purpose with or without fee is hereby granted, provided that the above
Jan F 3657ad
+ * copyright notice and this permission notice appear in all copies.
Jan F 3657ad
+ *
Jan F 3657ad
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
Jan F 3657ad
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
Jan F 3657ad
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
Jan F 3657ad
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
Jan F 3657ad
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
Jan F 3657ad
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
Jan F 3657ad
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Jan F 3657ad
+ */
Jan F 3657ad
+
Jan F 3657ad
+/*
Jan F 3657ad
+ * Linux-specific portability code - prng support
Jan F 3657ad
+ */
Jan F 3657ad
+
Jan F 3657ad
+#include "includes.h"
Jan F 3657ad
+
Jan F 3657ad
+#include <errno.h>
Jan F 3657ad
+#include <stdarg.h>
Jan F 3657ad
+#include <string.h>
Jan F 3657ad
+#include <stdio.h>
Jan F 8ecc9b
+#include <openssl/rand.h>
Jan F 3657ad
+
Jan F 3657ad
+#include "log.h"
Jan F 3657ad
+#include "xmalloc.h"
Jan F 3657ad
+#include "servconf.h"
Jan F 3657ad
+#include "port-linux.h"
Jan F 3657ad
+#include "key.h"
Jan F 3657ad
+#include "hostfile.h"
Jan F 3657ad
+#include "auth.h"
Jan F 3657ad
+
Jan F 3657ad
+void
Jan F 3657ad
+linux_seed(void)
Jan F 3657ad
+{
Jan F 3657ad
+	int len;
Jan F 3657ad
+	char *env = getenv("SSH_USE_STRONG_RNG");
Jan F 3657ad
+	char *random = "/dev/urandom";
Jan F 3657ad
+
Jan F 3657ad
+	if (env && !strcmp(env, "1"))
Jan F 3657ad
+		random = "/dev/random";
Jan F 3657ad
+
Jan F 3657ad
+	errno = 0;
Jan F 3657ad
+	if ((len = RAND_load_file(random, 48)) != 48) {
Jan F 3657ad
+		if (errno)
Jan F 3657ad
+			fatal ("cannot read from %s, %s", random, strerror(errno));
Jan F 3657ad
+		else
Jan F 3657ad
+			fatal ("EOF reading %s", random);
Jan F 3657ad
+	}
Jan F 3657ad
+}
Jan F 0553df
diff -up openssh-5.8p1/ssh.1.entropy openssh-5.8p1/ssh.1
Jan F 0553df
--- openssh-5.8p1/ssh.1.entropy	2010-11-20 05:21:03.000000000 +0100
Jan F 8ecc9b
+++ openssh-5.8p1/ssh.1	2011-04-01 10:21:38.352648197 +0200
Jan F 7317c8
@@ -1250,6 +1250,17 @@ For more information, see the
Jan F 0553df
 .Cm PermitUserEnvironment
Jan F 0553df
 option in
Jan F 0553df
 .Xr sshd_config 5 .
Jan F 0553df
+.It Ev SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F 0553df
+is set to
Jan F 0553df
+.Cm 1 ,
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F 7317c8
+random generator. Insuifficient entropy causes the blocking conection.
Jan F 0553df
 .Sh FILES
Jan F 0553df
 .Bl -tag -width Ds -compact
Jan F 0553df
 .It Pa ~/.rhosts
Jan F 0553df
diff -up openssh-5.8p1/ssh-add.1.entropy openssh-5.8p1/ssh-add.1
Jan F 0553df
--- openssh-5.8p1/ssh-add.1.entropy	2010-11-05 00:20:14.000000000 +0100
Jan F 8ecc9b
+++ openssh-5.8p1/ssh-add.1	2011-04-01 10:21:38.416648713 +0200
Jan F 7317c8
@@ -157,6 +157,17 @@ to make this work.)
Jan F 0553df
 Identifies the path of a
Jan F 0553df
 .Ux Ns -domain
Jan F 0553df
 socket used to communicate with the agent.
Jan F 0553df
+.It Ev SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F 0553df
+is set to
Jan F 0553df
+.Cm 1 ,
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F 7317c8
+random generator. Insuifficient entropy causes the blocking conection.
Jan F 0553df
 .El
Jan F 0553df
 .Sh FILES
Jan F 0553df
 .Bl -tag -width Ds
Jan F 0553df
diff -up openssh-5.8p1/ssh-agent.1.entropy openssh-5.8p1/ssh-agent.1
Jan F 0553df
--- openssh-5.8p1/ssh-agent.1.entropy	2010-12-01 01:50:35.000000000 +0100
Jan F 8ecc9b
+++ openssh-5.8p1/ssh-agent.1	2011-04-01 10:21:38.459648714 +0200
Jan F 7317c8
@@ -198,6 +198,20 @@ sockets used to contain the connection t
Jan F 0553df
 These sockets should only be readable by the owner.
Jan F 0553df
 The sockets should get automatically removed when the agent exits.
Jan F 0553df
 .El
Jan F 0553df
+.Sh ENVIRONMENT
Jan F 0553df
+.Bl -tag -width Ds -compact
Jan F 0553df
+.Pp
Jan F 0553df
+.It Pa SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F 0553df
+is set to
Jan F 0553df
+.Cm 1 ,
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F 7317c8
+random generator. Insuifficient entropy causes the blocking conection.
Jan F 0553df
 .Sh SEE ALSO
Jan F 0553df
 .Xr ssh 1 ,
Jan F 0553df
 .Xr ssh-add 1 ,
Jan F 0553df
diff -up openssh-5.8p1/sshd.8.entropy openssh-5.8p1/sshd.8
Jan F 0553df
--- openssh-5.8p1/sshd.8.entropy	2010-11-05 00:20:14.000000000 +0100
Jan F 8ecc9b
+++ openssh-5.8p1/sshd.8	2011-04-01 10:21:38.505648778 +0200
Jan F 7317c8
@@ -937,6 +937,20 @@ concurrently for different ports, this c
Jan F 0553df
 started last).
Jan F 0553df
 The content of this file is not sensitive; it can be world-readable.
Jan F 0553df
 .El
Jan F 0553df
+.Sh ENVIRONMENT
Jan F 0553df
+.Bl -tag -width Ds -compact
Jan F 0553df
+.Pp
Jan F 0553df
+.It Pa SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F 0553df
+is set to
Jan F 0553df
+.Cm 1 ,
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F 7317c8
+random generator. Insuifficient entropy causes the blocking conection.
Jan F 0553df
 .Sh SEE ALSO
Jan F 0553df
 .Xr scp 1 ,
Jan F 0553df
 .Xr sftp 1 ,
Jan F 0553df
diff -up openssh-5.8p1/ssh-keygen.1.entropy openssh-5.8p1/ssh-keygen.1
Jan F 0553df
--- openssh-5.8p1/ssh-keygen.1.entropy	2010-11-05 00:20:14.000000000 +0100
Jan F 8ecc9b
+++ openssh-5.8p1/ssh-keygen.1	2011-04-01 10:21:38.554648691 +0200
Jan F 7317c8
@@ -655,6 +655,20 @@ Contains Diffie-Hellman groups used for 
Jan F 0553df
 The file format is described in
Jan F 0553df
 .Xr moduli 5 .
Jan F 0553df
 .El
Jan F 0553df
+.Sh ENVIRONMENT
Jan F 0553df
+.Bl -tag -width Ds -compact
Jan F 0553df
+.Pp
Jan F 0553df
+.It Pa SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F 0553df
+is set to
Jan F 0553df
+.Cm 1 ,
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F 7317c8
+random generator. Insuifficient entropy causes the blocking conection.
Jan F 0553df
 .Sh SEE ALSO
Jan F 0553df
 .Xr ssh 1 ,
Jan F 0553df
 .Xr ssh-add 1 ,
Jan F 0553df
diff -up openssh-5.8p1/ssh-keysign.8.entropy openssh-5.8p1/ssh-keysign.8
Jan F 0553df
--- openssh-5.8p1/ssh-keysign.8.entropy	2010-08-31 14:41:14.000000000 +0200
Jan F 8ecc9b
+++ openssh-5.8p1/ssh-keysign.8	2011-04-01 10:21:38.606648660 +0200
Jan F 7317c8
@@ -78,6 +78,20 @@ must be set-uid root if host-based authe
Jan F 0553df
 If these files exist they are assumed to contain public certificate
Jan F 0553df
 information corresponding with the private keys above.
Jan F 0553df
 .El
Jan F 0553df
+.Sh ENVIRONMENT
Jan F 0553df
+.Bl -tag -width Ds -compact
Jan F 0553df
+.Pp
Jan F 0553df
+.It Pa SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F 0553df
+is set to
Jan F 0553df
+.Cm 1 ,
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F 7317c8
+random generator. Insuifficient entropy causes the blocking conection.
Jan F 0553df
 .Sh SEE ALSO
Jan F 0553df
 .Xr ssh 1 ,
Jan F 0553df
 .Xr ssh-keygen 1 ,