Package org.apache.cassandra.security
Class AbstractSslContextFactory
java.lang.Object
org.apache.cassandra.security.AbstractSslContextFactory
- All Implemented Interfaces:
ISslContextFactory
- Direct Known Subclasses:
DisableSslContextFactory,FileBasedSslContextFactory
Abstract class implementing
ISslContextFacotry to provide most of the functionality that any
implementation might need. This does not assume any file-based credentials for keys/certs hence provide a good base
for any implementation that only need to customize the loading of keys/certs in a custom way.
CAUTION: While this is extremely useful abstraction, please be careful if you need to modify this class
given possible custom implementations out there!
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.cassandra.security.ISslContextFactory
ISslContextFactory.SocketType -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractSslContextFactory(Map<String, Object> parameters) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract KeyManagerFactoryprotected abstract KeyManagerFactoryCreate aKeyManagerFactoryfor outbound connections.protected abstract TrustManagerFactorycreateJSSESslContext(boolean verifyPeerCertificate) Creates JSSE SSLContext.io.netty.handler.ssl.SslContextcreateNettySslContext(boolean verifyPeerCertificate, ISslContextFactory.SocketType socketType, io.netty.handler.ssl.CipherSuiteFilter cipherFilter) Creates Netty's SslContext object.protected voidDervies ifOpenSSLis available.Combine the pre-4.0 protocol field with the accepted_protocols list, substituting a list of explicit protocols for the previous catchall default of "TLS"protected BooleangetBoolean(String key) protected BooleangetBoolean(String key, boolean defaultValue) Returns the list of cipher suites supported by the implementation.protected io.netty.handler.ssl.SslProviderReturnsSslProviderto be used to build Netty's SslContext.protected Stringprotected StringgetStringList(String key) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.security.ISslContextFactory
hasKeystore, hasOutboundKeystore, initHotReloading, shouldReload
-
Field Details
-
TLS_PROTOCOL_SUBSTITUTION
-
openSslIsAvailable
protected boolean openSslIsAvailable -
parameters
-
cipher_suites
-
protocol
-
accepted_protocols
-
algorithm
-
store_type
-
require_client_auth
protected final boolean require_client_auth -
require_endpoint_verification
protected final boolean require_endpoint_verification -
enabled
-
optional
-
-
Constructor Details
-
AbstractSslContextFactory
protected AbstractSslContextFactory() -
AbstractSslContextFactory
-
-
Method Details
-
deriveIfOpenSslAvailable
protected void deriveIfOpenSslAvailable()Dervies ifOpenSSLis available. It allows in-jvm dtests to disable tcnative openssl support by settingCassandraRelevantProperties.DISABLE_TCACTIVE_OPENSSLsystem property astrue. Otherwise, it creates a circular reference that prevents the instance class loader from being garbage collected. -
getString
-
getString
-
getStringList
-
getBoolean
-
getBoolean
-
createJSSESslContext
Description copied from interface:ISslContextFactoryCreates JSSE SSLContext.- Specified by:
createJSSESslContextin interfaceISslContextFactory- Parameters:
verifyPeerCertificate-trueif SSL peer's certificate needs to be verified;falseotherwise- Returns:
- JSSE's
SSLContext - Throws:
SSLException- in case the Ssl Context creation fails for some reason
-
createNettySslContext
public io.netty.handler.ssl.SslContext createNettySslContext(boolean verifyPeerCertificate, ISslContextFactory.SocketType socketType, io.netty.handler.ssl.CipherSuiteFilter cipherFilter) throws SSLException Description copied from interface:ISslContextFactoryCreates Netty's SslContext object.- Specified by:
createNettySslContextin interfaceISslContextFactory- Parameters:
verifyPeerCertificate-trueif SSL peer's certificate needs to be verified;falseotherwisesocketType-ISslContextFactory.SocketTypefor Netty's Inbound or Outbound channelscipherFilter- to allow Netty's cipher suite filtering, e.g.SslContextBuilder.ciphers(Iterable, CipherSuiteFilter)- Returns:
- Netty's
SslContext - Throws:
SSLException- in case the Ssl Context creation fails for some reason
-
getAcceptedProtocols
Combine the pre-4.0 protocol field with the accepted_protocols list, substituting a list of explicit protocols for the previous catchall default of "TLS"- Specified by:
getAcceptedProtocolsin interfaceISslContextFactory- Returns:
- array of protocol names suitable for passing to SslContextBuilder.protocols, or null if the default
-
getCipherSuites
Description copied from interface:ISslContextFactoryReturns the list of cipher suites supported by the implementation.- Specified by:
getCipherSuitesin interfaceISslContextFactory- Returns:
- List of supported cipher suites
-
getSslProvider
protected io.netty.handler.ssl.SslProvider getSslProvider()ReturnsSslProviderto be used to build Netty's SslContext.- Returns:
- appropriate SslProvider
-
buildKeyManagerFactory
- Throws:
SSLException
-
buildTrustManagerFactory
- Throws:
SSLException
-
buildOutboundKeyManagerFactory
Create aKeyManagerFactoryfor outbound connections. It provides a seperate keystore for internode mTLS outbound connections.- Returns:
KeyManagerFactory- Throws:
SSLException
-