From 47a9ff5d1f4f90fe9ddc05a478cca0d4f82fd30a Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Fri, 5 Jun 2015 10:22:52 -0500 Subject: [PATCH] HBASE-13848 Use Credential Provider when available for SSL passwords in InfoServer. --- .../java/org/apache/hadoop/hbase/http/InfoServer.java | 7 ++++--- .../org/apache/hadoop/hbase/http/TestSSLHttpServer.java | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/http/InfoServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/http/InfoServer.java index e9b76bc752f..1e76da92dde 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/http/InfoServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/http/InfoServer.java @@ -24,6 +24,7 @@ import java.net.URI; import javax.servlet.http.HttpServlet; +import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; @@ -66,12 +67,12 @@ public class InfoServer { builder.setLogDir(logDir); } if (httpConfig.isSecure()) { - builder.keyPassword(c.get("ssl.server.keystore.keypassword")) + builder.keyPassword(HBaseConfiguration.getPassword(c, "ssl.server.keystore.keypassword", null)) .keyStore(c.get("ssl.server.keystore.location"), - c.get("ssl.server.keystore.password"), + HBaseConfiguration.getPassword(c,"ssl.server.keystore.password", null), c.get("ssl.server.keystore.type", "jks")) .trustStore(c.get("ssl.server.truststore.location"), - c.get("ssl.server.truststore.password"), + HBaseConfiguration.getPassword(c, "ssl.server.truststore.password", null), c.get("ssl.server.truststore.type", "jks")); } this.httpServer = builder.build(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/http/TestSSLHttpServer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/http/TestSSLHttpServer.java index 1b79aff4188..44d122ab0da 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/http/TestSSLHttpServer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/http/TestSSLHttpServer.java @@ -29,6 +29,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileUtil; +import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.testclassification.MiscTests; import org.apache.hadoop.hbase.testclassification.SmallTests; import org.apache.hadoop.hbase.http.ssl.KeyStoreTestUtil; @@ -81,12 +82,13 @@ public class TestSSLHttpServer extends HttpServerFunctionalTest { .setName("test") .addEndpoint(new URI("https://localhost")) .setConf(conf) - .keyPassword(sslConf.get("ssl.server.keystore.keypassword")) + .keyPassword(HBaseConfiguration.getPassword(sslConf, "ssl.server.keystore.keypassword", + null)) .keyStore(sslConf.get("ssl.server.keystore.location"), - sslConf.get("ssl.server.keystore.password"), + HBaseConfiguration.getPassword(sslConf, "ssl.server.keystore.password", null), sslConf.get("ssl.server.keystore.type", "jks")) .trustStore(sslConf.get("ssl.server.truststore.location"), - sslConf.get("ssl.server.truststore.password"), + HBaseConfiguration.getPassword(sslConf, "ssl.server.truststore.password", null), sslConf.get("ssl.server.truststore.type", "jks")).build(); server.addServlet("echo", "/echo", TestHttpServer.EchoServlet.class); server.start();