-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
how to do tls auth in grpc+grpc-gateway #727
Comments
Without tls all works fine with cmux, i can connect without certs to grpc server and do some rest requests, but with tls enabled i'm always have timeouts |
i think that me question is: |
mTLS between the grpc-gateway client and the gRPC server should absolutely be possible. You have to turn off client authentication for your gateway though, unless you expect those clients to also present a certificate. https://github.com/gogo/grpc-example/blob/master/main.go shows an example of how to do server auth, and adding client auth on top shouldn't be much work. |
I found the root of my issue - cmux. |
So my new question - does have somebody already knows how to do encrypted grpc+rest with cmux. |
i'm solve. With plain mode i'm use cmux to get rest and grpc on the same port. |
Could you post the code you ended up using in here? It might be useful to others in the future |
|
main part is above. may be i create some repo to put all stuff to it and provide link. |
no, i don't create repo |
@vtolstov Thanks! |
I've written about gRPC client authentication which might be useful: https://jbrandhorst.com/post/grpc-auth/ |
@vtolstov Can you please also post the function |
@vtolstov thanks!! your example helped me to solve an issue!! |
Hello, I tried to do same as @vtolstov, creating a tls listener but then I always get cmux match error. The only solution I found to make my backend work with grpc and oauth token was to disable the http server which is kinda sad. Here is the code if some are interested or eventually if someone can help me solve this issue: server.go
|
I think it should be possible to do gateway and grpc on the same port with cmux, note that you need to take soheilhy/cmux#64 into account. My comment on there might be useful? |
I'm already have grpc server with my own letsencrypt cert behind Nginx:
nginx listens ssl, and proxy_pass to https grpc-gateway
grpc server listens on int_ip:7777, nginx listens on ext_ip: 443, hostname - external domain name on nginx, endpoint intenal listen addr - int_ip:7777
grpc code stuff:
gw stuff:
main stuff:
when i'm try to start my app i have context deadline exceeded because grpc-gateway can't connect to grpc server
The text was updated successfully, but these errors were encountered: