Your strategy is very good, and I do so. You want to have your own certification authority, and then create a CSR for each node. This is much easier to manage than trusting node certificates.
- Each node will have its own keystore that stores its cert.
- You will want each node to have an open CA certificate in its trusted network. This only happens if the require_client_auth parameter is set to true. I would recommend doing this, since it is not difficult to configure and adds an additional level of identification, which should be considered important.
It is also important to distinguish between network encryption and client encryption . Cassandra has different settings for each (documented in the links above). If you use client-to-node encryption, you will also want to have a trusted server for client certificates. You can use the same store of trust, as well as issue certificates to customers.
On the client-node side, here is an example from a java driver test, how to configure your SSLContext using your key and trust:
public SSLOptions getSSLOptions(Optional<String> keyStorePath, Optional<String> trustStorePath) throws Exception { TrustManagerFactory tmf = null; if(trustStorePath.isPresent()) { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(this.getClass().getResourceAsStream(trustStorePath.get()), DEFAULT_CLIENT_TRUSTSTORE_PASSWORD.toCharArray()); tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); } KeyManagerFactory kmf = null; if(keyStorePath.isPresent()) { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(this.getClass().getResourceAsStream(keyStorePath.get()), DEFAULT_CLIENT_KEYSTORE_PASSWORD.toCharArray()); kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(ks, DEFAULT_CLIENT_KEYSTORE_PASSWORD.toCharArray()); } SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(kmf != null ? kmf.getKeyManagers() : null, tmf != null ? tmf.getTrustManagers() : null, new SecureRandom()); return new SSLOptions(sslContext, SSLOptions.DEFAULT_SSL_CIPHER_SUITES); }
Once you create an SSLOptions object, you can just pass it to your Cluster Builder, i.e.:
cluster = Cluster.builder() .addContactPoint(host) .withSSL(sslOptions)) .build();
CQLSH supports SSL through the cqlshrc file. You can find an example of how to install here .
source share