-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Unable to find valid certification path #13
Comments
@nboissel Does it also fail with the latest nightly build from https://adoptopenjdk.net/nightly.html ? |
I just tried with the last build |
I'm facing the same issue on JDK 13:
|
Just found in my case it was my fault. OpenLiberty doesn't use JDK cacerts by default. I needed to add the following to the server.xml file:
|
Is there a chance that it's due to the SHA-1 signature in the certificate chain per https://openjdk.java.net/jeps/288? Quoting:
Per https://www.sslshopper.com/ssl-checker.html?hostname=+https%3A%2F%2Fentreprise.data.gouv.fr: |
Closing due to inactivity. |
I can imagine this issue does not concerns a lot of users but if there is this behavior with those root certificates, it can append for others. I looked into the lead proposed by @tresf but I reproduce the same issue with api.insee.fr (a sub-site of data.gouv.fr) with the following chain certificate: This is for the new version of the same service with URL https://api.insee.fr/entreprises/sirene/V3/siret/{siret} |
Some conversation over here reads very similar: adoptium/temurin-build#676, but looking at the For example, if I cd to echo "changeit" | keytool -list -v -keystore cacerts |grep -i VeriSign ... however when I try the same command with Certigna, I get nothing echo "changeit" | keytool -list -v -keystore cacerts |grep -i Certigna ... yet Chrome trusts Certigna as a valid, Root Certificate Authority. |
Related: habitat-sh/core-plans#1488 (comment). Quoting:
|
The cacert file bundled with OpenJDK does not match the list of accepted CAs that is maintained by Mozilla. Historically, when only Oracle was in charge, they were significantly more forgiving than the browser vendors if I remember correctly. Personally, I hate the fact that our cacert does not match Mozilla's. I think there was a discussion on our Slack but Martijn wanted to discuss that privately because he considered it to be a sensitive security issue (I don't). Hence I don't know what our thinking is here. As a side note, there's adoptium/installer#105. The gist is: At least when you install the Linux packages, Java should either use the system's certificate store or get a cacert generated from Mozilla's. I didn't get around implementing the necessary tooling in Java, yet. If one of you wants to help out, please get in touch. |
I've worked with Firefox's Whereas you're not happy with the fact that Anyway, I vaguely remember a property for Windows called |
When 20,000 certificates are revoked, it's public knowledge these days, and issuance is as quick as running Of course, the most secure system is one which trusts no CAs at all, but that would be a difficult selling point. :D |
To verify whether the cacert file is really the culprit here:
If someone could do that, I‘d be very grateful. @tresf Debian has tooling to create a cacert file from the system‘s keystore. There is a hook system that updates the cacert every time the system‘s keystore is changed. lib/security/cacert is actually a symlink to that file. My plan is to create Java-based tools that replicate that on Red Hat and friends as well as all Debian derivatives. So you have an up-to-date CA list according to your needs that matches the behavour of your system. In case of Debian, it‘s identical with Mozilla‘s list. |
@aahlenst Using the perl script, I was able to create two cert files:
Next, I snagged Last, I attempted to create my own Here's my commands: # install curl on Ubuntu, mk-ca-bundle requires it
sudo apt install curl
# get mk-ca-bundle.pl
wget https://raw.githubusercontent.com/curl/curl/master/lib/mk-ca-bundle.pl
chmod +x mk-ca-bundle.pl
./mk-ca-bundle.pl
# get keyutil
wget https://github.com/use-sparingly/keyutil/releases/download/0.4.0/keyutil-0.4.0.jar
# create a new cacert file
java -jar keyutil-0.4.0.jar --new-keystore cacert --password changeit --import-pem-file ca-bundle.crt
# validate file before deploying
echo "changeit" |keytool -list -keystore cacert Unfortunately, I get the following: Enter keystore password: Keystore type: JKS
Keystore provider: SUN
- Your keystore contains 0 entries I assume I'm doing something very basically wrong. P.S. I can confirm that on Ubuntu 20.04:
I'll be able to confirm whether or not |
tl;dr: As suspected, the problem is the cacerts shipped with OpenJDK and also AdoptOpenJDK. There are significant less CA certificates in both cacerts keystores. Replacing the bundled cacerts with one generated from Mozilla's list of accepted CAs makes the problem go away. And now, the details… OpenJDK version:
AdoptOpenJDK version:
Sample project to reproduce: https://github.com/aahlenst/cacert-test (JDK 11 and higher). Run Number of bundled CA certificates with (Adopt)OpenJDK:
Number of CA certificates in Mozilla's list:
How I generated cacerts-mozilla (mk-ca-bundle.pl, keyutil-0.4.0.jar): $ wget https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt .
$ perl mk-ca-bundle.pl -n > ca-bundle.crt
$ java -jar keyutil-0.4.0.jar --import --new-keystore cacerts-mozilla --password changeit --force-new-overwrite --import-pem-file ca-bundle.crt With the bundled cacerts:
After replacing the bundled cacerts with the newly generated one (
The sites I used to test: https://google.com/ and https://api.insee.fr/catalogue/. It's expected that JDK's shipped with Ubuntu/Debian work because they use a different cacerts build from Mozilla's list. Side note: I tested with BellSoft Liberica 13, too. Same problem. Personal commentary: I can see how one can argue that it makes sense to ship the same cacerts file as upstream because one of AdoptOpenJDKs objectives is to match OpenJDK as closely as possible. In this case, I think we're doing our users a disservice. We should either delegate what CA certificates are accepted to the operating system or, if this isn't possible, at least ship the best curated list of trusted CA certificates and that's Mozilla's. |
@karianna Please advise how to proceed here. I see three options:
Necessary information to reproduce should be present. |
TSC has agreed in principle to add the Mozilla certs - @gdams will take a first look at it. |
I ran into this issue today as well. The Dutch government runs its own root CA, but this is not included in AdoptOpenJDK's
I'm tempted to just symlink AdoptOpenJDK's |
I also tried Azul Zulu Community, and that OpenJDK distribution does contain 'Staat der Nederlanden Root CA - G3':
Maybe they also use Mozilla's list? Although they don't have 'Staat der Nederlanden Root CA - G2'. |
Sorry it took us so long. 15 should be the first one with a fresh cacerts file. 8 and 11 should get it in October. The nightly builds (every version) that appear in the next hours on the website should already have it. Please give them a whirl. |
The cacers keystore is created at build time from a locally stored plain text copy of Mozilla's list of CA certificates. Fixes adoptium/adoptium-support#13.
The cacerts trust store provided by OpenJDK lacks a few common certificates (see adoptium/adoptium-support#13). We reached out to OpenJDK, but there was little interest to change the state of affairs (see https://mail.openjdk.java.net/pipermail/jdk-dev/2020-May/004305.html). Consequently, the AdoptOpenJDK TSC decided to replace the bundled trust store with the root CA certificates included in Mozilla Firefox. Mozilla runs a trusted root CA program and is used by, amongst others, most Linux distributions. Running our own root CA program was not an option (too much work, difficult). But we leave the option open to include CA certificates on a case-by-case basis. If anyone wants to build with the stock OpenJDK certificates, pass `--custom-cacerts false`. The list of CA certificates is not downloaded on demand but stored in the repository. This prevents intermittent download failures and makes it easier to inspect what certificates we have bundled with a certain release. Changes are also clearly visible in the revision history. This is also the reason that the cacerts file is built from source during the JDK build. The downside is that the list of certificates needs to be regularly updated. The cacerts trust store is built with keytool from the boot JDK to ensure that it is compatible with the built JDK version.
This issue appears on Docker official image (tried with AdoptOpenJDK 8 and 11 in hostpot/amd64 flavors) but I think it can be reproduced on any AdoptOpenJDK Hotspot.
I get the usual PKIX error each time I request some APIs
Error : javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
It wouldn't be a problem if this was an auto-signed certificate but it appears on all french government open APIs I tested (for example https://entreprise.data.gouv.fr/api/sirene/v1/siret/).
Those certificates are signed by the same root authority CN = Certigna, O = Dhimyotis, C = FR which seems legit.
It works on OpenJDK so I imagine it is "just" a difference in root certificate list.
Was this root certificate voluntarily invalidated? Is it just an omission ?
I know I can add this certificate manually using keystore but I was wondering if this should not be integrated by default.
The text was updated successfully, but these errors were encountered: