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

How to run revad with TLS enabled #1962

Open
michielbdejong opened this issue Aug 6, 2021 · 13 comments
Open

How to run revad with TLS enabled #1962

michielbdejong opened this issue Aug 6, 2021 · 13 comments

Comments

@michielbdejong
Copy link
Contributor

Can I run revad with a TLS certificate for grpc and https? If so, how?
I searched for this in the docs and in the code but couldn't find how to do it.

michielbdejong pushed a commit to michielbdejong/ocm-stub that referenced this issue Aug 6, 2021
@michielbdejong
Copy link
Contributor Author

While it seems to be impossible to run revad with https directly, it does refer to itself with https for instance here:
https://github.com/cs3org/reva/blob/v1.11.0/internal/http/services/ocmd/config.go#L64

So should revad always be run behind a TLS-offloading proxy, then? Or am I missing something?

michielbdejong added a commit to michielbdejong/reva that referenced this issue Aug 9, 2021
@michielbdejong
Copy link
Contributor Author

@michielbdejong
Copy link
Contributor Author

michielbdejong commented Oct 19, 2021

I think it's probably easier to include https support in reva than to tell people (including myself with the ocm-test-suite) to run a separate proxy. I'll see if I can make it work.
These two lines are key:

@michielbdejong
Copy link
Contributor Author

In starting the grpc server and starting the http server we would then probably just use s.ServeTLS instead of
s.Serve.

@michielbdejong
Copy link
Contributor Author

Making good progress with this in the pass-ocm-test-suite branch and the 'revad' docker image in the dev branch of ocm-test-suite. Now seeing:

authentication handshake failed: x509: certificate relies on legacy Common Name field, use SANs instead

michielbdejong pushed a commit to cs3org/ocm-test-suite that referenced this issue Oct 20, 2021
@michielbdejong
Copy link
Contributor Author

Next error:

C2021-10-20 13:08:04.967 DBG ../../reva/internal/grpc/interceptors/auth/auth.go:92 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/ListAuthProviders pid=8 pkg=rgrpc
2021-10-20 13:08:04.973 ERR ../../reva/internal/grpc/services/gateway/authregistry.go:45 > gateway error="gateway: error calling ListAuthProviders: rpc error: code = Unavailable desc = connection closed" pid=8 pkg=rgrpc
2021-10-20 13:08:04.974 DBG ../../reva/internal/grpc/interceptors/log/log.go:69 > unary code=OK end="20/Oct/2021:13:08:04 +0000" from=tcp://127.0.0.1:33026 pid=8 pkg=rgrpc start="20/Oct/2021:13:08:04 +0000" time_ns=6453354 uri=/cs3.gateway.v1beta1.GatewayAPI/ListAuthProviders user-agent=grpc-go/1.26.0
2021-10-20 13:08:08.483 DBG ../../reva/internal/grpc/interceptors/auth/auth.go:92 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/Authenticate pid=8 pkg=rgrpc
2021-10-20 13:08:08.483 ERR ../../reva/internal/grpc/services/gateway/authprovider.go:55 > error getting auth provider client error="error: not found: gateway: error finding auth provider for type: basic" pid=8 pkg=rgrpc
2021-10-20 13:08:08.484 DBG ../../reva/internal/grpc/interceptors/log/log.go:69 > unary code=OK end="20/Oct/2021:13:08:08 +0000" from=tcp://127.0.0.1:33034 pid=8 pkg=rgrpc start="20/Oct/2021:13:08:08 +0000" time_ns=613229 uri=/cs3.gateway.v1beta1.GatewayAPI/Authenticate user-agent=grpc-go/1.26.0

@michielbdejong
Copy link
Contributor Author

Also seeing

{"level":"error","pid":8,"error":"rpc error: code = Unavailable desc = connection closed","time":"2021-10-20T13:07:37.963792946Z","caller":"/reva/internal/grpc/services/appprovider/appprovider.go:123","message":"error registering app provider: error calling add app provider"}

before that

@michielbdejong
Copy link
Contributor Author

Ah, this is because of https://github.com/cs3org/reva/blob/v1.14.0/pkg/rgrpc/todo/pool/pool.go#L90
Will fix tomorrow.

@michielbdejong
Copy link
Contributor Author

It's leading to quite a big diff because all grpc clients need to know the filename of the grpc server's public certificate, but I seem to have a working version now.

@michielbdejong
Copy link
Contributor Author

aah wait, I could just have done

	tlsconf := &tls.Config{InsecureSkipVerify: skipverify}
	creds := credentials.NewTLS(tlsconf)
	return grpc.Dial(conf.Host, grpc.WithTransportCredentials(creds))

like reva-cli does... hm that is probably preferable over such a big refactor

@michielbdejong
Copy link
Contributor Author

Ah but that wouldn't have avoided the refactor, you would still need to know whether to connect securely or insecurely, so you would still need to pass at least a boolean around.

@michielbdejong
Copy link
Contributor Author

There is some problem where revad closes its connection to itself, not sure why. For the ocm-test-suite t's important to have tls on http but maybe not so important to have it on grpc. I therefore parked the grpc-with-tls work in a https://github.com/michielbdejong/reva/tree/grpc-with-tls.

In the context of the ocm-test-suite, I'll continue in the https://github.com/michielbdejong/reva/tree/pass-ocm-test-suite with tls for http but not for grpc.

@wkloucek
Copy link
Contributor

wkloucek commented Nov 7, 2022

Settings for GRPC have been added in Reva edge in this PR: #3332

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