我正在尝试将GRPC-C ++客户端连接到GRPC-C ++服务器。我已经有一个与工作TLS连接的GRPC-JAVA客户端,以便服务器应正常运行。
但是,在GRPC-JAVA内部构建一个名为“过度利用性”的通道时,有一种方法。从文档中
“覆盖与TLS和HTTP虚拟托管使用的权威。它不会更改主机实际连接的内容。通常在“主机:port”中。”
。”
我试图为C ++客户端找到类似的东西。但是,到目前为止,我发现的是GRPC :: clientContext上名为set_authority()的函数,以及与GRPC_CHANNEL_ARGS一起使用的两个选项,即GRPC_ARG_DEFAULT_AUTHORITY和GRPC_SSL_SSL_TAR_TARGET_TARGET_NAME_NAME_OVERRIDE_ARG。
这些似乎根本没有任何影响。服务器将始终拒绝与错误的连接
没有找到服务器名称的匹配:0.0.0.0。
PS我知道我可以将其添加到证书上的通用名称(如果需要的话,我会)。但是,如果可能的话,我想遵循与GRPC-JAVA客户端相同的模式。
I am trying to connect a grpc-c++ client to a grpc-c++ server. I already have a grpc-java client connected with working TLS so the server should be functioning correctly.
However inside grpc-java there is a method when building a channel named 'overrideAuthority'. From the documentation the method
"Overrides the authority used with TLS and HTTP virtual hosting. It does not change what host is actually connected to. Is commonly in the form host:port."
I was attempting to find something similar for the c++ client. However, so far all I have found is a function named set_authority() on the grpc::ClientContext as well as two options used with grpc_channel_args which are GRPC_ARG_DEFAULT_AUTHORITY and GRPC_SSL_TARGET_NAME_OVERRIDE_ARG.
None of these seem to have any effect on the authority at all. The server will always reject the connection with the error
No match found for server name: 0.0.0.0.
P.S. I am aware that I can add it to the common name on the certificate (and I will if I need to). However, if possible I would like to follow the same pattern as the grpc-java client.
发布评论
评论(1)
grpc_ssl_target_name_override_arg
是正确的频道arg。请看一些测试 https://github.com/grpc/grpc/blob/470A3066C74ABC7C2A0A2CAB3B3B3B35000B27B51AF1/test/core/core/end2end/end2end/end2end/end2end/h2_ssl.cc#l133另外,如果我还记得,如果我正确地记得,这是不正确的,这是不正确的,这是不正确的。请收集更多的详细日志 https://github.com/github.com/grpc/grpc/grpc/ blob/master/故障排除。md。这可能给出更多有关这里发生的事情的提示。
GRPC_SSL_TARGET_NAME_OVERRIDE_ARG
is the right channel arg. Please take a look at some of the tests https://github.com/grpc/grpc/blob/470a3066c74abc7c2a0a2cab3b35000b27b51af1/test/core/end2end/fixtures/h2_ssl.cc#L133https://github.com/grpc/grpc/blob/470a3066c74abc7c2a0a2cab3b35000b27b51af1/test/cpp/end2end/xds/xds_end2end_test.cc#L1348
Additionally, if I remember correctly, this log just serves as a warning and does not result in disconnections. Please collect some more verbose logs https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. That might give more hints as to what's going on here.