SSL trust not system-wide

Bug #1647285 reported by dwmw2 on 2016-12-05
100
This bug affects 16 people
Affects Status Importance Assigned to Milestone
ca-certificates (Ubuntu)
Wishlist
Unassigned
firefox (Ubuntu)
Undecided
Olivier Tilloy
nss (Ubuntu)
Wishlist
Unassigned
p11-kit (Ubuntu)
Undecided
Unassigned
thunderbird (Ubuntu)
Undecided
Olivier Tilloy

Bug Description

When I install a corporate CA trust root with update-ca-certificates, it doesn't seem to work everywhere. Various things like Firefox, Evolution, Chrome, etc. all fail to trust the newly-installed trusted CA.

This ought to work, and does on other distributions. In p11-kit there is a module p11-kit-trust.so which can be used as a drop-in replacement for NSS's own libnssckbi.so trust root module, but which reads from the system's configured trust setup instead of the hard-coded version.

This allows us to install the corporate CAs just once, and then file a bug against any package that *doesn't* then trust them.

See https://fedoraproject.org/wiki/Features/SharedSystemCertificates for some of the historical details from when this feature was first implemented, but this is all now supported upstream and not at all distribution-specific. There shouldn't be any significant work required; it's mostly just a case of configuring and building it to make use of this functionality. (With 'alternatives' to let you substitute p11-kit-trust.so for the original NSS libnssckbi.so, etc.)

dwmw2 (dwmw2) on 2016-12-05
no longer affects: network-manager-openconnect (Ubuntu)
dwmw2 (dwmw2) wrote :

It does seem that p11-kit-trust.so is working correctly. If I just make a symlink from libnssckbi.so to it, corporate trust installed by update-ca-certificates *does* work in Firefox.

Hi dwmw2,
thank you for your bug report and your help to make Ubuntu better.

I beg a pardon as I'm clearly not an expert on this particular area, but I try to sort out the details of this bug report to understand what has to be done.

Currently I understand this as feature request to make update-ca-certificates (almost?) all certificate users in one shot.

The current default config doesn't do that

Thanks for pointing out the links and background to this.

The answer on this thread is what I think the current state is http://superuser.com/questions/437330/how-do-you-add-a-certificate-authority-ca-to-ubuntu
and I understand and agree that to get this as "one shot accept this CA" is a valid feature-request-bug.

I happened to find various similar/related on other projects like firefox for example:
https://bugzilla.mozilla.org/show_bug.cgi?id=620373
https://bugzilla.mozilla.org/show_bug.cgi?id=449498
https://bugzilla.mozilla.org/show_bug.cgi?id=454036
There might be more for others, but it seems to fix the whole thing a Distribution would need to modify all consuming packages to agree on sort of a shared path and mechanism.

Ok, so far I was just trying to wrap my head around this a bit, I guess the next step clearly is the security Teams position on this in general - so I subscribe them for a statement.
Maybe they also know on past or existing approaches to this.

@Security Team - do you happen to know about this overall topic and could you share either whatever was the outcome of such discussions in the past or OTOH what you assert on this as a feature request would be?

Changed in ca-certificates (Ubuntu):
status: New → Incomplete
importance: Undecided → Wishlist
Changed in nss (Ubuntu):
status: New → Incomplete
importance: Undecided → Wishlist
dwmw2 (dwmw2) wrote :

The Mozilla bugs you link are a bit of a red herring. They refer to an abortive attempt by Mozilla/NSS to have a 'shared system database' in sql:/etc/pki/nssdb. The idea is that applications specify that as their NSS database and although it's obviously read-only, it automatically adds the user's database from ~/.pki/nssdb as a writeable token. This gets a step towards consistency for all NSS-using applications — but as those bugs note, not even Mozilla's own products are actually using it. You should support that anyway, but it isn't the focus of this bug.

The fix here (which has been working in Fedora for years, since you ask for existing approaches) is to replace NSS's built-in trust root module libnssckbi.so with a symlink to p11-kit-trust.so. Then you get the system's configured trust roots, instead of whatever's hard-coded into that particular instance of libnssckbi.so (and you're shipping multiple potentially different ones of those!)

Robie Basak (racb) on 2016-12-15
Changed in ca-certificates (Ubuntu):
status: Incomplete → New
Changed in nss (Ubuntu):
status: Incomplete → New
dwmw2 (dwmw2) wrote :

I believe we need to update p11-kit to v0.23.4 to make the key pinning work correctly in the recommended configuration, by adding the CKA_NSS_MOZILLA_CA_POLICY attribute.

https://bugs.freedesktop.org/show_bug.cgi?id=99453
https://bugzilla.mozilla.org/show_bug.cgi?id=1324096

dwmw2 (dwmw2) wrote :

I believe NSS wants these patches backported from 3.30:
https://bugzilla.mozilla.org/show_bug.cgi?id=1334976

Firefox has its own copy of NSS which I think as of Firefox 54 should be fine.
Thunderbird also needs fixing, I think.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ca-certificates (Ubuntu):
status: New → Confirmed
Changed in nss (Ubuntu):
status: New → Confirmed
Changed in p11-kit (Ubuntu):
status: New → Confirmed
Changed in thunderbird (Ubuntu):
status: New → Confirmed
dwmw2 (dwmw2) wrote :

Any progress on fixing this?

Tomas Pospisek (tpo-deb) wrote :

Wow, unified CA management would be awesome. No more fiddling around with (and forgetting to correctly install/remove certificates in) various applications (most notably in Firefox, Chromium, wget).

No progress on this yet, afaik it is just not high up on anyone's personal task list :-/

Orion-cora (orion-cora) wrote :

I'm trying to make use of this in Ubuntu 14.04 with p11-kit 0.23.2-5~ubuntu16.04.1, but get the following error:

# trust list
p11-kit: ca-certificates.crt: BEGIN ...: pem block before p11-kit section header
p11-kit: ca-certificates.crt: BEGIN ...: pem block before p11-kit section header

Is p11-kit just too old there?

Andreas Hasenack (ahasenack) wrote :

This isn't "just" a bug, it's a roadmap item in my view, as many products are affected. It needs a spec, like in the fedora case. I agree that it would be awesome to have this.

Kevin (kvasko) wrote :

@dwmw2

Were you able to make this work by doing this for firefox?

sudo mv /usr/lib/firefox/libnssckbi.so /usr/lib/firefox/libnssckbi.so.bak
sudo ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/firefox/libnssckbi.so

https://askubuntu.com/questions/244582/add-certificate-authorities-system-wide-on-firefox/1036637#1036637

I wasn't able to get it to work. Doing the above doesn't work at all for me. I'm on 18.04.3

Timo Aaltonen (tjaalton) wrote :

should this be marked as something to fix in focal for the next LTS?

dwmw2 (dwmw2) wrote :

@kvasko yes, it works here. Are you sure that's the version of libnssckbi.so that is being used? There are lots; I've replaced them all...

Kevin (kvasko) wrote :

@dwmw2,

I figured out the issue. Long story short, freeipa (which is our CA), when we enroll a PC into the realm, it adds the freeIPA cert to /etc/ssl/certs/ca-certificates.crt like it should, however it also adds other information that it shouldn't.

This results in p11-kit-trust.so blowing parsing errors.

You can read the entire bug report here if you want.

https://pagure.io/freeipa/issue/8106

Harout S. Hedeshian (harout) wrote :

Like others, I'm manually symlinking .so files on all of my interactive hosts and hoping updates don't break it. IMO this is not a valid workaround.

@ahasenack - I understand this is a roadmap item that would ideally resolve for multiple packages, but it seems that the Mozilla products are the worst offenders at the moment. I don't see anyone requesting anything else in this bug. Would it be possible to at least resolve it for Firefox and Thunderbird? What would it take to get this looked at for the next LTS?

For now, Thunderbird needs this too (and works for me on 18.0.3 LTS):

sudo mv /usr/lib/firefox/libnssckbi.so /usr/lib/firefox/libnssckbi.so.bak
sudo ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/firefox/libnssckbi.so
sudo mv /usr/lib/thunderbird/libnssckbi.so /usr/lib/thunderbird/libnssckbi.so.bak
sudo ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/thunderbird/libnssckbi.so

Timo Aaltonen (tjaalton) wrote :

nss should have everything on focal

Changed in nss (Ubuntu):
status: Confirmed → Fix Released
Timo Aaltonen (tjaalton) wrote :

p11-kit too

Changed in p11-kit (Ubuntu):
status: Confirmed → Fix Released
Timo Aaltonen (tjaalton) wrote :

according to #4 nss should still symlink libnssckbi.so to p11-kit-trust.so

Changed in nss (Ubuntu):
status: Fix Released → Confirmed
Olivier Tilloy (osomon) wrote :

It looks like symlinking firefox and thunderbird's own copies of libnssckbi.so to the system-wide p11-kit-trust.so is the proper way to fix this bug, as far as Mozilla's products are concerned.

Before I proceed to doing this, I'd welcome comments from the security team on this approach though, as I suspect I don't understand all the implications.

(an alternative would be building firefox/thunderbird against the system-wide nss, but firefox currently requires 3.50, which isn't yet in focal, and I suspect that requirement is being bumped often, so that wouldn't really work with our distribution model)

Changed in firefox (Ubuntu):
status: New → Confirmed
assignee: nobody → Olivier Tilloy (osomon)
Changed in thunderbird (Ubuntu):
assignee: nobody → Olivier Tilloy (osomon)

On Thu, 2020-03-19 at 09:44 +0000, Olivier Tilloy wrote:
> It looks like symlinking firefox and thunderbird's own copies of
> libnssckbi.so to the system-wide p11-kit-trust.so is the proper way to
> fix this bug, as far as Mozilla's products are concerned.
>
> Before I proceed to doing this, I'd welcome comments from the security
> team on this approach though, as I suspect I don't understand all the
> implications.
>
> (an alternative would be building firefox/thunderbird against the
> system-wide nss, but firefox currently requires 3.50, which isn't yet in
> focal, and I suspect that requirement is being bumped often, so that
> wouldn't really work with our distribution model)

Right, don't bother trying to replace NSS just for this (although
really, having a single version of NSS on the system *would* be nice).

The interface to libnssckbi.so is a standard PKCS#11 library, and it's
perfectly reasonable to replace that in each of
firefox/thunderbird/chromium individually.

Marc Deslauriers (mdeslaur) wrote :

Before we switch any software to using p11-kit-trust.so, we need to fix our ca-certificates package to properly handle untrusted or blacklisted certificates. At the moment, I believe they are simply skipped when generating the contents of /usr/share/ca-certificates.

Timo Aaltonen (tjaalton) wrote :

so what does it require to fix ca-certificates?

Marc Deslauriers (mdeslaur) wrote :

Looks like Fedora substantially modified the scripts used by ca-certificates to extract untrusted and blacklisted certs. We should probably start by investigating how their package is handling this, what files they are generating, and if they are being properly handled by p11-kit-trust.

So for the avoidance of doubt, every independent distro has its own custom ca-certificates package with no shared history. I know Debian, Fedora, and openSUSE all have their own completely separate upstreams. Looking at what Fedora does is probably a good idea indeed, just keep in mind it has no shared history with Debian's package. I took a quick look at openSUSE's package and it looks like it has good p11-kit integration as well. Arch uses Fedora; not sure about other independent distros. They all use Mozilla's certificates, but Mozilla doesn't release a package in a way that's directly usable by distros.

Debian's ca-certificates implements certificate blacklisting by putting a ! character at the start of a line in /etc/ca-certificates.conf (which doesn't exist on other distros). Once a certificate is removed, it stays removed, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=743339 which was never fixed.

Marc Deslauriers (mdeslaur) wrote :

Unfortunately, the ! character at the beginning the the line in ca-certificates.conf is just for blacklisting ca certificates from being imported into the system store, it's not really a backlist that can be used by a crypto library.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.