diff --git a/CHANGES.txt b/CHANGES.txt index 449a2b5af2..eda762b6c1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,6 +12,7 @@ * Fix filtering on non-primary key columns for queries without index (CASSANDRA-6377) * Fix sstableloader fail when using materialized view (CASSANDRA-11275) Merged from 2.2: + * Add cassandra-stress keystore option (CASSANDRA-9325) * Dont mark sstables as repairing with sub range repairs (CASSANDRA-11451) * Notify when sstables change after cancelling compaction (CASSANDRA-11373) * cqlsh: COPY FROM should check that explicit column names are valid (CASSANDRA-11333) diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsTransport.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsTransport.java index 8b0ef6adf5..b6d1d909c0 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsTransport.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsTransport.java @@ -65,6 +65,10 @@ public class SettingsTransport implements Serializable factoryOptions.put(SSLTransportFactory.TRUSTSTORE, options.trustStore.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD)) factoryOptions.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, options.trustStorePw.value()); + if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE)) + factoryOptions.put(SSLTransportFactory.KEYSTORE, options.keyStore.value()); + if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE_PASSWORD)) + factoryOptions.put(SSLTransportFactory.KEYSTORE_PASSWORD, options.keyStorePw.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL)) factoryOptions.put(SSLTransportFactory.PROTOCOL, options.protocol.value()); if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES)) @@ -102,6 +106,16 @@ public class SettingsTransport implements Serializable encOptions.enabled = true; encOptions.truststore = options.trustStore.value(); encOptions.truststore_password = options.trustStorePw.value(); + if (options.keyStore.present()) + { + encOptions.keystore = options.keyStore.value(); + encOptions.keystore_password = options.keyStorePw.value(); + } + else + { + // mandatory for SSLFactory.createSSLContext(), see CASSANDRA-9325 + encOptions.keystore = encOptions.truststore; + } encOptions.algorithm = options.alg.value(); encOptions.protocol = options.protocol.value(); encOptions.cipher_suites = options.ciphers.value().split(","); @@ -116,6 +130,8 @@ public class SettingsTransport implements Serializable final OptionSimple factory = new OptionSimple("factory=", ".*", TFramedTransportFactory.class.getName(), "Fully-qualified ITransportFactory class name for creating a connection. Note: For Thrift over SSL, use org.apache.cassandra.thrift.SSLTransportFactory.", false); final OptionSimple trustStore = new OptionSimple("truststore=", ".*", null, "SSL: full path to truststore", false); final OptionSimple trustStorePw = new OptionSimple("truststore-password=", ".*", null, "SSL: truststore password", false); + final OptionSimple keyStore = new OptionSimple("keystore=", ".*", null, "SSL: full path to keystore", false); + final OptionSimple keyStorePw = new OptionSimple("keystore-password=", ".*", null, "SSL: keystore password", false); final OptionSimple protocol = new OptionSimple("ssl-protocol=", ".*", "TLS", "SSL: connection protocol to use", false); final OptionSimple alg = new OptionSimple("ssl-alg=", ".*", "SunX509", "SSL: algorithm", false); final OptionSimple storeType = new OptionSimple("store-type=", ".*", "JKS", "SSL: keystore format", false); @@ -124,7 +140,7 @@ public class SettingsTransport implements Serializable @Override public List options() { - return Arrays.asList(factory, trustStore, trustStorePw, protocol, alg, storeType, ciphers); + return Arrays.asList(factory, trustStore, trustStorePw, keyStore, keyStorePw, protocol, alg, storeType, ciphers); } }