NetBSD Problem Report #10268

Received: (qmail 23509 invoked from network); 2 Jun 2000 23:33:26 -0000
Message-Id: <200006022333.SAA22065@jdarrowpiii.wheaton.edu>
Date: Fri, 2 Jun 2000 18:33:24 -0500 (CDT)
From: John.P.Darrow@wheaton.edu
Reply-To: John.P.Darrow@wheaton.edu
To: gnats-bugs@gnats.netbsd.org
Cc: John.P.Darrow@wheaton.edu
Subject: openssh 2 build, install issues
X-Send-Pr-Version: 3.95

>Number:         10268
>Category:       pkg
>Synopsis:       openssh 2 build, install issues
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 02 23:34:00 +0000 2000
>Closed-Date:    Fri Aug 11 05:39:20 +0000 2000
>Last-Modified:  Fri Aug 11 05:39:20 +0000 2000
>Originator:     John Darrow
>Release:        pkgsrc 2000-06-01
>Organization:
Computing Services, Wheaton College, Wheaton, IL
>Environment:
System: NetBSD jdarrowpiii.wheaton.edu 1.4V NetBSD 1.4V (JDARROW) #0: Tue Mar 21 15:04:28 CST 2000 jdarrow@jdarrowpiii.wheaton.edu:/var/src/sys/arch/i386/compile/JDARROW i386


>Description:
There are three issues with the build and install of openssh 2.1.0p3.
The first was noted by me, the second and third by Julian Coleman.

1) the build process fails on ELF-based platforms using RSARef, during the
configure stage.  All of the attempts to compile the OpenSSL test program
fail due to undefined references to RSA functions in
${LOCALBASE}/lib/libcrypto.so .  These functions are all defined in
${LOCALBASE}/lib/librsaref.so .  (This is a classic case of the ELF
interlibrary dependency issue...)

2) (From Julian:)
"I notice that if you install Openssh-2.1.0p3, you don't get v2 in sshd by
default as /etc/ssh_host_dsa_key isn't installed.  Is this deliberate?  If
not, see attached."

Note that the PLIST contains a line which does install /etc/ssh_host_dsa_key,
so a binary package install works fine.  It's only after a direct build from
pkgsrc that the file is missing.

3) (Also from Julian:)
"Also, sshd doesn't run unless you have :

  pseudo-device   rnd

in your kernel config.  Worth a note?"

>How-To-Repeat:
Work on building openssh.  Build fine on a.out, fail on ELF.  While working
on fixing build problems, notice tech-pkg mailing about same package.

>Fix:

Part 1:

Replace patch-aa with the following, and make makepatchsum.  In addition to
doing what the old patch-aa did, the new patch also adds an additional
attempt (after each step in the OpenSSL test) at compiling with -lrsaref.
(Note that this _shouldn't_ affect a non-RSARef OpenSSL, as the first attempt
should work fine, and thus not get to this one...)

--- configure.in.orig	Mon May 29 21:57:47 2000
+++ configure.in	Fri Jun  2 08:55:05 2000
@@ -237,6 +237,32 @@
 		if test ! -z "$found_crypto" ; then
 			break;
 		fi
+
+		LIBS="$saved_LIBS -lcrypto -lrsaref"
+
+		# Basic test to check for compatible version and correct linking
+		# *does not* test for RSA - that comes later.
+		AC_TRY_RUN(
+			[
+#include <string.h>
+#include <openssl/rand.h>
+int main(void) 
+{
+	char a[2048];
+	memset(a, 0, sizeof(a));
+	RAND_add(a, sizeof(a), sizeof(a));
+	return(RAND_status() <= 0);
+}
+			],
+			[
+				found_crypto=1
+				break;
+			], []
+		)
+
+		if test ! -z "$found_crypto" ; then
+			break;
+		fi
 	done

 	if test -z "$found_crypto" ; then
@@ -445,7 +471,9 @@
 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
 	AC_TRY_COMPILE(
 		[
+#include <sys/types.h>
 #include <netinet/in.h>
+#include <sys/socket.h>
 		],
 		[ struct sockaddr_in6 s; s.sin6_family = 0; ],
 		[ ac_cv_have_struct_sockaddr_in6="yes" ],
@@ -459,6 +487,7 @@
 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
 	AC_TRY_COMPILE(
 		[
+#include <sys/types.h>
 #include <netinet/in.h>
 		],
 		[ struct in6_addr s; s.s6_addr[0] = 0; ],

Part 2:

--- /usr/pkgsrc/security/openssh/Makefile	Thu Jun  1 11:41:15 2000
+++ Makefile	Fri Jun  2 15:05:39 2000
@@ -67,6 +67,11 @@
 		${PREFIX}/bin/ssh-keygen \
 			-f ${SSH_CONF_DIR}/ssh_host_key -N ""; \
 	fi
+	if [ ! -f ${SSH_CONF_DIR}/ssh_host_dsa_key ]; then \
+		${ECHO} "Generating a secret host dsa key..."; \
+		${PREFIX}/bin/ssh-keygen \
+			-d -f ${SSH_CONF_DIR}/ssh_host_dsa_key -N ""; \
+	fi
 	${INSTALL_SCRIPT} ${WRKDIR}/sshd.sh ${PREFIX}/etc/rc.d/sshd.sh

 .include "../../mk/bsd.pkg.mk"

Part 3:
Add a note to pkg/MESSAGE?
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: itojun 
State-Changed-When: Fri Jun 30 18:17:32 PDT 2000 
State-Changed-Why:  
part 2 is in the tree. 

From: "Johnny C. Lam" <lamj@stat.cmu.edu>
To: John.P.Darrow@wheaton.edu
Cc: gnats-bugs@gnats.netbsd.org, lamj@stat.cmu.edu
Subject: Re: pkg/10268: openssh 2 build, install issues
Date: Tue, 25 Jul 2000 03:37:34 -0400

 Hi,

 	I think all parts of your PR have been addressed.  The patch
 you gave in your PR seems to already be incorporated into the latest
 (openssh-2.1.1p4) sources; the ssh_host_dsa_key is correctly generated
 by the pkg/INSTALL script during the POST-INSTALL step of the
 installation; and the latest commit to the REQ script now tells the
 user to make sure that their kernel was built with:

 	pseudo-device rnd

 if a working /dev/urandom isn't found.

 	Can this PR now be closed?

 	Thanks,

      -- Johnny C. Lam <lamj@stat.cmu.edu>
         Department of Statistics, Carnegie Mellon University
         http://www.stat.cmu.edu/~lamj/

State-Changed-From-To: feedback->closed 
State-Changed-By: jlam 
State-Changed-When: Thu Aug 10 22:38:32 PDT 2000 
State-Changed-Why:  
configure.in was patched in similar way to included patch. 
Thanks for the PR. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.