|
@@ -66,6 +66,10 @@ public class SSLFactory implements ConnectionConfigurator {
|
|
|
public static final String KEYSTORES_FACTORY_CLASS_KEY =
|
|
|
"hadoop.ssl.keystores.factory.class";
|
|
|
|
|
|
+ public static final String SSL_ENABLED_PROTOCOLS =
|
|
|
+ "hadoop.ssl.enabled.protocols";
|
|
|
+ public static final String DEFAULT_SSL_ENABLED_PROTOCOLS = "TLSv1";
|
|
|
+
|
|
|
private Configuration conf;
|
|
|
private Mode mode;
|
|
|
private boolean requireClientCert;
|
|
@@ -73,6 +77,8 @@ public class SSLFactory implements ConnectionConfigurator {
|
|
|
private HostnameVerifier hostnameVerifier;
|
|
|
private KeyStoresFactory keystoresFactory;
|
|
|
|
|
|
+ private String[] enabledProtocols = null;
|
|
|
+
|
|
|
/**
|
|
|
* Creates an SSLFactory.
|
|
|
*
|
|
@@ -94,6 +100,9 @@ public class SSLFactory implements ConnectionConfigurator {
|
|
|
= conf.getClass(KEYSTORES_FACTORY_CLASS_KEY,
|
|
|
FileBasedKeyStoresFactory.class, KeyStoresFactory.class);
|
|
|
keystoresFactory = ReflectionUtils.newInstance(klass, sslConf);
|
|
|
+
|
|
|
+ enabledProtocols = conf.getStrings(SSL_ENABLED_PROTOCOLS,
|
|
|
+ DEFAULT_SSL_ENABLED_PROTOCOLS);
|
|
|
}
|
|
|
|
|
|
private Configuration readSSLConfiguration(Mode mode) {
|
|
@@ -122,7 +131,7 @@ public class SSLFactory implements ConnectionConfigurator {
|
|
|
context = SSLContext.getInstance("TLS");
|
|
|
context.init(keystoresFactory.getKeyManagers(),
|
|
|
keystoresFactory.getTrustManagers(), null);
|
|
|
-
|
|
|
+ context.getDefaultSSLParameters().setProtocols(enabledProtocols);
|
|
|
hostnameVerifier = getHostnameVerifier(conf);
|
|
|
}
|
|
|
|
|
@@ -181,6 +190,7 @@ public class SSLFactory implements ConnectionConfigurator {
|
|
|
sslEngine.setUseClientMode(false);
|
|
|
sslEngine.setNeedClientAuth(requireClientCert);
|
|
|
}
|
|
|
+ sslEngine.setEnabledProtocols(enabledProtocols);
|
|
|
return sslEngine;
|
|
|
}
|
|
|
|