org.apache.hadoop.security.authentication.client.ConnectionConfigurator@Private
@Evolving
public class SSLFactory
extends java.lang.Object
implements org.apache.hadoop.security.authentication.client.ConnectionConfigurator
This SSLFactory uses a ReloadingX509TrustManager instance,
which reloads public keys if the truststore file changes.
This factory is used to configure HTTPS in Hadoop HTTP based endpoints, both client and server.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
SSLFactory.Mode |
| Constructor | Description |
|---|---|
SSLFactory(SSLFactory.Mode mode,
Configuration conf) |
Creates an SSLFactory.
|
| Modifier and Type | Method | Description |
|---|---|---|
java.net.HttpURLConnection |
configure(java.net.HttpURLConnection conn) |
If the given
HttpURLConnection is an HttpsURLConnection
configures the connection with the SSLSocketFactory and
HostnameVerifier of this SSLFactory, otherwise does nothing. |
javax.net.ssl.SSLEngine |
createSSLEngine() |
Returns a configured SSLEngine.
|
javax.net.ssl.SSLServerSocketFactory |
createSSLServerSocketFactory() |
Returns a configured SSLServerSocketFactory.
|
javax.net.ssl.SSLSocketFactory |
createSSLSocketFactory() |
Returns a configured SSLSocketFactory.
|
void |
destroy() |
Releases any resources being used.
|
javax.net.ssl.HostnameVerifier |
getHostnameVerifier() |
Returns the hostname verifier it should be used in HttpsURLConnections.
|
static javax.net.ssl.HostnameVerifier |
getHostnameVerifier(java.lang.String verifier) |
|
KeyStoresFactory |
getKeystoresFactory() |
Returns the SSLFactory KeyStoresFactory instance.
|
Configuration |
getSslConf() |
Returns SSL configuration.
|
void |
init() |
Initializes the factory.
|
boolean |
isClientCertRequired() |
Returns if client certificates are required or not.
|
static Configuration |
readSSLConfiguration(Configuration conf,
SSLFactory.Mode mode) |
public static final java.lang.String SSL_CLIENT_CONF_KEY
public static final java.lang.String SSL_CLIENT_CONF_DEFAULT
public static final java.lang.String SSL_SERVER_CONF_KEY
public static final java.lang.String SSL_SERVER_CONF_DEFAULT
public static final java.lang.String SSL_REQUIRE_CLIENT_CERT_KEY
public static final boolean SSL_REQUIRE_CLIENT_CERT_DEFAULT
public static final java.lang.String SSL_HOSTNAME_VERIFIER_KEY
public static final java.lang.String SSL_ENABLED_PROTOCOLS_KEY
public static final java.lang.String SSL_ENABLED_PROTOCOLS_DEFAULT
public static final java.lang.String SSL_SERVER_NEED_CLIENT_AUTH
public static final boolean SSL_SERVER_NEED_CLIENT_AUTH_DEFAULT
public static final java.lang.String SSL_SERVER_KEYSTORE_LOCATION
public static final java.lang.String SSL_SERVER_KEYSTORE_PASSWORD
public static final java.lang.String SSL_SERVER_KEYSTORE_TYPE
public static final java.lang.String SSL_SERVER_KEYSTORE_TYPE_DEFAULT
public static final java.lang.String SSL_SERVER_KEYSTORE_KEYPASSWORD
public static final java.lang.String SSL_SERVER_TRUSTSTORE_LOCATION
public static final java.lang.String SSL_SERVER_TRUSTSTORE_PASSWORD
public static final java.lang.String SSL_SERVER_TRUSTSTORE_TYPE
public static final java.lang.String SSL_SERVER_TRUSTSTORE_TYPE_DEFAULT
public static final java.lang.String SSL_CLIENT_KEYSTORE_TYPE
public static final java.lang.String SSL_CLIENT_KEYSTORE_TYPE_DEFAULT
public static final java.lang.String SSL_SERVER_EXCLUDE_CIPHER_LIST
public static final java.lang.String SSL_SERVER_INCLUDE_CIPHER_LIST
public static final java.lang.String KEY_MANAGER_SSLCERTIFICATE
public static final java.lang.String TRUST_MANAGER_SSLCERTIFICATE
public static final java.lang.String KEYSTORES_FACTORY_CLASS_KEY
public static final java.lang.String SSL_CLIENT_TRUSTSTORE_PASSWORD
public static final java.lang.String SSL_CLIENT_TRUSTSTORE_TYPE
public static final java.lang.String TRUSTNAME_SERVICE_JAVA_PROPERTY
public static final java.lang.String TRUSTSTORE_PASS_JAVA_PROPERTY
public static final java.lang.String TRUSTSTORE_TYPE_JAVA_PROPERTY
public SSLFactory(SSLFactory.Mode mode, Configuration conf)
mode - SSLFactory mode, client or server.conf - Hadoop configuration from where the SSLFactory configuration
will be read.public static Configuration readSSLConfiguration(Configuration conf, SSLFactory.Mode mode)
public void init()
throws java.security.GeneralSecurityException,
java.io.IOException
java.security.GeneralSecurityException - thrown if an SSL initialization error
happened.java.io.IOException - thrown if an IO error happened while reading the SSL
configuration.public static javax.net.ssl.HostnameVerifier getHostnameVerifier(java.lang.String verifier)
throws java.security.GeneralSecurityException,
java.io.IOException
java.security.GeneralSecurityExceptionjava.io.IOExceptionpublic void destroy()
public KeyStoresFactory getKeystoresFactory()
public javax.net.ssl.SSLEngine createSSLEngine()
throws java.security.GeneralSecurityException,
java.io.IOException
java.security.GeneralSecurityException - thrown if the SSL engine could not
be initialized.java.io.IOException - thrown if and IO error occurred while loading
the server keystore.public javax.net.ssl.SSLServerSocketFactory createSSLServerSocketFactory()
throws java.security.GeneralSecurityException,
java.io.IOException
java.security.GeneralSecurityException - thrown if the SSLSocketFactory could not
be initialized.java.io.IOException - thrown if and IO error occurred while loading
the server keystore.public javax.net.ssl.SSLSocketFactory createSSLSocketFactory()
throws java.security.GeneralSecurityException,
java.io.IOException
java.security.GeneralSecurityException - thrown if the SSLSocketFactory could not
be initialized.java.io.IOException - thrown if and IO error occurred while loading
the server keystore.public javax.net.ssl.HostnameVerifier getHostnameVerifier()
public Configuration getSslConf()
public boolean isClientCertRequired()
public java.net.HttpURLConnection configure(java.net.HttpURLConnection conn)
throws java.io.IOException
HttpURLConnection is an HttpsURLConnection
configures the connection with the SSLSocketFactory and
HostnameVerifier of this SSLFactory, otherwise does nothing.configure in interface org.apache.hadoop.security.authentication.client.ConnectionConfiguratorconn - the HttpURLConnection instance to configure.HttpURLConnection instance.java.io.IOException - if an IO error occurred.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.