Configure Tls
Certificate Configuration for TLS/MTLS
To establish secure communication between your target application and the chaos proxy server, you need to configure certificates based on your requirements:
For TLS (one-way authentication): Configure server-side certificates using either Self-Signed or Trusted Certificates
For MTLS (mutual authentication): Configure server-side certificates (Self-Signed or Trusted) + Client Certificates
Using Self-Signed Certificates
Choose one of the following approaches to configure server-side certificates for TLS:
CA Certificates (Dynamic Certificate Generation)
Use this approach when you want the proxy to dynamically generate server certificates during the TLS handshake. This is the most flexible option for handling multiple domains.
What you need:
ca.key: The private key used to sign certificates.
ca.crt: The Certificate Authority (CA) certificate.
Prerequisites:
Load
ca.crtas a trusted root CA certificate in your target application before running the chaos experiment.
Configuration Steps:
Combine your CA key and certificate into a single PEM file:
cat ca.key ca.crt > ca.pemBase64-encode the combined file and add it to the
CA_CERTIFICATESenvironment variable:cat ca.pem | base64
How it works: The proxy dynamically generates server certificates with the appropriate domain names during each TLS handshake. These certificates are signed by the self-signed CA (provided in the
CA_CERTIFICATESenvironment variable) and then presented to the target application.Server Certificates (Pre-Generated Certificates)
Use this approach when you want to use pre-generated server certificates with specific domain names. This is ideal when you know all the domains your application will communicate with.
What you need:
server.key: The private key for the server certificate.
server.crt: The server certificate signed by your CA.
Understanding Domain Types:
Internal Domains: Organization-managed services (e.g.,
api.mycompany.internal). These typically include internal microservices and soft dependencies.External Domains: Third-party services (e.g.,
dynamodb.amazonaws.com,s3.amazonaws.com). These are usually hard dependencies.SAN (Subject Alternative Names): A list of all domain names that the certificate should be valid for. These are specified when creating the Certificate Signing Request (CSR).
Prerequisites:
Load
ca.crtas a trusted root CA certificate in your target application before running the chaos experiment.Generate
server.crtwith all necessary domain names (using SAN) and sign it with your CA certificates.
Configuration Steps:
Combine your server key and certificate into a single PEM file:
cat server.key server.crt > server.pemBase64-encode the combined file and add it to the
SERVER_CERTIFICATESenvironment variable:cat server.pem | base64
How it works: The proxy uses the pre-generated server certificates (provided in the
SERVER_CERTIFICATESenvironment variable) during the TLS handshake with your target application.
Using Trusted Certificates
When using certificates signed by a publicly trusted Certificate Authority (such as Let's Encrypt, DigiCert, or your organization's trusted CA), you don't need to manually load the CA certificate into your target application, as it's already trusted by default.
For Internal Domains Only
Use this when your chaos experiments only affect internal, organization-managed services.
Prerequisites:
Generate server certificates that include all internal domain names (using SAN).
Sign the certificates using a trusted CA.
No need to load the CA certificate in the target application since it's already trusted.
Configuration Steps:
Combine your server key, certificate, and any intermediate certificates:
Note: Replace
intermediate.crtwith your actual intermediate certificate file(s). If you have multiple intermediate certificates, include them all in order.Base64-encode the combined file and add it to the
SERVER_CERTIFICATESenvironment variable:
For Both Internal and External Domains
Use this when your chaos experiments affect both internal services and external third-party services (e.g., AWS, Azure, GCP).
Prerequisites:
Generate server certificates that include both internal and external domain names (using SAN).
Sign the certificates using a trusted CA.
No need to load the CA certificate in the target application since it's already trusted.
Configuration Steps:
Combine your server key, certificate, and any intermediate certificates:
Note: Ensure your certificate's SAN includes all domains your application communicates with.
Base64-encode the combined file and add it to the
SERVER_CERTIFICATESenvironment variable:
Client Certificates (For MTLS)
Client certificates are required in addition to server-side certificates (Self-Signed or Trusted) when you need mutual TLS (MTLS). They enable the proxy to authenticate itself to the upstream server, completing the mutual authentication setup.
When to use: Use client certificates when the upstream server requires client certificate authentication for MTLS communication. This applies to both self-signed and trusted certificate setups.
What you need:
client.key: The private key for the client certificate.
client.crt: The client certificate signed by a CA trusted by the upstream server.
Plus: Server-side certificates configured using either Self-Signed Certificates (CA or Server Certificates) OR Trusted Certificates.
Prerequisites:
Configure server-side TLS first using one of the approaches above (Self-Signed or Trusted Certificates).
Ensure the upstream server is configured to require and validate client certificates.
The CA that signed
client.crtmust be trusted by the upstream server.
Configuration Steps:
Combine your client key and certificate into a single PEM file:
Base64-encode the combined file and add it to the
CLIENT_CERTIFICATESenvironment variable:
How it works:
Proxy ↔ Target Application: The proxy uses server-side certificates (CA, Server, or Trusted) for the TLS handshake.
Proxy ↔ Upstream Server: The proxy presents client certificates when connecting to the upstream server.
Result: Mutual authentication (MTLS) is established, where both the proxy and the upstream server verify each other's identity.
Last updated
Was this helpful?