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 Helios:
-
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 the Cloud Portal:
-
On the left navigation pane, select Workspaces.
-
Select the three dots for your workspace, and select Access & Security from the list.
-
On the Security tab, select Upload CA Bundle, and upload the CA bundle (
ca-cert.file).pem
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: