If your service doesn’t support TLS termination, you can still use Agent TLS termination with Zero-Knowledge TLS.
What you’ll need
- Ensure you have openssl installed.
1. Generate a cert and key pair
The following command:- Generates a new certificate signing request (CSR) for a 4096-bit RSA key pair.
- The key is saved to
your-key.key
.
- The key is saved to
- Creates a self-signed certificate which:
- Is in x509 format and uses the SHA-256 hash algorithm.
- Is valid for 365 days.
- Is saved to
your-cert.crt
.
2. Configure your endpoint
You can configure your endpoint with an agent configuration file. To create a new configuration file with your generated cert and key pair, run the following command:You can run
ngrok config edit
to open the configuration file in your default text editor. Learn more about the ngrok config
command.3. Start your endpoint
Next, usengrok start endpoint_name_here
in the terminal to start an endpoint using the settings in your agent configuration file, as shown below:
4. Start your upstream server
Start an upstream server on the specified port (e.g.,12345
) to handle incoming requests. The following example uses Python, but you can use any language or framework depending on your requirements.
5. Try connecting to your endpoint
The following example usesopenssl s_client
to initiate an SSL/TLS client connection to your upstream server without a certificate.
openssl s_client
to initiate an SSL/TLS client connection to your upstream server with a certificate.
The extra arguments added to the command suppress most of the output so that only the data exchanged with the server will be displayed.