7 # REQUIRE: LOGIN cleanvar
13 command="/usr/sbin/${name}"
14 keygen_cmd="sshd_keygen"
15 start_precmd="sshd_precmd"
16 pidfile="/var/run/${name}.pid"
17 extra_commands="keygen reload"
24 seeded=`sysctl -n kern.random.sys.seeded 2>/dev/null`
25 if [ "x${seeded}" != "x" ] && [ ${seeded} -eq 0 ] ; then
26 warn "Setting entropy source to blocking mode."
27 echo "===================================================="
28 echo "Type a full screenful of random junk to unblock"
29 echo "it and remember to finish with <enter>. This will"
30 echo "timeout in ${timeout} seconds, but waiting for"
31 echo "the timeout without typing junk may make the"
32 echo "entropy source deliver predictable output."
34 echo "Just hit <enter> for fast+insecure startup."
35 echo "===================================================="
36 sysctl kern.random.sys.seeded=0 2>/dev/null
37 read -t ${timeout} junk
38 echo "${junk}" `sysctl -a` `date` > /dev/random
48 # Can't do anything if ssh is not installed
49 [ -x /usr/bin/ssh-keygen ] || {
50 warn "/usr/bin/ssh-keygen does not exist."
54 if [ -f /etc/ssh/ssh_host_key ]; then
55 echo "You already have an RSA host key" \
56 "in /etc/ssh/ssh_host_key"
57 echo "Skipping protocol version 1 RSA Key Generation"
59 /usr/bin/ssh-keygen -t rsa1 -b 1024 \
60 -f /etc/ssh/ssh_host_key -N ''
63 if [ -f /etc/ssh/ssh_host_dsa_key ]; then
64 echo "You already have a DSA host key" \
65 "in /etc/ssh/ssh_host_dsa_key"
66 echo "Skipping protocol version 2 DSA Key Generation"
68 /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
71 if [ -f /etc/ssh/ssh_host_rsa_key ]; then
72 echo "You already have a RSA host key" \
73 "in /etc/ssh/ssh_host_rsa_key"
74 echo "Skipping protocol version 2 RSA Key Generation"
76 /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
83 if [ ! -f /etc/ssh/ssh_host_key -o \
84 ! -f /etc/ssh/ssh_host_dsa_key -o \
85 ! -f /etc/ssh/ssh_host_rsa_key ]; then