sshd revision 1.16
11.1Slukem#!/bin/sh 21.1Slukem# 31.16Senami# $NetBSD: sshd,v 1.16 2002/04/19 23:13:44 enami 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.15Senami echo "You already have an RSA host key" \ 261.15Senami "in ${sshd_conf_dir}/ssh_host_key" 271.9Sitojun echo "Skipping protocol version 1 RSA Key Generation" 281.3Sjwise else 291.15Senami /usr/bin/ssh-keygen -t rsa1 -b 1024 \ 301.15Senami -f ${sshd_conf_dir}/ssh_host_key -N '' 311.3Sjwise fi 321.3Sjwise 331.13Slukem if [ -f ${sshd_conf_dir}/ssh_host_dsa_key ]; then 341.15Senami echo "You already have a DSA host key" \ 351.15Senami "in ${sshd_conf_dir}/ssh_host_dsa_key" 361.9Sitojun echo "Skipping protocol version 2 DSA Key Generation" 371.3Sjwise else 381.15Senami /usr/bin/ssh-keygen -t dsa \ 391.15Senami -f ${sshd_conf_dir}/ssh_host_dsa_key -N '' 401.9Sitojun fi 411.9Sitojun 421.13Slukem if [ -f ${sshd_conf_dir}/ssh_host_rsa_key ]; then 431.15Senami echo "You already have a RSA host key" \ 441.15Senami "in ${sshd_conf_dir}/ssh_host_rsa_key" 451.9Sitojun echo "Skipping protocol version 2 RSA Key Generation" 461.9Sitojun else 471.15Senami /usr/bin/ssh-keygen -t rsa \ 481.15Senami -f ${sshd_conf_dir}/ssh_host_rsa_key -N '' 491.3Sjwise fi 501.12Slukem ) 511.3Sjwise} 521.3Sjwise 531.6Slukemsshd_precmd() 541.6Slukem{ 551.15Senami if [ ! -f ${sshd_conf_dir}/ssh_host_key -o \ 561.15Senami ! -f ${sshd_conf_dir}/ssh_host_dsa_key -o \ 571.15Senami ! -f ${sshd_conf_dir}/ssh_host_rsa_key ]; then 581.16Senami run_rc_command keygen 591.3Sjwise fi 601.3Sjwise} 611.3Sjwise 621.3Sjwisekeygen_cmd=sshd_keygen 631.5Sjwisestart_precmd=sshd_precmd 641.3Sjwise 651.3Sjwiseload_rc_config $name 661.3Sjwiserun_rc_command "$1" 67