How to SSH into my MacBook from EC2 when using AWS IOT Secure Tunnels

0

Hi all

I have created an SSH Tunnel and connected an EC2 instance at one end of the tunnel and my macbook at the other end but I am still unable to connect to my MacBook rom the EC2 instance. I have a proxy running in source mode on ec2 and another proxy running in destination mode in my MacBook. When using the command 'ssh nikhilsanjujerald@localhost -p 443' to ssh into my MacBook, this is what I see on the terminals.

On the source proxy side, I see this source proxy

On the destination proxy side I have this destination proxy

A this is what I see when executing the command 'ssh nikhilsanjujerald@localhost -p 443' ec2 terminal

Does anyone know how I can fix this issue? I have tried everything I know and I am now quite lost. For your reference, these are the commands I using for starting Source proxy and Destination proxy

Command for running SOURCE proxy on ec2

docker run --rm -it -p 443:443
-e AWSIOT_TUNNEL_ACCESS_TOKEN="my_source_token"
public.ecr.aws/aws-iot-securetunneling-localproxy/amazonlinux-bin:amd64-latest
--region eu-central-1
-b 0.0.0.0
-s 443
-c /etc/ssl/certs

*Command for running DESTINATION proxy in Macbook

docker run --rm -it -p 8443:443
-e AWSIOT_TUNNEL_ACCESS_TOKEN="my_destination_token"
public.ecr.aws/aws-iot-securetunneling-localproxy/ubuntu-bin:arm64-latest
--region eu-central-1 -d 127.0.0.1 -c /etc/ssl/certs

asked a month ago42 views
1 Answer
0

Based on the information provided, it appears that you're encountering issues with SSH connectivity through an AWS IoT Secure Tunnel between your EC2 instance and your MacBook. Here are some suggestions to help troubleshoot and potentially resolve the issue:

  1. Port configuration: In your source proxy command on EC2, you're using port 443. However, in your SSH command, you're also using port 443. This might be causing a conflict. Try changing the SSH command to use a different port, such as 8443, which matches the port you've exposed in your destination proxy command on the MacBook.

  2. Destination IP: In your destination proxy command, you've set the destination IP to 127.0.0.1. This means the proxy will only forward connections to the local machine. If your SSH server is running on a different IP or interface, you might need to adjust this.

  3. SSH server: Ensure that the SSH server is actually running and accessible on your MacBook. You can check this by trying to SSH locally on your MacBook using ssh localhost.

  4. Firewall settings: Check if there are any firewall rules on your MacBook that might be blocking incoming SSH connections.

  5. SSH configuration: Verify that your SSH configuration on the MacBook allows for remote connections.

  6. Tunnel status: Make sure that the tunnel is actually established and active. The AWS IoT console should show the tunnel status.

  7. Token validity: Ensure that your source and destination tokens are still valid and haven't expired.

  8. Logs: Check the logs of both the source and destination proxies for any error messages or indications of what might be going wrong.

Try modifying your SSH command on the EC2 instance to:

ssh nikhilsanjujerald@localhost -p 8443

If the issue persists, you may need to review your AWS IoT Secure Tunnel configuration and ensure all the necessary permissions and settings are correctly in place.
Sources
How secure tunneling works - AWS IoT Core
AWS IoT secure tunneling tutorials - AWS IoT Core

profile picture
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions