use of org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions in project cassandra by apache.
the class MessagingServiceTest method listenOptionalSecureConnectionWithBroadcastAddr.
@Test
public void listenOptionalSecureConnectionWithBroadcastAddr() throws InterruptedException {
ServerEncryptionOptions serverEncryptionOptions = new ServerEncryptionOptions().withOptional(true);
listen(serverEncryptionOptions, true);
}
use of org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions in project cassandra by apache.
the class MessagingServiceTest method listenPlainConnectionWithBroadcastAddr.
@Test
public void listenPlainConnectionWithBroadcastAddr() throws InterruptedException {
ServerEncryptionOptions serverEncryptionOptions = new ServerEncryptionOptions().withInternodeEncryption(ServerEncryptionOptions.InternodeEncryption.none);
listen(serverEncryptionOptions, true);
}
use of org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions in project cassandra by apache.
the class MessagingServiceTest method listenOptionalSecureConnection.
@Test
public void listenOptionalSecureConnection() throws InterruptedException {
for (// test used to be flaky, so run in a loop to make sure stable (see CASSANDRA-17033)
int i = 0; // test used to be flaky, so run in a loop to make sure stable (see CASSANDRA-17033)
i < 500; // test used to be flaky, so run in a loop to make sure stable (see CASSANDRA-17033)
i++) {
ServerEncryptionOptions serverEncryptionOptions = new ServerEncryptionOptions().withOptional(true);
listen(serverEncryptionOptions, false);
}
}
use of org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions in project cassandra by apache.
the class SSLFactoryTest method testSslContextReload_HappyPath.
@Test
public void testSslContextReload_HappyPath() throws IOException, InterruptedException {
try {
ServerEncryptionOptions options = addKeystoreOptions(encryptionOptions).withInternodeEncryption(ServerEncryptionOptions.InternodeEncryption.all);
SSLFactory.initHotReloading(options, options, true);
SslContext oldCtx = SSLFactory.getOrCreateSslContext(options, true, ISslContextFactory.SocketType.CLIENT);
File keystoreFile = new File(options.keystore);
SSLFactory.checkCertFilesForHotReloading(options, options);
keystoreFile.trySetLastModified(System.currentTimeMillis() + 15000);
SSLFactory.checkCertFilesForHotReloading(options, options);
SslContext newCtx = SSLFactory.getOrCreateSslContext(options, true, ISslContextFactory.SocketType.CLIENT);
Assert.assertNotSame(oldCtx, newCtx);
} catch (Exception e) {
throw e;
} finally {
DatabaseDescriptor.loadConfig();
}
}
use of org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions in project cassandra by apache.
the class SSLFactoryTest method testSslFactoryHotReload_CorruptOrNonExistentFile_DoesNotClearExistingSslContext.
@Test
public void testSslFactoryHotReload_CorruptOrNonExistentFile_DoesNotClearExistingSslContext() throws IOException {
try {
ServerEncryptionOptions options = addKeystoreOptions(encryptionOptions);
File testKeystoreFile = new File(options.keystore + ".test");
FileUtils.copyFile(new File(options.keystore).toJavaIOFile(), testKeystoreFile.toJavaIOFile());
options = options.withKeyStore(testKeystoreFile.path());
SSLFactory.initHotReloading(options, options, true);
SslContext oldCtx = SSLFactory.getOrCreateSslContext(options, true, ISslContextFactory.SocketType.CLIENT);
SSLFactory.checkCertFilesForHotReloading(options, options);
testKeystoreFile.trySetLastModified(System.currentTimeMillis() + 15000);
FileUtils.forceDelete(testKeystoreFile.toJavaIOFile());
SSLFactory.checkCertFilesForHotReloading(options, options);
SslContext newCtx = SSLFactory.getOrCreateSslContext(options, true, ISslContextFactory.SocketType.CLIENT);
Assert.assertSame(oldCtx, newCtx);
} catch (Exception e) {
throw e;
} finally {
DatabaseDescriptor.loadConfig();
FileUtils.deleteQuietly(new File(encryptionOptions.keystore + ".test").toJavaIOFile());
}
}
Aggregations