blob: 25f7f259b12fc897ebe67161b88c28b2ee4a16ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
use logger dns
need net
}
check_config() {
# bug #947598 - don't generate keys if DROPBEAR_OPTS contains option `-r`
echo "${DROPBEAR_OPTS}" | grep -E '(^-r)|(\s-r)' > /dev/null 2>&1 && return
mkdir -p /etc/dropbear
local t k
for t in rsa ecdsa ed25519; do
k="/etc/dropbear/dropbear_${t}_host_key"
if [ ! -e ${k} ] ; then
# See if support is enabled for this key type.
if dropbearkey -h 2>&1 | grep -q " ${t}$" ; then
einfo "Generating ${k} ..."
dropbearkey -t ${t} -f ${k} >/dev/null
fi
fi &
done
wait
}
start() {
check_config || return 1
ebegin "Starting dropbear"
dropbear ${DROPBEAR_OPTS}
eend $?
}
stop() {
ebegin "Stopping dropbear"
start-stop-daemon --stop --pidfile /var/run/dropbear.pid
eend $?
}
|