3 # $NetBSD: sshd.sh,v 1.12 2011/05/16 05:06:49 taca Exp $
6 # REQUIRE: DAEMON LOGIN
15 command="@PREFIX@/sbin/${name}"
16 keygen_command
="@PREFIX@/bin/ssh-keygen"
17 pidfile
="@SSH_PID_DIR@/${name}.pid"
18 required_files
="@PKG_SYSCONFDIR@/sshd_config"
19 extra_commands
="keygen reload"
25 if [ -f @PKG_SYSCONFDIR@
/ssh_host_key
]; then
26 @ECHO@
"You already have an RSA host key in @PKG_SYSCONFDIR@/ssh_host_key"
27 @ECHO@
"Skipping protocol version 1 RSA Key Generation"
29 ${keygen_command} -t rsa1
-b 1024 -f @PKG_SYSCONFDIR@
/ssh_host_key
-N ''
32 if [ -f @PKG_SYSCONFDIR@
/ssh_host_dsa_key
]; then
33 @ECHO@
"You already have a DSA host key in @PKG_SYSCONFDIR@/ssh_host_dsa_key"
34 @ECHO@
"Skipping protocol version 2 DSA Key Generation"
36 ${keygen_command} -t dsa
-f @PKG_SYSCONFDIR@
/ssh_host_dsa_key
-N ''
39 if [ -f @PKG_SYSCONFDIR@
/ssh_host_rsa_key
]; then
40 @ECHO@
"You already have a RSA host key in @PKG_SYSCONFDIR@/ssh_host_rsa_key"
41 @ECHO@
"Skipping protocol version 2 RSA Key Generation"
43 ${keygen_command} -t rsa
-f @PKG_SYSCONFDIR@
/ssh_host_rsa_key
-N ''
45 /* HAVE_ECDSA_START
*/
46 if [ -f @PKG_SYSCONFDIR@
/ssh_host_ecdsa_key
]; then
47 @ECHO@
"You already have a ECDSA host key in @PKG_SYSCONFDIR@/ssh_host_ecdsa_key"
48 @ECHO@
"Skipping protocol version 2 ECDSA Key Generation"
50 ${keygen_command} -t ecdsa
-f @PKG_SYSCONFDIR@
/ssh_host_ecdsa_key
-N ''
58 if [ ! -f @PKG_SYSCONFDIR@
/ssh_host_key
-o \
59 ! -f @PKG_SYSCONFDIR@
/ssh_host_dsa_key
-o \
60 ! -f @PKG_SYSCONFDIR@
/ssh_host_rsa_key
-o \
61 ! -f @PKG_SYSCONFDIR@
/ssh_host_ecdsa_key
]; then
62 if [ -f /etc
/rc.subr
-a -f /etc
/rc.conf
-a -f /etc
/rc.d
/DAEMON
]
71 keygen_cmd
=sshd_keygen
72 start_precmd
=sshd_precmd
74 if [ -f /etc
/rc.subr
-a -f /etc
/rc.conf
-a -f /etc
/rc.d
/DAEMON
]
81 if [ -x ${command} -a -f ${required_files} ]
83 @ECHO@
"Starting ${name}."
85 eval ${command} ${sshd_flags} ${command_args}
89 if [ -f ${pidfile} ]; then
90 pid
=`@HEAD@ -1 ${pidfile}`
91 @ECHO@
"Stopping ${name}."
94 @ECHO@
"${name} not running?"
103 if [ -f ${pidfile} ]; then
104 pid
=`@HEAD@ -1 ${pidfile}`
105 @ECHO@
"${name} is running as pid ${pid}."
107 @ECHO@
"${name} is not running."