You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by lizhanhui <gi...@git.apache.org> on 2017/06/05 09:14:30 UTC
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
GitHub user lizhanhui opened a pull request:
https://github.com/apache/incubator-rocketmq/pull/111
[ROCKETMQ-28] Add TLS support to provide end-2-end security
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/lizhanhui/incubator-rocketmq ROCKETMQ-28
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-rocketmq/pull/111.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #111
----
commit 6fcb64920748ffeb88d2035ee2885c6dd90db2cc
Author: Li Zhanhui <li...@gmail.com>
Date: 2017-06-05T08:37:36Z
Add TLS to provide end-2-end security
----
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by lizhanhui <gi...@git.apache.org>.
Github user lizhanhui closed the pull request at:
https://github.com/apache/incubator-rocketmq/pull/111
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by lizhanhui <gi...@git.apache.org>.
Github user lizhanhui commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r121319741
--- Diff: remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java ---
@@ -169,6 +188,7 @@ public void initChannel(SocketChannel ch) throws Exception {
new NettyDecoder(),
new IdleStateHandler(0, 0, nettyServerConfig.getServerChannelMaxIdleTimeSeconds()),
new NettyConnectManageHandler(),
+ new StartTlsHandler(),
--- End diff --
Nice catch. We do can simplify this process by detecting handshake per https://tools.ietf.org/html/rfc5246#section-6.2.1
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by lizhanhui <gi...@git.apache.org>.
Github user lizhanhui commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r121338236
--- Diff: remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java ---
@@ -169,6 +188,7 @@ public void initChannel(SocketChannel ch) throws Exception {
new NettyDecoder(),
new IdleStateHandler(0, 0, nettyServerConfig.getServerChannelMaxIdleTimeSeconds()),
new NettyConnectManageHandler(),
+ new StartTlsHandler(),
--- End diff --
Updated.
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by vongosling <gi...@git.apache.org>.
Github user vongosling commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r120901312
--- Diff: remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java ---
@@ -88,6 +89,11 @@
protected Pair<NettyRequestProcessor, ExecutorService> defaultRequestProcessor;
/**
+ * SSL Context.
--- End diff --
No need to use the same text, we'd better to remove this javadoc if we could not further describe this class :-)
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
[](https://coveralls.io/builds/11927821)
Coverage increased (+0.4%) to 38.845% when pulling **a771c120c82d2cd06dbf5cbf60bda6be364bc6ef on lizhanhui:ROCKETMQ-28** into **c4a3e0c1325e67aec76aa94e9ade3a6ea1b682d2 on apache:develop**.
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by zhouxinyu <gi...@git.apache.org>.
Github user zhouxinyu commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r121307154
--- Diff: remoting/pom.xml ---
@@ -45,5 +45,22 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-tcnative-boringssl-static</artifactId>
--- End diff --
`boringssl` is too heavy for `client` module, how about excluding it and use a more lightweight way in `client` module?
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by vongosling <gi...@git.apache.org>.
Github user vongosling commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r120903001
--- 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 --
@lizhanhui
@Jaskey agreed, client must be compatible with JDK 1.6 considering RocketMQ's massive user:-)
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by lizhanhui <gi...@git.apache.org>.
Github user lizhanhui commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r120584925
--- 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 --
This module needs to maintain compatibility with java 1.6, hence, no try-with-resource.
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
[](https://coveralls.io/builds/11827865)
Coverage increased (+0.03%) to 38.689% when pulling **6fcb64920748ffeb88d2035ee2885c6dd90db2cc on lizhanhui:ROCKETMQ-28** into **0fe947173a85d8931b1068805713e89dbba4125a on apache:develop**.
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
[](https://coveralls.io/builds/11880510)
Coverage increased (+0.1%) to 38.566% when pulling **bf2c6cb8628d796a75904a0283fb1527b1258275 on lizhanhui:ROCKETMQ-28** into **c4a3e0c1325e67aec76aa94e9ade3a6ea1b682d2 on apache:develop**.
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by lizhanhui <gi...@git.apache.org>.
Github user lizhanhui commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
@Jaskey @dongeforever @vongosling @shroman Please review this PR.
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by Jaskey <gi...@git.apache.org>.
Github user Jaskey commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r120276597
--- Diff: remoting/src/main/java/org/apache/rocketmq/remoting/netty/FileRegionEncoder.java ---
@@ -0,0 +1,66 @@
+/*
+ * 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.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.FileRegion;
+import io.netty.handler.codec.MessageToByteEncoder;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.WritableByteChannel;
+
+public class FileRegionEncoder extends MessageToByteEncoder<FileRegion> {
--- End diff --
Not quite understand what this class is tls, how about add javadoc for this class and explain it's usage?
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
[](https://coveralls.io/builds/11863024)
Coverage increased (+0.3%) to 38.92% when pulling **02c547b47d28b5b75412eb35f10147ecdc535057 on lizhanhui:ROCKETMQ-28** into **0fe947173a85d8931b1068805713e89dbba4125a on apache:develop**.
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by Jaskey <gi...@git.apache.org>.
Github user Jaskey commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r120276124
--- Diff: remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java ---
@@ -128,6 +131,19 @@ public Thread newThread(Runnable r) {
}
});
}
+
--- End diff --
How about extract these code to a method, `buildSSLContext` in `NettyRemoteAbstact` for both client and server
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
[](https://coveralls.io/builds/11943068)
Coverage increased (+0.4%) to 38.87% when pulling **0925769a52d9e378a5dbf9d621e23025b610fbde on lizhanhui:ROCKETMQ-28** into **c4a3e0c1325e67aec76aa94e9ade3a6ea1b682d2 on apache:develop**.
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
[](https://coveralls.io/builds/11866450)
Coverage decreased (-0.2%) to 38.44% when pulling **169c5ae78db18f6dd6a48be576615ce3e9974bcc on lizhanhui:ROCKETMQ-28** into **0fe947173a85d8931b1068805713e89dbba4125a on apache:develop**.
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by Jaskey <gi...@git.apache.org>.
Github user Jaskey commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
Hi , guys you miss the jira link
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
[](https://coveralls.io/builds/11927686)
Coverage decreased (-0.1%) to 38.347% when pulling **81d1616686495ee9fac71b4b133e69b4c60a9dc2 on lizhanhui:ROCKETMQ-28** into **c4a3e0c1325e67aec76aa94e9ade3a6ea1b682d2 on apache:develop**.
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by Jaskey <gi...@git.apache.org>.
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
---
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.
---
[GitHub] incubator-rocketmq issue #111: [ROCKETMQ-28] Add TLS support to provide end-...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/incubator-rocketmq/pull/111
[](https://coveralls.io/builds/11866450)
Coverage decreased (-0.2%) to 38.44% when pulling **169c5ae78db18f6dd6a48be576615ce3e9974bcc on lizhanhui:ROCKETMQ-28** into **0fe947173a85d8931b1068805713e89dbba4125a on apache:develop**.
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by lizhanhui <gi...@git.apache.org>.
Github user lizhanhui commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r121035306
--- Diff: remoting/src/main/java/org/apache/rocketmq/remoting/netty/FileRegionEncoder.java ---
@@ -0,0 +1,66 @@
+/*
+ * 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.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.FileRegion;
+import io.netty.handler.codec.MessageToByteEncoder;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.WritableByteChannel;
+
+public class FileRegionEncoder extends MessageToByteEncoder<FileRegion> {
--- End diff --
I'll add some javadoc to this class.
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by lizhanhui <gi...@git.apache.org>.
Github user lizhanhui commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r120585593
--- Diff: remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java ---
@@ -128,6 +131,19 @@ public Thread newThread(Runnable r) {
}
});
}
+
--- End diff --
I am implementing a mechanism similar to [StartTLS](https://en.wikipedia.org/wiki/Opportunistic_TLS), this PR for now is in-progress.
---
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.
---
[GitHub] incubator-rocketmq pull request #111: [ROCKETMQ-28] Add TLS support to provi...
Posted by zhouxinyu <gi...@git.apache.org>.
Github user zhouxinyu commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/111#discussion_r121307383
--- Diff: remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java ---
@@ -169,6 +188,7 @@ public void initChannel(SocketChannel ch) throws Exception {
new NettyDecoder(),
new IdleStateHandler(0, 0, nettyServerConfig.getServerChannelMaxIdleTimeSeconds()),
new NettyConnectManageHandler(),
+ new StartTlsHandler(),
--- End diff --
This `StartTls` mechanism is great, and there is another mechanism for your reference:
For SSL 3.0 or TLS 1.0, 1.1 and 1.2:
+-------+------------------+------------------+--------+------
| 0x16 | 2 bytes version | 2 bytes length | 0x01 | etc.
+-------+------------------+------------------+--------+------
The first byte always is 0x16(SSL handshake), can be used to decide use SSL or not.
---
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.
---