Skip to content

zulu: generate cacerts from cacert - #577093

Merged
FliegendeWurst merged 1 commit into
NixOS:stagingfrom
irgolic:cacert/zulu
Nov 17, 2026
Merged

FliegendeWurst merged 1 commit into
NixOS:stagingfrom
irgolic:cacert/zulu

Conversation

@irgolic

@irgolic irgolic commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Part of #576543.

The Zulu binary JDKs, zulu8 to zulu25, have a bundled Java trust store, lib/security/cacerts, from approximately 2020. This change makes a new cacerts from the cacert bundle with jre-generate-cacerts, as the merged openjdk change #576518 does. This change is for Linux only. On darwin, zulu is the openjdk package, and its drvPath does not change.

Warning

AI Disclosure: Claude Code made the code change, the commit message and the first version of this pull request description. Claude Code used Claude Fable 5.1 and Claude Opus 5.5. I examined all of this work. Claude Code also wrote all of nix-cacert-harness. This pull request description is written in ASD-STE100 (Simplified Technical English), examined with memelint in strict mode.

Test

nix-cacert-harness examines the package before and after this change. A local copy of nixpkgs is not necessary. The harness builds the binary JDK one time.

nix run github:irgolic/nix-cacert-harness -- zulu --pr 577093
Harness output: zulu
$ nix run github:irgolic/nix-cacert-harness -- zulu --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/685723a7d7131cb56c7c65a86af05e0e9d4fbfa7
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR zulu
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: 685723a7d7131cb56c7c65a86af05e0e9d4fbfa7
before ok (0 built, 1s)
        drv /nix/store/…-zulu-ca-jdk-21.0.11.drv
after  ok (0 built, 1s)
        drv /nix/store/…-zulu-ca-jdk-21.0.11.drv

| output:path | before | after |
|---|---|---|
| out:/lib/security/cacerts | keystore 109 certs: 33 not in cacert, 17 in cacert but not for TLS, 59 cacert TLS roots missing [no-password]; scanner: AAA,ECC G3 | keystore 118 certs == cacert [no-password] |

cacert in runtime closure (before): no
cacert in runtime closure (after): no
CAs trusted before but not trusted for TLS by cacert (50 total), e.g.:
  - CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB
  - CN=emSign ECC Root CA - G3, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN
  - CN=emSign Root CA - G2, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN
  - CN=AddTrust External CA Root, OU=AddTrust External TTP Network, O=AddTrust AB, C=SE
  - CN=AddTrust Qualified CA Root, OU=AddTrust TTP Network, O=AddTrust AB, C=SE
  - CN=Certigna, O=Dhimyotis, C=FR
  - CN=Certum CA, O=Unizeto Sp. z o.o., C=PL
  - CN=Chambers of Commerce Root - 2008, O=AC Camerfirma S.A., SERIALNUMBER=A82743287, L=Madrid (see current address at www.camerfirma.com/address), C=EU
  - CN=DigiCert Assured ID Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US
VERDICT zulu: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/zulu.nix
  package derivations to build for the matrix: 0
  before-stock: REFUSED -> /nix/store/…-ca-behave-zulu-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-zulu-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-zulu-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-zulu-test

zulu  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after 685723a7d7131cb56c7c65a86af05e0e9d4fbfa7)
         | stock cacert | + test root  | override with test-root cacert
before   | REFUSED      | REFUSED      | NO-OP (package does not take cacert)
after    | REFUSED      | CONNECTED    | yes (rebuilt with cacert + test root)
control (before cells): curl --cacert test-root: CONNECTED, curl --cacert stock: REFUSED
VERDICT zulu: PASS: after-fix trust follows cacert; before-fix ignores it

In the second part of the output, the harness adds a temporary test root to cacert and builds the JDK again. Then a small Java test sends a request to a local openssl s_server with the default trust store. The certificate of this server chains to the test root. Before this change, cacert has no effect on the result. After this change, it has an effect. The harness compares the certificates by their SHA-256 fingerprints, because jre-generate-cacerts does not keep the usual aliases.

Things done

@irgolic irgolic added 1.severity: security Issues which raise a security issue, or PRs that fix one llm-assisted Contributions that include code generation with LLMs labels Oct 21, 2026
@zimbatm zimbatm mentioned this pull request Oct 21, 2026
28 of 37 tasks
@nixpkgs-ci
nixpkgs-ci Bot requested a review from a team October 21, 2026 23:04
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 6.topic: java Including JDK, tooling, other languages, other VMs labels Oct 21, 2026
@irgolic
irgolic force-pushed the cacert/zulu branch 2 times, most recently from cdf35dc to 685723a Compare October 22, 2026 00:04
@gepbird gepbird mentioned this pull request Oct 22, 2026
5 of 14 tasks
Comment on lines +238 to +240
// lib.optionalAttrs regenerateCacerts {
# keytool must already be patched when postFixup regenerates cacerts
dontAutoPatchelf = true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// lib.optionalAttrs regenerateCacerts {
# keytool must already be patched when postFixup regenerates cacerts
dontAutoPatchelf = true;
dontAutoPatchelf = regenerateCacerts;

This avoids the reindent and should be equivalent

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, I've made this change now, thanks.

pushd "$out/${lib.optionalString isJdk8 "jre/"}lib/security"
rm cacerts
JAVA_TOOL_OPTIONS="-Dkeystore.pkcs12.certProtectionAlgorithm=NONE -Dkeystore.pkcs12.macAlgorithm=NONE" \
${jre-generate-cacerts} "$out/bin/keytool" ${cacert}/etc/ssl/certs/ca-bundle.crt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would break cross-compilation, though I'm not sure it works at the moment anyway.

Assisted-by: Claude Code (Claude Fable 5.1)
Assisted-by: Claude Code (Claude Opus 5.5) with patchix
nixpkgs-branch-check[bot]

This comment was marked as outdated.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. labels Nov 17, 2026
@FliegendeWurst
FliegendeWurst changed the base branch from master to staging November 17, 2026 18:10
@FliegendeWurst
FliegendeWurst added this pull request to the merge queue Nov 17, 2026
@nixpkgs-ci nixpkgs-ci Bot closed this Nov 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a manual request Nov 17, 2026
@nixpkgs-ci nixpkgs-ci Bot reopened this Nov 17, 2026
@FliegendeWurst
FliegendeWurst added this pull request to the merge queue Nov 17, 2026
@nixpkgs-branch-check
nixpkgs-branch-check Bot dismissed their stale review November 17, 2026 18:21

Review dismissed automatically

Merged via the queue into NixOS:staging with commit 686b62d Nov 17, 2026
61 checks passed
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 2501-5000 This PR causes many rebuilds on Darwin and should target the staging branches. and removed 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. labels Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.severity: security Issues which raise a security issue, or PRs that fix one 6.topic: java Including JDK, tooling, other languages, other VMs 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 2501-5000 This PR causes many rebuilds on Darwin and should target the staging branches. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants