1 #!@STARTUP_SCRIPT_SHELL@
2 # Donated code that was put under PD license.
4 # Stripped PRNGd out of it for the time being.
12 sysconfdir=@sysconfdir@
15 SSHD=$prefix/sbin/sshd
16 PIDFILE=$piddir/sshd.pid
17 PidFile=`grep "^PidFile" ${sysconfdir}/sshd_config | tr "=" " " | awk '{print $2}'`
18 [ X$PidFile = X ] || PIDFILE=$PidFile
19 SSH_KEYGEN=$prefix/bin/ssh-keygen
20 HOST_KEY_RSA1=$sysconfdir/ssh_host_key
21 HOST_KEY_DSA=$sysconfdir/ssh_host_dsa_key
22 HOST_KEY_RSA=$sysconfdir/ssh_host_rsa_key
23 @COMMENT_OUT_ECC@HOST_KEY_ECDSA=$sysconfdir/ssh_host_ecdsa_key
27 if [ ! -f $HOST_KEY_RSA1 ]; then
28 ${SSH_KEYGEN} -t rsa1 -f ${HOST_KEY_RSA1} -N ""
30 if [ ! -f $HOST_KEY_DSA ]; then
31 ${SSH_KEYGEN} -t dsa -f ${HOST_KEY_DSA} -N ""
33 if [ ! -f $HOST_KEY_RSA ]; then
34 ${SSH_KEYGEN} -t rsa -f ${HOST_KEY_RSA} -N ""
36 @COMMENT_OUT_ECC@ if [ ! -f $HOST_KEY_ECDSA ]; then
37 @COMMENT_OUT_ECC@ ${SSH_KEYGEN} -t ecdsa -f ${HOST_KEY_ECDSA} -N ""
42 if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then
43 PID=`${CAT} ${PIDFILE}`
45 if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then
48 echo "Unable to read PID file"
53 # XXX We really should check if the service is already going, but
54 # XXX we will opt out at this time. - Bal
56 # Check to see if we have keys that need to be made
60 echo "starting $SSHD... \c" ; $SSHD
63 if [ $sshd_rc -ne 0 ]; then
64 echo "$0: Error ${sshd_rc} starting ${SSHD}... bailing."
86 echo "$0: usage: $0 {start|stop|restart}"