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

ASF GitHub Bot commented on HADOOP-18709:
-----------------------------------------

szilard-nemeth commented on code in PR #5638:
URL: https://github.com/apache/hadoop/pull/5638#discussion_r1199521669


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestSecureZKCuratorManager.java:
##########
@@ -0,0 +1,157 @@
+/**
+ * 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.hadoop.util.curator;
+
+import org.apache.curator.test.InstanceSpec;
+import org.apache.curator.test.TestingServer;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.client.ZKClientConfig;
+import org.apache.zookeeper.common.ClientX509Util;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.apache.hadoop.fs.FileContext.LOG;
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Test the manager for ZooKeeper Curator when SSL/TLS is enabled for the ZK 
server-client connection.
+ */
+public class TestSecureZKCuratorManager {
+
+  private TestingServer server;
+  private ZKCuratorManager curator;
+  private Configuration hadoopConf;
+  private Integer secureClientPort = 2281;
+  private File zkDataDir = new File("testZkSSLClientConnectionDataDir");
+
+  @Before
+  public void setup() throws Exception {
+    //set zkServer
+    this.hadoopConf = setUpSecure();
+    Map<String, Object> customConfiguration = new HashMap<>();
+    
customConfiguration.put("secureClientPort",this.secureClientPort.toString());
+    customConfiguration.put("audit.enable",true);
+
+    InstanceSpec spec = new InstanceSpec(
+            this.zkDataDir,
+            this.secureClientPort,
+            -1,
+            -1,
+            true,
+            1,
+            100,
+            10,
+            customConfiguration);
+    this.server = new TestingServer(spec, true);
+    hadoopConf.set(CommonConfigurationKeys.ZK_ADDRESS, 
this.server.getConnectString());
+    this.curator = new ZKCuratorManager(hadoopConf);
+    this.curator.start(new ArrayList<>(), true);
+  }
+
+  public Configuration setUpSecure() throws Exception {
+    Configuration hadoopConf = new Configuration();
+    String testDataPath = 
"src/test/java/org/apache/hadoop/util/curator/resources/data";
+    System.setProperty("zookeeper.serverCnxnFactory", 
"org.apache.zookeeper.server.NettyServerCnxnFactory");
+    //System.setProperty("zookeeper.client.secure", "true");
+
+
+    System.setProperty("zookeeper.ssl.keyStore.location", testDataPath + 
"/ssl/keystore.jks");
+    System.setProperty("zookeeper.ssl.keyStore.password", "password");
+    System.setProperty("zookeeper.ssl.trustStore.location", testDataPath + 
"/ssl/truststore.jks");
+    System.setProperty("zookeeper.ssl.trustStore.password", "password");
+    System.setProperty("zookeeper.request.timeout", "12345");
+
+    System.setProperty("jute.maxbuffer", "469296129");

Review Comment:
   I see. thanks





> Add curator based ZooKeeper communication support over SSL/TLS into the 
> common library
> --------------------------------------------------------------------------------------
>
>                 Key: HADOOP-18709
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18709
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Ferenc Erdelyi
>            Assignee: Ferenc Erdelyi
>            Priority: Major
>              Labels: pull-request-available
>
> With HADOOP-16579 the ZooKeeper client is capable of securing communication 
> with SSL. 
> To follow the convention introduced in HADOOP-14741, proposing to add to the 
> core-default.xml the following configurations, as the groundwork for the 
> components to enable encrypted communication between the individual 
> components and ZooKeeper:
>  * hadoop.zk.ssl.keystore.location
>  * hadoop.zk.ssl.keystore.password
>  * hadoop.zk.ssl.truststore.location
>  * hadoop.zk.ssl.truststore.password
> These parameters along with the component-specific ssl.client.enable option 
> (e.g. yarn.zookeeper.ssl.client.enable) should be passed to the 
> ZKCuratorManager to build the CuratorFramework. The ZKCuratorManager needs a 
> new overloaded start() method to build the encrypted communication.
>  * The secured ZK Client uses Netty, hence the dependency is included in the 
> pom.xml. Added netty-handler and netty-transport-native-epoll dependency to 
> the pom.xml based on ZOOKEEPER-3494 - "No need to depend on netty-all (SSL)".
>  * The change was exclusively tested with the unit test, which is a kind of 
> integration test, as a ZK Server was brought up and the communication tested 
> between the client and the server.
>  * This code change is in the common code base and there is no component 
> calling it yet. Once YARN-11468 - "Zookeeper SSL/TLS support" is implemented, 
> we can test it in a real cluster environment.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to