Configure mTLS authentication
Mutual TLS (mTLS) authentication uses certificate-based authentication for client and internode connections. After the SSL handshake, Hyper-Converged Database (HCD) extracts the identity from client certificates and grants access only to authorized users.
About identity in mTLS
You can define your own identity for certificates by extracting fields or information from the certificates.
Implement the MutualTlsCertificateValidator interface to validate and extract identities from certificates.
The MutualTlsAuthenticator and MutualTlsInternodeAuthenticator use these identities to customize for the certificate conventions in your deployment environment.
HCD includes a default implementation of MutualTlsCertificateValidator that uses SPIFFE as the certificate identity.
SPIFFE must be present in the Subject Alternative Name (SAN) of the certificate.
If you prefer not to use the SPIFFE-based validator, configure a custom CN-based validator that implements MutualTlsCertificateValidator.
Configure mTLS for client connections
HCD supports two approaches for configuring mTLS authentication for client connections:
-
AdvancedAuthenticator(recommended): Supports multiple authentication schemes, allowing you to use mTLS alongside or instead of password-based, OIDC, or LDAP authentication. -
MutualTlsAuthenticator: Provides certificate-only authentication compatible with open-source Cassandra.
Choose the approach that best fits your deployment requirements.
Configure mTLS with AdvancedAuthenticator
Use AdvancedAuthenticator to enable mTLS alongside other authentication schemes or as the sole authentication method.
For more information about AdvancedAuthenticator, see About HCD Unified Authentication.
-
You have created SSL certificates, keystores, and truststores.
-
You have permissions to create and modify roles.
|
The following steps use SPIFFE identity as an example.
If you use a custom validator, replace |
-
Add authorized users to the
system_auth.identity_to_roletable.Client certificates with identities in this table are trusted by HCD. For more information about role management, see Roles.
ADD IDENTITY 'spiffe://testdomain.com/testIdentifier/testValue' TO ROLE 'read_only_user' -
Locate the
cassandra.yamlconfiguration file.The location of the
cassandra.yamlfile depends on your installation type.-
Package installations:
/etc/hcd/cassandra/cassandra.yaml -
Tarball installations:
INSTALLATION_LOCATION/resources/cassandra/conf/cassandra.yaml
-
-
In the
cassandra.yamlfile, configure theclient_encryption_optionssection:client_encryption_options: enabled: true optional: false keystore: conf/.keystore keystore_password: cassandra truststore: conf/.truststore truststore_password: cassandra require_client_auth: trueFor more information about client encryption options, see Configure SSL for client-to-node connections.
enabled-
Enables client-to-node encryption. Set to
trueto enable mTLS. optional-
When set to
false, only encrypted connections are allowed. Set tofalsefor mTLS. keystore-
Path to the keystore file containing the node’s private key and certificate.
keystore_password-
Password for the keystore.
truststore-
Path to the truststore file containing trusted certificates.
truststore_password-
Password for the truststore.
require_client_auth-
Set to
trueto enable mTLS and require client certificate authentication.
-
Configure the
authenticatorsection with AdvancedAuthenticator and mTLS support:authenticator: class_name: com.datastax.cassandra.auth.AdvancedAuthenticator parameters: enabled: true default_scheme: internal additional_schemes: mtls mtls_class_name: org.apache.cassandra.auth.MutualTlsAuthenticator mtls_validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidatorclass_name-
The
AdvancedAuthenticatorclass. Usecom.datastax.cassandra.auth.AdvancedAuthenticator. enabled-
Set to
trueto enable authentication. default_scheme-
The default authentication scheme. Set to
internalfor password-based authentication,mtlsfor certificate-only authentication,oidcfor OpenID Connect, orldapfor LDAP authentication. additional_schemes-
Comma-separated list of additional authentication schemes. Include
mtlsto enable mTLS authentication alongside other schemes such asinternal,oidc, orldap. mtls_class_name-
The mTLS authenticator class. Use
org.apache.cassandra.auth.MutualTlsAuthenticator. mtls_validator_class_name-
The certificate validator class. Use
org.apache.cassandra.auth.SpiffeCertificateValidatorfor SPIFFE-based validation, or specify your custom validator class.
-
Save the
cassandra.yamlfile. -
Complete a rolling rolling restart.
After the restart, HCD accepts mTLS connections from clients.
Access is granted only if the client’s identity is present in the identity_to_role table.
Configure mTLS with MutualTlsAuthenticator
Use MutualTlsAuthenticator for certificate-only authentication without additional authentication schemes.
-
You have created SSL certificates, keystores, and truststores.
-
You have permissions to create and modify roles.
|
The following steps use SPIFFE identity as an example.
If you use a custom validator, replace |
-
Add authorized users to the
system_auth.identity_to_roletable.Client certificates with identities in this table are trusted by HCD. For more information about role management, see Roles.
ADD IDENTITY 'spiffe://testdomain.com/testIdentifier/testValue' TO ROLE 'read_only_user' -
Locate the
cassandra.yamlconfiguration file.The location of the
cassandra.yamlfile depends on your installation type.-
Package installations:
/etc/hcd/cassandra/cassandra.yaml -
Tarball installations:
INSTALLATION_LOCATION/resources/cassandra/conf/cassandra.yaml
-
-
In the
cassandra.yamlfile, configure theclient_encryption_optionssection:client_encryption_options: enabled: true optional: false keystore: conf/.keystore keystore_password: cassandra truststore: conf/.truststore truststore_password: cassandra require_client_auth: trueFor more information about client encryption options, see Configure SSL for client-to-node connections.
enabled-
Enables client-to-node encryption. Set to
trueto enable mTLS. optional-
When set to
false, only SSL connections are allowed. Set tofalsefor mTLS. keystore-
Path to the keystore file containing the node’s private key and certificate.
keystore_password-
Password for the keystore.
truststore-
Path to the truststore file containing trusted certificates.
truststore_password-
Password for the truststore.
require_client_auth-
Set to
trueto enable mTLS and require client certificate authentication.
-
Configure the
authenticatorsection with MutualTlsAuthenticator:authenticator: class_name: org.apache.cassandra.auth.MutualTlsAuthenticator parameters: validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidatorclass_name-
The mTLS authenticator class. Use
org.apache.cassandra.auth.MutualTlsAuthenticator. validator_class_name-
The certificate validator class. Use
org.apache.cassandra.auth.SpiffeCertificateValidatorfor SPIFFE-based validation, or specify your custom validator class.
-
Save the
cassandra.yamlfile. -
Complete a rolling rolling restart.
After the restart, HCD accepts only mTLS connections from clients.
Access is granted only if the client’s identity is present in the identity_to_role table.
Configure mTLS for internode connections
Secure node-to-node communication by requiring certificate-based authentication between cluster nodes. The internode authenticator trusts certificates based on the following criteria:
-
If
trusted_peer_identitiesis configured, it trusts certificates whose identities are in that list. -
If
trusted_peer_identitiesis not configured, it trusts connections with the same identity as the node.
When a node makes an outbound connection to another node, it uses the certificate configured in server_encryption_options.outbound_keystore.
During node startup, HCD extracts the identity from the outbound keystore.
If trusted_peer_identities is not configured, connections from other nodes with the same identity are trusted.
For example, if a node has testIdentity embedded in the certificate in the outbound keystore, it trusts connections from other nodes when their certificates have testIdentity embedded in them.
|
Use the optional |
Configure server encryption options
-
Locate the
cassandra.yamlconfiguration file.The location of the
cassandra.yamlfile depends on your installation type.-
Package installations:
/etc/hcd/cassandra/cassandra.yaml -
Tarball installations:
INSTALLATION_LOCATION/resources/cassandra/conf/cassandra.yaml
-
-
Configure the
server_encryption_optionssection:server_encryption_options: internode_encryption: all optional: true keystore: conf/.keystore keystore_password: cassandra outbound_keystore: conf/.outbound_keystore outbound_keystore_password: cassandra require_client_auth: true truststore: conf/.truststore truststore_password: cassandraFor more information about server encryption options, see Configure SSL for node-to-node connections.
internode_encryption-
Set to
allto encrypt all internode communication. optional-
Set to
trueduring rolling upgrades to allow both mTLS and non-mTLS connections. Set tofalseafter all nodes are upgraded to require mTLS. keystore-
The file path to the keystore file for inbound connections.
keystore_password-
Password for the inbound keystore.
outbound_keystore-
Path to the keystore file for outbound connections.
outbound_keystore_password-
Password for the outbound keystore.
require_client_auth-
Set to
trueto enable mTLS for internode connections. truststore-
The file path to the truststore file containing trusted certificates.
truststore_password-
Password for the truststore.
Configure the internode authenticator
-
In the
cassandra.yamlfile, configure theinternode_authenticatorsection:internode_authenticator: class_name: org.apache.cassandra.auth.MutualTlsInternodeAuthenticator parameters: validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidator trusted_peer_identities: "spiffe1,spiffe2" node_identity: "spiffe1"class_name-
The mTLS internode authenticator class. Use
org.apache.cassandra.auth.MutualTlsInternodeAuthenticator. validator_class_name-
The certificate validator class. Use
org.apache.cassandra.auth.SpiffeCertificateValidatorfor SPIFFE-based validation, or specify your custom validator class. trusted_peer_identities-
Optional comma-separated list of trusted peer identities. If not specified, the node trusts connections with the same identity as itself.
node_identity-
Optional identity to verify against the identity extracted from the outbound keystore. Use this parameter to catch configuration errors.
-
Save and close the
cassandra.yamlfile.
Restart the cluster
Complete a rolling rolling restart.
After all nodes restart, all internode communications are authenticated by mTLS.
Migrate to mTLS authentication
You can migrate from password-based authentication to mTLS authentication without downtime.
Migrate client connections with AdvancedAuthenticator
Transition client connections to mTLS by adding mTLS as an additional authentication scheme.
-
In the
cassandra.yamlfile, configure optional mode:client_encryption_options: enabled: true optional: true keystore: conf/.keystore keystore_password: cassandra truststore: conf/.truststore truststore_password: cassandra require_client_auth: true -
Add mTLS to the additional schemes:
authenticator: class_name: com.datastax.cassandra.auth.AdvancedAuthenticator parameters: enabled: true default_scheme: internal additional_schemes: mtls mtls_class_name: org.apache.cassandra.auth.MutualTlsAuthenticator mtls_validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidator -
Complete a rolling rolling restart.
-
After all clients migrate to mTLS, disable optional mode:
client_encryption_options: enabled: true optional: false keystore: conf/.keystore keystore_password: cassandra truststore: conf/.truststore truststore_password: cassandra require_client_auth: true -
Change the default scheme to mTLS and remove other schemes:
authenticator: class_name: com.datastax.cassandra.auth.AdvancedAuthenticator parameters: enabled: true default_scheme: mtls mtls_class_name: org.apache.cassandra.auth.MutualTlsAuthenticator mtls_validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidator -
Complete a rolling rolling restart.
After this final restart, HCD accepts only mTLS client connections.
Migrate internode connections
Transition internode connections to mTLS during a rolling upgrade.
-
During the rolling upgrade, set
server_encryption_options.optionaltotrue:server_encryption_options: internode_encryption: all optional: true keystore: conf/.keystore keystore_password: cassandra outbound_keystore: conf/.outbound_keystore outbound_keystore_password: cassandra require_client_auth: true truststore: conf/.truststore truststore_password: cassandra -
After all nodes are upgraded, configure the internode authenticator:
internode_authenticator: class_name: org.apache.cassandra.auth.MutualTlsInternodeAuthenticator parameters: validator_class_name: org.apache.cassandra.auth.SpiffeCertificateValidator -
Disable optional mode:
server_encryption_options: internode_encryption: all optional: false keystore: conf/.keystore keystore_password: cassandra outbound_keystore: conf/.outbound_keystore outbound_keystore_password: cassandra require_client_auth: true truststore: conf/.truststore truststore_password: cassandra -
Complete a rolling rolling restart.
After this final restart, all internode communications use mTLS authentication.