Repository navigation
Description
Describe the bug
Firefox (from pkgs.firefox) shows “Connection verified by a certificate issuer that is not recognized by Mozilla” even for well-known public certificate authorities (DigiCert, Let's Encrypt, …).
To Reproduce
Steps to reproduce the behavior:
- Install Firefox on NixOS 21.05 from the unmodified
pkgs.firefoxpackage. - Start Firefox with an empty profile; it helpfully opens the “Firefox Privacy Notice” page from https://www.mozilla.org/en-US/privacy/firefox/ (you can also open https://addons.mozilla.org, https://www.nixos.org/, …)
- Click the padlock icon to the left of the URL bar to open the site information popup.
- Observe the warning: “Connection verified by a certificate issuer that is not recognized by Mozilla”.
Expected behavior
Firefox should not show warnings about not recognized certificate issuers when the site certificate was issued by a well-known public certificate authority (not by some local CA added via policy).
Additional context
Tested Firefox 89.0 at the most recent nixos-21.05 commit at the moment (5de44c1), 88.0.1 @ d6229c7, 87.0 @ 29058f9 — they are all affected; not sure whether it is possible to test some older versions without the need to build them from source. Firefox 78.11.0esr (pkgs.firefox-esr) does not have the problem, but I'm not sure whether that older version is actually able to show that warning.
Apparently this is caused by the nss change to use p11-kit (#96763). Just for testing I tried to build nss without that option:
nix profile install --impure --expr '(import <nixpkgs> {}).nss.override { useP11kit = false; }'When I inject that library version into Firefox using LD_PRELOAD=$HOME/.nix-profile/lib/libnss3.so, the warning about “certificate issuer that is not recognized by Mozilla” disappears.
Note that the problems in Firefox are apparently not limited to that warning — extension installation using extraPolicies.ExtensionSettings with install_url pointing to https://addons.mozilla.org/ also does not work, showing messages complaining about unrecognized certificates. The addon manager, however, still works even in this configuration.
Notify maintainers
@rnhmjoj
@ajs124
@mweinelt
@lovesegfault
Metadata
- system:
"x86_64-linux" - host os:
Linux 5.10.37, NixOS, 21.05.20210604.aa57635 (Okapi) - multi-user?:
yes - sandbox:
yes - version:
nix-env (Nix) 2.4pre20210601_5985b8b - nixpkgs:
/nix/store/zjmnwn76xzxw3j7v1p98fd0aywpvyylf-source
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
Activity
[-]Firefox show public certificate authorities as “not recognized by Mozilla”[/-][+]Firefox shows public certificate authorities as “not recognized by Mozilla”[/+]mweinelt commentedon Jun 7, 2021
Right, so nss uses p11kit since #96763 to make every nss consumer rely on the system certificate store. We could rebuild firefox with the nss override you mentioned, that would then decouple firefox from the central certificate store, but the kicker is, that our cacert package is extracted from nss itself, so it is in fact the same IIUC. So it might make sense to look into how they certify those, that makes Firefox see them as recognized.
mweinelt commentedon Jun 7, 2021
browser/base/content/browser-siteIdentity.js
Looks to be this
isBuiltInRootattribute, which is ultimately hooked into this function:security/certverifier/CertVerifier.cpp
So it comes down to the
CKA_NSS_MOZILLA_CA_POLICYattribute on a certificate. Why do we loose that when using p11-kit? I guess this could be because ofcertdata2pem.pyused in the cacert package.But apparently p11-kit should support CKA_NSS_MOZILLA_CA_POLICY, see https://github.com/p11-glue/p11-kit/pull/46/files. So maybe it is a problem in our p11-kit packaging.
ajs124 commentedon Jun 7, 2021
The reason why this doesn't happen with firefox esr 78 is that that uses an older version of nss, in which we didn't have p11-kit support yet.
sigprof commentedon Jun 7, 2021
Looks like it. In nixpkgs p11-kit uses
--with-trust-paths=/etc/ssl/certs/ca-certificates.crt— this is apparently a plain OpenSSL-compatible certificate bundle which does not contain any certificate attributes. But in Fedora p11-kit is configured like this (they build it with meson):/usr/share/pki/ca-trust-sourcecomes from theca-certificatespackage, and containsca-bundle.trust.p11-kit, which looks like this:Note
nss-mozilla-ca-policy: true— this format supports such certificate attributes. Fedora also has some scripts in their packages that can extract the certificate information from that format and write it out in various other formats, such as OpenSSL-compatible certificate bundle, Java key store, …ajs124 commentedon Jun 7, 2021
There was an attempt to build p11-kit with meson before, in #73341, although that seems to have stalled.
So maybe we should also modify our
cacertpackage to include this?On a side-note, Arch Linux also seems to use a different cacertdata2pem.py script from us, which looks like it generates a file like this.
sigprof commentedon Jun 7, 2021
Yes, and apparently it's even the same script as the one used in Fedora.
Yes, this would make sense. Fedora treats the p11-kit format as the master one, and generates all other formats from it:
Doing it like this, however, would bring
p11-kitinto the dependency chain ofcacerts, which might not be desired.And we will need to do something with
nixos/modules/security/ca.nix— these options should also affect the contents ofca-bundle.trust.p11-kitsomehow.mweinelt commentedon Jun 7, 2021
Agreed, let's try that route (the fedora one), we are also leaning on them for firefox sometimes and they have dedicated people for this stuff.
ajs124 commentedon Jun 8, 2021
I'm not sure if and when I'll have some time to further look into this. Do any of you think you'll get around to working on this in the foreseeable future?
Also, we should probably get the cacert maintainers in here cc @andir @lukegb
lukegb commentedon Jun 8, 2021
I'll try to look at this this evening.
dasJ commentedon Jun 8, 2021
I don't see this mentioned here but it's currently not possible to install add-ons or to update them. This also includes the automatic update functionality.
Installing an add-on from AMO:

Running the auto-updater from about:addons top-right cogwheel tells me there are no updates.
However opening the browser console from the developer menu shows something like:
This is a critical security problem since plugins with vulnerabilities are not updateable without manual work to disable certificate verification. cc @NixOS/security-notifications
@ajs124 committed a downstream
fixworkaround for this in our overlay (hope it's okay to share ;):firefox: use nss without p11-kit
sigprof commentedon Jun 11, 2021
So at least the emergency fix is in
nixos-21.05now, and seems to work — there is no scary warning about unrecognized certificate issuer, and addon installation and updating seems to work (I did not immediately notice this part of the problem, because I was using an existing profile with the needed addons already installed). Did not test theextraPolicies.ExtensionSettingspart yet, but I guess that the addon installation would work too.Should I just close this issue now (because the Firefox part has been handled), or would you prefer to keep it open, even though the problem in the form described at the first message does not exist anymore?
Also I just found #8247, where this change should probably be noted too.
rnhmjoj commentedon Jun 11, 2021
The issue with Firefox is solved by simply turning off p11-kit integration, it 100% undoes the change in #96763. So, yeah le'ts close this.
mweinelt commentedon Jun 11, 2021
AFAIU andir and lukgeb are working on updating the cacert/p11-kit packaging so that we can eventually reenable the integration.
felixsinger commentedon Sep 14, 2021
Why was the issue closed? In my opinion, disabling p11-kit is not a good long-term solution. What is the status of the cacert / p11-kit packaging? Any updates?
mweinelt commentedon Sep 14, 2021
It isn't the chosen long-term solution, but the issue itself is resolved.
The long-term solution will be #136777.
felixsinger commentedon Sep 14, 2021
Thanks!