mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Merge pull request #3605 from dokku/empty-ssh-key
fix: handle case where there are empty newlines in the authorized_keys file
This commit is contained in:
@@ -20,6 +20,7 @@ verify_ssh_key_file() {
|
||||
|
||||
while read -r key; do
|
||||
line=$((line + 1))
|
||||
[[ -z "$key" ]] && continue
|
||||
echo "$key" >"$TMP_KEY_FILE"
|
||||
ssh-keygen -lf "$TMP_KEY_FILE" &>/dev/null || dokku_log_fail "${DOKKU_ROOT}/.ssh/authorized_keys line $line failed ssh-keygen check."
|
||||
done <"${DOKKU_ROOT}/.ssh/authorized_keys"
|
||||
|
||||
@@ -53,6 +53,10 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
run /bin/bash -c 'echo "" >> "${DOKKU_ROOT:-/home/dokku}/.ssh/authorized_keys"'
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ssh-keys:list | grep name1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
|
||||
Reference in New Issue
Block a user