Using nodetool (JMX) with SSL encryption
Using nodetool with SSL encryption.
Using nodetool with SSL requires some JMX setup. Changes to
cassandra-env.sh are required, and a configuration
file, ~/.cassandra/nodetool-ssl.properties, is created.
Prerequisites
Procedure
- First, follow steps #1-8 in Enabling JMX authentication and authorization if authentication and authorization are required.
-
To run
nodetoolwith SSL encryption, some additional changes are required to cassandra-env.sh. The following settings must be added to the file. Use the file path to the keystore and truststore, and appropriate passwords for each file. These changes must be made on each node in the cluster.For production:JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true" JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true" JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.registry.ssl=true" #JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.enabled.protocols=<enabled-protocols>" #JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.enabled.cipher.suites=<enabled-cipher-suites>" JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.keyStore=%USERPROFILE\server-keystore.jks" JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.keyStorePassword=myKeyPass" JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.trustStore=%USERPROFILE\server-truststore.jks" JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.trustStorePassword=truststorePass"For development:JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true" JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true" JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.registry.ssl=true" #JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.enabled.protocols=<enabled-protocols>" #JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.enabled.cipher.suites=<enabled-cipher-suites>" JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.keyStore=%USERPROFILE\keystore.node0" JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.keyStorePassword=cassandra" JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.trustStore=%USERPROFILE\truststore.node0" JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.trustStorePassword=cassandra"Enable SSL for JMX by setting
com.sun.management.jmxremote.ssltotrue. If two-way certificate authentication is desired, setcom.sun.management.jmxremote.ssl.need.client.authtotrue. Ifcom.sun.management.jmxremote.registry.sslis set totrue, an RMI registry protected by SSL will be created and configured by the out-of-the-box management agent when the Java VM is started. If thecom.sun.management.jmxremote.registry.sslproperty is set totrue, to have full security thencom.sun.management.jmxremote.ssl.need.client.authmust also be enabled. Set appropriate paths to thekeystoreandtruststorefiles. Set the passwords to the passwords set during keystore and truststore generation. - Restart Cassandra.
-
To run
nodetoolwith SSL encryption, create a.cassandra/nodetool-ssl.propertiesfile in your home or client program directory with the following settings on the node on whichnodetoolwill run.For production:-Dcom.sun.management.jmxremote.ssl=true -Dcom.sun.management.jmxremote.ssl.need.client.auth=true -Dcom.sun.management.jmxremote.registry.ssl=true -Djavax.net.ssl.keyStore=%USERPROFILE\server-keystore.jks -Djavax.net.ssl.keyStorePassword=myKeyPass -Djavax.net.ssl.trustStore=%USERPROFILE\server-truststore.jks -Djavax.net.ssl.trustStorePassword=truststorePassFor development:
-Djavax.net.ssl.keyStore=%USERPROFILE\keystore.node0 -Djavax.net.ssl.keyStorePassword=cassandra -Djavax.net.ssl.trustStore=%USERPROFILE\truststore.node0 -Djavax.net.ssl.trustStorePassword=cassandra -Dcom.sun.management.jmxremote.ssl.need.client.auth=true -Dcom.sun.management.jmxremote.registry.ssl=true -
Start
nodetoolwith the --ssl option for encrypted connection for anynodetooloperation.C:\> %CASSANDRA_HOME%\bin\nodetool.bat --ssl ring
CASSANDRA_HOME
On a standard Windows installation, the installation wizard creates %CASSANDRA_HOME% as an environment variable.Windows 3.0 installations C:\Program Files\Datastax Community\apache-cassandra\ Windows 3.x installations C:\Program Files\Datastax-DDC\apache-cassandra\ -
Start
nodetoolwith the --ssl option for encrypted connection and a username and password for authentication and authorization for anynodetooloperation.C:\> %CASSANDRA_HOME%\bin\nodetool.bat --ssl -u cassandra -pw cassandra status