From 04b0f6851bcfcd8986868f06d64e4339ef8609de Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Thu, 29 May 2014 21:39:16 +0000 Subject: [PATCH] HADOOP-10639. FileBasedKeyStoresFactory initialization is not using default for SSL_REQUIRE_CLIENT_CERT_KEY. (tucu) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1598413 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../security/ssl/FileBasedKeyStoresFactory.java | 3 ++- .../apache/hadoop/security/ssl/TestSSLFactory.java | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index e48d85e985..855dbd0467 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -516,6 +516,9 @@ Release 2.5.0 - UNRELEASED HADOOP-10602. Documentation has broken "Go Back" hyperlinks. (Akira AJISAKA via cnauroth) + HADOOP-10639. FileBasedKeyStoresFactory initialization is not using default + for SSL_REQUIRE_CLIENT_CERT_KEY. (tucu) + Release 2.4.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/FileBasedKeyStoresFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/FileBasedKeyStoresFactory.java index ef4fad041e..52e54addaa 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/FileBasedKeyStoresFactory.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/FileBasedKeyStoresFactory.java @@ -131,7 +131,8 @@ public void init(SSLFactory.Mode mode) throws IOException, GeneralSecurityException { boolean requireClientCert = - conf.getBoolean(SSLFactory.SSL_REQUIRE_CLIENT_CERT_KEY, true); + conf.getBoolean(SSLFactory.SSL_REQUIRE_CLIENT_CERT_KEY, + SSLFactory.DEFAULT_SSL_REQUIRE_CLIENT_CERT); // certificate store String keystoreType = diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestSSLFactory.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestSSLFactory.java index 1711a74226..20585b15d0 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestSSLFactory.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestSSLFactory.java @@ -272,4 +272,17 @@ private void checkSSLFactoryInitWithPasswords(SSLFactory.Mode mode, sslFactory.destroy(); } } + + @Test + public void testNoClientCertsInitialization() throws Exception { + Configuration conf = createConfiguration(false); + conf.unset(SSLFactory.SSL_REQUIRE_CLIENT_CERT_KEY); + SSLFactory sslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, conf); + try { + sslFactory.init(); + } finally { + sslFactory.destroy(); + } + } + }