Skip to content

Commit

Permalink
fix error when connect bastion without key
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyLuLiu committed Oct 29, 2024
1 parent 8fb62ec commit b7bfa4c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/common/remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ Host proxy_host
StrictHostKeyChecking no
HostName ${BASTION_HOST}
User ${BASTION_HOST_USERNAME}
IdentityFile ${BASTION_HOST_KEY_PATH}
Host target_host
HostName ${TARGET_HOST}
User ${TARGET_HOST_USERNAME}
IdentityFile ${TARGET_HOST_KEY_PATH}
ProxyJump proxy_host
EOF
if [[ -z ${TARGET_HOST_KEY_PATH+x} ]]; then
sed -i"" -e '9d' ssh_config
if [[ -n ${TARGET_HOST_KEY_PATH+x} ]]; then
sed -i"" -e "11 i\ IdentityFile $TARGET_HOST_KEY_PATH" ssh_config
fi
if [[ -z ${BASTION_HOST_KEY_PATH+x} ]]; then
sed -i"" -e '4d' ssh_config
if [[ -n ${BASTION_HOST_KEY_PATH+x} ]]; then
sed -i"" -e "5 i\ IdentityFile ${BASTION_HOST_KEY_PATH}" ssh_config
fi
cat ssh_config
}
Expand Down

0 comments on commit b7bfa4c

Please sign in to comment.