From 3c5f5af1184e85158dec962df0b0bc2be8d0d1e3 Mon Sep 17 00:00:00 2001 From: Karthik Kambatla Date: Tue, 28 Oct 2014 18:03:00 -0700 Subject: [PATCH] HADOOP-11243. SSLFactory shouldn't allow SSLv3. (Wei Yan via kasha) --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../org/apache/hadoop/security/ssl/SSLFactory.java | 12 +++++++++++- .../src/main/resources/core-default.xml | 8 ++++++++ .../src/site/apt/EncryptedShuffle.apt.vm | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 7358b98e6d5..a82cdae0dde 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -1015,6 +1015,8 @@ Release 2.6.0 - UNRELEASED HADOOP-11217. Disable SSLv3 in KMS. (Robert Kanter via kasha) + HADOOP-11243. SSLFactory shouldn't allow SSLv3. (Wei Yan via kasha) + Release 2.5.1 - 2014-09-05 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java index 404b00739ac..bbea33b7a09 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java @@ -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); } @@ -185,6 +194,7 @@ public class SSLFactory implements ConnectionConfigurator { sslEngine.setUseClientMode(false); sslEngine.setNeedClientAuth(requireClientCert); } + sslEngine.setEnabledProtocols(enabledProtocols); return sslEngine; } diff --git a/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml b/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml index 69dedfccf5e..e7a382d9bc9 100644 --- a/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml +++ b/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml @@ -1372,6 +1372,14 @@ for ldap providers in the same way as above does. + + hadoop.ssl.enabled.protocols + TLSv1 + + Protocols supported by the ssl. + + + hadoop.jetty.logs.serve.aliases true diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/apt/EncryptedShuffle.apt.vm b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/apt/EncryptedShuffle.apt.vm index e766cbc10ed..da412df7877 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/apt/EncryptedShuffle.apt.vm +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/apt/EncryptedShuffle.apt.vm @@ -53,6 +53,8 @@ Hadoop MapReduce Next Generation - Encrypted Shuffle | <<>> | <<>> | Resource file from which ssl server keystore information will be extracted. This file is looked up in the classpath, typically it should be in Hadoop conf/ directory | *--------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Resource file from which ssl server keystore information will be extracted. This file is looked up in the classpath, typically it should be in Hadoop conf/ directory | +*--------------------------------------+---------------------+-----------------+ +| <<>> | <<>> | The supported SSL protocols (JDK6 can use <>, JDK7+ can use <>) | *--------------------------------------+---------------------+-----------------+ <> Currently requiring client certificates should be set to false.