Remote Connection to StretchWebTeleop using ngrok: DEBUGGING

Recently, I achieved remote control of the stretch_web_teleop using these instructions, and some additional debugging, so I thought I would post them in hopes of helping others with similar issues.

This will allow you to access the stretch from any wifi network, even University networks!

WARNING: This method does pose security risks. Proceed at your own risk.

  1. Make an ngrok account. Once made, ensure you follow installation instructions for linux as well as adding your authtoken to the ngrok.yml file.
  2. Navigate to Universal Gateway -> Domains in the ngrok website side panel. Click New Domain and an automatic domain will be created. If you have a free account, you can only create/use 1 domain.
  3. Change some network settings to get ngrok visible (this was important as I am on a university wifi). Type sudo nano /etc/systemd/resolved.conf in a linux terminal. In the file, navigate to a line that says something like #DNS=. Remove the # at the start to uncomment it. Also uncomment the line below it that says #FallbackDNS=. To save, do ctrl o. Then hit enter. Then ctrl x to exit. This is the case for all nano files we will open.
  4. Restart the DNS resolver. In the terminal type sudo sytsemctl restart systemd-resolved.
  5. Change the config file with your ngrok information. Type ngrok config edit. In this file, copy in the following code. Ensure you fill in the information from the domain you created in the ngrok site for YOUR AUTH TOKEN, YOUR DOMAIN and create a USERNAME and PASSWORD you would like for devices that try to access this site.

version: 3
agent:
authtoken: YOUR AUTH TOKEN
tunnels:
stretch-web-teleop:
proto: http
domain: YOUR DOMAIN
addr: localhost:443
basic_auth:
- “USERNAME:PASSWORD”
host_header: rewrite
inspect: true

  1. Now everything is configured. Launch the stretch_web_teleop by typing colcon_cd stretch_web_teleop in the terminal, then running ./launch_interface
  2. In a new terminal, launch the ngrok tunnel using ngrok start stretch-web-teleop
  3. You should now be able to access the site from anywhere using an address like https://<YOUR_DOMAIN>/operator
1 Like

Really cool @keshavshankar! I’m curious, what does uncommenting #DNS= and #FallbackDNS= do? Why does it help?

The issue seemed to be that the university wifi I was on had restrictive DNS settings, making connect.ngrok-agent.com unresolvable. Usually, the default settings in systemd-resolved rely on what the university DNS servers provide. So, I manually set it to a reliable DNS by uncommenting the DNS and FallbackDNS settings and using specific values there (specifically Google’s 8.8.8.8).

1 Like

Oh that makes sense. So the conf should look like:

DNS=8.8.8.8
FallbackDNS=8.8.8.8

Right?

1 Like

Almost. Specifically, I used DNS=8.8.8.8 8.8.4.4 and FallbackDNS=1.1.1.1 1.0.0.1

1 Like