Add cassandra-stress keystore option (CASSANDRA-9325)

* Prevents stress tool from checking keystore at .conf/keystore even if not needed
 * Adds keystore -transport option in case client verification is used on server

Patch by Stefan Podkowinski; reviewed by T Jake Luciani for CASSANDRA-9325
This commit is contained in:
Stefan Podkowinski 2016-02-16 17:34:26 +01:00 committed by T Jake Luciani
parent 10f25aeebb
commit 106750c78e
2 changed files with 18 additions and 1 deletions

View File

@ -1,4 +1,5 @@
2.2.6
* Add cassandra-stress keystore option (CASSANDRA-9325)
* Dont mark sstables as repairing with sub range repairs (CASSANDRA-11451)
* Fix use of NullUpdater for 2i during compaction (CASSANDRA-11450)
* Notify when sstables change after cancelling compaction (CASSANDRA-11373)

View File

@ -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<? extends Option> options()
{
return Arrays.asList(factory, trustStore, trustStorePw, protocol, alg, storeType, ciphers);
return Arrays.asList(factory, trustStore, trustStorePw, keyStore, keyStorePw, protocol, alg, storeType, ciphers);
}
}