Commit 5482ee34 authored by Natanael Copa's avatar Natanael Copa
Browse files

setup-sshd: fix backwards compat with -c

Do not enter interactive mode if -c was set, for backwards compatiblity.
parent 90d5d98a
Pipeline #123363 passed with stage
in 44 seconds
...@@ -57,7 +57,7 @@ shift $(( $OPTIND - 1 )) ...@@ -57,7 +57,7 @@ shift $(( $OPTIND - 1 ))
case "$1" in case "$1" in
openssh|dropbear|none) sshdchoice="$1" ;; openssh|dropbear|none) sshdchoice="$1" ;;
"") interactive=1;; "") [ -z "$sshdchoice" ] && interactive=1;;
*) usage "1" >&2;; *) usage "1" >&2;;
esac esac
......
...@@ -6,6 +6,7 @@ init_tests \ ...@@ -6,6 +6,7 @@ init_tests \
setup_sshd_empty \ setup_sshd_empty \
setup_sshd_dropbear \ setup_sshd_dropbear \
setup_sshd_openssh \ setup_sshd_openssh \
setup_sshd_openssh_c_compat \
setup_sshd_interactive_openssh_nologin \ setup_sshd_interactive_openssh_nologin \
setup_sshd_interactive_openssh_prohibitpass \ setup_sshd_interactive_openssh_prohibitpass \
setup_sshd_interactive_openssh_nokey \ setup_sshd_interactive_openssh_nokey \
...@@ -45,6 +46,17 @@ setup_sshd_openssh_body() { ...@@ -45,6 +46,17 @@ setup_sshd_openssh_body() {
grep 'ssh-id FOOBAR' root/.ssh/authorized_keys || atf_fail "failed to wget ssh key" grep 'ssh-id FOOBAR' root/.ssh/authorized_keys || atf_fail "failed to wget ssh key"
} }
setup_sshd_openssh_c_compat_body() {
init_env
atf_check -s exit:0 \
-e empty \
-o match:"^apk add .* openssh" \
-o match:"service sshd added" \
-o match:"Starting sshd" \
-o not-match:"Allow root ssh" \
setup-sshd -c openssh
}
setup_sshd_interactive_openssh_nologin_body() { setup_sshd_interactive_openssh_nologin_body() {
init_env init_env
mkdir -p etc/ssh mkdir -p etc/ssh
......
Supports Markdown
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