Skip to content

cacert: Split blocklist option into caCertificateBlocklistFailOnNonMatching and caCertificateBlocklistIgnoreNonMatching - #581985

Draft
nh2 wants to merge 2 commits into
NixOS:stagingfrom
nh2:cacert-blocklist-nonmatching
Draft

nh2 wants to merge 2 commits into
NixOS:stagingfrom
nh2:cacert-blocklist-nonmatching

Conversation

@nh2

@nh2 nh2 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #249080.

Removes the security-update-breaking naming footgun explained in #249080 (comment).

The two options can be combined at will, e.g. if for some reason you really like the build/update-breaking behaviour of caCertificateBlocklistFailOnNonMatching, e.g. because you want to distrust a CA that Mozilla won't remove from the list, and want to be protect against that one being renamed at Mozilla, you can use caCertificateBlocklistFailOnNonMatching for that in addition with normal CA-security mitigations via caCertificateBlocklistIgnoreNonMatching that are sensible for most users.

TODO

If the merge is done, anybody feel free to hijack this PR to put the new version in please, as i have time this weekend but probably not so much after.

Things done

nh2 added 2 commits November 1, 2026 22:37
…, `blocklistFailOnNonMatching`

DO NOT MERGE WITHOUT UPDATE
  because this commit should be combined with
  the one that updates do the version that has `buildcatrust` PR
  nix-community/buildcatrust#19 in it,
  because the CLI flags change and `--blocklist` is an ambiguous
  Python `argparse` prefix with that version;
  then remove this note.

Names in `blocklistIgnoreNonMatching` that match no certificate in the
NSS store only produce a build-time warning instead of failing the build.

`blocklistFailOnNonMatching` has the strict behaviour of `blacklist`,
which is kept as a legacy name for it.

Uses buildcatrust's new `--blocklist_ignoring_nonmatching_input`.
Also pass `--blocklist_input` by its full name, because the abbreviation
`--blocklist` is ambiguous since that buildcatrust version.

See NixOS#249080

Assisted-By: Claude Opus 5.5, human review
Names in it that match no certificate in the Mozilla Trust Store only
produce a build-time warning instead of failing the system build.

Motivation:
Upstream regularly removes CAs from the Mozilla Trust Store, and those
are exactly the CAs users are most likely to blocklist.
Failing the build in that case broke system builds, and with them
`system.autoUpgrade`, thus stopping all automatic security updates until
somebody edited the blocklist by hand.
It also meant that blocklists could not be shared across NixOS releases.

`caCertificateBlacklist` keeps its strict behaviour, as a deprecated
alias of the new `caCertificateBlocklistFailOnNonMatching`.
Its deprecation warning explains that drawback and recommends
`caCertificateBlocklistIgnoreNonMatching`.

Fixes NixOS#249080

Assisted-By: Claude Opus 5.5, human review
@nh2
nh2 requested review from K900, Ma27, bjornfor, lukegb and whentze November 1, 2026 22:49
@nh2 nh2 self-assigned this Nov 1, 2026

@nixpkgs-ci nixpkgs-ci Bot 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.

Thanks for contributing to the documentation.

Follow the documentation style guide, especially:

  • Show, don’t tell. Start with a minimal working example. Explain after the code.
  • Avoid meta-commentary. Don’t write "This section explains how to…".
  • Use present tense, imperative mood, and active voice. For example: "Run the command," not "The user should run the following command."
  • Avoid vague references like "this" when the referent is unclear. Write "This command creates a folder," not "This will create a folder."
  • Be direct. Avoid "should", "might", "typically", and "usually".
  • Cut filler words like "simply", "just", "easily", and "basically". Use "to" instead of "in order to".

For larger changes, such as adding or removing whole sections, ask the NixOS documentation team for review.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. llm-assisted Contributions that include code generation with LLMs 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: documentation This PR adds or changes documentation labels Nov 1, 2026

@Ma27 Ma27 left a comment

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.

So, in general I think that's a fair approach moving forward.

That being said, one question for my own understanding: the eMudhra mitigation was applied via the module system before the cacert update landed such that people didn't have to await the staging cycle (16ac0cd, revert in f903b88).

Now, reflecting on the discussion I do see your point of stuck security updates being bad and especially on stable moving forward should(tm) instead always be possible.

I'm asking this question because that might be a reason to give a stronger recommendation for end-users to prefer the failing option and make the non-failing one a "you have to know what you're doing" thing (honestly, I'm not sure if beginner-me would have been able to reasonably verify such a change).

@nh2

nh2 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@Ma27 I don't properly understand your question. In that might be a reason, what exactly is the that referring to? None of the preceding paragraphs seem to make an argument for the failing option.

Maybe you mean: "blacklist in (16ac0cd, revert in f903b88) didn't not break updates, because the revert is also what brought the new cacert version, so at no point did NixOS itself provide a non-building config"? If so, yes: nixpkgs did not use the option in a way that breaks updates. I believe I also didn't suggest that.

It's all other users of the option that accidentally break updates.

For example, https://emudhra.we-have-a-problem.com/#linux contains

On NixOS, add to your configuration:

security.pki.caCertificateBlacklist = [
  "Comodo AAA Services root"
  "emSign ECC Root CA - G3"
];

and I, too, used caCertificateBlacklist in configuration.nix on my own machines immediately as a mitigation, independent from nixpkg's mitigation in 16ac0cd. Thus, the cacert update later broke the build.

I'm not sure if beginner-me would have been able to reasonably verify such a change

I totally get the need to verify if these strings people mark as forbidden, are the right ones. If instead of emSign Root CA - C1 you typo it to emSign Root CA-C1, it might silently match nothing. That's why I think that the recommendation this PR adds,

check that the CAs are marked as not trusted in /etc/ssl/certs/ca-certificates.crt, or temporarily use security.pki.caCertificateBlocklistFailOnNonMatching and switch back to this option once you've checked that the name is correct

is a good one.

That said, even this typo-finding help cannot guarantee exhaustiveness, e.g. the merged mitigation included

      "Comodo AAA Services root"
      "emSign ECC Root CA - G3"
      "emSign Root CA - C1"
      "emSign ECC Root CA - C3"

which is more entries than emudhra.we-have-a-problem.com suggested, and no typo-finding error would help with pointing out missing entries.


Based on that, I think it is fine to argue that nixpkgs should be "more allowed" to use caCertificateBlocklistFailOnNonMatching than third-parties, or users in their configuration.nix, because it can atomically revert entries to it combined with the cacert update, as demonstrated by f903b88.

But it's still a somewhat weak argument, because if a user instead of the blocklist option patched cacert themselvs instead, then nixpkgs' blacklisting in 16ac0cd would have broken the user's updates.

That's why I think it's best, for both nixpkgs and users in configuration.nix, to use caCertificateBlocklistIgnoreNonMatching, and use caCertificateBlocklistFailOnNonMatching only for temporary typo-checking (and cases where users really want to opt into caCertificateBlocklistFailOnNonMatching behaviour, e.g. if some CA was banned by Mozilla and unbanned later, but the user has a grude or regulation or whatever against that CA and wants to ensure that never again in the future will their machine accept that CA, and would rather have things break loudly than that to happen).

I think this is a sensible argument, and common practice with such blocklists. For example, for "Copy Fail" people blocklisted the algif_aead kernel module as immediate mitigation; that blocklist is lenient so that if Linux eventually chooses to get rid of algif_aead, computers will still boot.

Let me know if I that answers the question!

@nh2

nh2 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@Ma27 Just checking in what you think about the above.

@Ma27

Ma27 commented Nov 20, 2026

Copy link
Copy Markdown
Member

Apologies for not replying earlier, thanks for paging me!

So, long story short I think my first question could've been reduced to "why bother blocking CAs yourself if nixpkgs does it already for you at all?", coming back with a fresh mind I see at least two reasons for this:

Now, I didn't intend to argue against this, but I was mostly wondering if the docs should say something along the lines of "Use caCertificateBlocklistFailOnNonMatching unless you know what you're doing" given I considered the case you ran into rather unlikely.

Looking back at this (including the additional information about the recommendation to ignore on we-have-a-problem.com) I think the way you present both options in the docs is fine, so nothing to address here from my side.

@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 20, 2026
@nh2

nh2 commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

"why bother blocking CAs yourself if nixpkgs does it already for you at all?"

@Ma27 I think the biggest reason for that is "anybody can do that way faster (mitigating immeidatly) than it takes NixOS to do a channel update".

And I think that's a good idea, so also think it's good that we-have-a-problem.com recommends a mitigation. It just doesn't recommend a good mitigation because NixOS so far didn't provide the right option it could use for it.

That's also why I don't find the situation too unlikely.

@lukegb Would you have a chance to check out nix-community/buildcatrust#19 ? Then I could make this a non-draft-PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants