Make SSSD in 20.04 using OpenSSL and p11-kit (instead of NSS) for p11_child
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sssd (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Focal |
Fix Released
|
High
|
Marco Trevisan (Treviño) |
Bug Description
[ Impact ]
SSSD supports in 20.04 two security backends: NSS and OpenSSL
(speaking in past tense as upstream dropped NSS support completely).
Those two backends are used for various generic crypto features (so they are interchangeable), but also for the management of the PKCS#11 modules for smart cards.
In this case, the main problem is that by using NSS it also relies on the presence of a "system NSS" database [1] that is something present in Fedora and RHEL, but not in ubuntu or generic Linux distributions.
In order to make SSSD to find a smart card module, we would then need to create a such database that mentions a p11kit proxy that will eventually load the p11-kit module and then add the card CA certificate to the same DB (see more details in [2]).
And even in such case... It will not work at login phase.
This is making support for Smart-card based authentication in 20.04 quite complicated, and hard to implement in professional environments (see bug #1865226).
As per this, recompiling SSSD's p11_child to use OpenSSL (as it already happens starting from 20.10) would be enough to make the this tool (the one in charge for smartcard authentications and certificate matching) to be able to get the smartcard devices from p11-kit allowed modules and to check their certificate using CA certificates in the ubuntu system ca certificate files (or other configured file).
One more mayor reason to do this, is also that if we fix 20.04 now to use the "proper" method, people who will configure smartcard access there via SSSD (not easily possible right now) won't be affected by future migrations.
[ Proposed Implementations ]
1) Use p11-kit and openssl for p11_child, by changing the build/test system (preferred)
https:/
2) Build both versions and package things accordingly (hackish)
https:/
3) Recompile SSSD completely to use libcrypto as backend
The option 3) has been finally choosen, but we also require migration scripts on upgrade.
[ Test case ]
With a smartcard reader available (and with a card in its slot) as reported by:
$ p11-kit list-modules
launch:
$ sudo /usr/libexec/
--nssdb=
The tool should find your card:
(2020-11-26 21:34:22:020395): [p11_child[100729]] [do_card] (0x4000): Module List:
(2020-11-26 21:34:22:020481): [p11_child[100729]] [do_card] (0x4000): common name: [p11-kit-trust].
(2020-11-26 21:34:22:020497): [p11_child[100729]] [do_card] (0x4000): dll name: [/usr/lib/
(2020-11-26 21:34:22:020569): [p11_child[100729]] [do_card] (0x4000): Description [/etc/ssl/
(2020-11-26 21:34:22:020611): [p11_child[100729]] [do_card] (0x4000): common name: [opensc-pkcs11].
(2020-11-26 21:34:22:020646): [p11_child[100729]] [do_card] (0x4000): dll name: [/usr/lib/
(2020-11-26 21:34:22:025443): [p11_child[100729]] [do_card] (0x4000): Description [VMware Virtual USB CCID 00 00 VMware ] Manufacturer [VMware ] flags [7] removable [true] token present [true].
(2020-11-26 21:34:22:025725): [p11_child[100729]] [do_card] (0x4000): Found [MARCO TREVISAN (PIN CNS0)] in slot [VMware Virtual USB CCID 00 00][0] of module [1][/usr/
Then:
1) If you previously configured SSSD match rules and/or CA certificates:
- You should still get your certificate public key printed as output
- Configured login with smartcard should continue working
2) If SSSD was not configured to do smartcard authentication:
- p11_child may fail if the card certificate was not previously added to
the trusted DB, but this is outside of this test case.
- What it matters is that the card is found.
[ Regression potential ]
While the change may involve quite different code paths when it comes to security features, I think we trust OpenSSL enough to be an acceptable crypto backend for PKCS#11 operations. Behavior should not change, also assuming that upstream dropped NSS support completely in latest release [3], keeping the same functionalities.
As per a further review of this by xnox [4], we can safely assume that SSSD does not use libcrypto for operations where its behavior should differ from NSS. As it's needed only for certificates handling.
The only binary that is really affected in its behavior is p11_child (as per p11-kit usage instead of NSS for getting pkcs#11 modules).
So this change will break only those setup (if there are any, given that smartcard access is currently not supported by ubuntu) that have been manually configured using an unsupported system NSS db.
While we're providing a post-install script that migrates the possibly configured NSS CA certificates, there could be still possible regressions:
1) certificates not to be handled (referenced) in the same way, for example in the SSSD
certmap: the mapping between users and their certificate could change, not making an
user being able to access to the system anymore, not being correctly be correctly
associated to a certificate.
-> This can be fixed by adapting the [certmap/*/*] options in sssd.conf
2) custom p11-kit modules configured as allowed in the NSS database and not recognized by
p11-kit, won't be accepted anymore, so again login won't work as p11_child won't find a
module.
-> Modules can be added creating .module files in /usr/share/
So 1) can be the mayor concern here, even though I assume the few custom installations that there might be around can be adapted to this, in case this proves to be an important regression we can go back to use NSS as backend for libsss_certs, but still using p11-kit + openssl for p11_child.
Instead 2) can be a lower problem to handle, in case of a regression we can think of listing all the modules added to the NSS database, and if any, generate a module file for it, but I'd prefer to avoid this unless needed as we should trust them.
Said this, given the fact that there are probably not known implementations using this system for authentication in Ubuntu, I'm confident that we can accept those two regressions as they are, but being prepared to handle them (as described) if they end up in being real concerns.
[1] https:/
[2] https:/
[3] https:/
[4] https:/
Related branches
- Dimitri John Ledkov (community): Approve (with logs)
- Sergio Durigan Junior (community): Approve
-
Diff: 500 lines (+357/-1)9 files modifieddebian/changelog (+35/-0)
debian/control (+10/-1)
debian/nss-database-pem-exporter/README.md (+13/-0)
debian/nss-database-pem-exporter/nss-database-pem-exporter.c (+179/-0)
debian/patches/series (+1/-0)
debian/patches/test_ca-Look-for-libsofthsm2-in-libdir-before-falling-bac.patch (+37/-0)
debian/rules (+13/-0)
debian/sssd-common.install (+1/-0)
debian/sssd-common.postinst (+68/-0)
- Sergio Durigan Junior: Pending requested
- Dimitri John Ledkov: Pending requested
-
Diff: 1160 lines (+1013/-2)12 files modifieddebian/changelog (+40/-0)
debian/control (+5/-2)
debian/nss-database-pem-exporter/README.md (+13/-0)
debian/nss-database-pem-exporter/nss-database-pem-exporter.c (+179/-0)
debian/patches/lp-1868703-01-ad-allow-booleans-for-ad_inherit_opts_if_needed.patch (+40/-0)
debian/patches/lp-1868703-02-ad-add-ad_use_ldaps.patch (+412/-0)
debian/patches/lp-1868703-03-ldap-add-new-option-ldap_sasl_maxssf.patch (+174/-0)
debian/patches/lp-1868703-04-ad-set-min-and-max-ssf-for-ldaps.patch (+68/-0)
debian/patches/series (+4/-0)
debian/rules (+13/-0)
debian/sssd-common.install (+1/-0)
debian/sssd-common.postinst (+64/-0)
Changed in sssd (Ubuntu Focal): | |
importance: | Undecided → High |
description: | updated |
description: | updated |
tags: | added: server-next |
Changed in sssd (Ubuntu Focal): | |
assignee: | nobody → Sergio Durigan Junior (sergiodj) |
description: | updated |
tags: | added: rls-ff-incoming |
description: | updated |
summary: |
- Recompile SSSD in 20.04 using OpenSSL (instead of NSS) support + Recompile SSSD in 20.04 using OpenSSL (instead of NSS) support for + p11_child |
description: | updated |
description: | updated |
description: | updated |
tags: | added: patch |
description: | updated |
description: | updated |
description: | updated |
Changed in sssd (Ubuntu Focal): | |
assignee: | Sergio Durigan Junior (sergiodj) → Marco Trevisan (Treviño) (3v1n0) |
no longer affects: | ca-certificates (Ubuntu Focal) |
no longer affects: | ca-certificates (Ubuntu) |
> While the change may involve quite different code paths when it comes to security features, I think we trust OpenSSL enough to be an acceptable crypto backend. And behavior should not change.
Are you sure about this? TLS has a wide variety of protocol options and the supported vs. "available" cryptosystem matrix is complex. Won't these all change if the underlying implementation changes?