Ngrok Tunnel: A more secure but simple to use alternative to port forwarding

The 0.1.x versions of the plugin do no take into account the granular access permissions that were introduced with OctoPrint 1.4. I'm working on a version that does, but before I do an official release, I would like to get some feedback on the implementation.

Please install the current development version via OctoPrint Settings -> Plugin Manager -> Get more -> ... from URL with the following url: https://github.com/fieldOfView/OctoPrint-ngrok/archive/devel.zip

This version implements the following restrictions:

  • the tunnel address can be seen by users with the Ngrok Tunnel Plugin: View permission, which is by default granted to all users in the Users group (the default group)
  • the tunnel can be started and stopped by users with the Ngrok Tunnel Plugin: Control permission, which is by default granted to all users in the Admins group
  • the tunnel settings can be accessed by users with the default Settings Admin permission.
1 Like

Version 0.2.0 including the changes mentioned above is now available.

Hi. Yeah, I start my printer and my Raspberry. I will install the new version, maybe it helps. :slight_smile:

@20pyro00, the same thing is reported here: https://github.com/fieldOfView/OctoPrint-ngrok/issues/12
I will investigate. It is unlikely this is fixed in version 0.2.0, but I'll get it fixed in the next minor update.

@20pyro00, it would help if you could share your octoprint.log

Ok i installed the new version, but still no auto-tunnel :frowning_face:
Here is the Log: octoprint.log (63.0 KB)
Is it possible to code it, so the tunnel will be created 20s after the server started? Maybe then it is fully connected to the Wifi.

It seems you have the same issue as reported on github. It is not just the ngrok plugin failing; in your case the pushover plugin also complains about the network being unreachable.

That would delay the tunnel creation for everybody, by an arbitrary period. I'll try to implement an automatic "retry" instead.

That is interesting to hear, but later when a Print is finished, pushover works.

That sounds good :smiley:

@20pyro00, could you try installing the current development version via OctoPrint Settings -> Plugin Manager -> Get more -> ... from URL with the following url: https://github.com/fieldOfView/OctoPrint-ngrok/archive/devel.zip? It adds a retry after 20 seconds if the first attempt does not work.

Hi @fieldOfView , i got the dev-version installed and restarted my printer severel times new. Now everytime a tunnel is created. Thank you :slightly_smiling_face:

1 Like

Hi again. I have the same problem. Today i started the printer and later i wanted to see how far my print was. But there was no tunnel. I have no idea why. Could you programm it so we can change the delay-number? Thanks :smiley:

I would rather fix the problem. I need logs to see what the problem is.

I copied these lines out of the log. This happened after a restart from a Plugin-update.

2020-08-27 16:56:17,472 - octoprint.plugins.ngrok - INFO - Setting ngrok auth token & region...
2020-08-27 16:56:17,473 - octoprint.plugins.ngrok - INFO - Opening ngrok tunnel...
2020-08-27 16:56:17,515 - pyngrok.process - WARNING - t=2020-08-27T16:56:17+0100 lvl=warn msg="can't bind default web address, trying alternatives" obj=web addr=127.0.0.1:4040

2020-08-27 16:56:17,696 - pyngrok.process - ERROR - t=2020-08-27T16:56:17+0100 lvl=eror msg="failed to auth" obj=tunnels.session err="Your account '20pyro00@gmail.com' is limited to 1 simultaneous ngrok client session.\nActive ngrok client sessions in region 'eu':\n  - ts_1ggVVd2wHWt7Y8eArLEIoNHXEgI (91.65.178.35)\r\n\r\nERR_NGROK_108\r\n"

2020-08-27 16:56:17,697 - octoprint.plugins.ngrok - ERROR - Could not connect with the provided API key

That looks like the previous tunnel wasn't properly closed, and therefore still existed on the NGROK server side and wouldn't allow you to create a second one. You might have to log in to the NGROK dashboard and kill the tunnel manually.

Thanks for the partial logs. Thus tells me a little what happened. A more complete log might give me an indication of why or how it happened so I can try to reproduce the issue and fix it.

Well i thought this was enough information. But here you go.
octoprint.log (134.0 GB)
Does a function exists were you can terminate a tunnel?

You can always close the tunnel from the ngrok.io dashboard. However I will try to detect orphan tunnels in a future version.

Hey fieldOfView, I recently downloaded this plugin and I think its great! I am having one issue that i haven't been able to figure out.

The live stream of the webcam is inaccessible on WAN, but works on LAN.
I've used a few different URLs to try and get it to work.
http://127.0.0.1:8080/?action=stream
http://192.168.0.xxx:8080/?action=stream
http://ender3.local:8080/?action=stream

all work locally but not through the tunnel for some reason. Any tips?

Have you tried a relative URL, ie /webcam/?action=stream

Yup no luck