use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestUserBitKerberosEncryption method encryptionEnabledWithOnlyPlainMech.
@Test
public void encryptionEnabledWithOnlyPlainMech() {
try {
final Properties connectionProps = new Properties();
connectionProps.setProperty(DrillProperties.SERVICE_PRINCIPAL, krbHelper.SERVER_PRINCIPAL);
connectionProps.setProperty(DrillProperties.USER, krbHelper.CLIENT_PRINCIPAL);
connectionProps.setProperty(DrillProperties.KEYTAB, krbHelper.clientKeytab.getAbsolutePath());
newConfig = new DrillConfig(DrillConfig.create(cloneDefaultTestConfigProperties()).withValue(ExecConstants.USER_AUTHENTICATION_ENABLED, ConfigValueFactory.fromAnyRef(true)).withValue(ExecConstants.USER_AUTHENTICATOR_IMPL, ConfigValueFactory.fromAnyRef(UserAuthenticatorTestImpl.TYPE)).withValue(ExecConstants.SERVICE_PRINCIPAL, ConfigValueFactory.fromAnyRef(krbHelper.SERVER_PRINCIPAL)).withValue(ExecConstants.SERVICE_KEYTAB_LOCATION, ConfigValueFactory.fromAnyRef(krbHelper.serverKeytab.toString())).withValue(ExecConstants.AUTHENTICATION_MECHANISMS, ConfigValueFactory.fromIterable(Lists.newArrayList("plain"))).withValue(ExecConstants.USER_ENCRYPTION_SASL_ENABLED, ConfigValueFactory.fromAnyRef(true)));
updateTestCluster(1, newConfig, connectionProps);
fail();
} catch (Exception ex) {
assert (ex.getCause() instanceof NonTransientRpcException);
logger.error("Caught exception: ", ex);
}
}
use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestUserBitSSLServer method testNoKeyPassword.
@Test
public // Should pass because the keystore password will be used.
void testNoKeyPassword() throws Exception {
DrillConfig testConfig = new DrillConfig(DrillConfig.create(sslConfig).withValue(ExecConstants.SSL_KEY_PASSWORD, ConfigValueFactory.fromAnyRef("")));
// Start an SSL enabled cluster
boolean failureCaught = false;
try {
updateTestCluster(1, testConfig, initProps);
} catch (Exception e) {
failureCaught = true;
}
assertEquals(failureCaught, false);
}
use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestUserBitSSLServer method setupTest.
@BeforeClass
public static void setupTest() throws Exception {
classLoader = TestUserBitSSLServer.class.getClassLoader();
ksPath = new File(classLoader.getResource("ssl/keystore.ks").getFile()).getAbsolutePath();
tsPath = new File(classLoader.getResource("ssl/truststore.ks").getFile()).getAbsolutePath();
sslConfig = new DrillConfig(DrillConfig.create(cloneDefaultTestConfigProperties()).withValue(ExecConstants.USER_SSL_ENABLED, ConfigValueFactory.fromAnyRef(true)).withValue(ExecConstants.SSL_KEYSTORE_TYPE, ConfigValueFactory.fromAnyRef("JKS")).withValue(ExecConstants.SSL_KEYSTORE_PATH, ConfigValueFactory.fromAnyRef(ksPath)).withValue(ExecConstants.SSL_KEYSTORE_PASSWORD, ConfigValueFactory.fromAnyRef("drill123")).withValue(ExecConstants.SSL_KEY_PASSWORD, ConfigValueFactory.fromAnyRef("drill123")).withValue(ExecConstants.SSL_PROTOCOL, ConfigValueFactory.fromAnyRef("TLSv1.2")));
initProps = new Properties();
initProps.setProperty(DrillProperties.ENABLE_TLS, "true");
initProps.setProperty(DrillProperties.TRUSTSTORE_PATH, tsPath);
initProps.setProperty(DrillProperties.TRUSTSTORE_PASSWORD, "drill123");
initProps.setProperty(DrillProperties.DISABLE_HOST_VERIFICATION, "true");
}
use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestUserBitSSLServer method cleanTest.
@AfterClass
public static void cleanTest() throws Exception {
DrillConfig restoreConfig = new DrillConfig(DrillConfig.create(cloneDefaultTestConfigProperties()));
updateTestCluster(1, restoreConfig);
}
use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestUserBitSSLServer method testInvalidKeystorePath.
@Test
public void testInvalidKeystorePath() throws Exception {
DrillConfig testConfig = new DrillConfig(DrillConfig.create(sslConfig).withValue(ExecConstants.SSL_KEYSTORE_PATH, ConfigValueFactory.fromAnyRef("/bad/path")));
// Start an SSL enabled cluster
boolean failureCaught = false;
try {
updateTestCluster(1, testConfig, initProps);
} catch (Exception e) {
failureCaught = true;
}
assertEquals(failureCaught, true);
}
Aggregations