Mutual TLS for Kafka Pipelines
On this page
SingleStore Pipelines support mutual TLS (mTLS) when loading data from Kafka.
Certificate Requirements
Before configuring Kafka and SingleStore, generate the required certificates and keys in . format.
The following are the required files:
-
CA certificate configured on the Kafka broker for client certificate verification
-
Client certificate, signed by the CA in step 1
-
Client private key
-
CA certificate used by the client to verify the broker certificate
-
Kafka broker certificate, signed by the CA in step 4
-
Kafka broker private key
Note
The CA certificates used for signing and verification can be either self-generated or issued by well-known third-party CA certificates.
Generate Kafka Keystore and Truststore
Kafka uses Java KeyStore (JKS) files for SSL configuration.
JKS Keystore Format (Java 8 and Earlier)
In Java 8 and earlier, the default keystore and truststore format is JKS (Java KeyStore).
Use the following commands to generate the keystore and truststore from the . files.
-
Use the following command to create a PKCS12 keystore file:
openssl pkcs12 -export \ -in /path/to/server-cert.pem \ -inkey /path/to/server-key.pem \ -certfile /path/to/ca-cert.pem \ -out kafka-server.p12 \ -name kafka-server \ -passout pass:<PKCS12_PASSWORD> -
Use the following command to convert the PKCS12 keystore to JKS file:
keytool -importkeystore \ -destkeystore kafka.server.keystore.jks \ -srckeystore kafka-server.p12 \ -srcstoretype PKCS12 \ -alias kafka-server \ -deststorepass <JKS_KEYSTORE_PASSWORD> \ -destkeypass <JKS_KEY_PASSWORD> \ -srcstorepass <PKCS12_PASSWORD> -
Use the following command to create the truststore file:
keytool -import \ -trustcacerts \ -alias CARoot \ -file /path/to/ca-cert.pem \ -keystore kafka.server.truststore.jks \ -storepass <JKS_TRUSTSTORE_PASSWORD> \ -noprompt
Use these JKS files in the Kafka broker configuration.
PKCS12 Keystore Format (Java 9 and Later)
In Java 9 and later, the default keystore and truststore format is PKCS12 (.
Use the following commands to generate the keystore and truststore from . files.
-
Use the following command to create a PKCS12 keystore file:
openssl pkcs12 -export \ -in path/to/server-cert.pem \ -inkey path/to/server-key.pem \ -certfile path/to/ca-cert.pem \ -out kafka.server.keystore.p12 \ -name kafka-server \ -passout pass:<SERVER_KEYSTORE_PASSWORD> -
Use the following command to create the PKCS12 truststore file:
keytool -import \ -trustcacerts \ -alias CARoot \ -file certs/ca-cert.pem \ -keystore kafka-stores-pkcs12/kafka.server.truststore.p12 \ -storetype PKCS12 \ -storepass <SERVER_TRUSTSTORE_PASSWORD> \ -noprompt
Use these . files in the Kafka broker configuration.
Configure Kafka Brokers
Configure the Kafka broker with an SSL listener and enable client authentication by adding the following properties to server. file.
JKS Keystore Configuration (Java 8 and Earlier)
listeners=PLAINTEXT://:9092,SSL://:9093,CONTROLLER://:9096
advertised.listeners=PLAINTEXT://host.example.com:9092,SSL://host.example.com:9093
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,CONTROLLER:PLAINTEXT
inter.broker.listener.name=SSL
ssl.keystore.location=/path/to/kafka.server.keystore.jks
ssl.keystore.password=<JKS_KEYSTORE_PASSWORD>
ssl.key.password=<JKS_KEY_PASSWORD>
ssl.truststore.location=/path/to/kafka.server.truststore.jks
ssl.truststore.password=<JKS_TRUSTSTORE_PASSWORD>
ssl.client.auth=requiredReplace host. with the Kafka broker endpoint.
Enabling ssl. requires clients to present a valid certificate that enables mutual TLS.
PKCS12 Keystore Configuration (Java 9 and Later)
listeners=PLAINTEXT://:9092,SSL://:9093,CONTROLLER://:9096
advertised.listeners=PLAINTEXT://host.example.com:9092,SSL://host.example.com:9093
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,CONTROLLER:PLAINTEXT
inter.broker.listener.name=SSL
ssl.keystore.location=/path/to/kafka.server.keystore.p12
ssl.keystore.password=<SERVER_KEYSTORE_PASSWORD>
ssl.key.password=<SERVER_KEYSTORE_PASSWORD>
ssl.truststore.location=/path/to/kafka.server.truststore.p12
ssl.truststore.password=<SERVER_TRUSTSTORE_PASSWORD>
ssl.client.auth=requiredReplace host. with the Kafka broker endpoint.
Enabling ssl. requires clients to present a valid certificate that enables mutual TLS.
Configure a Pipeline to Use mTLS
When creating a pipeline, configure the Kafka connection to use SSL and specify the client certificate, private key, and CA certificate.
Example: CREATE PIPELINE with mTLS
The following example demonstrates how to create a Kafka pipeline that authenticates to the Kafka broker using mTLS.
CREATE PIPELINE p ASLOAD DATA KAFKA 'host.example.com:9093/test_topic'CONFIG '{"security.protocol": "ssl","ssl.ca.location": "/path/to/ca-cert.pem","ssl.certificate.location": "/path/to/client-cert.pem","ssl.key.location": "/path/to/client-key.pem"}'CREDENTIALS '{"ssl.key.password": "<CLIENT_PRIVATE_KEY_PASSWORD>"}'INTO TABLE t;
The host and port mentioned must be the same as specified in advertised. in the Kafka server configuration.9093 as the SSL port and must be used for the mTLS connection.
Last modified: December 22, 2025