|
1 | 1 | # Security files for OpenJDK |
2 | 2 |
|
3 | | -### This repository contains the cacerts file used with OpenJDK |
| 3 | +## CA Certificates |
4 | 4 |
|
5 | | -#### Steps we use to create the cacerts file |
| 5 | +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]. |
6 | 6 |
|
7 | | -1. Download the following Perl script: https://raw.githubusercontent.com/curl/curl/master/lib/mk-ca-bundle.pl |
| 7 | +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. |
8 | 8 |
|
9 | | -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) |
| 9 | +If you want to build OpenJDK with the original cacerts file, set `--custom-cacerts=false`. |
10 | 10 |
|
11 | | -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 |
| 11 | +### Process |
12 | 12 |
|
13 | | -4. Use the cacerts provided: it must be in the `jdk/jre/lib/security` or `jdk/lib/security`folder |
| 13 | +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: |
| 14 | + |
| 15 | +1. Convert `certdata.txt` in a PEM file (`ca-bundle.crt`) with [mk-ca-bundle.pl][mk-ca-bundle.pl]. |
| 16 | +2. Split `ca-bundle.crt` into individual certificates and import them with `keytool` into a new `cacerts` file. |
| 17 | + |
| 18 | +To generate a new `cacerts` file, run: |
| 19 | + |
| 20 | + $ ./mk-cacerts.sh |
| 21 | + |
| 22 | +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]. |
| 23 | + |
| 24 | +### Updating the List of Certificates |
| 25 | + |
| 26 | +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: |
| 27 | + |
| 28 | +1. Download the [current version of certdata.txt][mozilla-certdata]. |
| 29 | +2. Replace the existing file in `security`. |
| 30 | +3. Open a pull request to get it merged. |
| 31 | + |
| 32 | +The updated list will be picked up during the next build. |
| 33 | + |
| 34 | +### License |
| 35 | + |
| 36 | +The resulting cacerts file is licensed under the terms of the [source file][mozilla-certdata], the Mozilla Public License, v.2.0. |
| 37 | + |
| 38 | +## Future Work |
| 39 | + |
| 40 | +* Create a GitHub bot that checks whether `certdata.txt` needs updating and automatically creates a PR. |
| 41 | + |
| 42 | + [support-issues]: https://github.com/AdoptOpenJDK/openjdk-support/issues/13 |
| 43 | + [jdk-dev-thread]: https://mail.openjdk.java.net/pipermail/jdk-dev/2020-May/004305.html |
| 44 | + [tsc-decision]: https://github.com/AdoptOpenJDK/openjdk-support/issues/13#issuecomment-635400251 |
| 45 | + [mozilla-certdata]: https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt |
| 46 | + [mk-ca-bundle.pl]: https://curl.haxx.se/docs/mk-ca-bundle.html |
| 47 | + [curl-ca-extract]: https://curl.haxx.se/docs/caextract.html |
| 48 | + [can-i-use-mozilla]: https://wiki.mozilla.org/CA/FAQ#Can_I_use_Mozilla.27s_set_of_CA_certificates.3F |
0 commit comments