Github user sohami commented on a diff in the pull request:

    https://github.com/apache/drill/pull/773#discussion_r111646250
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BitConnectionConfig.java 
---
    @@ -46,16 +47,40 @@ protected BitConnectionConfig(BufferAllocator 
allocator, BootStrapContext contex
         super(allocator, context);
     
         final DrillConfig config = context.getConfig();
    +    final AuthenticatorProvider authProvider = getAuthProvider();
    +
         if (config.getBoolean(ExecConstants.BIT_AUTHENTICATION_ENABLED)) {
           this.authMechanismToUse = 
config.getString(ExecConstants.BIT_AUTHENTICATION_MECHANISM);
           try {
    -        getAuthProvider().getAuthenticatorFactory(authMechanismToUse);
    +        authProvider.getAuthenticatorFactory(authMechanismToUse);
           } catch (final SaslException e) {
             throw new DrillbitStartupException(String.format(
                 "'%s' mechanism not found for bit-to-bit authentication. 
Please check authentication configuration.",
                 authMechanismToUse));
           }
    -      logger.info("Configured bit-to-bit connections to require 
authentication using: {}", authMechanismToUse);
    +
    +      // Update encryption related configurations
    +      
encryptionContext.setEncryption(config.getBoolean(ExecConstants.BIT_SASL_ENCRYPTION_ENABLED));
    +
    +      int maxEncodeSize = 
config.getInt(ExecConstants.BIT_SASL_ENCRYPTION_ENCODESIZE);
    +
    +      if(maxEncodeSize > RpcConstants.MAX_WRAP_SIZE) {
    +        logger.warn("Setting bit.sasl.encryption.encodesize to maximum 
allowed value of 16MB");
    +        maxEncodeSize = RpcConstants.MAX_WRAP_SIZE;
    +      }
    +      encryptionContext.setWrappedChunkSize(maxEncodeSize);
    +
    +      if (encryptionContext.isEncryptionEnabled() && 
authProvider.isOnlyPlainConfigured()) {
    +        throw new DrillbitStartupException("Encryption is enabled but only 
PLAIN mechanism is configured." +
    +          " Please check the security.bit configurations.");
    +      }
    +
    +      logger.info("Configured bit-to-bit connections to require 
authentication using: {} with encryption: {}",
    +        authMechanismToUse, encryptionContext.getEncryptionString());
    +
    +    } else if 
(config.getBoolean(ExecConstants.BIT_SASL_ENCRYPTION_ENABLED)) {
    +      throw new DrillbitStartupException("Invalid security configuration. 
Encryption is enabled with authentication " +
    --- End diff --
    
    Fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to