Important
The SingleStore 9.1 release candidate (RC) gives you the opportunity to preview, evaluate, and provide feedback on new and upcoming features prior to their general availability. In the interim, SingleStore 9.0 is recommended for production workloads, which can later be upgraded to SingleStore 9.1.
Configure mTLS for SingleStore Kafka Sink Connector
On this page
To configure a mutual TLS (mTLS) connection for the SingleStore Kafka Sink Connector ("the connector") on SingleStore:
-
Create a database user that requires certificate-based mTLS authentication.
Generate Client Certificates
Refer to Generate Client Certificates for SingleStore mTLS Connection for information on generating the required certificates for mTLS authentication.
The following files are generated:
-
ca-key.: The private key for the CA.pem -
ca-cert.: The public CA certificate.pem -
client-key.: The client private key.pem -
client-cert.: The client certificate signed by the CA.pem
Additionally, download the singlestore_
Create a Java Keystore
The connector uses the SingleStore JDBC driver internally, which expects the client certificate and key in a keystore format.. files to a . keystore using OpenSSL.
openssl pkcs12 -export \-inkey /path/to/client-key.pem \-in /path/to/client-cert.pem \-out client-keystore.p12 \-name client-cert \-CAfile /path/to/ca-cert.pem \-caname root \-passout pass:<your_keystore_password>
This command creates a client-keystore. file that contains the client certificate, private key, and CA certificate chain, protected by the keystore password (<your_).
Copy and securely store the client-keystore. file.
Configure SingleStore
Configure a CA in your SingleStore Self-Managed cluster:
-
Copy the
ca-cert.file to the same path on each host running aggregator nodes in the cluster.pem -
Run the following command to configure the CA bundle (
ca-cert.file) using thepem ssl_engine variable (update the path before running the command):ca_ for_ client_ cert sdb-admin update-config --role aggregator --key ssl_ca_for_client_cert --value /path/to/ca-cert.pem --all --yes -
Restart all the nodes in the cluster to apply the changes:
sdb-admin restart-node --all --yes
The client certificate is verified using this CA.
Create a Database User
Create a database user with one of the following options in the CREATE USER statement to require certificate-based mTLS authentication (replace <mtls_ with a secure password):
-
REQUIRE X509: The user can connect only if the client presents a valid TLS client certificate that is not expired and chains to the CA bundle configured on the server.Connections that do not provide a valid certificate are rejected. For example: CREATE USER 's2user'@'%' IDENTIFIED BY '<mtls_password>' REQUIRE X509; -
REQUIRE SUBJECT '<subject-dn-string>': In addition to extendingREQUIRE X509,REQUIRE SUBJECTenforces that theSubject DNin the client certificate must exactly match the configured value.This option verifies both trust (via certificate chaining to the CA) and identity (via the Subject DNstring).For example: CREATE USER 's2user'@'%' IDENTIFIED BY '<mtls_password>' REQUIRE SUBJECT '/CN=s2user/O=example/C=US';Note: While running
CREATE USERorALTER USER, theSubjectmust be specified in OpenSSL “oneline” format.The fields CN,O,C,ST,L, etc., must be separated by a /.
Grant the required privileges to the database user.
Update the Connector Configuration
Update the following parameters in the SingleStore Kafka Sink connector's configuration JSON to enable mTLS authentication:
-
connection.: Specify the username of the mTLS-enabled SingleStore database user.user -
connection.: Specify the password (password <mtls_) for the SingleStore database user.password> -
params.: Specify either of the following:sslMode -
verify-ca: Use SSL/TLS for encryption and perform certificate verification, but do not perform hostname verification. -
verify-full: Use SSL/TLS for encryption, certificate verification, and hostname verification.
Refer to sslMode for more information.
-
-
params.: Specify the path toserverSslCert singlestore_(include the filename and extension).bundle. pem -
params.: Specify the path tokeyStore client-keystore.(include the filename and extension).p12 -
params.: Specify the keystore password (keyStorePassword <your_) passed to thekeystore_ password> opensslcommand. -
params..keyStoreType Specify PKCS12as the keystore type.
Refer to SingleStore JDBC Driver - TLS Parameters for more information on supported SSL/TLS configuration options.
The following is a sample configuration:
{"name": "singlestore-sink-connector-mtls","config": {"connector.class": "com.singlestore.kafka.SingleStoreSinkConnector","tasks.max": "1","topics": "s2Ingest","connection.clientEndpoint": "svc-XXXX-svchost:3306","connection.database": "dbTest","connection.user": "mtls_user","connection.password": "<mtls_password>","params.sslMode": "verify-full","params.serverSslCert": "/opt/certs/singlestore_bundle.pem","params.keystore": "/opt/certs/client-keystore.p12","params.keyStorePassword": "<keystore_password>","params.keyStoreType": "PKCS12"}}
To apply the configuration, deploy or restart the connector.
Last modified: