Commit 43e5c986 authored by Jeff Bilyk's avatar Jeff Bilyk

setup-sshd: add dropbear support

parent 69f14068
...@@ -73,11 +73,11 @@ sed -i -e "s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn)} ${_hn} localh ...@@ -73,11 +73,11 @@ sed -i -e "s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn)} ${_hn} localh
$PREFIX/sbin/setup-apkrepos $PREFIX/sbin/setup-apkrepos
$PREFIX/sbin/setup-sshd
$PREFIX/sbin/setup-ntp
DEFAULT_DISK=none \ DEFAULT_DISK=none \
$PREFIX/sbin/setup-disk -q $PREFIX/sbin/setup-disk -q
$PREFIX/sbin/setup-apklbu -i $PREFIX/sbin/setup-apklbu -i
$PREFIX/sbin/setup-ntp
$PREFIX/sbin/setup-sshd
...@@ -8,48 +8,36 @@ usage() { ...@@ -8,48 +8,36 @@ usage() {
cat <<__EOF__ cat <<__EOF__
usage: setup-sshd [-hnp] usage: setup-sshd [-hnp]
Setup sshd, turning off server side DNS lookups and password authentication by default Setup sshd
options: options:
-h Show this help -h Show this help
-n Don't prompt, just use defaults
-p Leave password authentication enabled
__EOF__ __EOF__
exit 1 exit 1
} }
PASSWORDAUTH="N" while getopts "hn" opt; do
while getopts "hnp" opt; do
case $opt in case $opt in
n) PROMPT="0";;
h) usage;; h) usage;;
p) PASSWORDAUTH="Y";;
esac esac
done done
if [ "$PROMPT" != "0" ]; then echo "Sshd to setup? (openssh, dropbear, none) [openssh]"
echo "Setup sshd? (y/N)" default_read setupsshd "openssh"
default_read setupsshd "N" if [ "$setupsshd" = "none" ]; then
if [ "$setupsshd" = "N" ] || [ "$setupsshd" = "n" ]; then exit 0
exit 0
fi
fi fi
exit 1
acfinstalled="`apk version acf-core -q | awk '{print $1}'`" acfinstalled="`apk version acf-core -q | awk '{print $1}'`"
if [ "$acfinstalled" != "ERROR:" ]; then if [ "setupsshd" = "openssh"]; then
apk add acf-openssh -q if [ "$acfinstalled" != "ERROR:" ]; then
else apk add acf-openssh -q
apk add openssh -q else
fi apk add openssh -q
fi
if [ "$PASSWORDAUTH" = "N"]; then elif [ "setupsshd" = "dropbear"]; then
printf "PasswordAuthentication no\nUseDNS no\n" >> /etc/ssh/sshd_config apk add dropbear
else
printf "UseDNS no\n" >> /etc/ssh/sshd_config
fi fi
/etc/init.d/sshd start /etc/init.d/sshd start
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment