Search in sources :

Example 86 with DrillConfig

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);
    }
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) NonTransientRpcException(org.apache.drill.exec.rpc.NonTransientRpcException) DrillProperties(org.apache.drill.common.config.DrillProperties) Properties(java.util.Properties) RpcException(org.apache.drill.exec.rpc.RpcException) NonTransientRpcException(org.apache.drill.exec.rpc.NonTransientRpcException) SecurityTest(org.apache.drill.categories.SecurityTest) Test(org.junit.Test)

Example 87 with DrillConfig

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);
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) Test(org.junit.Test) SecurityTest(org.apache.drill.categories.SecurityTest)

Example 88 with DrillConfig

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");
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) Properties(java.util.Properties) DrillProperties(org.apache.drill.common.config.DrillProperties) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 89 with DrillConfig

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);
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) AfterClass(org.junit.AfterClass)

Example 90 with DrillConfig

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);
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) Test(org.junit.Test) SecurityTest(org.apache.drill.categories.SecurityTest)

Aggregations

DrillConfig (org.apache.drill.common.config.DrillConfig)249 Test (org.junit.Test)165 Properties (java.util.Properties)89 SecurityTest (org.apache.drill.categories.SecurityTest)88 DrillProperties (org.apache.drill.common.config.DrillProperties)77 NonTransientRpcException (org.apache.drill.exec.rpc.NonTransientRpcException)32 ScanResult (org.apache.drill.common.scanner.persistence.ScanResult)29 DrillbitContext (org.apache.drill.exec.server.DrillbitContext)28 BeforeClass (org.junit.BeforeClass)25 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)23 SaslException (javax.security.sasl.SaslException)20 RpcException (org.apache.drill.exec.rpc.RpcException)20 Drillbit (org.apache.drill.exec.server.Drillbit)20 DrillbitStartupException (org.apache.drill.exec.exception.DrillbitStartupException)18 RemoteServiceSet (org.apache.drill.exec.server.RemoteServiceSet)17 BaseTest (org.apache.drill.test.BaseTest)17 ExecTest (org.apache.drill.exec.ExecTest)14 IOException (java.io.IOException)12 IcebergMetastore (org.apache.drill.metastore.iceberg.IcebergMetastore)12 File (java.io.File)10