2000-08-01 00:39:41 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2000-09-19 17:04:38 +04:00
|
|
|
# $NetBSD: sshd,v 1.8 2000/09/19 13:04:39 lukem Exp $
|
2000-08-01 18:28:32 +04:00
|
|
|
#
|
2000-08-01 00:39:41 +04:00
|
|
|
|
2000-08-10 05:41:09 +04:00
|
|
|
# PROVIDE: sshd
|
|
|
|
# REQUIRE: LOGIN
|
2000-08-01 00:39:41 +04:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="sshd"
|
2000-09-19 17:04:38 +04:00
|
|
|
rcvar=$name
|
2000-08-10 05:41:09 +04:00
|
|
|
command="/usr/sbin/${name}"
|
2000-08-11 02:49:43 +04:00
|
|
|
pidfile="/var/run/${name}.pid"
|
2000-08-10 05:41:09 +04:00
|
|
|
required_files="/etc/${name}.conf"
|
2000-08-11 02:49:43 +04:00
|
|
|
extra_commands="keygen reload"
|
2000-08-01 00:39:41 +04:00
|
|
|
|
2000-08-10 05:41:09 +04:00
|
|
|
sshd_keygen()
|
|
|
|
{
|
|
|
|
if [ -f /etc/ssh_host_key ]; then
|
2000-08-01 00:39:41 +04:00
|
|
|
echo "You already have an RSA host key in /etc/ssh_host_key"
|
|
|
|
echo "Skipping RSA Key Generation"
|
|
|
|
else
|
|
|
|
umask 022
|
|
|
|
/usr/bin/ssh-keygen -b 1024 -f /etc/ssh_host_key -N ''
|
|
|
|
fi
|
|
|
|
|
2000-08-10 05:41:09 +04:00
|
|
|
if [ -f /etc/ssh_host_dsa_key ]; then
|
2000-08-01 00:39:41 +04:00
|
|
|
echo "You already have a DSA host key in /etc/ssh_host_dsa_key"
|
2000-08-01 01:43:52 +04:00
|
|
|
echo "Skipping DSA Key Generation"
|
2000-08-01 00:39:41 +04:00
|
|
|
else
|
|
|
|
umask 022
|
|
|
|
/usr/bin/ssh-keygen -d -f /etc/ssh_host_dsa_key -N ''
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2000-08-10 05:41:09 +04:00
|
|
|
sshd_precmd()
|
|
|
|
{
|
|
|
|
if [ ! -f /etc/ssh_host_key -o ! -f /etc/ssh_host_dsa_key ]; then
|
2000-08-01 00:39:41 +04:00
|
|
|
/etc/rc.d/sshd keygen
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
keygen_cmd=sshd_keygen
|
2000-08-01 18:28:32 +04:00
|
|
|
start_precmd=sshd_precmd
|
2000-08-01 00:39:41 +04:00
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|