Debian Codegraph @

support/init.d.examples/sshd.in

raw
1 #!@SBINDIR@/openrc-run
2 # Copyright (c) 2007-2015 The OpenRC Authors.
3 # See the Authors file at the top-level directory of this distribution and
4 # https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
5 #
6 # This file is part of OpenRC. It is subject to the license terms in
7 # the LICENSE file found in the top-level directory of this
8 # distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
9 # This file may not be copied, modified, propagated, or distributed
10 # except according to the terms contained in the LICENSE file.
11
12 command=/usr/sbin/sshd
13 command_args=$sshd_args
14 pidfile=/var/run/sshd.pid
15 required_files=/etc/ssh/sshd_config
16
17 depend()
18 {
19 use logger dns
20 need net
21 }
22
23 start_pre()
24 {
25 if [ ! -e /etc/ssh/ssh_host_key ]; then
26 ebegin "Generating Hostkey"
27 ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ''
28 eend $? || return 1
29 fi
30 if [ ! -e /etc/ssh/ssh_host_dsa_key ]; then
31 ebegin "Generating DSA Hostkey"
32 ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N ''
33 eend $? || return 1
34 fi
35 if [ ! -e /etc/ssh/ssh_host_rsa_key ]; then
36 ebegin "Generating RSA Hostkey"
37 ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
38 eend $? || return 1
39 fi
40
41 $command -t
42 }