How to configure and associate an mTLS certificate to a domain

Mutual Transport Layer Security (mTLS) is a security protocol that enables two-way authentication and encryption for network interaction. It confirms that both the client and the server are authenticated and have the clearance for effective communication.

To configure mTLS in your applications, you need a digital certificate with mTLS support signed by a third-party certificate authority (CA). At Azion, this type of certificate is called a Trusted CA.


Adding a Trusted CA certificate and associating it to a domain

  1. Access Azion Console > Digital Certificates.
  2. Click the + Digital Certificate button.
  3. Give your certificate an easy-to-remember name.
  4. Select the Import Trusted CA Certificate option.
  5. In the Private Certificate field, paste your Trusted CA, including the begin and end tags.
  1. Click the Save button.

After adding a Trusted CA to your certificate library, you need to configure which domains should operate with mTLS.

  1. Access Azion Console > Domains.
  2. Click on the domain you’d like to configure mTLS for.
  3. Enable the Mutual Authentication switch.
  4. Choose which verification mode you wish to use.
  • By selecting Enforce (default), mTLS is enabled in your edge application’s domain and all incoming traffic will comply with client and server authentication.
  • By selecting Permissive, you must configure this mode in Edge Firewall.
  1. Select the Trusted CA Certificate you created.
  2. Click the Save button.

Creating specific rules for Permissive mTLS

To configure a firewall to block access to a domain using the Permissive mode in mTLS, you must use the Rules Engine for Edge Firewall. The following example describes a rule set that will block any incoming network traffic with the hostname mydomain.com whose client certificate validation isn’t true and deliver a 403 Forbidden error.

  1. Access Azion Console > Edge Firewall.
  2. Configure an edge firewall for the mTLS domain.
  3. Click the Rules Engine tab.
  4. Click the + Rules Engine button.
  5. Give your rule an easy-to-remember name.
  6. In the Criteria section, as a variable, select Host.
  7. As a comparison operator, select is equal.
  8. As an argument, enter mydomain.com.
  9. Click the + And button to add a new criteria.
  10. As a variable, select Client Certificate Validation.
  11. As a comparison operator, select is not equal to.
  12. As an argument, enter true.
  13. In the Behavior section, select Deny (403 Forbidden).
  14. Click the Save button.

Specifying mTLS variables in HTTP headers

If your application is part of the Open Banking model, you must specify the variables ${ssl_client_escaped_cert} and ${ssl_client_s_dn_parsed} in the HTTP headers of your application. You can use the Rules Engine for Edge Application to create this behavior for your whole application.

Requires:

To test whether the headers you add are being sent in requests, you can run the following cURL command in your terminal from a directory containing the .pem files of your Trusted CA and its private key:

Terminal window
curl -skv https://mydomain.com/ -H "Pragma: azion-debug-cache" -o /dev/stdout --cert cert.pem --key key.pem
  1. Access Azion Console > Edge Application.
  2. Find and click on the application with the mTLS domain.
  3. Click the Rules Engine tab.
  4. Click the + Rule button.
  5. Give your rule an easy-to-remember name.
  6. Select Request Phase.
  7. In the Criteria field, enter the desired mTLS variable. Example: ${ssl_client_escaped_cert}.
  8. Select the comparison operator exists.
  9. In the Behaviors section, select the Add Response Header behavior.
  10. As an argument, enter Mtls-Variable-Name: ${ssl_variable_name}, replacing the name and variable with the mTLS variable you wish to insert in your application’s header.
    • Example: Escaped-Client-Cert: ${ssl_client_escaped_cert}
  1. To add another variable, click the + And button in the Criteria section and repeat the remaining steps.
  2. Click the Save button when you’re done.