Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for grpc.ssl_target_name_override #1362

Closed
jayd16 opened this issue Aug 6, 2021 · 4 comments
Closed

Add support for grpc.ssl_target_name_override #1362

jayd16 opened this issue Aug 6, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@jayd16
Copy link

jayd16 commented Aug 6, 2021

I would like to see support for for the grpc.ssl_target_name_override ChannelOption from the legacy Grpc.Core implementation supported in grpc-dotnet. This is a very nice testing feature.

I can't find the equivalent configuration in grpc-dotnet. I've also tried setting the request host header from HttpClientHandler by overriding SendAsync and that doesn't seem to work.

I cannot simply ignore the server certificate from the client either. The ServerCertificateCustomValidationCallback is never even hit because the Grpc server will only return a cert for the requested host and otherwise kill the socket. An example of the server error when requesting the wrong host:
E0805 18:58:05.678826 123145379745792 /tmpfs/src/github/grpc/workspace_csharp_ext_macos_x64/src/core/tsi/ssl_transport_security.cc:1837: No match found for server name: localhost.

Can this be added or is there some other way to achieve this? Thanks!

@jayd16 jayd16 added the enhancement New feature or request label Aug 6, 2021
@JamesNK
Copy link
Member

JamesNK commented Aug 6, 2021

I think this would need to be supported in SocketsHttpHandler first. Grpc.Net.Client uses it for its networking layer.

@jayd16
Copy link
Author

jayd16 commented Aug 6, 2021

If that's the case, there might already be a way? SocketsHttpHandler.SslOptions.TargetHost.

Is there a way to get at this configuration already?

@JamesNK
Copy link
Member

JamesNK commented Aug 6, 2021

Create SocketsHttpHandler, configure it how you want, then pass it to gRPC channel using GrpcChannelOptions.HttpHandler property.

@jayd16
Copy link
Author

jayd16 commented Aug 6, 2021

Hmm I'm using Unity's new .net standard 2.1 support which uses the older HttpClientHandler.

There also seem to be Unity related issues. I confirmed that customizing the HttpClientHandler.ServerCertificateCustomValidationCallback works fine in a normal .net5.0 app.

I'll close this ticket and move the discussion to #1309.

@jayd16 jayd16 closed this as completed Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants