[
https://issues.apache.org/jira/browse/ROCKETMQ-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040479#comment-16040479
]
ASF GitHub Bot commented on ROCKETMQ-28:
----------------------------------------
Github user Jaskey commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r120285629
--- Diff:
remoting/src/main/java/org/apache/rocketmq/remoting/netty/SslHelper.java ---
@@ -0,0 +1,110 @@
+/*
+ * 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.rocketmq.remoting.netty;
+
+import io.netty.handler.ssl.ClientAuth;
+import io.netty.handler.ssl.SslContext;
+import io.netty.handler.ssl.SslContextBuilder;
+import io.netty.handler.ssl.SslProvider;
+import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
+import io.netty.handler.ssl.util.SelfSignedCertificate;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.cert.CertificateException;
+import java.util.Properties;
+import javax.net.ssl.SSLException;
+
+public class SslHelper {
+
+ public static SslContext buildSslContext(boolean forClient) throws
SSLException, CertificateException {
+
+ File configFile = new File(NettySystemConfig.sslConfigFile);
+ boolean testMode = !(configFile.exists() && configFile.isFile() &&
configFile.canRead());
+ Properties properties = null;
+
+ if (!testMode) {
+ properties = new Properties();
+ InputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(configFile);
--- End diff --
what about using try-with-resources to deal with resource auto close
> Transportation Layer Security
> -----------------------------
>
> Key: ROCKETMQ-28
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-28
> Project: Apache RocketMQ
> Issue Type: New Feature
> Components: rocketmq-remoting
> Reporter: Zhanhui Li
> Assignee: Zhanhui Li
> Fix For: 4.2.0-incubating
>
>
> RocketMQ delivers data in clear text for now, which requires internal network
> environment. As use scenarios expand, end-to-end security is in bad need.
> This issue is to introduce features making RocketMQ security for various use
> cases and sacrificing as few as possible.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)