You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by sudheeshkatkam <gi...@git.apache.org> on 2017/04/05 22:19:48 UTC

[GitHub] drill pull request #773: DRILL-4335: Apache Drill should support network enc...

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

    https://github.com/apache/drill/pull/773#discussion_r109974828
  
    --- Diff: exec/rpc/src/main/java/org/apache/drill/exec/rpc/AbstractRemoteConnection.java ---
    @@ -224,4 +237,67 @@ public void close() {
         }
       }
     
    +  /**
    +   * Helps to add all the required security handler's after negotiation for encryption is completed.
    +   * <p>
    +   *  Handler's that are added are:
    +   *    <li>  SaslDecryptionHandler
    +   *    <li>  LengthFieldBasedFrameDecoder Handler
    +   *    <li>  SaslEncryptionHandler
    +   *    <li>  ChunkCreationHandler
    +   * </p>
    +   * <p>
    +   *  If encryption is enabled ChunkCreationHandler is always added irrespective of chunkMode enabled or not.
    +   *  This helps to make a generic encryption handler.
    +   * </p>
    +   */
    +  @Override
    +  public void addSecurityHandlers() {
    +
    +    final ChannelPipeline channelPipeline = getChannel().pipeline();
    +    channelPipeline.addFirst("SaslDecryptionHandler", new SaslDecryptionHandler(saslBackend, getWrappedChunkSize(),
    +      OutOfMemoryHandler.DEFAULT_INSTANCE));
    +
    +    channelPipeline.addFirst("Length-Decoder",
    +      new LengthFieldBasedFrameDecoder(ByteOrder.BIG_ENDIAN, Integer.MAX_VALUE,
    +        RpcConstants.LENGTH_FIELD_OFFSET, RpcConstants.LENGTH_FIELD_LENGTH, RpcConstants.LENGTH_ADJUSTMENT,
    +        RpcConstants.INITIAL_BYTES_TO_STRIP, true));
    +
    +    channelPipeline.addAfter("message-decoder", "SaslEncryptionHandler",
    +      new SaslEncryptionHandler(saslBackend, encryptionContext.getMaxRawWrapSendSize(),
    +        OutOfMemoryHandler.DEFAULT_INSTANCE));
    +
    +    channelPipeline.addAfter("SaslEncryptionHandler", "ChunkCreationHandler",
    +      new ChunkCreationHandler("ChunkCreatorHandler", encryptionContext.getMaxRawWrapSendSize()));
    +  }
    +
    +  public void setEncrypted(boolean encrypted) {
    --- End diff --
    
    maybe `getEncryptionContext` to avoid delegating setters and getters?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---