blob: 56718551764e569e0b4fbbbce8bba47082e66435 (
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
42
43
44
45
46
47
48
49
50
51
|
#!/sbin/openrc-run
# Alpine Linux init.d for TinySSH
# Copyright 2017 Stuart Cardall (https://github.com/itoffshore)
# Distributed under the terms of the GNU General Public License, v2 or later #
supervisor=supervise-daemon
description="Small SSH server using NaCl (no dependency on OpenSSL)"
nice="0"
pidfile="/run/tinysshd.sd.pid"
supervise_daemon_args=""
daemon=/usr/sbin/tinysshd
keygen=$daemon-makekey
CONFDIR=${CONFDIR:-/etc/tinyssh}
keydir=${CONFDIR}/sshkeys
OPTIONS=${OPTIONS:-\-v -l}
PORT=${PORT:-22}
IP=${IP:-0.0.0.0}
command="tcpserver"
command_args="-HRDl0 ${IP} ${PORT} $daemon ${OPTIONS} $keydir"
proxy_env=/etc/profile.d/proxy.sh
depend() {
use net
after logger firewall
}
in_contr() {
grep "container=" /proc/1/environ
}
start_pre() {
checkpath --directory ${CONFDIR}
eval $keygen $keydir 2>/dev/null
if [ -z "$(in_contr)" ]; then
supervise_daemon_args="$supervise_daemon_args -N $nice"
fi
# tinyssh also runs from inetd without tcpserver
if [ ! -x /usr/bin/tcpserver ]; then
# openrc does not use proxy environment by default
if [ -f "$proxy_env" ]; then
. $proxy_env
fi
apk add ucspi-tcp6
fi
}
|