Skip to content

matomo: use cacert bundle instead of vendored CA bundle - #577585

Merged
dasJ merged 1 commit into
NixOS:masterfrom
irgolic:cacert/matomo
Nov 4, 2026
Merged

dasJ merged 1 commit into
NixOS:masterfrom
irgolic:cacert/matomo

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

Matomo has a bundled CA file, vendor/composer/ca-bundle/res/cacert.pem. By default, Matomo gives this file to curl for each request. Matomo does not try a CA bundle of the system first. This change replaces the installed file with a symlink to the ca-bundle.crt file of cacert in installPhase. Thus, the installed file is a symlink to cacert, and replaceDependencies can replace cacert. This change also adds the file to filesToFix. Thus, postFixup writes the length and SHA-256 value of the new file into config/manifest.inc.php, and Matomo uses these values to examine its files.

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.

nix run github:irgolic/nix-cacert-harness -- matomo --pr 577585
Harness output: matomo
$ nix run github:irgolic/nix-cacert-harness -- matomo --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/688700cf6529a284973b5f3efb3da0a9557afa47
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR matomo
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/688700cf6529a284973b5f3efb3da0a9557afa47
before ok (0 built, 2s)
        drv /nix/store/…-matomo-5.13.0.drv
after  ok (0 built, 2s)
        drv /nix/store/…-matomo-5.13.0.drv

| output:path | before | after |
|---|---|---|
| out:/share/vendor/composer/ca-bundle/res/cacert.pem | pem 119 certs: 4 not in cacert, 1 in cacert but not for TLS, 4 cacert TLS roots missing; scanner: ECC G3 | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |

cacert in runtime closure (before): no
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (5 total), e.g.:
  - C=IN, OU=emSign PKI, O=eMudhra Technologies Limited, CN=emSign ECC Root CA - G3
  - C=US, OU=emSign PKI, O=eMudhra Inc, CN=emSign ECC Root CA - C3
  - C=US, OU=emSign PKI, O=eMudhra Inc, CN=emSign Root CA - C1
  - CN=Atos TrustedRoot 2011, O=Atos, C=DE
  - C=TW, O=Chunghwa Telecom Co., Ltd., OU=ePKI Root Certification Authority
VERDICT matomo: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

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

matomo  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/688700cf6529a284973b5f3efb3da0a9557afa47)
         | 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 matomo: 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 package again. Then a small PHP test uses vendor/autoload.php of Matomo and sends a request to a local openssl s_server with curl. The test sets CURLOPT_CAINFO to CaBundle::getBundledCaBundlePath(), the same as Matomo. 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.

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 23, 2026
@zimbatm zimbatm mentioned this pull request Oct 23, 2026
66 of 95 tasks
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Oct 23, 2026
@dasJ
dasJ added this pull request to the merge queue Nov 4, 2026
Merged via the queue into NixOS:master with commit b6b2162 Nov 4, 2026
28 checks passed
@osnyx osnyx added the backport release-26.05 Backport PR automatically label Nov 9, 2026
@nixpkgs-ci

nixpkgs-ci Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release-26.05:

@github-actions github-actions Bot added the 8.has: port to stable This PR already has a backport to the stable release. label Nov 9, 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 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. backport release-26.05 Backport PR automatically llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants