Skip to content

Commit

Permalink
Update connect.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias authored Oct 6, 2024
1 parent 82ae692 commit 9724aa2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/bastion/scripts/connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ ssh_proxy_command_option="ProxyCommand sh -c \"aws ssm start-session --target %h
if [[ -z "$tunnel" ]]; then
echo "Connecting to Bastion host using SSH through Session Manager..."
ssh -i "$SSH_KEY_PATH" -o "$ssh_proxy_command_option" "$BASTION_USER@$instance_id"
echo "Connection to Bastion host established."
exit 0
fi

Expand All @@ -97,8 +96,8 @@ if [[ -n "$tunnel_target_user" && -n "$tunnel_target_key" ]]; then
tunnel_host=$(echo "$tunnel" | cut -d':' -f2)
ssh_proxy_command_option="ProxyCommand ssh -i $tunnel_target_key -W %h:%p $tunnel_target_user@$tunnel_host"
ssh_tunnel_proxy_command_option="ProxyCommand ssh -i $tunnel_target_key -W %h:%p $tunnel_target_user@$tunnel_host"
ssh -i "$SSH_KEY_PATH" -o "$ssh_proxy_command_option" -L "$tunnel" -o "$ssh_tunnel_proxy_command_option" -N "$BASTION_USER@$instance_id"
ssh -i "$SSH_KEY_PATH" -o "$ssh_proxy_command_option" -L "$tunnel" -o "$ssh_tunnel_proxy_command_option" -N "$BASTION_USER@$instance_id" &
else
ssh -i "$SSH_KEY_PATH" -o "$ssh_proxy_command_option" -L "$tunnel" -N "$BASTION_USER@$instance_id"
ssh -i "$SSH_KEY_PATH" -o "$ssh_proxy_command_option" -L "$tunnel" -N "$BASTION_USER@$instance_id" &
fi
echo "Tunnel established through Bastion host."

0 comments on commit 9724aa2

Please sign in to comment.