You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "leizhiyuan (via GitHub)" <gi...@apache.org> on 2024/02/27 05:24:52 UTC

[PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

leizhiyuan opened a new pull request, #7862:
URL: https://github.com/apache/rocketmq/pull/7862

   <!-- Please make sure the target branch is right. In most case, the target branch should be `develop`. -->
   
   ### Which Issue(s) This PR Fixes
   
   <!-- Please ensure that the related issue has already been created, and [link this pull request to that issue using keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>) to ensure automatic closure. -->
   
   Fixes #7861
   
   ### Brief Description
   
   <!-- Write a brief description for your pull request to help the maintainer understand the reasons behind your changes. -->
   
   ### How Did You Test This Change?
   
   <!-- In order to ensure the code quality of Apache RocketMQ, we expect every pull request to have undergone thorough testing. -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on code in PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#discussion_r1510414041


##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -134,14 +136,14 @@ public ProxyAndTlsProtocolHandler(GrpcHttp2ConnectionHandler grpcHandler) {
         protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
             try {
                 ProtocolDetectionResult<HAProxyProtocolVersion> ha = HAProxyMessageDecoder.detectProtocol(
-                        in);
+                    in);
                 if (ha.state() == ProtocolDetectionState.NEEDS_MORE_DATA) {
                     return;
                 }
                 if (ha.state() == ProtocolDetectionState.DETECTED) {
                     ctx.pipeline().addAfter(ctx.name(), HA_PROXY_DECODER, new HAProxyMessageDecoder())
-                            .addAfter(HA_PROXY_DECODER, HA_PROXY_HANDLER, new HAProxyMessageHandler())

Review Comment:
   这是特地的,如果这里不格式化,过不了代码检查。使用的是rocketmq的格式化风格。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#issuecomment-1973032651

   > > 不是的吧,现在要么test tls,要么开启读取tls文件 cserwen _**@**_._**> 于 2024年3月1日周五 下午6:52写道:
   > > […](#)
   > > _**@**_.**_* commented on this pull request. ------------------------------ In proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java <[#7862 (comment)](https://github.com/apache/rocketmq/pull/7862#discussion_r1508823675)>: > @@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder { private final ChannelHandler plaintext; public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) { - this.ssl = InternalProtocolNegotiators.serverTls(sslContext) + if (sslContext == null) { + this.ssl = null; 现在的逻辑应该就是通过 tlsMode 控制的吧,disable 状态 会使用 serverPlaintext() 这个 sslContext,好像不需要这个优化 — Reply to this email directly, view it on GitHub <[#7862 (comment)](https://github.com/apache/rocketmq/pull/7862#discussion_r1508823675)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUPLYDESAEFUEDI6P7IRMDYWBMWHAVCNFSM6AAAAABD3OBX2KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVS
 XG5CSMV3GSZLXHMYTSMJQHA3DAMZRHE . You are receiving this because you were mentioned.Message ID: _**@**_.***>
   > 
   > 你看一下这里的逻辑,
   > 
   > https://github.com/apache/rocketmq/blob/cb9ea9efb379c7658f83078e6f7f6be580455ce8/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java#L230
   > 
   > disable 会使用 plaintext,这个应该就是没有开启 ssl? 如果开启了 ssl,是根据 sslContext 来生成的,sslContext 的构建里又细分为 test 和 配置 两种
   > 
   > https://github.com/apache/rocketmq/blob/cb9ea9efb379c7658f83078e6f7f6be580455ce8/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java#L93
   > 
   > 我没有测试过 grpc,remoting 可以这么设置,而且看代码理论上是可以通过设置为 disable 来关闭 ssl 的 @leizhiyuan
   
   启动的时候就报错了。
   
   <img width="831" alt="image" src="https://github.com/apache/rocketmq/assets/2684384/dfec20ae-8894-46a7-b261-b78e67b21a9a">
   
   
   因为tls 不需要开的时候,是不会设置tlsCertPath 和 tlsKeyPath了。decode的时候, 已经运行起来了。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#issuecomment-1972969593

   不是的吧,现在要么test tls,要么开启读取tls文件
   
   cserwen ***@***.***> 于 2024年3月1日周五 下午6:52写道:
   
   > ***@***.**** commented on this pull request.
   > ------------------------------
   >
   > In
   > proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java
   > <https://github.com/apache/rocketmq/pull/7862#discussion_r1508823675>:
   >
   > > @@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder {
   >          private final ChannelHandler plaintext;
   >
   >          public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) {
   > -            this.ssl = InternalProtocolNegotiators.serverTls(sslContext)
   > +            if (sslContext == null) {
   > +                this.ssl = null;
   >
   > 现在的逻辑应该就是通过 tlsMode 控制的吧,disable 状态 会使用 serverPlaintext() 这个
   > sslContext,好像不需要这个优化
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/rocketmq/pull/7862#discussion_r1508823675>, or
   > unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AAUPLYDESAEFUEDI6P7IRMDYWBMWHAVCNFSM6AAAAABD3OBX2KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSMJQHA3DAMZRHE>
   > .
   > You are receiving this because you were mentioned.Message ID:
   > ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#issuecomment-1973036309

   
   <img width="390" alt="image" src="https://github.com/apache/rocketmq/assets/2684384/4f7d69cb-f269-4898-becf-30f535c449c1">
   
   <img width="873" alt="image" src="https://github.com/apache/rocketmq/assets/2684384/ebd021b5-4812-4a02-970f-fe84b1f16926">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "cserwen (via GitHub)" <gi...@apache.org>.
cserwen commented on code in PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#discussion_r1508425223


##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder {
         private final ChannelHandler plaintext;
 
         public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) {
-            this.ssl = InternalProtocolNegotiators.serverTls(sslContext)
+            if (sslContext == null) {
+                this.ssl = null;

Review Comment:
   我看了一下,tls.enable 这个参数在服务端是不生效的,不论是 Remoting 还是 grpc server,服务端应该只需要通过  tls.server.mode 来控制就行。所以这个修改是不是改变了原本的配置方式 @leizhiyuan 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on code in PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#discussion_r1510416474


##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -134,14 +136,14 @@ public ProxyAndTlsProtocolHandler(GrpcHttp2ConnectionHandler grpcHandler) {
         protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
             try {
                 ProtocolDetectionResult<HAProxyProtocolVersion> ha = HAProxyMessageDecoder.detectProtocol(
-                        in);
+                    in);
                 if (ha.state() == ProtocolDetectionState.NEEDS_MORE_DATA) {
                     return;
                 }
                 if (ha.state() == ProtocolDetectionState.DETECTED) {
                     ctx.pipeline().addAfter(ctx.name(), HA_PROXY_DECODER, new HAProxyMessageDecoder())
-                            .addAfter(HA_PROXY_DECODER, HA_PROXY_HANDLER, new HAProxyMessageHandler())

Review Comment:
   revert了一些



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on code in PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#discussion_r1508403360


##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder {
         private final ChannelHandler plaintext;
 
         public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) {
-            this.ssl = InternalProtocolNegotiators.serverTls(sslContext)
+            if (sslContext == null) {
+                this.ssl = null;

Review Comment:
   close with **-Dtls.enable=false**
   <img width="1008" alt="image" src="https://github.com/apache/rocketmq/assets/2684384/0d881473-a02e-4e8d-adee-f0124e7f1663">
   
    demo test ok with client enableSsl=false
   <img width="992" alt="image" src="https://github.com/apache/rocketmq/assets/2684384/052722f6-886e-46e1-b995-85d2b74b8fcc">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "cserwen (via GitHub)" <gi...@apache.org>.
cserwen commented on PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#issuecomment-1973085520

   哦,那这一点确实是,默认都会把 sslcontext 初始化好,关闭状态下不需要初始化在 2024年3月1日,19:38,Lei Zhiyuan ***@***.***> 写道:
   
   
   不是的吧,现在要么test tls,要么开启读取tls文件 cserwen @.> 于 2024年3月1日周五 下午6:52写道:
   …
   _@**._* commented on this pull request. ------------------------------ In proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java <#7862 (comment)>: > @@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder { private final ChannelHandler plaintext; public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) { - this.ssl = InternalProtocolNegotiators.serverTls(sslContext) + if (sslContext == null) { + this.ssl = null; 现在的逻辑应该就是通过 tlsMode 控制的吧,disable 状态 会使用 serverPlaintext() 这个 sslContext,好像不需要这个优化 — Reply to this email directly, view it on GitHub <#7862 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUPLYDESAEFUEDI6P7IRMDYWBMWHAVCNFSM6AAAAABD3OBX2KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSMJQHA3DAMZRHE . You are receiving this because you were mentioned.Message ID: _@_.*>
   
   你看一下这里的逻辑,
   https://github.com/apache/rocketmq/blob/cb9ea9efb379c7658f83078e6f7f6be580455ce8/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java#L230
   disable 会使用 plaintext,这个应该就是没有开启 ssl? 如果开启了 ssl,是根据 sslContext 来生成的,sslContext 的构建里又细分为 test 和 配置 两种
   https://github.com/apache/rocketmq/blob/cb9ea9efb379c7658f83078e6f7f6be580455ce8/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java#L93
   我没有测试过 grpc,remoting 可以这么设置,而且看代码理论上是可以通过设置为 disable 来关闭 ssl 的 @leizhiyuan
   
   启动的时候就报错了。
   image.png (view on web)
   因为tls 不需要开的时候,是不会设置tlsCertPath 和 tlsKeyPath了。decode的时候, 已经运行起来了。
   
   —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "joeCarf (via GitHub)" <gi...@apache.org>.
joeCarf commented on code in PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#discussion_r1510280013


##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -134,14 +136,14 @@ public ProxyAndTlsProtocolHandler(GrpcHttp2ConnectionHandler grpcHandler) {
         protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
             try {
                 ProtocolDetectionResult<HAProxyProtocolVersion> ha = HAProxyMessageDecoder.detectProtocol(
-                        in);
+                    in);
                 if (ha.state() == ProtocolDetectionState.NEEDS_MORE_DATA) {
                     return;
                 }
                 if (ha.state() == ProtocolDetectionState.DETECTED) {
                     ctx.pipeline().addAfter(ctx.name(), HA_PROXY_DECODER, new HAProxyMessageDecoder())
-                            .addAfter(HA_PROXY_DECODER, HA_PROXY_HANDLER, new HAProxyMessageHandler())

Review Comment:
   格式化改动有点多



##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -134,14 +136,14 @@ public ProxyAndTlsProtocolHandler(GrpcHttp2ConnectionHandler grpcHandler) {
         protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
             try {
                 ProtocolDetectionResult<HAProxyProtocolVersion> ha = HAProxyMessageDecoder.detectProtocol(
-                        in);
+                    in);
                 if (ha.state() == ProtocolDetectionState.NEEDS_MORE_DATA) {
                     return;
                 }
                 if (ha.state() == ProtocolDetectionState.DETECTED) {
                     ctx.pipeline().addAfter(ctx.name(), HA_PROXY_DECODER, new HAProxyMessageDecoder())
-                            .addAfter(HA_PROXY_DECODER, HA_PROXY_HANDLER, new HAProxyMessageHandler())

Review Comment:
   这部分是不是误格式化了 有点干扰review



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on code in PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#discussion_r1508520419


##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder {
         private final ChannelHandler plaintext;
 
         public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) {
-            this.ssl = InternalProtocolNegotiators.serverTls(sslContext)
+            if (sslContext == null) {
+                this.ssl = null;

Review Comment:
   嗯,你是对的,这里我重新改了一下。通过tlsMode来控制。
   
   > 我看了一下,tls.enable 这个参数在服务端是不生效的,不论是 Remoting 还是 grpc server,服务端应该只需要通过 tls.server.mode 来控制就行。所以这个修改是不是改变了原本的配置方式 @leizhiyuan
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#issuecomment-1965897561

   ## [Codecov](https://app.codecov.io/gh/apache/rocketmq/pull/7862?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `9.52381%` with `19 lines` in your changes are missing coverage. Please review.
   > Project coverage is 42.93%. Comparing base [(`0b05e9c`)](https://app.codecov.io/gh/apache/rocketmq/commit/0b05e9c7c13d1016057bd17dd12f4cc0238feb39?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`5f157eb`)](https://app.codecov.io/gh/apache/rocketmq/pull/7862?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   | [Files](https://app.codecov.io/gh/apache/rocketmq/pull/7862?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...etmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java](https://app.codecov.io/gh/apache/rocketmq/pull/7862?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHJveHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3Byb3h5L2dycGMvUHJveHlBbmRUbHNQcm90b2NvbE5lZ290aWF0b3IuamF2YQ==) | 9.52% | [17 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/rocketmq/pull/7862?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #7862      +/-   ##
   =============================================
   - Coverage      42.94%   42.93%   -0.01%     
   + Complexity      9913     9911       -2     
   =============================================
     Files           1190     1190              
     Lines          86014    86020       +6     
     Branches       11079    11082       +3     
   =============================================
   - Hits           36942    36936       -6     
   - Misses         44495    44508      +13     
   + Partials        4577     4576       -1     
   ```
   
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/rocketmq/pull/7862?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "cserwen (via GitHub)" <gi...@apache.org>.
cserwen commented on code in PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#discussion_r1507466329


##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder {
         private final ChannelHandler plaintext;
 
         public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) {
-            this.ssl = InternalProtocolNegotiators.serverTls(sslContext)
+            if (sslContext == null) {
+                this.ssl = null;

Review Comment:
   If ssl is null, will it cause other npe problems?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "cserwen (via GitHub)" <gi...@apache.org>.
cserwen commented on code in PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#discussion_r1508823675


##########
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:
##########
@@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder {
         private final ChannelHandler plaintext;
 
         public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) {
-            this.ssl = InternalProtocolNegotiators.serverTls(sslContext)
+            if (sslContext == null) {
+                this.ssl = null;

Review Comment:
   现在的逻辑应该就是通过 tlsMode 控制的吧,disable 状态 会使用 serverPlaintext() 这个 sslContext,好像不需要这个优化



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "cserwen (via GitHub)" <gi...@apache.org>.
cserwen commented on PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#issuecomment-1972982926

   > 不是的吧,现在要么test tls,要么开启读取tls文件 cserwen ***@***.***> 于 2024年3月1日周五 下午6:52写道:
   > […](#)
   > ***@***.**** commented on this pull request. ------------------------------ In proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java <[#7862 (comment)](https://github.com/apache/rocketmq/pull/7862#discussion_r1508823675)>: > @@ -220,10 +227,14 @@ private class TlsModeHandler extends ByteToMessageDecoder { private final ChannelHandler plaintext; public TlsModeHandler(GrpcHttp2ConnectionHandler grpcHandler) { - this.ssl = InternalProtocolNegotiators.serverTls(sslContext) + if (sslContext == null) { + this.ssl = null; 现在的逻辑应该就是通过 tlsMode 控制的吧,disable 状态 会使用 serverPlaintext() 这个 sslContext,好像不需要这个优化 — Reply to this email directly, view it on GitHub <[#7862 (comment)](https://github.com/apache/rocketmq/pull/7862#discussion_r1508823675)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAUPLYDESAEFUEDI6P7IRMDYWBMWHAVCNFSM6AAAAABD3OBX2KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSX
 G5CSMV3GSZLXHMYTSMJQHA3DAMZRHE> . You are receiving this because you were mentioned.Message ID: ***@***.***>
   
   你看一下这里的逻辑,https://github.com/apache/rocketmq/blob/cb9ea9efb379c7658f83078e6f7f6be580455ce8/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java#L230
   
   disable 会使用 plaintext,这个应该就是没有开启 ssl? 如果开启了 ssl,是根据 sslContext 来传输的,sslContext 的构建里又细分为 test 和 配置 两种
   https://github.com/apache/rocketmq/blob/cb9ea9efb379c7658f83078e6f7f6be580455ce8/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java#L93
   
   我没有测试过 grpc,remoting 可以这么设置,而且看代码理论上是可以通过设置为 disable 来关闭 ssl 的 @leizhiyuan 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [ISSUE #7861] Allow user can change the tls mode to avoid init ssl context [rocketmq]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on PR #7862:
URL: https://github.com/apache/rocketmq/pull/7862#issuecomment-5707147436

   ⚠️ **Merge conflict detected**
   
   This PR has conflicts with the `develop` branch and cannot be merged. Please rebase or merge `develop` into your branch and resolve the conflicts:
   
   ```bash
   git fetch origin
   git checkout feat/allow_close_tls
   git rebase origin/develop
   # resolve conflicts, then:
   git push --force-with-lease
   ```
   
   This is a one-time reminder. Feel free to @mention me for a re-review after conflicts are resolved.
   
   ---
   *Automated notification by "github-manager-bot"*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org