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.3 2005/11/19 21:47:32 swildner Exp $
15 keygen_cmd
="sshd_keygen"
16 start_precmd
="sshd_precmd"
17 pidfile
="/var/run/${name}.pid"
18 extra_commands
="keygen reload"
25 # Can't do anything if ssh is not installed
26 [ -x /usr
/bin
/ssh-keygen
] ||
{
27 warn
"/usr/bin/ssh-keygen does not exist."
31 if [ -f /etc
/ssh
/ssh_host_key
]; then
32 echo "You already have an RSA host key" \
33 "in /etc/ssh/ssh_host_key"
34 echo "Skipping protocol version 1 RSA Key Generation"
36 /usr
/bin
/ssh-keygen
-t rsa1
-b 1024 \
37 -f /etc
/ssh
/ssh_host_key
-N ''
40 if [ -f /etc
/ssh
/ssh_host_dsa_key
]; then
41 echo "You already have a DSA host key" \
42 "in /etc/ssh/ssh_host_dsa_key"
43 echo "Skipping protocol version 2 DSA Key Generation"
45 /usr
/bin
/ssh-keygen
-t dsa
-f /etc
/ssh
/ssh_host_dsa_key
-N ''
48 if [ -f /etc
/ssh
/ssh_host_ecdsa_key
]; then
49 echo "You already have a ECDSA host key" \
50 "in /etc/ssh/ssh_host_ecdsa_key"
51 echo "Skipping protocol version 2 ECDSA Key Generation"
53 /usr
/bin
/ssh-keygen
-t ecdsa
-f /etc
/ssh
/ssh_host_ecdsa_key
-N ''
56 if [ -f /etc
/ssh
/ssh_host_rsa_key
]; then
57 echo "You already have a RSA host key" \
58 "in /etc/ssh/ssh_host_rsa_key"
59 echo "Skipping protocol version 2 RSA Key Generation"
61 /usr
/bin
/ssh-keygen
-t rsa
-f /etc
/ssh
/ssh_host_rsa_key
-N ''
68 if [ ! -f /etc
/ssh
/ssh_host_key
-o \
69 ! -f /etc
/ssh
/ssh_host_dsa_key
-o \
70 ! -f /etc
/ssh
/ssh_host_ecdsa_key
-o \
71 ! -f /etc
/ssh
/ssh_host_rsa_key
]; then