Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public static void setMetastoreSslConf(HiveConf conf) {
KEY_STORE_TRUST_STORE_PASSWORD);
}

public static void setMetastoreHttpsConf(HiveConf conf) {
setMetastoreSslConf(conf);
MetastoreConf.setVar(conf, MetastoreConf.ConfVars.THRIFT_TRANSPORT_MODE, "http");
MetastoreConf.setVar(conf, MetastoreConf.ConfVars.METASTORE_CLIENT_THRIFT_TRANSPORT_MODE, "http");
}

public static void clearSslConfOverlay(Map<String, String> confOverlay) {
confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_USE_SSL.varname, "false");
}
Expand Down
24 changes: 23 additions & 1 deletion itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestSSL.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.slf4j.LoggerFactory;


@org.junit.Ignore("HIVE-22620")
public class TestSSL {

private static final Logger LOG = LoggerFactory.getLogger(TestSSL.class);
Expand All @@ -65,6 +64,7 @@ public class TestSSL {
private static final String JAVA_TRUST_STORE_PROP = "javax.net.ssl.trustStore";
private static final String JAVA_TRUST_STORE_PASS_PROP = "javax.net.ssl.trustStorePassword";
private static final String JAVA_TRUST_STORE_TYPE_PROP = "javax.net.ssl.trustStoreType";
private static final String KEY_MANAGER_FACTORY_ALGORITHM = "SunX509";

private MiniHS2 miniHS2 = null;
private static HiveConf conf = new HiveConf();
Expand Down Expand Up @@ -290,6 +290,7 @@ public void testSSLConnectionWithURL() throws Exception {
* Test SSL client connection to SSL server
* @throws Exception
*/
@Ignore
@Test
public void testSSLConnectionWithProperty() throws Exception {
SSLTestUtils.setSslConfOverlay(confOverlay);
Expand Down Expand Up @@ -390,6 +391,7 @@ public void testSSLFetchHttp() throws Exception {
* Opening a new connection with this wrong certificate should fail
* @throws Exception
*/
@Ignore
@Test
public void testConnectionWrongCertCN() throws Exception {
// This call sets the default ssl params including the correct keystore in the server config
Expand Down Expand Up @@ -437,15 +439,34 @@ public void testConnectionWrongCertCN() throws Exception {
* Test HMS server with SSL
* @throws Exception
*/
@Ignore
@Test
public void testMetastoreWithSSL() throws Exception {
testSSLHMS(true);
}

/**
* Test HMS server with Thrift over Http + SSL
* @throws Exception
*/
@Test
public void testMetastoreWithHttps() throws Exception {
SSLTestUtils.setMetastoreHttpsConf(conf);
MetastoreConf.setVar(conf, MetastoreConf.ConfVars.SSL_TRUSTMANAGERFACTORY_ALGORITHM,
KEY_MANAGER_FACTORY_ALGORITHM);
MetastoreConf.setVar(conf, MetastoreConf.ConfVars.SSL_TRUSTSTORE_TYPE, KEY_STORE_TRUST_STORE_TYPE);
// false flag in testSSLHMS will set key store type for metastore
MetastoreConf.setVar(conf, MetastoreConf.ConfVars.SSL_KEYMANAGERFACTORY_ALGORITHM,
KEY_MANAGER_FACTORY_ALGORITHM);

testSSLHMS(false);
}

/**
* Test HMS server with SSL with input keystore type
* @throws Exception
*/
@Ignore
@Test
public void testMetastoreWithSSLKeyStoreType() throws Exception {
testSSLHMS(false);
Expand Down Expand Up @@ -511,6 +532,7 @@ public void testMetastoreConnectionWrongCertCN() throws Exception {
* Test SSL client connection to SSL server
* @throws Exception
*/
@Ignore
@Test
public void testSSLConnectionWithKeystoreType() throws Exception {
SSLTestUtils.setSslConfOverlay(confOverlay);
Expand Down
Loading