summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-11 23:40:54 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-11 23:40:54 +0200
commite6a59acd289efaa21d04274b75aa3073df61ef7a (patch)
tree2a07f688965c99393eed8d61a832f34deac77afc /tests
parentd30e0b06ea6070a5805865354547805e6d5a8242 (diff)
downloadalpine-conf-e6a59acd289efaa21d04274b75aa3073df61ef7a.zip
tests: setup-sshd: add test for interactive questions
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup_sshd_test16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/setup_sshd_test b/tests/setup_sshd_test
index fc9118d..c7701b1 100755
--- a/tests/setup_sshd_test
+++ b/tests/setup_sshd_test
@@ -51,9 +51,25 @@ setup_sshd_openssh_body() {
grep '^wget .*https://example.com/user.keys$' root/.ssh/authorized_keys || atf_fail "failed to wget ssh key"
}
+atf_test_case setup_sshd_interactive
+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 \
+ -e empty \
+ -o match:"Which SSH server" \
+ -o match:"^apk add .* openssh" \
+ -o match:"^rc-update add sshd" \
+ -o match:"^rc-service sshd start" \
+ setup-sshd
+ grep '^PermitRootLogin no$' etc/ssh/sshd_config || atf_fail "did not set PermitRootLogin"
+}
+
atf_init_test_cases() {
atf_add_test_case setup_sshd_help
atf_add_test_case setup_sshd_empty
atf_add_test_case setup_sshd_dropbear
atf_add_test_case setup_sshd_openssh
+ atf_add_test_case setup_sshd_interactive
}