blob: 0a86a86836e9165a8ff1544875c6a378889f946a (
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
52
53
54
55
56
|
#!/bin/sh
PREFIX=
. "$PREFIX/lib/libalpine.sh"
usage() {
cat <<__EOF__
usage: setup-sshd [-hnp]
Setup sshd, turning off server side DNS lookups and password authentication by default
options:
-h Show this help
-n Don't prompt, just use defaults
-p Leave password authentication enabled
__EOF__
exit 1
}
PASSWORDAUTH="N"
while getopts "hnp" opt; do
case $opt in
n) PROMPT="0";;
h) usage;;
p) PASSWORDAUTH="Y";;
esac
done
if [ "$PROMPT" != "0" ]; then
echo "Setup sshd? (y/N)"
default_read setupsshd "N"
if [ "$setupsshd" == "N" ] || [ "$setupsshd" == "n" ]; then
exit 0
fi
fi
exit 1
acfinstalled="`apk version acf-core -q | awk '{print $1}'`"
if [ "$acfinstalled" != "ERROR:" ]; then
apk add acf-openssh -q
else
apk add openssh -q
fi
if [ "$PASSWORDAUTH" == "N"]; then
printf "PasswordAuthentication no\nUseDNS no\n" >> /etc/ssh/sshd_config
else
printf "UseDNS no\n" >> /etc/ssh/sshd_config
fi
/etc/init.d/sshd start
rc-update add sshd default
|