Expand PMF_FN_* macros.
[netbsd-mini2440.git] / etc / rc.d / sshd
blob1b9ee39ca40abc79e10c3687ff80aec0a2fb7e72
1 #!/bin/sh
3 # $NetBSD: sshd,v 1.19 2004/02/18 17:36:34 jonb Exp $
6 # PROVIDE: sshd
7 # REQUIRE: LOGIN
9 $_rc_subr_loaded . /etc/rc.subr
11 name="sshd"
12 rcvar=$name
13 command="/usr/sbin/${name}"
14 pidfile="/var/run/${name}.pid"
15 required_files="/etc/ssh/sshd_config"
16 extra_commands="keygen reload"
18 sshd_keygen()
21 umask 022
22 if [ -f /etc/ssh/ssh_host_key ]; then
23 echo "You already have an RSA host key" \
24 "in /etc/ssh/ssh_host_key"
25 echo "Skipping protocol version 1 RSA Key Generation"
26 else
27 /usr/bin/ssh-keygen -t rsa1 ${ssh_keygen_flags} \
28 -f /etc/ssh/ssh_host_key -N ''
31 if [ -f /etc/ssh/ssh_host_dsa_key ]; then
32 echo "You already have a DSA host key" \
33 "in /etc/ssh/ssh_host_dsa_key"
34 echo "Skipping protocol version 2 DSA Key Generation"
35 else
36 /usr/bin/ssh-keygen -t dsa ${ssh_keygen_flags} \
37 -f /etc/ssh/ssh_host_dsa_key -N ''
40 if [ -f /etc/ssh/ssh_host_rsa_key ]; then
41 echo "You already have a RSA host key" \
42 "in /etc/ssh/ssh_host_rsa_key"
43 echo "Skipping protocol version 2 RSA Key Generation"
44 else
45 /usr/bin/ssh-keygen -t rsa ${ssh_keygen_flags} \
46 -f /etc/ssh/ssh_host_rsa_key -N ''
51 sshd_precmd()
53 if [ ! -f /etc/ssh/ssh_host_key -o \
54 ! -f /etc/ssh/ssh_host_dsa_key -o \
55 ! -f /etc/ssh/ssh_host_rsa_key ]; then
56 run_rc_command keygen
60 keygen_cmd=sshd_keygen
61 start_precmd=sshd_precmd
63 load_rc_config $name
64 run_rc_command "$1"