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.1 2003/07/24 06:35:37 dillon Exp $
10 # KEYWORD: DragonFly FreeBSD NetBSD
16 keygen_cmd="sshd_keygen"
17 start_precmd="sshd_precmd"
18 pidfile="/var/run/${name}.pid"
19 extra_commands="keygen reload"
22 command="/usr/sbin/${name}"
23 required_files="/etc/ssh/sshd_config"
32 # Can't do anything if ssh is not installed
33 [ -x /usr/bin/ssh-keygen ] || {
34 warn "/usr/bin/ssh-keygen does not exist."
38 if [ -f /etc/ssh/ssh_host_key ]; then
39 echo "You already have an RSA host key" \
40 "in /etc/ssh/ssh_host_key"
41 echo "Skipping protocol version 1 RSA Key Generation"
43 /usr/bin/ssh-keygen -t rsa1 -b 1024 \
44 -f /etc/ssh/ssh_host_key -N ''
47 if [ -f /etc/ssh/ssh_host_dsa_key ]; then
48 echo "You already have a DSA host key" \
49 "in /etc/ssh/ssh_host_dsa_key"
50 echo "Skipping protocol version 2 DSA Key Generation"
52 /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
55 if [ -f /etc/ssh/ssh_host_rsa_key ]; then
56 echo "You already have a RSA host key" \
57 "in /etc/ssh/ssh_host_rsa_key"
58 echo "Skipping protocol version 2 RSA Key Generation"
60 /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
67 if [ ! -f /etc/ssh/ssh_host_key -o \
68 ! -f /etc/ssh/ssh_host_dsa_key -o \
69 ! -f /etc/ssh/ssh_host_rsa_key ]; then