You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should security.pki.caCertificateBlacklist warn instead of error when encountering certificates not in the trust store? #249080
You can use security.pki.caCertificateBlacklist to opt out of importing certain certificates from Mozilla's trust store. This is a very useful option for people who want to be extra cautious.
However, if a certificate that's on the blocklist gets removed by upstream (which is quite common, the lesser-known and lesser-trustworthy CAs are both the most likely to get blocklisted and to get removed upstream), the module will give a build error like this:
Certs in blocklist but not in cert store: {'Hongkong Post Root CA 1'}
In practice, this has some quite regrettable consequences. Folks who are proactive about CA management are punished by frequent breakage when they update nixpkgs. Worse: if you then remove those CAs from the blocklist, everything builds fine, but if the CAs are re-added to the original trust store (for instance because you downgraded nixpkgs again) you will silently start trusting them again! It is also highly inconvenient for anybody trying to write re-usable NixOS modules using this option that are supposed to work on several NixOS releases.
I think it would be much better if this was a warning, not a build error.
I'm not sure there's a great way of dealing with this.
This is deliberately a fatal error because, if it isn't, it's easy to end up not distrusting what you thought you were distrusting because the name doesn't match exactly.
If you're paranoid enough to want to distrust arbitrary CAs then you should already be keeping up to date with every cacerts bump anyway, because each new release might add a new CA that meets your criteria for being dropped. You can also parameterize your distrust list based on the cacerts version if you think you'll be moving backwards and forwards often.
In terms of finding a middle ground, though: I'd be supportive of adding an option to buildcatrust to downgrade the error to a warning and then expose that in the module as an option, though.
If you're paranoid enough to want to distrust arbitrary CAs then you should already be keeping up to date with every cacerts bump anyway, because each new release might add a new CA that meets your criteria for being dropped. You can also parameterize your distrust list based on the cacerts version if you think you'll be moving backwards and forwards often.
That is a good point. In fact, I think a bunch of people would like an allowlist-type option instead.
You can of course remove the entire trust-store and provide your own PEMs, but that is quite a steep usability cliff.
Do you think an allowlist-by-name option that still takes the certificates thus named from the trust-store would be a good idea?
In that scenario, if you misspell a CA's name, it would still build, but then later fail "loudly" as you get cert validation errors. So it is fail-safe in that sense.
Taking another look at this in the interest of Spring Cleaning.
I think @lukegb's reasoning is sound, and the current somewhat inconvenient way is better than one that will silently fail to meet security requirements.
We can still consider an allowlist-style option in a future issue, but I'll close this for now.
only to notice some days later that this build error Certs in blocklist but not in cert store: {'emSign ECC Root CA - G3'} completly broke system.autoUpgrade and thus stopping ALL security updates of my servers, including the fix for CVE-2026-98432, the Linux IP options remote code execution bug (nixpkgs tracker).
This drawback of caCertificateBlacklist was separately noticed in:
The workaround presented in there, lib.optionals (lib.versionOlder pkgs.cacert.version "3.131.1") [ ... ] is not a general solution because it requires that a new version to compare against must already be released and known.
No other blacklisting system I am aware of behaves like this, e.g. if you blacklist a kernel module, it'll not break your kernel from booting if that module doesn't exist.
I understand the desire to not typo the name, but killing NixOS's main security update mechanism for it is the wrong tradeoff.
If available at all, such a breaking mechanism should have the behaviour in the name, e.g. caCertificateBlacklistFailOnNonexistent, and the NixOS option description of that should make very clear how using it will break the system build in the future.
Then caCertificateBlacklist itself should ignore nonexistent one, and perhaps output a nss-cacert package-build-time warning, instead of an error.
@lukegb In your newer feature --distrust_bundle_input you already support lenient-ness, right?
It seems cleanest to me to just add a flag that makes the name-based check lenient, and then have both caCertificateBlacklistFailOnNonexistent for strong and caCertificateBlacklist for lenient.
Then users can choose if they want to fail hard on absence or just "add to blacklist" behaviour.
@bjornfor Eval feels difficult because of IFD. With my proposal there's no "default" option; there'd be 2 NixOS options (one failing loudly on absence in the certstore, one failing leniently), and they could even be combined (so you can name some certificates that shall fail loudly, and others that fail leniently).
--distrust_bundle_input doesn't really factor into this - any certs you provide there end up added to the cert store and then explicitly distrusted, so it doesn't really have the same problem and is useful for e.g. intermediates, because then you can keep root trust and drop the intermediate... on systems which can support that - so software that consumes the trust bundle that includes trust rules. upki will hopefully make this better, but we're not there yet.
TBH I think it's a better UX than listing the names of the certs, but it's not in a release nor exposed as an option yet, in part due to the drawbacks.
Activity
whentze commentedon Aug 14, 2023
Pinging @fpletz and @lukegb who are listed as maintainers for
pkgs.cacertlukegb commentedon Aug 14, 2023
I'm not sure there's a great way of dealing with this.
This is deliberately a fatal error because, if it isn't, it's easy to end up not distrusting what you thought you were distrusting because the name doesn't match exactly.
If you're paranoid enough to want to distrust arbitrary CAs then you should already be keeping up to date with every cacerts bump anyway, because each new release might add a new CA that meets your criteria for being dropped. You can also parameterize your distrust list based on the cacerts version if you think you'll be moving backwards and forwards often.
In terms of finding a middle ground, though: I'd be supportive of adding an option to buildcatrust to downgrade the error to a warning and then expose that in the module as an option, though.
whentze commentedon Aug 14, 2023
Hey, thanks so much for the quick respones :)
That is a good point. In fact, I think a bunch of people would like an allowlist-type option instead.
You can of course remove the entire trust-store and provide your own PEMs, but that is quite a steep usability cliff.
Do you think an allowlist-by-name option that still takes the certificates thus named from the trust-store would be a good idea?
In that scenario, if you misspell a CA's name, it would still build, but then later fail "loudly" as you get cert validation errors. So it is fail-safe in that sense.
whentze commentedon Apr 22, 2024
Taking another look at this in the interest of Spring Cleaning.
I think @lukegb's reasoning is sound, and the current somewhat inconvenient way is better than one that will silently fail to meet security requirements.
We can still consider an allowlist-style option in a future issue, but I'll close this for now.
refactor(pki): leave the eMudhra distrust to upstream
nh2 commentedon Nov 1, 2026
I am reopening this because this isn't really a workable situation: It breaks automatic security updates.
I used
security.pki.caCertificateBlacklistto mitigate the eMudhra CA compromiseonly to notice some days later that this build error
Certs in blocklist but not in cert store: {'emSign ECC Root CA - G3'}completly brokesystem.autoUpgradeand thus stopping ALL security updates of my servers, including the fix for CVE-2026-98432, the Linux IP options remote code execution bug (nixpkgs tracker).This drawback of
caCertificateBlacklistwas separately noticed in:lib.optionals (lib.versionOlder pkgs.cacert.version "3.131.1") [ ... ]is not a general solution because it requires that a new version to compare against must already be released and known.No other blacklisting system I am aware of behaves like this, e.g. if you blacklist a kernel module, it'll not break your kernel from booting if that module doesn't exist.
I understand the desire to not typo the name, but killing NixOS's main security update mechanism for it is the wrong tradeoff.
If available at all, such a breaking mechanism should have the behaviour in the name, e.g.
caCertificateBlacklistFailOnNonexistent, and the NixOS option description of that should make very clear how using it will break the system build in the future.Then
caCertificateBlacklistitself should ignore nonexistent one, and perhaps output anss-cacertpackage-build-time warning, instead of an error.nh2 commentedon Nov 1, 2026
Moving the discussion from #576485 (comment) to here:
@lukegb In your newer feature
--distrust_bundle_inputyou already support lenient-ness, right?It seems cleanest to me to just add a flag that makes the name-based check lenient, and then have both
caCertificateBlacklistFailOnNonexistentfor strong andcaCertificateBlacklistfor lenient.Then users can choose if they want to fail hard on absence or just "add to blacklist" behaviour.
bjornfor commentedon Nov 1, 2026
Data point: I'd like the default to be eval time error, and if that's difficult, build time error. Degrading to warning only by opt-in.
nh2 commentedon Nov 1, 2026
@bjornfor Eval feels difficult because of IFD. With my proposal there's no "default" option; there'd be 2 NixOS options (one failing loudly on absence in the certstore, one failing leniently), and they could even be combined (so you can name some certificates that shall fail loudly, and others that fail leniently).
lukegb commentedon Nov 1, 2026
--distrust_bundle_inputdoesn't really factor into this - any certs you provide there end up added to the cert store and then explicitly distrusted, so it doesn't really have the same problem and is useful for e.g. intermediates, because then you can keep root trust and drop the intermediate... on systems which can support that - so software that consumes the trust bundle that includes trust rules. upki will hopefully make this better, but we're not there yet.TBH I think it's a better UX than listing the names of the certs, but it's not in a release nor exposed as an option yet, in part due to the drawbacks.
nh2 commentedon Nov 1, 2026
@lukegb I'm currently working on a draft option for what I suggest, for both
buildcatrustand nixpkgs. Will ping you shortly.Add --blocklist_ignoring_nonmatching_input
nh2 commentedon Nov 1, 2026
@lukegb I made:
buildcatrustPR:--blocklist_ignoring_nonmatching_inputnix-community/buildcatrust#19caCertificateBlocklistFailOnNonMatchingandcaCertificateBlocklistIgnoreNonMatching#581985Drop emSign ECC Root CA - G3 from the cacert blacklist