Skip to main content

Mutual TLS at the gateway with your organization's CA

Serve a host name with your own certificate, admit only clients whose certificate your CA signed, skip a health path, and read the refusals in Traffic Explorer.

By Akif F. Güven Updated Security

What you will have at the end

A host name, shop.lab, served by the gateway with a certificate your own CA issued, on which a client is admitted only when it presents a certificate signed by that CA. A client with such a certificate reaches the backend; a client with none, or with one signed by another CA, is answered 400 by the gateway before any Route is matched; a health path is served without asking for a certificate. The certificate’s private key is sent to the engine and never shown again, the refusals are request records in Traffic Explorer, and the creation of the certificate is in the audit log.

Prerequisites

  • Your organization’s CA and three files it signed for this article: a server certificate for shop.lab with that name as a subject alternative name, a client certificate for the partner system, and, for the refusal, a certificate signed by some other CA. All of them are RSA 2048 keys, made with openssl on the lab host.
  • A Route for the host. Here it is partner-api, /partner/* with the host shop.lab, forwarding to the echo service httpbin-backend so that the article can show the request that got through.
  • The engine’s TLS port, 9443 on this install. The calls below are made from a container on the gateway’s network with a small Python client, because the lab host does not publish that port; curl --cacert ca.crt --cert client.crt --key client.key https://shop.lab:9443/partner/ping is the same call from a host that can reach it.
  • Traffic logging turned on under Traffic Explorer › Settings, and a role that may manage certificates. The screenshots below were taken as nora.becker.

The server certificate for the host name

Open Certificates in the Environment’s navigation and select New certificate. Under General, Type stays Server certificate; the other choice, a client certificate, is one the gateway itself presents to a backend. Server names takes the host names clients will ask for, shop.lab here; the help under it says a leading * matches subdomains. Use names from the certificate fills the list from the certificate’s own names once it is pasted.

The General section of the new certificate form: Type Server certificate, Server names holding shop.lab with the Use names from the certificate button under it, the Description, and Enabled on One certificate per set of host names. The names decide which connections it is served on.

Under Certificate, paste the PEM or choose the files: the Certificate, with the leaf first and intermediates after it in the same text, and the Private key. The form reads the certificate as you paste and shows what it found; the key is sent to the engine and never shown again, which the field says in its own help line. Additional certificates takes a second pair for the same names, an ECDSA certificate next to an RSA one. Under Protocols, leave the TLS versions unchecked for the engine default; the measurement below negotiated TLS 1.3.

Who may connect: the client CA

Under Client certificates, switch Require client certificates on. The form says what that means in one line: mutual TLS, clients must present a certificate signed by the CA you provide. Three fields open:

  • CA certificate: the PEM of your CA. The form shows the subject and the expiry it read, CN=Cosmonot Lab CA, expires 13 Oct 2027.
  • Depth: how many intermediate certificates may stand between a client certificate and the trusted CA. 1, the default, is right for a CA that signs client certificates directly.
  • Skip for URIs: paths served without asking for a client certificate, as regular expressions. ^/partner/health$ here, so that a load balancer can probe the host without a certificate of its own.

The Client certificates section: Require client certificates on, the CA certificate pasted with the line CN=Cosmonot Lab CA · expires 13 Oct 2027 under it, Depth 1, and Skip for URIs holding ^/partner/health$ The CA decides who gets in; the skip list decides which paths need no certificate.

Select Create certificate. The certificate page shows what the engine holds: the subject, the issuer, the names, the validity, the key type, the private key as •••• stored on the engine, and the client CA with its expiry.

The Certificate card of the saved certificate: Subject CN=shop.lab, Issuer CN=Cosmonot Lab CA, Names shop.lab, Valid from 13 Oct 2026 to 13 Oct 2027 in 364 days, Key RSA 2048, Private key as four dots stored on the engine, Client CA CN=Cosmonot Lab CA RSA 2048 expiring 13 Oct 2027 Everything about the certificate except the one thing nobody should see again.

What a client sees

Four connections to shop.lab, each verifying the server against the CA. The partner, with its certificate:

handshake ok · server CN=shop.lab issuer CN=Cosmonot Lab CA · TLSv1.3
HTTP/1.1 200 OK

The echo service received the request with Host: shop.lab. The same request without a client certificate:

handshake ok · server CN=shop.lab issuer CN=Cosmonot Lab CA · TLSv1.3
HTTP/1.1 400 Bad Request

And with a certificate signed by another CA:

handshake ok · server CN=shop.lab issuer CN=Cosmonot Lab CA · TLSv1.3
HTTP/1.1 400 Bad Request

One thing to notice: the TLS handshake completes in both refusals. The gateway asks for a client certificate, and when none that the CA signed arrives, it answers the request itself with 400 and never matches a Route. A client library that only checks the handshake will not see the refusal; the status code is where it is.

The health path without any certificate:

handshake ok · server CN=shop.lab issuer CN=Cosmonot Lab CA · TLSv1.3
HTTP/1.1 200 OK

What Traffic Explorer shows

The two refusals are request records, because the gateway answered them: 400, gateway as the Upstream node, and no route matched where the Route would be, since the client certificate is checked before routing. The admitted request and the health probe carry the Route and the backend’s address.

Traffic Explorer filtered to the path /partner/: a 200 for /partner/health with the backend address, two 400 records for /partner/ping with no route matched and gateway as the Upstream node, and a 200 for /partner/ping with the backend address The refusals are recorded. A connection that fails during the handshake itself would leave no request to record; these did not.

What the audit log keeps

Creating the certificate is an ssl.created record: who, when, and the object as the engine received it, the certificate and the CA in the clear, as they are public, and no private key at all, because the engine never returns one and the console never asks for it back.

The Change section of the audit record of the certificate creation: the certificate's PEM, the description, the server name shop.lab, the client block with the CA's PEM and the skip_mtls_uri_regex ^/partner/health$, and no key field The certificate as the engine received it. The key is the one field that is not there.

What to do next

Written by
Akif F. Güven
Engineer, G8
Was this helpful?
Next step

See G8 in a demo

We’ll show you the console with APIs and AI traffic like yours, and answer the questions these articles leave open.

  1. 01Demo
  2. 02Proof of conceptOn Docker for a quick start, or on the infrastructure you plan to run G8 on.
  3. 03LicenseWe prepare a quote for your edition and nodes, and you receive a signed license file.