Class PEMBasedSslContextFactory
- All Implemented Interfaces:
ISslContextFactory
KeyStore with PKCS# 12 store type
to be used for keystore and the truststore managers.
This factory also supports 'hot reloading' of the key material, the same way as defined by FileBasedSslContextFactory,
if it is file based. This factory ignores the existing 'store_type' configuration used for other file based store
types like JKS.
You can configure this factory with either inline PEM data or with the files having the required PEM data as shown
below,
Configuration: PEM keys/certs defined inline (mind the spaces in the YAML!)
client/server_encryption_options:
ssl_context_factory:
class_name: org.apache.cassandra.security.PEMBasedSslContextFactory
parameters:
private_key: |
-----BEGIN ENCRYPTED PRIVATE KEY----- OR -----BEGIN PRIVATE KEY-----
<your base64 encoded private key>
-----END ENCRYPTED PRIVATE KEY----- OR -----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
<your base64 encoded certificate chain>
-----END CERTIFICATE-----
private_key_password: "<your password if the private key is encrypted with a password>"
trusted_certificates: |
-----BEGIN CERTIFICATE-----
<your base64 encoded certificate>
-----END CERTIFICATE-----
Configuration: PEM keys/certs defined in files
client/server_encryption_options:
ssl_context_factory:
class_name: org.apache.cassandra.security.PEMBasedSslContextFactory
keystore: <file path to the keystore file in the PEM format with the private key and the certificate chain>
keystore_password: "<your password if the private key is encrypted with a password>"
truststore: <file path to the truststore file in the PEM format>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classNested classes/interfaces inherited from class org.apache.cassandra.security.FileBasedSslContextFactory
FileBasedSslContextFactory.FileBasedStoreContext, FileBasedSslContextFactory.HotReloadableFileNested classes/interfaces inherited from interface org.apache.cassandra.security.ISslContextFactory
ISslContextFactory.SocketType -
Field Summary
FieldsFields inherited from class org.apache.cassandra.security.FileBasedSslContextFactory
hotReloadableFiles, keystoreContext, outboundKeystoreContext, trustStoreContextFields inherited from class org.apache.cassandra.security.AbstractSslContextFactory
accepted_protocols, algorithm, cipher_suites, enabled, openSslIsAvailable, optional, parameters, protocol, require_client_auth, require_endpoint_verification, store_type, TLS_PROTOCOL_SUBSTITUTION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected KeyManagerFactoryBuilds required KeyManagerFactory from the PEM based keystore.protected KeyManagerFactoryCreate aKeyManagerFactoryfor outbound connections.protected TrustManagerFactoryBuilds TrustManagerFactory from the PEM based truststore.booleanDecides if this factory has a keystore defined - key material specified in files or inline to the configuration.booleanDecides if this factory has an outbound keystore defined - key material specified in files or inline to the configuration.voidThis enables 'hot' reloading of the key/trust stores based on the last updated timestamps if they are file based.Methods inherited from class org.apache.cassandra.security.FileBasedSslContextFactory
checkExpiredCerts, shouldReload, validatePasswordMethods inherited from class org.apache.cassandra.security.AbstractSslContextFactory
createJSSESslContext, createNettySslContext, deriveIfOpenSslAvailable, getAcceptedProtocols, getBoolean, getBoolean, getCipherSuites, getSslProvider, getString, getString, getStringList
-
Field Details
-
DEFAULT_TARGET_STORETYPE
- See Also:
-
-
Constructor Details
-
PEMBasedSslContextFactory
public PEMBasedSslContextFactory() -
PEMBasedSslContextFactory
-
-
Method Details
-
hasKeystore
public boolean hasKeystore()Decides if this factory has a keystore defined - key material specified in files or inline to the configuration.- Specified by:
hasKeystorein interfaceISslContextFactory- Overrides:
hasKeystorein classFileBasedSslContextFactory- Returns:
trueif there is a keystore defined;falseotherwise
-
hasOutboundKeystore
public boolean hasOutboundKeystore()Decides if this factory has an outbound keystore defined - key material specified in files or inline to the configuration.- Specified by:
hasOutboundKeystorein interfaceISslContextFactory- Overrides:
hasOutboundKeystorein classFileBasedSslContextFactory- Returns:
trueif there is an outbound keystore defined;falseotherwise
-
initHotReloading
public void initHotReloading()This enables 'hot' reloading of the key/trust stores based on the last updated timestamps if they are file based.- Specified by:
initHotReloadingin interfaceISslContextFactory- Overrides:
initHotReloadingin classFileBasedSslContextFactory
-
buildKeyManagerFactory
Builds required KeyManagerFactory from the PEM based keystore. It also checks for the PrivateKey's certificate's expiry and logswarningfor each expired PrivateKey's certitificate.- Overrides:
buildKeyManagerFactoryin classFileBasedSslContextFactory- Returns:
- KeyManagerFactory built from the PEM based keystore.
- Throws:
SSLException- if any issues encountered during the build process- See Also:
-
buildOutboundKeyManagerFactory
Description copied from class:AbstractSslContextFactoryCreate aKeyManagerFactoryfor outbound connections. It provides a seperate keystore for internode mTLS outbound connections.- Overrides:
buildOutboundKeyManagerFactoryin classFileBasedSslContextFactory- Returns:
KeyManagerFactory- Throws:
SSLException
-
buildTrustManagerFactory
Builds TrustManagerFactory from the PEM based truststore.- Overrides:
buildTrustManagerFactoryin classFileBasedSslContextFactory- Returns:
- TrustManagerFactory from the PEM based truststore
- Throws:
SSLException- if any issues encountered during the build process
-