summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-07-07 15:22:25 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-07-07 15:24:29 +0200
commita6a50d89f9c01de6560aeecd4149c5c676c47361 (patch)
tree7e02ccd6ed5cabfed0ec38ec8a1e9b369c80ce89 /tests
parent619f3a2d4de92539542d627657271861b6721e22 (diff)
downloadalpine-conf-a6a50d89f9c01de6560aeecd4149c5c676c47361.zip
tests: setup-sshd: add test for SSH_KEY env var
Apparently we can set ssh key via SSH_KEY env var. make sure that it works.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup_sshd_test13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/setup_sshd_test b/tests/setup_sshd_test
index f6770e0..5048802 100755
--- a/tests/setup_sshd_test
+++ b/tests/setup_sshd_test
@@ -10,7 +10,8 @@ init_tests \
setup_sshd_interactive_openssh_nologin \
setup_sshd_interactive_openssh_prohibitpass \
setup_sshd_interactive_openssh_nokey \
- setup_sshd_interactive_openssh_user_exist
+ setup_sshd_interactive_openssh_user_exist \
+ setup_sshd_openssh_ssh_key
setup_sshd_usage_body() {
test_usage setup-sshd
@@ -138,3 +139,13 @@ setup_sshd_interactive_openssh_user_exist_body() {
setup-sshd < answers
}
+setup_sshd_openssh_ssh_key_body() {
+ init_env
+ SSH_KEY="ssh-rsa foobar user@example.com" atf_check -s exit:0 \
+ -o match:"apk add.*openssh" \
+ -e empty \
+ setup-sshd openssh
+ grep "ssh-rsa foobar user@example.com" root/.ssh/authorized_keys \
+ || atf_fail "did not add ssh key"
+}
+