drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-4335) Apache Drill should support network encryption
Date Mon, 01 May 2017 23:08:04 GMT

    [ https://issues.apache.org/jira/browse/DRILL-4335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15991732#comment-15991732
] 

ASF GitHub Bot commented on DRILL-4335:
---------------------------------------

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

    https://github.com/apache/drill/pull/773#discussion_r114213700
  
    --- Diff: exec/rpc/src/main/java/org/apache/drill/exec/rpc/ChunkCreationHandler.java ---
    @@ -0,0 +1,101 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.rpc;
    +
    +
    +import io.netty.buffer.ByteBuf;
    +import io.netty.buffer.CompositeByteBuf;
    +import io.netty.channel.ChannelHandlerContext;
    +import io.netty.handler.codec.MessageToMessageEncoder;
    +
    +import java.util.List;
    +
    +import static com.google.common.base.Preconditions.checkArgument;
    +import static java.lang.Math.min;
    +
    +/**
    + * Handler that converts an input ByteBuf into chunk size ByteBuf's and add it to the
    + * CompositeByteBuf as individual components. If encryption is enabled, this is always
    + * added in the channel pipeline.
    + */
    +class ChunkCreationHandler extends MessageToMessageEncoder<ByteBuf> {
    +  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(
    +      ChunkCreationHandler.class.getCanonicalName());
    +
    +  private final int chunkSize;
    +
    +  ChunkCreationHandler(int chunkSize) {
    +    checkArgument(chunkSize > 0);
    +    this.chunkSize = chunkSize;
    +  }
    +
    +  @Override
    +  public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
    +    super.handlerAdded(ctx);
    +    logger.trace("Added " + RpcConstants.CHUNK_CREATION_HANDLER + " handler!");
    +  }
    +
    +  @Override
    +  public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
    +    super.handlerRemoved(ctx);
    +    logger.trace("Removed " + RpcConstants.CHUNK_CREATION_HANDLER + " handler");
    +  }
    +
    +  @Override
    +  protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out)
throws Exception {
    +
    +    if (RpcConstants.EXTRA_DEBUGGING) {
    +      logger.debug("ChunkCreationHandler called with msg {} of size {} with chunkSize
{}",
    +          msg, msg.readableBytes(), chunkSize);
    +    }
    +
    +    if (!ctx.channel().isOpen()) {
    +      logger.debug("Channel closed, skipping encode inside {}.", RpcConstants.CHUNK_CREATION_HANDLER);
    +      msg.release();
    +      return;
    +    }
    +
    +    ByteBuf chunkBuf;
    +
    +    // Calculate the number of chunks based on configured chunk size and input msg size
    +    int numChunks = (int) Math.ceil((double) msg.readableBytes() / chunkSize);
    +
    +    // Initialize a composite buffer to hold numChunks chunk.
    +    final CompositeByteBuf cbb = ctx.alloc().compositeBuffer(numChunks);
    +
    +    int cbbWriteIndex = 0;
    +    int currentChunkLen = min(msg.readableBytes(), chunkSize);
    +
    +    // Create slices of chunkSize from input msg and add it to the composite buffer.
    +    while (numChunks > 0) {
    +      chunkBuf = msg.slice(msg.readerIndex(), currentChunkLen);
    --- End diff --
    
    `final ByteBuf chunkBuf ...`


> Apache Drill should support network encryption
> ----------------------------------------------
>
>                 Key: DRILL-4335
>                 URL: https://issues.apache.org/jira/browse/DRILL-4335
>             Project: Apache Drill
>          Issue Type: New Feature
>            Reporter: Keys Botzum
>            Assignee: Sorabh Hamirwasia
>              Labels: security
>         Attachments: ApacheDrillEncryptionUsingSASLDesign.pdf
>
>
> This is clearly related to Drill-291 but wanted to make explicit that this needs to include
network level encryption and not just authentication. This is particularly important for the
client connection to Drill which will often be sending passwords in the clear until there
is encryption.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message