NGROK Tutorial

User avatar
Thixotropic
Posts: 513
Joined: Wed Sep 04, 2019 7:20 pm

NGROK Tutorial

Post by Thixotropic » Sun Mar 08, 2020 6:27 pm

Ngrok is a free web service that allows you to quickly create a secure HTTPS connection to a PC or web service. It's a simple and easy way to access your Blue Iris PC over HTTPS from anywhere in the world and requires very little setup. It does not require a VPN, certificates, changing your router settings, or anything else.
For complete information, visit Ngrok.com.


If you want to use Ngrok to securely access your Blue Iris web server, follow this walk-through.

1) Create an account on Ngrok.com (it's free): https://ngrok.com/

2) Download the Ngrok executable, unzip it and put it someplace convenient. (https://ngrok.com/download)

3) Register your API Authtoken: https://ngrok.com/docs#getting-started-authtoken (you only have to do this once).

4) Connect your account. This will become important later, because connecting your account will let you find your open tunnels (HTTPS connections) in the dashboard. Do this by executing this command:

Code: Select all

 .\ngrok authtoken <your authtoken>


5) Create a .bat or .cmd file that will start Ngrok with the correct parameters. Name it whatever you want, for example, "ngrok-starter.cmd".
In the example below, the Ngrok executable is in a folder named "NRGOK" on the desktop, and the BI webserver is located on the LAN at "192.168.1.2:99". Replace "<your username>" with your actual Windows username. The cmd file can go in the same directory if you want. I placed mine in the main C:\Windows directory.

This example starts Ngrok with an HTTPS connection on port 99:

Code: Select all

C:\Users\<your username>\Desktop\NGROK\ngrok.exe https 192.168.1.2:99

1) Change the IP to whatever IP address your router resides on.
2) Change "99" to match whichever port you've forwarded for your Blue Iris web server.

Note that including the IP address appears to be PC-dependent; some PCs require you to 'force' the IP assignment, some don't. If it doesn't work using an IP address, try starting Ngrok without specifying the IP: ngrok.exe https 99


6) Test the connection by running the cmd file. You should get a command window showing that Ngrok started and the current, ephemeral connection URL.
It'll be a random URL similar to "https://fuj47645.ngrok.io". This will change every time you start Ngrok, but that's okay- you'll always be able to find the current URL in the Ngrok Status Dashboard whenever you need to.

7) Go to the Ngrok Status Dashboard and confirm the HTTPS tunnel has been created: https://dashboard.ngrok.com/status You should see the same URL there.

8) Click the HTTPS URL. If you've done everything right so far you should see the BI login screen.

If you prefer to start Ngrok manually each time, then you're done- you can skip to the end and start using Ngrok.


9) Create a Scheduled Task in Windows that will run on startup (before any user logs in).
  • Open the Windows Task Scheduler.
  • Create a Basic Task.
  • Name it whatever you want, such as "NGROK_startup".
  • Fill in the Description so you'll know what the heck this is later (i.e. "Starts ngrok when Windows boots and before any user logs in")
  • Click Next, and choose When the computer starts.
  • Click Next, and choose Start a program.
  • Click Next, and click Browse, then find and select your batch/cmd file (e.g. "ngrok-starter.cmd").
  • Check the box that says "Open the Properties dialog for this task when I click Finish". Refer to the image below for additional parameters you need to set. Set the parameters as shown below to run the batch/cmd file as the user you specified earlier in the ngrok batch file.

-
st-6.PNG
st-6.PNG (58.41 KiB) Viewed 5898 times
-
Save and close the dialog box.

Open the Scheduled Tasks screen again and verify that the task has been added. You should see something similar to what's shown in the image below:
-
st-7.PNG
st-7.PNG (52.8 KiB) Viewed 5898 times
-

10) Test by rebooting Windows. After Windows has finished booting BUT BEFORE YOU LOGIN, go to the Ngrok Status Dashboard, refresh it, and confirm that two default tunnels (HTTP and HTTPS) have been started: https://dashboard.ngrok.com/status

11) If the tunnels have been started, clicking on the HTTPS URL should show you your BI server logon through a secure, https connection.

12) From now on, each time you start Windows it will run Ngrok and create a new secure tunnel URL for you to use, wherever you are.
  • Also note that when you login, you won't see the CMD window that's running Ngrok, it'll be hidden and running in the background. Use the Task Manager to stop it if you need to.

If you have any questions, please ask them in the forum.
Last edited by Thixotropic on Mon Apr 20, 2020 12:00 am, edited 3 times in total.
Blue Iris 5.x x64 | Windows 10 Pro x64 | 16GB RAM | i7-7700 3.6 GHz | 1TB HDD | 2TB RAID NAS | 9 Cameras | Almost Dual NIC | 2KVA UPS
User avatar
TimG
Posts: 702
Joined: Tue Jun 18, 2019 10:45 am
Location: Nottinghamshire, UK.

Re: NGROK Tutorial

Post by TimG » Sun Mar 22, 2020 7:45 am

Wow, that is thorough !
Another solution for securing remote connections.
I myself have used the OpenVpn with an Asus router (Merlin firmware) method. These posts should be sticky - Ken ?
Blue Iris v5.3.3.12 | Win10 x64 version 2004 | Dahua IPC-HDW5231R-ZE, Foscam R2, Ertech 4MP, 2 analogue cameras on Euresys Picolo Pro 2 | Intel i5-3330 CPU, 16GB Ram, Multiple SSD and HD | TVMosaic.
wepee
Posts: 8
Joined: Wed Apr 08, 2020 8:45 am

Re: NGROK Tutorial

Post by wepee » Wed Apr 08, 2020 6:02 pm

Hi,

I went through the tutorial that @Thixotropic wrote,

I found some problems.............

Code: Select all

 ./ngrok authtoken <your authtoken>

This command cannot run in Windows 10 command prompt, it complains: "." is not recognized as internal or external command

Code: Select all

 ngrok authtoken <your authtoken>

This command works fine. I just remove the ./ and run it.

Code: Select all

ngrok.exe https 192.168.1.2:81

This command did not work either....(Default BI port is 81)

Code: Select all

ngrok.exe http 81
This command is working (Default BI port is 81)
User avatar
Thixotropic
Posts: 513
Joined: Wed Sep 04, 2019 7:20 pm

Re: NGROK Tutorial

Post by Thixotropic » Sun Apr 12, 2020 5:36 pm

Code: Select all

 ./ngrok authtoken <your authtoken>

This command cannot run in Windows 10 command prompt, it complains: "." is not recognized as internal or external command
The problem was a forward slash (/) instead of a backslash (\). I updated the tutorial.

-
This command did not work either....(Default BI port is 81)

Code: Select all

 ngrok.exe https 192.168.1.2:81
This appears to be PC-dependent; some PCs require you to 'force' the IP assignment, some don't. I updated the tutorial to reflect this.
Blue Iris 5.x x64 | Windows 10 Pro x64 | 16GB RAM | i7-7700 3.6 GHz | 1TB HDD | 2TB RAID NAS | 9 Cameras | Almost Dual NIC | 2KVA UPS
wepee
Posts: 8
Joined: Wed Apr 08, 2020 8:45 am

Re: NGROK Tutorial

Post by wepee » Mon Apr 13, 2020 7:20 am

This command did not work either....(Default BI port is 81)

Code: Select all

 ngrok.exe https 192.168.1.2:81
This appears to be PC-dependent; some PCs require you to 'force' the IP assignment, some don't. I updated the tutorial to reflect this.
[/quote]

@Thixotropic,
Thank you for your reply.
Referring to the above, you mean is OS platform dependent? Rather than PC dependent.
User avatar
Thixotropic
Posts: 513
Joined: Wed Sep 04, 2019 7:20 pm

Re: NGROK Tutorial

Post by Thixotropic » Mon Apr 13, 2020 8:53 pm

wepee wrote:
Mon Apr 13, 2020 7:20 am
Referring to the above, you mean is OS platform dependent? Rather than PC dependent.
Since BI only runs on Windows I think it's a difference in the PC setup, path, or some other variable particular to the PC it's on.
Blue Iris 5.x x64 | Windows 10 Pro x64 | 16GB RAM | i7-7700 3.6 GHz | 1TB HDD | 2TB RAID NAS | 9 Cameras | Almost Dual NIC | 2KVA UPS
wepee
Posts: 8
Joined: Wed Apr 08, 2020 8:45 am

Re: NGROK Tutorial

Post by wepee » Fri Apr 17, 2020 2:13 pm

@Thixotropic,

It seems like, support for free registered user is non-existent.
I have been patiently waiting for a reply from ngrok support.
But so far no response yet.

I was wondering, if you are able to implement this:

Code: Select all

c:\ngrok\ngrok.exe http -auth= "admin:xyz123" 81
I am trying to protect my tunnel by using password authentication method.
But I could get it working.

2020-04-17_22-10-35.jpg
2020-04-17_22-10-35.jpg (56.63 KiB) Viewed 5285 times
Last edited by wepee on Sun Apr 19, 2020 4:56 am, edited 1 time in total.
User avatar
Thixotropic
Posts: 513
Joined: Wed Sep 04, 2019 7:20 pm

Re: NGROK Tutorial

Post by Thixotropic » Sat Apr 18, 2020 3:29 pm

wepee wrote:
Fri Apr 17, 2020 2:13 pm
It seems like, support for free registered user is non-existent.
Yes, I also wrote them repeatedly and never got any response at all. Nothing, zero, zip, nada.

wepee wrote:
Fri Apr 17, 2020 2:13 pm
I was wondering, if you are able to implement this:

Code: Select all

c:\ngrok\ngrok.exe http -auth= "admin:xyz123" 81
I haven't tried using a password. Maybe change 'http' to 'https', and also maybe try removing the quotes from around the username and password.
Blue Iris 5.x x64 | Windows 10 Pro x64 | 16GB RAM | i7-7700 3.6 GHz | 1TB HDD | 2TB RAID NAS | 9 Cameras | Almost Dual NIC | 2KVA UPS
jbutterfill
Posts: 4
Joined: Fri Sep 11, 2020 8:56 am

Re: NGROK Tutorial

Post by jbutterfill » Sun Sep 13, 2020 9:30 am

Great tutorial. I have it all working and have now used the curl command to copy the ngrok url in to a text file when the computer starts up. Is there a way to automatically copy the url to the wan address on the web server tab in blue iris?

I’ve been looking through the files and can’t find any config file to edit.. any help Greatly appreciated
User avatar
Thixotropic
Posts: 513
Joined: Wed Sep 04, 2019 7:20 pm

Re: NGROK Tutorial

Post by Thixotropic » Fri Sep 18, 2020 8:06 pm

It may be in the registry.
Blue Iris 5.x x64 | Windows 10 Pro x64 | 16GB RAM | i7-7700 3.6 GHz | 1TB HDD | 2TB RAID NAS | 9 Cameras | Almost Dual NIC | 2KVA UPS
Post Reply