sshd revision 1.14
11.1Slukem#!/bin/sh 21.1Slukem# 31.14Slukem# $NetBSD: sshd,v 1.14 2002/03/27 09:15:54 lukem Exp $ 41.5Sjwise# 51.1Slukem 61.6Slukem# PROVIDE: sshd 71.6Slukem# REQUIRE: LOGIN 81.1Slukem 91.1Slukem. /etc/rc.subr 101.1Slukem 111.1Slukemname="sshd" 121.8Slukemrcvar=$name 131.6Slukemcommand="/usr/sbin/${name}" 141.14Slukemcommand_args='-f ${sshd_conf_dir}/${name}.conf' 151.7Slukempidfile="/var/run/${name}.pid" 161.13Slukemload_rc_config $name 171.13Slukemrequired_files="${sshd_conf_dir}/${name}.conf" 181.7Slukemextra_commands="keygen reload" 191.3Sjwise 201.6Slukemsshd_keygen() 211.6Slukem{ 221.12Slukem ( 231.11Slukem umask 022 241.13Slukem if [ -f ${sshd_conf_dir}/ssh_host_key ]; then 251.13Slukem echo "You already have an RSA host key in ${sshd_conf_dir}/ssh_host_key" 261.9Sitojun echo "Skipping protocol version 1 RSA Key Generation" 271.3Sjwise else 281.13Slukem /usr/bin/ssh-keygen -t rsa1 -b 1024 -f ${sshd_conf_dir}/ssh_host_key -N '' 291.3Sjwise fi 301.3Sjwise 311.13Slukem if [ -f ${sshd_conf_dir}/ssh_host_dsa_key ]; then 321.13Slukem echo "You already have a DSA host key in ${sshd_conf_dir}/ssh_host_dsa_key" 331.9Sitojun echo "Skipping protocol version 2 DSA Key Generation" 341.3Sjwise else 351.13Slukem /usr/bin/ssh-keygen -t dsa -f ${sshd_conf_dir}/ssh_host_dsa_key -N '' 361.9Sitojun fi 371.9Sitojun 381.13Slukem if [ -f ${sshd_conf_dir}/ssh_host_rsa_key ]; then 391.13Slukem echo "You already have a RSA host key in ${sshd_conf_dir}/ssh_host_rsa_key" 401.9Sitojun echo "Skipping protocol version 2 RSA Key Generation" 411.9Sitojun else 421.13Slukem /usr/bin/ssh-keygen -t rsa -f ${sshd_conf_dir}/ssh_host_rsa_key -N '' 431.3Sjwise fi 441.12Slukem ) 451.3Sjwise} 461.3Sjwise 471.6Slukemsshd_precmd() 481.6Slukem{ 491.13Slukem if [ ! -f ${sshd_conf_dir}/ssh_host_key -o ! -f ${sshd_conf_dir}/ssh_host_dsa_key -o \ 501.13Slukem ! -f ${sshd_conf_dir}/ssh_host_rsa_key ]; then 511.13Slukem $0 keygen 521.3Sjwise fi 531.3Sjwise} 541.3Sjwise 551.3Sjwisekeygen_cmd=sshd_keygen 561.5Sjwisestart_precmd=sshd_precmd 571.3Sjwise 581.3Sjwiseload_rc_config $name 591.3Sjwiserun_rc_command "$1" 60