Important

Helios features are now enabled during weekly update windows and are no longer directly tied to SingleStore engine releases. Refer to the release notes to view the latest features available in your Helios cluster.

Configure mTLS for SingleStore Kafka Sink Connector

To configure a mutual TLS (mTLS) connection for the SingleStore Kafka Sink Connector ("the connector") on SingleStore Helios:

  1. Generate client certificates.

  2. Create a Java keystore.

  3. Configure SingleStore.

  4. Create a database user that requires certificate-based mTLS authentication.

  5. Update the connector configuration.

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.pem: The private key for the CA.

  • ca-cert.pem: The public CA certificate.

  • client-key.pem: The client private key.

  • client-cert.pem: The client certificate signed by the CA.

Additionally, download the singlestore_bundle.pem certificate file.

Create a Java Keystore

The connector uses the SingleStore JDBC driver internally, which expects the client certificate and key in a keystore format. Convert the .pem files to a .p12 keystore using OpenSSL. Update the certificate files paths, and then run the following command:

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.p12 file that contains the client certificate, private key, and CA certificate chain, protected by the keystore password (<your_keystore_password>).

Copy and securely store the client-keystore.p12 file.

Configure SingleStore

Configure a CA in the Cloud Portal:

  1. On the left navigation pane, select Clusters.

  2. Select the three dots for your cluster, and select Access & Security from the list.

  3. On the Security tab, select Upload CA Bundle, and upload the CA bundle (ca-cert.pem file).

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_password> with a secure password):

  • REQUIRE X509: Enables mutual authentication between the client and SingleStore. 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. Example:

    CREATE USER 's2user'@'%' IDENTIFIED BY '<mtls_password>' REQUIRE X509;
  • REQUIRE SUBJECT '<subject-dn-string>': In addition to extending REQUIRE X509, REQUIRE SUBJECT checks the subject in the client certificate provided during mTLS connection and enforces that the Subject DN in the client certificate must exactly match the configured value. This verifies both trust (via certificate chaining to the CA) and identity (via the Subject DN string). For example:

    CREATE USER 's2user'@'%' IDENTIFIED BY '<mtls_password>' REQUIRE SUBJECT '/CN=s2user/O=example/C=US';

    When running CREATE USER or ALTER USER, specify the SUBJECT in OpenSSL “oneline” format. Separate fields, such as CN, O, C, ST, and L, with a /. To generate the Subject DN string in OpenSSL "oneline" format, run the following command:

    openssl x509 -in client-cert.pem -noout -subject -nameopt compat

    If the openssl output escapes characters inside a DN value, escape each backslash (\) in the output because the value is entered as a SQL string literal. For example, if the Subject contains \+, replace it with \\+ in the CREATE USER or ALTER USER statement. For example:

    CREATE USER 's2user'@'%' IDENTIFIED BY '<mtls_password>' REQUIRE SUBJECT '/O=example/CN=Js3g\\+AF\\+/C=US';

    A Subject mismatch can return the same generic certificate verification error as CA-chain issues. To troubleshoot, first verify that the client certificate chains to the CA bundle configured on the server (REQUIRE X509), and then verify that the Subject DN in the certificate exactly matches the configured REQUIRE SUBJECT value.

Grant the required privileges to the database user. Refer to CREATE USER for related information.

Update the Connector Configuration

Update the following parameters in the SingleStore Kafka Sink connector's configuration JSON to enable mTLS authentication:

  • connection.user: Specify the username of the mTLS-enabled SingleStore database user.

  • connection.password: Specify the password (<mtls_password>) for the SingleStore database user.

  • params.sslMode: Specify either of the following:

    • 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.serverSslCert: Specify the path to singlestore_bundle.pem (include the filename and extension).

  • params.keyStore: Specify the path to client-keystore.p12 (include the filename and extension).

  • params.keyStorePassword: Specify the keystore password (<your_keystore_password>) passed to the openssl command.

  • params.keyStoreType. Specify PKCS12 as 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:

Was this article helpful?