Skip to main content
Mutual TLS (mTLS) authenticates both sides of a Kafka connection. The client validates the AutoMQ server certificate, and AutoMQ validates a client certificate issued by a trusted client CA. AutoMQ maps the certificate identity to a Kafka ACL user and applies ACL authorization.

Certificate responsibilities

Server certificate responsibilities depend on the DNS Zone mode selected when the instance is created. In both modes, you provide the client CA and issue a unique client certificate for each client identity.
Select the DNS Zone mode and enable mTLS when you create the instance. Existing instances cannot be changed from an unencrypted listener to mTLS.

Configuration workflow

Complete the following steps in order:
  1. Create or select a client CA and issue a Client Certificate. This step is required for both DNS Zone modes.
  2. Prepare the server identity. AutoMQ manages it for a Public DNS Zone; you provide it for a Private DNS Zone.
  3. Configure the AutoMQ instance.
  4. Configure the Kafka client.

Step 1: Create a client CA and Client Certificate

Both DNS Zone modes require a client CA and a Client Certificate. Use your organization’s certificate management system when available. If you need to create and maintain a private client CA, use the following procedure as a reference.
Protect client-ca.key and client.key according to your organization’s key management requirements. For client authentication, upload client-ca.crt, but never upload the client CA private key or Client Private Key. A customer-managed Private DNS Zone also requires the server materials described in Step 3.

Create a client CA

Create client-ca.cnf. Replace the distinguished-name values before running the commands.
Generate the client CA private key and certificate:

Issue a Client Certificate

Create the corresponding Kafka ACL user before issuing the Client Certificate. Unless you configure a different principal mapping rule, set the certificate Common Name (CN) to the ACL username. The default principal mapping extracts the CN from the Client Certificate:
For example, a certificate with CN=user01 maps to the ACL user user01. Create client.cnf:
Generate the Client Private Key and CSR, and then sign the CSR with the client CA:
Verify the certificate identity, purpose, and validity period:

Step 2: Prepare the server identity

AutoMQ Managed Public DNS Zone

No user action is required. AutoMQ provides, installs, and renews the authoritative Server Certificate. Do not create or upload a Server Certificate or Server Private Key.

Customer-managed Private DNS Zone

You must provide a Server Certificate whose Subject Alternative Name (SAN) covers the AutoMQ private endpoint names associated with the Private DNS Zone. Use a certificate issued by your organization’s certificate authority when available. The following reference procedure uses the client CA created in Step 1 to sign the Server Certificate. If your organization requires separate server and client CAs, use the server CA to sign the Server Certificate and retain both public CA certificates for the CA bundle in Step 3. Create server.cnf. Use the exact DNS name or wildcard required by the instance endpoint. Do not rely on the Common Name for hostname verification.
Generate the Server Private Key and CSR, and then sign the CSR:
Verify the certificate SAN, purpose, and validity period:

Step 3: Configure AutoMQ

AutoMQ Managed Public DNS Zone

  1. When creating the instance, select Public DNS Zone and the AutoMQ managed mode.
  2. Enable the mTLS listener.
  3. Upload client-ca.crt as the Client CA certificate.
  4. Do not upload a Server Certificate or Server Private Key.
  5. Create the ACL user that matches the Client Certificate identity and grant only the required Topic and Consumer Group permissions.

Customer-managed Private DNS Zone

  1. When creating the instance, select the customer-managed Private DNS Zone and enable the mTLS listener.
  2. Upload a PEM CA bundle that contains the client CA and server CA public certificates. If one CA issues both certificates as in this example, upload client-ca.crt once.
  3. Upload server.crt as the Server Certificate and server.key as the Server Private Key.
  4. Create the ACL user that matches the Client Certificate identity and grant only the required Topic and Consumer Group permissions.

Step 4: Configure a Kafka client

Convert the Client Certificate and Client Private Key to a PKCS#12 keystore:
Configure the Kafka client:
For an AutoMQ Managed Public DNS Zone, the client normally trusts the public Server Certificate through the operating system or Java runtime. No custom server truststore is required unless your organization requires one. For a customer-managed Private DNS Zone whose server CA is not already trusted, import the server CA certificate into a client truststore. In the single-CA example above, use client-ca.crt as the server CA certificate.
Add the truststore settings to the client configuration:

Certificate expiration responsibility

  • AutoMQ Managed Public DNS Zone: AutoMQ monitors and renews the server certificate. You monitor and rotate the client CA and all client certificates.
  • Customer-managed Private DNS Zone: You monitor and rotate the server CA, Server Certificate, client CA, and client certificates.
The server exposes kafka_stream_cert_expiry_timestamp_milliseconds and kafka_stream_cert_days_remaining for the installed server certificate. For collection methods, see Monitoring and Alerting with Prometheus. Client certificate monitoring must be implemented in your certificate management process.