-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build cacerts during build from Mozilla's list (#2033)
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.
- Loading branch information
Showing
13 changed files
with
23,744 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ca-bundle.crt | ||
cacerts | ||
certs/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,48 @@ | ||
# Security files for OpenJDK | ||
|
||
### This repository contains the cacerts file used with OpenJDK | ||
## CA Certificates | ||
|
||
#### Steps we use to create the cacerts file | ||
The cacerts file that OpenJDK maintains lacks a number of CA certificates that are present in common browsers. As a result, users of OpenJDK cannot connect to servers with Java that they can connect to with their browsers. This causes confusion and [support requests][support-issues]. | ||
|
||
1. Download the following Perl script: https://raw.githubusercontent.com/curl/curl/master/lib/mk-ca-bundle.pl | ||
In May 2020, [we reached out to OpenJDK to discuss this situation][jdk-dev-thread], but no consensus was reached. Consequently, the [AdoptOpenJDK TSC decided to deviate from OpenJDK and distribute a custom trust store][tsc-decision] based on [Mozilla's list of trusted CA certificates][mozilla-certdata] which is also used by many Linux distributions. | ||
|
||
2. Download the following Java application: https://github.com/use-sparingly/keyutil/releases/download/0.4.0/keyutil-0.4.0.jar (source available at https://github.com/use-sparingly/keyutil) | ||
If you want to build OpenJDK with the original cacerts file, set `--custom-cacerts=false`. | ||
|
||
3. Run the provided `GenerateCertsFile.sh` script with: `bash ./GenerateCertsFile.sh` - this will use the above files assuming they're located in the same directory as the script | ||
### Process | ||
|
||
4. Use the cacerts provided: it must be in the `jdk/jre/lib/security` or `jdk/lib/security`folder | ||
The `cacerts` file is build as part of the regular JDK build from source. The reason is that vetting blobs in PR is difficult. Because `certdata.txt` cannot be converted directly into a Java Key Store, we do it in multiple steps: | ||
|
||
1. Convert `certdata.txt` in a PEM file (`ca-bundle.crt`) with [mk-ca-bundle.pl][mk-ca-bundle.pl]. | ||
2. Split `ca-bundle.crt` into individual certificates and import them with `keytool` into a new `cacerts` file. | ||
|
||
To generate a new `cacerts` file, run: | ||
|
||
$ ./mk-cacerts.sh | ||
|
||
If anybody ever plans to replace `mk-ca-bundle.pl`, be sure to read [Can I use Mozilla's set of CA certificates?][can-i-use-mozilla]. | ||
|
||
### Updating the List of Certificates | ||
|
||
Every time Mozilla updates the list of CA certificates, we have to update our copy of `certdata.txt`. Whether it needs to be updated can be checked on [curl's website][curl-ca-extract]. If it needs updating, the process looks as follows: | ||
|
||
1. Download the [current version of certdata.txt][mozilla-certdata]. | ||
2. Replace the existing file in `security`. | ||
3. Open a pull request to get it merged. | ||
|
||
The updated list will be picked up during the next build. | ||
|
||
### License | ||
|
||
The resulting cacerts file is licensed under the terms of the [source file][mozilla-certdata], the Mozilla Public License, v.2.0. | ||
|
||
## Future Work | ||
|
||
* Create a GitHub bot that checks whether `certdata.txt` needs updating and automatically creates a PR. | ||
|
||
[support-issues]: https://github.com/AdoptOpenJDK/openjdk-support/issues/13 | ||
[jdk-dev-thread]: https://mail.openjdk.java.net/pipermail/jdk-dev/2020-May/004305.html | ||
[tsc-decision]: https://github.com/AdoptOpenJDK/openjdk-support/issues/13#issuecomment-635400251 | ||
[mozilla-certdata]: https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt | ||
[mk-ca-bundle.pl]: https://curl.haxx.se/docs/mk-ca-bundle.html | ||
[curl-ca-extract]: https://curl.haxx.se/docs/caextract.html | ||
[can-i-use-mozilla]: https://wiki.mozilla.org/CA/FAQ#Can_I_use_Mozilla.27s_set_of_CA_certificates.3F |
Binary file not shown.
Oops, something went wrong.