Skip to content

moodle: use cacert bundle instead of vendored CA bundles - #577805

Merged
pbsds merged 1 commit into
NixOS:masterfrom
irgolic:cacert/moodle
Oct 24, 2026
Merged

pbsds merged 1 commit into
NixOS:masterfrom
irgolic:cacert/moodle

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

Moodle has two bundled CA files in share/moodle: public/lib/cacert.pem and public/lib/google/src/Google/IO/cacerts.pem. curl::get_cacert() uses public/lib/cacert.pem only on Windows. On Linux, it gives no file, and libcurl uses its default CA file. The bundled Google API client uses cacerts.pem when its caller sets no CA file. get_google_client() of Moodle replaces the IO class of this client with moodle_google_curlio, which uses the curl class of Moodle. Thus, only a plugin that uses the Google API client directly reads this file. This change replaces the two files with symlinks to the ca-bundle.crt file of cacert in installPhase.

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 -- moodle --pr 577805 --emudhra
Harness output: moodle
$ nix run github:irgolic/nix-cacert-harness -- moodle --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/c7993316fbc48e7fa951711fd29daf337544f222 --emudhra
[1/2] static check + eMudhra chains: offline, reproducible
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR moodle
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/c7993316fbc48e7fa951711fd29daf337544f222
before ok (0 built, 0s)
        drv /nix/store/…-moodle-5.1.3.drv
after  ok (0 built, 0s)
        drv /nix/store/…-moodle-5.1.3.drv

| output:path | before | after |
|---|---|---|
| out:/share/moodle/public/lib/cacert.pem | pem 150 certs: 115 not in cacert, 15 in cacert but not for TLS, 98 cacert TLS roots missing; scanner: AAA | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |
| out:/share/moodle/public/lib/google/src/Google/IO/cacerts.pem | pem 70 certs: 57 not in cacert, 8 in cacert but not for TLS, 113 cacert TLS roots missing; scanner: AAA | 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 (133 total), e.g.:
  - C=GB, O=Comodo CA Limited, CN=AAA Certificate Services
  - C=AT, O=A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH, OU=A-Trust-nQual-03, CN=A-Trust-nQual-03
  - C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
  - C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority
  - C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 1
VERDICT moodle: FIXED: before trusted CAs outside cacert; after: 2 store(s) == cacert, none with extra CAs

eMudhra chains (--emudhra; offline and reproducible): the 14 chains in fixtures/emudhra,
each leaf verified against each store (openssl verify -purpose sslserver, at 2026-10-23):
| output:path | before | after |
|---|---|---|
| out:/share/moodle/public/lib/cacert.pem | pem: accepted 7/14 (g3: 0/7, aaa: 7/7, noct: 1/2) | symlink->cacert:ca-bundle.crt pem: accepted 0/14 |
| out:/share/moodle/public/lib/google/src/Google/IO/cacerts.pem | pem: accepted 7/14 (g3: 0/7, aaa: 7/7, noct: 1/2) | symlink->cacert:ca-bundle.crt pem: accepted 0/14 |
VERDICT moodle emudhra: FIXED: before accepted 7/14 compromised eMudhra chains (g3: 0/7, aaa: 7/7, noct: 1/2); after 0/14

[2/2] live eMudhra test hosts: needs network, NOT reproducible offline
(no shims/moodle.{nix,sh} or shims/live/moodle.{nix,sh}: live check skipped)

The harness tests the package with the certificate chains of the eMudhra incident, from https://emudhra.we-have-a-problem.com/ (only the certificates, not the keys). Before this change, each bundled file accepts 7 of the 14 chains (accepted 7/14). Thus, the files accept the eMudhra intermediate certificates through the Sectigo cross-sign by AAA Certificate Services. After this change, the files accept no chain (accepted 0/14). The output has no second part, because on Linux, the code of Moodle does not read these files. Thus, a test of Moodle with the test servers gives the same result before and after this change.

Things done

Assisted-by: Claude Code (Claude Fable 5.1)
Assisted-by: Claude Code (Claude Opus 5.5)
@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label 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. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. llm-assisted Contributions that include code generation with LLMs 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! labels Oct 23, 2026
@pbsbot

pbsbot commented Oct 24, 2026

Copy link
Copy Markdown

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 577805
Commit: c7993316fbc48e7fa951711fd29daf337544f222


x86_64-linux

✅ 1 package built:
  • moodle

@pbsds
pbsds added this pull request to the merge queue Oct 24, 2026
Merged via the queue into NixOS:master with commit 4d44793 Oct 24, 2026
36 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 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 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. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants