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

Disable the old versions of TLS on buchgr / bazel-remote #708

Closed
tushar150 opened this issue Oct 13, 2023 · 13 comments
Closed

Disable the old versions of TLS on buchgr / bazel-remote #708

tushar150 opened this issue Oct 13, 2023 · 13 comments

Comments

@tushar150
Copy link

We are using buchgr/bazel-remote container on our Linux environment. Recently Tlsv1 and Tlsv1.1 is detected on the container and we are not sure how to get rid of these vulnerabilities on this container. Any suggestion/recommendation would be helpful.

@tushar150 tushar150 changed the title TLS1.0 vulnerability detected on buchgr / bazel-remote. Is there a way to get rid of this. TLS1.0 vulnerability detected on buchgr / bazel-remote. We would like to disable the old versions of TLS Oct 13, 2023
@tushar150 tushar150 changed the title TLS1.0 vulnerability detected on buchgr / bazel-remote. We would like to disable the old versions of TLS Disable the old versions of TLS on buchgr / bazel-remote Oct 13, 2023
mostynb added a commit to mostynb/bazel-remote that referenced this issue Oct 13, 2023
At the time of writing, current go versions default to TLS 1.0 as the minimum
version when acting as a server (and 1.2 when acting as a client). This change
raises the minium version to 1.2 when acting as a server too.

If this causes trouble, we can consider adding a config flag to specify the
minimum TLS version.

Fixes buchgr#708.
@mostynb
Copy link
Collaborator

mostynb commented Oct 13, 2023

Hi, I wonder if you could test a build of #709 to see if it disables TLS 1.0 and 1.1?

@tushar150
Copy link
Author

Thanks for quick updates, We have updated the image with new build and awaiting for new scan results. I will keep you posted.

@tushar150
Copy link
Author

Still old TLS version is detected. May you suggest

@tushar150
Copy link
Author

I am not able to build image . Is it possible for you to build image and share the link.

@mostynb
Copy link
Collaborator

mostynb commented Oct 26, 2023

I tried to push a test image for you here, could you try that? index.docker.io/mostynb/bazel-remote-cache@sha256:b9ee62c7826afe550b3dd86b96c234a6359a8932443dfc6afb11f0a471b0773d

@tushar150
Copy link
Author

tushar150 commented Oct 26, 2023

Thanks for quick updates on this.

old tls version 1 and tls1.1 are gone.

There are some weak ciphers exists (Birthday attacks against TLS ciphers with 64bit block size vulnerability (Sweet32)), is it possible to block these as well.
ECDHE-RSA-DES-CBC3-SHA
DES-CBC3-SHA

@mostynb
Copy link
Collaborator

mostynb commented Oct 26, 2023

I looked into this a bit. While it is possible to specify a custom set of ciphers by setting CipherSuites in the tls.Config, there isn't a good way to get the current version of go's default ciphers. If we were to hardcode a list, then we would need to manually check that it was up to date. So I'm not sure this would be a wise decision long term.

There is a bit of a hack that has been suggested: write a function that uses net.Pipe to do a TLS handshake with itself, and set the GetCertificate field of the tls.Config to a function that reports the supported cipher suites, and use those values in the tls.Config that we start the http/grpc servers with. But I would need to think this through a bit before deciding if it's worthwhile.

Do you know of any clients that are actually using these old cipher suites to communicate with bazel-remote? If not, then maybe it's OK to live with these old cipher suites being supported but not used?

@tushar150
Copy link
Author

tushar150 commented Oct 27, 2023 via email

@mostynb
Copy link
Collaborator

mostynb commented Oct 30, 2023

Would it be possible to expose ciphers as configuration? May you suggest more information on using tls.Config and how to use it?

The idea is that on startup you can run a TLS server on a net.Pipe connection, connect to it and read the server's supported cipher suites from the client side. Then you can stop the server and use the cipher suite values (maybe removing some of them) that were discovered when creating the tls.Config for the real server.

But the more I think about it, the less I like this idea. If the go security team doesn't make this easy to do, the less important it must be. And I want to avoid custom solutions when it comes to security.

We don't know any clients that are actually using these old cipher suites to communicate with bazel-remote but security team see this as an issue so we need to block it in one way or other at our end.

If you really want to block the use of these (unused?) cipher suites, I think there's a way to do it without modifications to bazel-remote: you can run bazel-remote without network access by using unix domain sockets, and place a TLS termination proxy in front of bazel-remote. Then you can configure your preferred TLS settings in that proxy server.

@tushar150
Copy link
Author

tushar150 commented Nov 7, 2023 via email

@tushar150
Copy link
Author

tushar150 commented Dec 1, 2023 via email

mostynb added a commit to mostynb/bazel-remote that referenced this issue Dec 3, 2023
Allowed values are 1.0 (default), 1.1, 1.2 or 1.3.

At the time of writing, current go versions default to TLS 1.0 as the minimum
version when acting as a server (and 1.2 when acting as a client). This change
allows admins to raise the minium supported TLS version.

Fixes buchgr#708.
@mostynb mostynb closed this as completed in ad2ded8 Dec 3, 2023
@mostynb
Copy link
Collaborator

mostynb commented Dec 3, 2023

Sorry for the delay- I decided to add a flag to specify this value. This feature has landed on the master branch now, and been pushed to dockerhub and quay.io under the "latest" tag.

@tushar150
Copy link
Author

tushar150 commented Dec 3, 2023 via email

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