ngrok / ngrok-python

Embed ngrok secure ingress into your Python apps with a single line of code.
https://ngrok.com
Apache License 2.0
103 stars 19 forks source link

ngrok and ssl certs #41

Closed pjaol closed 9 months ago

pjaol commented 10 months ago

Running flask as

app.run(debug=True, use_reloader=True, port=port, ssl_context=("certs/cert.pem", "certs/key.pem")

Doesn't appear as connect / http_endpoint support SSL certs locally?

ngrok http https://127.0.0.1:3000/ 

Works fine

Can we add this to http_endpoint?

bobzilladev commented 10 months ago

Hello, thanks for your feedback! This would be a reasonable feature to bring the Python SDK up to parity with the agent. We'll review how this might fit in amongst our priorities and take it into consideration.

bobzilladev commented 9 months ago

As of 0.10.0 there is backend TLS support, validated by a filepath specified in the SSL_CERT_FILE environment variable, or falling back to the host OS installed certificates. So it should now be possible to do this to connect:

tunnel = ngrok.connect("https://127.0.0.1:3000", authtoken_from_env=True)

Possibly needing to add a variable like this to the environment before running, if the flask service is using certs not trusted by the OS: SSL_CERT_FILE=/path/to/ca.crt.

bobzilladev commented 9 months ago

Going to close out this issue, feel free to reopen if it doesn't work as expected. Thanks for your feedback!