Subject: pkg/17928: openssh package's startup script and hostkey generation
To: None <gnats-bugs@gnats.netbsd.org>
From: Takahiro Kambe <taca@kyoto.jepro.co.jp>
List: netbsd-bugs
Date: 08/13/2002 20:10:45
>Number:         17928
>Category:       pkg
>Synopsis:       openssh package's startup script and hostkey generation
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 13 04:11:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Takahiro Kambe
>Release:        NetBSD 1.5.4_ALPHA
>Organization:
	
>Environment:
	
	
System: NetBSD cancel.kyoto.jepro.co.jp 1.5.4_ALPHA NetBSD 1.5.4_ALPHA (CANCEL) #64: Mon Aug 5 17:57:44 JST 2002 boxqun-request@kyoto.jepro.co.jp:/usr/src/sys/arch/i386/compile/CANCEL i386
Architecture: i386
Machine: i386
>Description:
	openssh package's startup script seems to fail when no hostkey
	file exist.
>How-To-Repeat:
	Install openssh package and remove hostkey files and reboot.
	sshd dosen't start with below message.

eval: /etc/rc: permissiion denied

	pkgsrc/openssh/files/sshd.sh contains below lines:

	sshd_precmd()
	{
		if [ ! -f @PKG_SYSCONFDIR@/ssh_host_key -o \
		     ! -f @PKG_SYSCONFDIR@/ssh_host_dsa_key -o \
		     ! -f @PKG_SYSCONFDIR@/ssh_host_rsa_key ]; then
			$0 keygen
		fi
	}

	It expects $0 is expanded to sshd script itself.  Yes, it's true
	when execute sshd.sh directly from shell (sh /etc/rc.d/ssh).
	But /etc/rc calls /etc/rc.d/sshd with $0 set "/etc/rc".

>Fix:
	I don't know proper fix for this problem.
>Release-Note:
>Audit-Trail:
>Unformatted: