-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firefox shows public certificate authorities as “not recognized by Mozilla” #126065
Comments
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. |
/**
* Returns whether the issuer of the current certificate chain is
* built-in (returns false) or imported (returns true).
*/
_hasCustomRoot() {
let issuerCert = null;
issuerCert = this._secInfo.succeededCertChain[
this._secInfo.succeededCertChain.length - 1
];
return !issuerCert.isBuiltInRoot;
}, browser/base/content/browser-siteIdentity.js Looks to be this // The term "builtin root" traditionally refers to a root CA certificate that
// has been added to the NSS trust store, because it has been approved
// for inclusion according to the Mozilla CA policy, and might be accepted
// by Mozilla applications as an issuer for certificates seen on the public web.
Result IsCertBuiltInRoot(CERTCertificate* cert, bool& result) {
if (NS_FAILED(BlockUntilLoadableCertsLoaded())) {
return Result::FATAL_ERROR_LIBRARY_FAILURE;
}
result = false;
#ifdef DEBUG
nsCOMPtr<nsINSSComponent> component(do_GetService(PSM_COMPONENT_CONTRACTID));
if (!component) {
return Result::FATAL_ERROR_LIBRARY_FAILURE;
}
nsresult rv = component->IsCertTestBuiltInRoot(cert, &result);
if (NS_FAILED(rv)) {
return Result::FATAL_ERROR_LIBRARY_FAILURE;
}
if (result) {
return Success;
}
#endif // DEBUG
AutoSECMODListReadLock lock;
for (SECMODModuleList* list = SECMOD_GetDefaultModuleList(); list;
list = list->next) {
for (int i = 0; i < list->module->slotCount; i++) {
PK11SlotInfo* slot = list->module->slots[i];
// We're searching for the "builtin root module", which is a module that
// contains an object with a CKA_CLASS of CKO_NETSCAPE_BUILTIN_ROOT_LIST.
// We use PK11_HasRootCerts() to identify a module with that property.
// In the past, we exclusively used the PKCS#11 module named nssckbi,
// which is provided by the NSS library.
// Nowadays, some distributions use a replacement module, which contains
// the builtin roots, but which also contains additional CA certificates,
// such as CAs trusted in a local deployment.
// We want to be able to distinguish between these two categories,
// because a CA, which may issue certificates for the public web,
// is expected to comply with additional requirements.
// If the certificate has attribute CKA_NSS_MOZILLA_CA_POLICY set to true,
// then we treat it as a "builtin root".
if (PK11_IsPresent(slot) && PK11_HasRootCerts(slot)) {
CK_OBJECT_HANDLE handle = PK11_FindCertInSlot(slot, cert, nullptr);
if (handle != CK_INVALID_HANDLE &&
PK11_HasAttributeSet(slot, handle, CKA_NSS_MOZILLA_CA_POLICY,
false)) {
// Attribute was found, and is set to true
result = true;
break;
}
}
}
}
return Success;
} security/certverifier/CertVerifier.cpp So it comes down to the 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. |
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. |
Looks like it. In nixpkgs p11-kit uses
Note |
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 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. |
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: /usr/bin/p11-kit extract --format=openssl-bundle --filter=certificates --overwrite --comment $DEST/openssl/ca-bundle.trust.crt
/usr/bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --comment --purpose server-auth $DEST/pem/tls-ca-bundle.pem
/usr/bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --comment --purpose email $DEST/pem/email-ca-bundle.pem
/usr/bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --comment --purpose code-signing $DEST/pem/objsign-ca-bundle.pem
/usr/bin/p11-kit extract --format=java-cacerts --filter=ca-anchors --overwrite --purpose server-auth $DEST/java/cacerts
/usr/bin/p11-kit extract --format=edk2-cacerts --filter=ca-anchors --overwrite --purpose=server-auth $DEST/edk2/cacerts.bin Doing it like this, however, would bring And we will need to do something with |
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. |
I'll try to look at this this evening. |
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.
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 self: super: {
firefox = super.firefox.override {
nss = unstable.nss.override { useP11kit = false; };
};
} |
Quickfix to allow firefox to recognize certificates as trusted by Mozilla. Related: NixOS#126065
So at least the emergency fix is in 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. |
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. |
AFAIU andir and lukgeb are working on updating the cacert/p11-kit packaging so that we can eventually reenable the integration. |
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? |
It isn't the chosen long-term solution, but the issue itself is resolved. The long-term solution will be #136777. |
Thanks! |
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:
pkgs.firefox
package.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).
Screenshots
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 buildnss
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
withinstall_url
pointing tohttps://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
"x86_64-linux"
Linux 5.10.37, NixOS, 21.05.20210604.aa57635 (Okapi)
yes
yes
nix-env (Nix) 2.4pre20210601_5985b8b
/nix/store/zjmnwn76xzxw3j7v1p98fd0aywpvyylf-source
Maintainer information:
The text was updated successfully, but these errors were encountered: