3 # $NetBSD: sshd,v 1.18 2002/04/29 08:23:34 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/sshd,v 1.3 2003/07/13 01:49:07 mtm Exp $
5 # $DragonFly: src/etc/rc.d/sshd,v 1.2 2004/01/27 00:55:43 rob Exp $
16 keygen_cmd="sshd_keygen"
17 start_precmd="sshd_precmd"
18 pidfile="/var/run/${name}.pid"
19 extra_commands="keygen reload"
26 # Can't do anything if ssh is not installed
27 [ -x /usr/bin/ssh-keygen ] || {
28 warn "/usr/bin/ssh-keygen does not exist."
32 if [ -f /etc/ssh/ssh_host_key ]; then
33 echo "You already have an RSA host key" \
34 "in /etc/ssh/ssh_host_key"
35 echo "Skipping protocol version 1 RSA Key Generation"
37 /usr/bin/ssh-keygen -t rsa1 -b 1024 \
38 -f /etc/ssh/ssh_host_key -N ''
41 if [ -f /etc/ssh/ssh_host_dsa_key ]; then
42 echo "You already have a DSA host key" \
43 "in /etc/ssh/ssh_host_dsa_key"
44 echo "Skipping protocol version 2 DSA Key Generation"
46 /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
49 if [ -f /etc/ssh/ssh_host_rsa_key ]; then
50 echo "You already have a RSA host key" \
51 "in /etc/ssh/ssh_host_rsa_key"
52 echo "Skipping protocol version 2 RSA Key Generation"
54 /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
61 if [ ! -f /etc/ssh/ssh_host_key -o \
62 ! -f /etc/ssh/ssh_host_dsa_key -o \
63 ! -f /etc/ssh/ssh_host_rsa_key ]; then