Ngrok: Selfhosting: Provide Let's Encrypt usage?

Created on 27 Apr 2019  Â·  7Comments  Â·  Source: inconshreveable/ngrok

Hey!

I'd like to host ngrok from my own server, which is currently using Let's Encrypt certs (/etc/letsencrypt/live/$domain/{privkey,chain,fullchain,cert}.pem).

I am unsure which file goes where, and would like to suggest adding a suggestion to SELFHOSTING.md for other users, since Let's Encrypt is widely used.

Thanks and kind regards,
Ingwie

Most helpful comment

I think I got it working! I hope to write a blog about it, but these are the general steps:

NOTE: The ngrok cli you download is version 2. When compiling, you are working with version 1. They are incompatible for this effort

  • Install Certbot
  • Generate and install Wildcard certificate. (Wildcard is needed to support custom hostnames, e.g. blah.ngrok.example.com).

    • My DNS registrar isn't supported, so this was a manual process and took me a while to get right. sudo certbot certonly -d '*.ngrok.example.com' --manual

  • Compile (requires golang). make release-server release-client
  • sudo bin/ngrokd -tlsKey="/etc/letsencrypt/live/ngrok.example.com/privkey.pem" -tlsCrt="/etc/letsencrypt/live/ngrok.example.com/fullchain.pem" -domain="ngrok.example.com"
  • Create a config: echo -e "server_addr: ngrok.example.com:4443\ntrust_host_root_certs: true" > ngrok-config
  • Run client: ./ngrok -config=ngrok-notify.yaml 80

A few gotchas:

  • The Wildcard cert is important, and took me a while to get right.
  • You will need to compile client and server

I'm sure there's a lot more steps required, but after fighting with this for hours, I wanted to detail my steps so far.

All 7 comments

I have the same quesstion.

Hey!

I'd like to host ngrok from my own server, which is currently using Let's Encrypt certs (/etc/letsencrypt/live/$domain/{privkey,chain,fullchain,cert}.pem).

I am unsure which file goes where, and would like to suggest adding a suggestion to SELFHOSTING.md for other users, since Let's Encrypt is widely used.

Thanks and kind regards,
Ingwie

/etc/letsencrypt/live/$domain/privkey.pem is your private key, rename it to private.key。
/etc/letsencrypt/live/$domain/fullchain.pem is certificate file,rename it to xxx.crt。
Adding -tlskey and -tlsCrt parameter when running ngrokd。
-tlskey=private.key, -tlsCrt=xxx.crt
I hope to help you ^_^

Would someone be able to link a tutorial for self hosted ngrok using letsencrypt for ssl?

I think I got it working! I hope to write a blog about it, but these are the general steps:

NOTE: The ngrok cli you download is version 2. When compiling, you are working with version 1. They are incompatible for this effort

  • Install Certbot
  • Generate and install Wildcard certificate. (Wildcard is needed to support custom hostnames, e.g. blah.ngrok.example.com).

    • My DNS registrar isn't supported, so this was a manual process and took me a while to get right. sudo certbot certonly -d '*.ngrok.example.com' --manual

  • Compile (requires golang). make release-server release-client
  • sudo bin/ngrokd -tlsKey="/etc/letsencrypt/live/ngrok.example.com/privkey.pem" -tlsCrt="/etc/letsencrypt/live/ngrok.example.com/fullchain.pem" -domain="ngrok.example.com"
  • Create a config: echo -e "server_addr: ngrok.example.com:4443\ntrust_host_root_certs: true" > ngrok-config
  • Run client: ./ngrok -config=ngrok-notify.yaml 80

A few gotchas:

  • The Wildcard cert is important, and took me a while to get right.
  • You will need to compile client and server

I'm sure there's a lot more steps required, but after fighting with this for hours, I wanted to detail my steps so far.

Notice Here
echo -e "server_addr: *.ngrok.example.com:4443\ntrust_host_root_certs: true" > ngrok-config
./ngrok -config=ngrok-config.yaml 80

See tutorial:
https://medium.com/@shivanshvij/a-self-hosted-ngrok-45bcec06d0cf

Was this page helpful?
0 / 5 - 0 ratings