@@ -96,14 +96,26 @@ public class CCMBridge implements CCMAccess {
96
96
public static final String DEFAULT_SERVER_TRUSTSTORE_PASSWORD = "scylla1sfun" ;
97
97
public static final String DEFAULT_SERVER_TRUSTSTORE_PATH = "/server.truststore" ;
98
98
99
+ public static final String DEFAULT_SERVER_TRUSTSTORE_PEM_PATH = "/server.truststore.pem" ;
100
+
99
101
private static final File DEFAULT_SERVER_TRUSTSTORE_FILE =
100
102
createTempStore (DEFAULT_SERVER_TRUSTSTORE_PATH );
103
+ private static final File DEFAULT_SERVER_TRUSTSTORE_PEM_FILE =
104
+ createTempStore (DEFAULT_SERVER_TRUSTSTORE_PEM_PATH );
101
105
102
106
public static final String DEFAULT_SERVER_KEYSTORE_PASSWORD = "scylla1sfun" ;
103
107
public static final String DEFAULT_SERVER_KEYSTORE_PATH = "/server.keystore" ;
104
108
109
+ // Contain the same keypair as the server keystore, but in format usable by Scylla
110
+ public static final String DEFAULT_SERVER_PRIVATE_KEY_PATH = "/server.key" ;
111
+ public static final String DEFAULT_SERVER_CERT_CHAIN_PATH = "/server.crt" ;
112
+
105
113
private static final File DEFAULT_SERVER_KEYSTORE_FILE =
106
114
createTempStore (DEFAULT_SERVER_KEYSTORE_PATH );
115
+ private static final File DEFAULT_SERVER_PRIVATE_KEY_FILE =
116
+ createTempStore (DEFAULT_SERVER_PRIVATE_KEY_PATH );
117
+ private static final File DEFAULT_SERVER_CERT_CHAIN_FILE =
118
+ createTempStore (DEFAULT_SERVER_CERT_CHAIN_PATH );
107
119
108
120
/**
109
121
* The environment variables to use when invoking CCM. Inherits the current processes environment,
@@ -951,22 +963,37 @@ public Builder withoutNodes() {
951
963
/** Enables SSL encryption. */
952
964
public Builder withSSL () {
953
965
cassandraConfiguration .put ("client_encryption_options.enabled" , "true" );
954
- cassandraConfiguration .put ("client_encryption_options.optional" , "false" );
955
- cassandraConfiguration .put (
956
- "client_encryption_options.keystore" , DEFAULT_SERVER_KEYSTORE_FILE .getAbsolutePath ());
957
- cassandraConfiguration .put (
958
- "client_encryption_options.keystore_password" , DEFAULT_SERVER_KEYSTORE_PASSWORD );
966
+ if (GLOBAL_SCYLLA_VERSION_NUMBER != null ) {
967
+ cassandraConfiguration .put (
968
+ "client_encryption_options.certificate" ,
969
+ DEFAULT_SERVER_CERT_CHAIN_FILE .getAbsolutePath ());
970
+ cassandraConfiguration .put (
971
+ "client_encryption_options.keyfile" , DEFAULT_SERVER_PRIVATE_KEY_FILE .getAbsolutePath ());
972
+ } else {
973
+ cassandraConfiguration .put ("client_encryption_options.optional" , "false" );
974
+ cassandraConfiguration .put (
975
+ "client_encryption_options.keystore" , DEFAULT_SERVER_KEYSTORE_FILE .getAbsolutePath ());
976
+ cassandraConfiguration .put (
977
+ "client_encryption_options.keystore_password" , DEFAULT_SERVER_KEYSTORE_PASSWORD );
978
+ }
959
979
return this ;
960
980
}
961
981
962
982
/** Enables client authentication. This also enables encryption ({@link #withSSL()}. */
963
983
public Builder withAuth () {
964
984
withSSL ();
965
985
cassandraConfiguration .put ("client_encryption_options.require_client_auth" , "true" );
966
- cassandraConfiguration .put (
967
- "client_encryption_options.truststore" , DEFAULT_SERVER_TRUSTSTORE_FILE .getAbsolutePath ());
968
- cassandraConfiguration .put (
969
- "client_encryption_options.truststore_password" , DEFAULT_SERVER_TRUSTSTORE_PASSWORD );
986
+ if (GLOBAL_SCYLLA_VERSION_NUMBER != null ) {
987
+ cassandraConfiguration .put (
988
+ "client_encryption_options.truststore" ,
989
+ DEFAULT_SERVER_TRUSTSTORE_PEM_FILE .getAbsolutePath ());
990
+ } else {
991
+ cassandraConfiguration .put (
992
+ "client_encryption_options.truststore" ,
993
+ DEFAULT_SERVER_TRUSTSTORE_FILE .getAbsolutePath ());
994
+ cassandraConfiguration .put (
995
+ "client_encryption_options.truststore_password" , DEFAULT_SERVER_TRUSTSTORE_PASSWORD );
996
+ }
970
997
return this ;
971
998
}
972
999
0 commit comments