Skip to content

Commit

Permalink
Manually scan key of SSH host
Browse files Browse the repository at this point in the history
  • Loading branch information
delasy committed Sep 14, 2024
1 parent b2184c3 commit 458bc16
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ else
remote="$INPUT_USERNAME:$INPUT_PASSWORD@$INPUT_HOST"
fi

ssh_args=('-o' 'StrictHostKeyChecking=no')
ssh_args=()

if [ "$INPUT_PRIVATE_KEY" != '' ]; then
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
printf '%s' "$INPUT_PRIVATE_KEY" > "$HOME/.ssh/$INPUT_NAME"
chmod 600 "$HOME/.ssh/$INPUT_NAME"
ssh_args+=('-i' "$HOME/.ssh/$INPUT_NAME")
ssh-keyscan "$INPUT_HOST" >> "$HOME/.ssh/known_hosts"
chmod 600 "$HOME/.ssh/known_hosts"
fi

scp "${ssh_args[@]}" -P "$INPUT_PORT" "$tmp_dir/$INPUT_NAME.tgz" "$remote:$INPUT_NAME.tgz"
Expand Down

0 comments on commit 458bc16

Please sign in to comment.