summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-21 08:32:32 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-21 08:32:32 +0200
commit6483529fd6d60f8ae3f996f9089faf289ef86b1d (patch)
tree602ade86d860a85fe1b0fbbae435629eaa4a113b
parent7695fa275dafebf70af448bda0b01c5951f3a3e1 (diff)
downloadalpine-conf-6483529fd6d60f8ae3f996f9089faf289ef86b1d.zip
setup-sshd: fix prompts
Use 'ssh' in lowercase consistently Fix duplicate [prohibit-password]
-rw-r--r--setup-sshd.in4
-rwxr-xr-xtests/setup_sshd_test5
2 files changed, 6 insertions, 3 deletions
diff --git a/setup-sshd.in b/setup-sshd.in
index fabea69..b6c2877 100644
--- a/setup-sshd.in
+++ b/setup-sshd.in
@@ -35,7 +35,7 @@ case "$1" in
esac
while ! isin "$sshdchoice" openssh dropbear none; do
- ask "Which SSH server? ('openssh', 'dropbear' or 'none')" openssh
+ ask "Which ssh server? ('openssh', 'dropbear' or 'none')" openssh
sshdchoice="$resp"
done
@@ -52,7 +52,7 @@ $MOCK apk add --quiet $pkgs
if [ "$sshdchoice" = "openssh" ] && [ -z "$authorized_key" ]; then
while true; do
- ask "Allow root ssh login? ('yes', 'no', 'prohibit-password' or KEYURL) [prohibit-password]" prohibit-password
+ ask "Allow root ssh login? ('yes', 'no', 'prohibit-password' or KEYURL)" prohibit-password
case "$resp" in
yes|no|prohibit-password)
sed -i -E -e "s/^#?\s*PermitRootLogin.*/PermitRootLogin $resp/" "$ROOT"/etc/ssh/sshd_config
diff --git a/tests/setup_sshd_test b/tests/setup_sshd_test
index 6df679c..23a6f07 100755
--- a/tests/setup_sshd_test
+++ b/tests/setup_sshd_test
@@ -46,7 +46,10 @@ setup_sshd_interactive_body() {
init_env
mkdir -p etc/ssh
echo "PermitRootLogin foobar" > etc/ssh/sshd_config
- printf "%s\n%s\n" openssh no | atf_check -s exit:0 \
+ (
+ echo "openssh"
+ echo "no"
+ ) | atf_check -s exit:0 \
-e empty \
-o match:"Which SSH server" \
-o match:"^apk add .* openssh" \