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

Bazel remote cache SSLEngine closed already #6551

Closed
sevki opened this issue Oct 30, 2018 · 13 comments
Closed

Bazel remote cache SSLEngine closed already #6551

sevki opened this issue Oct 30, 2018 · 13 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) type: bug

Comments

@sevki
Copy link
Contributor

sevki commented Oct 30, 2018

Description of the problem / feature request:

bazel fails reading/writing to remote-cache

WARNING: Error reading from the remote cache:
SSLEngine closed already
WARNING: Error writing to the remote cache:
SSLEngine closed already

the certificate is valid, and issued by DigiCert, it uses TLS 1.2 and ECDSA. The certificate is able to be verified with every up to date browser.

Feature requests: what underlying problem are you trying to solve with this feature?

Ship bazel with a more up to date trust store or provide a simpler way to use one

As the homogeny of operating systems becoming more and more prevalent, what would be great is if bazel just worked™. It would be a major pain if we'd have to go and package it for debian, archlinux, fedora, macos, windows and so on...

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

bazel build --remote_http_cache=https://cache.sevki.net/ ....
I've deployed this as an example, I'm not using this in production or anything, just wanted to share this as a quick repro step.

What operating system are you running Bazel on?

Linux 4.18.16-arch1-1-ARCH

What's the output of bazel info release?

release 0.19.0- (@non-git)

If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.

pacman -S bazel

Have you found anything relevant by searching the web?

@buchgr
Copy link
Contributor

buchgr commented Oct 30, 2018

Hey Sevik,

you seem to be using Bazel from an unofficial package. Can you please try with an official Bazel release? Bazel doesn't ship with a truststore but uses what's provided by it's JVM. Presumably arch linux ships its own JVM and truststore?

Thanks!

@buchgr buchgr self-assigned this Oct 30, 2018
@sevki
Copy link
Contributor Author

sevki commented Oct 30, 2018

I tried using it with the oficial deb too.
Arch is also using an official release. https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/bazel#n15

@buchgr
Copy link
Contributor

buchgr commented Oct 30, 2018

Thanks @sevki.

Apparently, the OpenJDK did a major overhaul of trusted CAs with the release of JDK10 and this list seems to also include DigiCert: http://openjdk.java.net/jeps/319. So once we upgrade Bazel's JDK to JDK10 this should solve your issues. You can do that already by specifying the --server_javabase and pointing it to a JDK10 folder.

@buchgr
Copy link
Contributor

buchgr commented Oct 30, 2018

@sevki I just talked to people responsible for updating Bazel's JDK to 10. The plan is to do that in Bazel 0.22. There are a few changes that need to happen before we can safely update to JDK10, most importantly the decoupling of Bazel's JDK and javac's JDK. After 0.22 we will be able to update to new JDKs as their are released.

@sevki
Copy link
Contributor Author

sevki commented Oct 30, 2018

thanks @buchgr for the response. openjdk-10 seems to break bazel. it gets stuck somewhere in analysis stage

@sevki
Copy link
Contributor Author

sevki commented Oct 30, 2018

sorry doesn't break it, it's just less verbose with git

@sevki
Copy link
Contributor Author

sevki commented Oct 30, 2018

also openjdk-10 doesn't seem to fix the issue. still getting

WARNING: Error reading from the remote cache:
SSLEngine closed already
WARNING: Error writing to the remote cache:
SSLEngine closed already

@sevki
Copy link
Contributor Author

sevki commented Oct 31, 2018

Here is what I've tried and this problem still persists;

  • changed server javabase to use openjdk10
  • installed the latest version of ca-certificates-java ran with --host_jvm_args=-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts --host_jvm_args=-Djavax.net.ssl.trustStorePassword=changeit after that
  • combined both javabase and the host jvm args methods

nothing helped

@sevki
Copy link
Contributor Author

sevki commented Nov 1, 2018

I've tried this, with the both openjdk-8 and openjdk-10 and both worked no problem. bazel is still failing when I change the --server_javabase openjdk-10 or anything that is not embedded and I'm still getting SSLEngine already closed. i'm at my wits end, don't know how else to debug this, any suggestions @buchgr?

@sevki sevki changed the title Bazel remote cache SSLEngine closed alread Bazel remote cache SSLEngine closed already Nov 2, 2018
@sevki
Copy link
Contributor Author

sevki commented Nov 2, 2018

@buchgr so this does not seem to be a problem with the truststore but rather a problem with the http client that bazel uses, which does not seem to support SNI

@philwo philwo added type: bug P1 I'll work on this now. (Assignee required) category: remote execution / caching labels Nov 6, 2018
@sevki
Copy link
Contributor Author

sevki commented Nov 6, 2018

attached is the pcap

image

https://sevki.io/bazel-cache.pcap

@buchgr buchgr added P2 We'll consider working on this in future. (Assignee optional) and removed P1 I'll work on this now. (Assignee required) labels Nov 6, 2018
@buchgr
Copy link
Contributor

buchgr commented Nov 6, 2018

Thanks for debugging this @sevki! So we'll need to add SNI support to it. This should actually be a one liner:

Instead of

SSLEngine engine = sslCtx.newEngine(ch.alloc());

call

SSLEngine engine = sslCtx.newEngine(ch.alloc(), hostname, port);

Do you want to take a stab at it? :-)

@sevki
Copy link
Contributor Author

sevki commented Nov 6, 2018

Yeah sure 😄

sevki added a commit to sevki/bazel that referenced this issue Nov 15, 2018
this change adds host and port parameters to SSL connection contrcutor
with out which the blobstore download client cannot talk to endpoints
sharing SSL certificates.

Fixes bazelbuild#6551
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: bug
Projects
None yet
Development

No branches or pull requests

3 participants