sshd revision 1.30
11.1Slukem#!/bin/sh 21.1Slukem# 31.30Schristos# $NetBSD: sshd,v 1.30 2019/10/23 14:45:38 christos Exp $ 41.5Sjwise# 51.1Slukem 61.6Slukem# PROVIDE: sshd 71.6Slukem# REQUIRE: LOGIN 81.1Slukem 91.20Smycroft$_rc_subr_loaded . /etc/rc.subr 101.1Slukem 111.1Slukemname="sshd" 121.8Slukemrcvar=$name 131.6Slukemcommand="/usr/sbin/${name}" 141.7Slukempidfile="/var/run/${name}.pid" 151.18Slukemrequired_files="/etc/ssh/sshd_config" 161.7Slukemextra_commands="keygen reload" 171.3Sjwise 181.6Slukemsshd_keygen() 191.6Slukem{ 201.23Schristos( 211.23Schristos keygen="/usr/bin/ssh-keygen" 221.11Slukem umask 022 231.30Schristos while read type bits filename; do 241.23Schristos f="/etc/ssh/$filename" 251.23Schristos if [ -f "$f" ]; then 261.27Schristos continue 271.23Schristos fi 281.27Schristos case "${bits}" in 291.27Schristos -1) bitarg=;; 301.27Schristos 0) bitarg="${ssh_keygen_flags}";; 311.27Schristos *) bitarg="-b ${bits}";; 321.27Schristos esac 331.28Sjmcneill "${keygen}" -t "${type}" ${bitarg} -f "${f}" -N '' -q && \ 341.28Sjmcneill printf "ssh-keygen: " && "${keygen}" -f "${f}" -l 351.23Schristos done << _EOF 361.30Schristosdsa 1024 ssh_host_dsa_key 371.30Schristosecdsa 521 ssh_host_ecdsa_key 381.30Schristosed25519 -1 ssh_host_ed25519_key 391.30Schristosrsa 0 ssh_host_rsa_key 401.23Schristos_EOF 411.23Schristos) 421.3Sjwise} 431.3Sjwise 441.6Slukemsshd_precmd() 451.6Slukem{ 461.27Schristos run_rc_command keygen 471.3Sjwise} 481.3Sjwise 491.3Sjwisekeygen_cmd=sshd_keygen 501.5Sjwisestart_precmd=sshd_precmd 511.3Sjwise 521.3Sjwiseload_rc_config $name 531.3Sjwiserun_rc_command "$1" 54