Skip to content

temurin-bin: generate cacerts from cacert - #577094

Merged
FliegendeWurst merged 1 commit into
NixOS:masterfrom
irgolic:cacert/temurin-bin
Oct 28, 2026
Merged

FliegendeWurst merged 1 commit into
NixOS:masterfrom
irgolic:cacert/temurin-bin

Conversation

@irgolic

@irgolic irgolic commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Part of #576543.

Heads up, most of this change is a reindent – you can press "hide whitespace" in the diff to make it easier to read.

The Temurin binary JDKs, temurin-bin and temurin-jre-bin, have a bundled Java trust store, lib/security/cacerts. This change makes a new cacerts from the cacert bundle with jre-generate-cacerts, as the merged openjdk change #576518 does. temurin-bin is also the bootstrap JDK of openjdk. Thus, this change adds the argument regenerateCacerts, and openjdk sets it to false for its bootstrap JDK. The drvPath of each openjdk does not change. This change does not change jmods/java.base.jmod or the darwin packages.

The JDKs semeru-bin and semeru-jre-bin also come from temurin-bin/jdk-linux-base.nix. At this time, their JVM does not start on nixpkgs, and it shows this error: cannot enable executable stack as shared object requires: Invalid argument. This occurs because glibc 2.41 and newer versions do not accept a library that must have an executable stack, and libj9vm29.so is such a library. Thus, it is not possible to use keytool at build time. This change sets regenerateCacerts = false for these two packages, and their drvPath does not change. The repair of these two packages (a new version, or meta.broken) is a different task.

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 -- temurin-bin --pr 577094
nix run github:irgolic/nix-cacert-harness -- temurin-jre-bin --pr 577094
Harness output: temurin-bin
$ nix run github:irgolic/nix-cacert-harness -- temurin-bin --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/f2957b081271777e3141ea91c8ed22c752f3c919
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR temurin-bin
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: f2957b081271777e3141ea91c8ed22c752f3c919
before ok (0 built, 1s)
        drv /nix/store/…-temurin-bin-21.0.12.drv
after  ok (0 built, 1s)
        drv /nix/store/…-temurin-bin-21.0.12.drv

| output:path | before | after |
|---|---|---|
| out:/lib/security/cacerts | keystore 118 certs: 4 not in cacert, 1 in cacert but not for TLS, 5 cacert TLS roots missing [no-password]; scanner: 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 (5 total), e.g.:
  - CN=emSign ECC Root CA - C3, O=eMudhra Inc, OU=emSign PKI, C=US
  - CN=emSign ECC Root CA - G3, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN
  - CN=emSign Root CA - C1, O=eMudhra Inc, OU=emSign PKI, C=US
  - C=DE, O=Atos, CN=Atos TrustedRoot 2011
  - OU=ePKI Root Certification Authority, O="Chunghwa Telecom Co., Ltd.", C=TW
VERDICT temurin-bin: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/java-runtime.nix
  package derivations to build for the matrix: 1 temurin-bin-21.0.12.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-temurin-bin-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-temurin-bin-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-temurin-bin-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-temurin-bin-test

temurin-bin  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after f2957b081271777e3141ea91c8ed22c752f3c919)
         | 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 temurin-bin: PASS: after-fix trust follows cacert; before-fix ignores it
Harness output: temurin-jre-bin
$ nix run github:irgolic/nix-cacert-harness -- temurin-jre-bin --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/f2957b081271777e3141ea91c8ed22c752f3c919
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR temurin-jre-bin
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: f2957b081271777e3141ea91c8ed22c752f3c919
before ok (0 built, 1s)
        drv /nix/store/…-temurin-jre-bin-21.0.12.drv
after  ok (0 built, 1s)
        drv /nix/store/…-temurin-jre-bin-21.0.12.drv

| output:path | before | after |
|---|---|---|
| out:/lib/security/cacerts | keystore 118 certs: 4 not in cacert, 1 in cacert but not for TLS, 5 cacert TLS roots missing [no-password]; scanner: 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 (5 total), e.g.:
  - CN=emSign ECC Root CA - C3, O=eMudhra Inc, OU=emSign PKI, C=US
  - CN=emSign ECC Root CA - G3, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN
  - CN=emSign Root CA - C1, O=eMudhra Inc, OU=emSign PKI, C=US
  - C=DE, O=Atos, CN=Atos TrustedRoot 2011
  - OU=ePKI Root Certification Authority, O="Chunghwa Telecom Co., Ltd.", C=TW
VERDICT temurin-jre-bin: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/java-runtime.nix
  package derivations to build for the matrix: 1 temurin-jre-bin-21.0.12.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-temurin-jre-bin-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-temurin-jre-bin-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-temurin-jre-bin-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-temurin-jre-bin-test

temurin-jre-bin  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after f2957b081271777e3141ea91c8ed22c752f3c919)
         | 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 temurin-jre-bin: 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

Assisted-by: Claude Code (Claude Fable 5.1)
Assisted-by: Claude Code (Claude Opus 5.5)
@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
@nixpkgs-ci
nixpkgs-ci Bot requested review from a team and taku0 October 21, 2026 23:06
@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
@zimbatm zimbatm mentioned this pull request Oct 21, 2026
28 of 37 tasks
@irgolic
irgolic force-pushed the cacert/temurin-bin branch from feb5119 to f47b8a2 Compare October 21, 2026 23:22
@irgolic
irgolic marked this pull request as draft October 21, 2026 23:44
@irgolic
irgolic force-pushed the cacert/temurin-bin branch from f47b8a2 to f2957b0 Compare October 22, 2026 00:04
@irgolic
irgolic marked this pull request as ready for review October 22, 2026 00:05

@taku0 taku0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

  • nixpkgs-review builds temurin-bin* and temurin-jre-bin* but not semeru-bin* nor openjdk as expected.
  • lib/security/cacerts is different to the file from master branch.
  • bin/java -version and bin/javac -version works.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Oct 28, 2026
@FliegendeWurst
FliegendeWurst added this pull request to the merge queue Oct 28, 2026
@FliegendeWurst

Copy link
Copy Markdown
Member

Should this be backported to 26.05?

Merged via the queue into NixOS:master with commit 6a418a9 Oct 28, 2026
31 checks passed
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: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants