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

localsecret: Provide SSL on Port 9091 (gRPC-web) and make it same secure as test / mainnet #1293

Open
0xxCodemonkey opened this issue Dec 22, 2022 · 3 comments

Comments

@0xxCodemonkey
Copy link

0xxCodemonkey commented Dec 22, 2022

Currently, the configuration of localsecret (Docker) differs from testnet and mainnet and uses HTTP instead of HTTPS on port 9091 (gRPC-web).

This currently leads to problems with some languages that require a certain connection security. In my case I'm talking about Secret.NET, a port of secretjs which uses C# / .NET.

In the case of .NET there are restrictions if you want to establish an unprotected connection via gRPC (see: gRPC services with ASP.NET Core and Troubleshoot gRPC on .NET Core).

There is the possibility to connect .NET to an unencrypted endpoint, but in this case the endpoint has to run only HTTP2 (and no HTTP) over this port because of protocol negotiation. If I see this correctly, localsecret also speaks HTTP on this port and it is therefore not possible for .NET to communicate over this multi-protocol port with localsecret over an unsecure connection

Extract from gRPC services with ASP.NET Core:

Protocol negotiation TLS is used for more than securing communication. The TLS Application-Layer Protocol Negotiation (ALPN) handshake is used to negotiate the connection protocol between the client and the server when an endpoint supports multiple protocols. This negotiation determines whether the connection uses HTTP/1.1 or HTTP/2.
If an HTTP/2 endpoint is configured without TLS, the endpoint's ListenOptions.Protocols must be set to HttpProtocols.Http2. An endpoint with multiple protocols, such as HttpProtocols.Http1AndHttp2 for example, can't be used without TLS because there's no negotiation. All connections to the unsecured endpoint default to HTTP/1.1, and gRPC calls fail.

My suggestion is to either

  • change port 9091 to HTTPS with a self-signed certificate (see Certificates for localhost)

  • or to offer a separate port e.g. 9443 with HTTPS (localsecret only) for gRPC-web

@0xxCodemonkey
Copy link
Author

Since gRPC-Web seems to have a firm place in the future, and will not be replaced by gRPC-Gateway, (see link below) my open issue for localsecret has gained more importance again, as it is currently not possible via Secret.NET / C# to establish a secure connection via gRPC-Web with localsecret.

https://github.com/cosmos/cosmos-sdk/pull/14652/files

Client Breaking Changes

  • (grpc-web) #14652 Use same port for gRPC-Web and the API server.

gRPC-Web

gRPC-Web is now listening to the same address as the gRPC Gateway API server (default: localhost:1317).
The possibility to listen to a different address has been removed, as well as its settings.

@toml01
Copy link
Member

toml01 commented Jan 30, 2023

Hey @0xxCodemonkey , thanks for opening this! Don't see why not provide SSL in Localsecret.
Just letting you know that we've opened an internal ticket for this 👍🏼

@toml01
Copy link
Member

toml01 commented Mar 15, 2023

Hey again @0xxCodemonkey :)
We've been very busy as of late and I'm not sure we are going to get to fix it in the immediate future.

If possible, a PR would be very appreciated!
If not, just letting you know it will take some more time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants