updated sssd with smart cards now brick systems without full cert chain
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sssd (Ubuntu) |
Fix Released
|
High
|
Marco Trevisan (Treviño) | ||
Focal |
Incomplete
|
High
|
Marco Trevisan (Treviño) |
Bug Description
[ Impact ]
With the latest sssd release supporting OpenSSL PKI authentication for Ubuntu 20.04, the behavior between nssdb and OpenSSL has adversely affected many systems which are configured for PKI only authentication.
The NSSDB implementation of sssd/p11_child ONLY requires the issuing certificate to be populated to the nssdb and marked as trusted. While this may be considered a poorly configured system, it is still technically valid.
The OpenSSL implementation of the sssd/p11_child requires the FULL cert chain to the root cert (which is then also trusted by the system root chain) in order to allow a certificate to authenticate.
By upgrading to the latest packages, the conversion process from nssdb to the OpenSSL pam file fails to check the chain of trust, thereby creating a denial of service for some systems configured to require smart card/PKI authentication in the pam stack via pam_sss and require_cert_auth flag.
Note that this is a popular configuration due to many organizations are required to follow NIST 800-171 (and other) security derived policy. Often policy requires PKI based authentication to be enforced and all other authentication methods disabled.
[ Test case ]
Testing this fix in any system is complex because it depends on certificates with partial authentication, so ideally we should:
1. Configure SSSD to include an intermediate certificate for the smart card in use in
/etc/
2. Launch:
sudo /usr/libexec/
--
And this should NOT return a certificate, then launch it with:
sudo /usr/libexec/
--
And this MUST return the card certificate.
Alternatively, you should try to login. Ensuring that /etc/sssd/sssd.conf contains:
[pam]
pam_cert_
---
However, given that testing this is complex without specific hardware, I've setup a test case that automates all this, creating keyrings with partially trusted certificates and a software-generated smartcard (using softhsm2) so that this can be all tested easily, see:
https:/
So, basically you only have to:
0. sudo apt install gnutls-bin openssl softhsm2 && \
sudo apt-mark auto gnutls-bin openssl softhsm2
1. wget https:/
2. sudo bash sssd-softhism2-
(sudo can be avoided by copying /usr/libexec/
local path and calling the script with
SSSD_
3. Ensure that "Test completed, Root CA and intermediate issued certificates verified!"
is printed and the script returns properly
This will:
- Generate a test Root Certificate Authority (and will emit a cert from it)
- Generate a test Intermediate Certificate Authority (and will emit a cert)
- Generate a test Sub Intermediate Certificate Authority (and will emit a cert)
- Test the certificates themselves with openssl
- For each certificate will create various fake smartcards
- Will test each smartcard how it behaves when used via p11_child with both
partial and full verification, and doing full p11_child authentication.
Before to this SRU, the script fails with this error:
(Thu Jan 26 04:36:16:676491 2023) [p11_child[257107]] [read_certs] (0x4000): found cert[Test Organization Intermediate Trusted Certificate 0001][/O=Test Organization/
(Thu Jan 26 04:36:16:676970 2023) [p11_child[257107]] [do_verification] (0x0040): X509_verify_cert failed [0].
(Thu Jan 26 04:36:16:677197 2023) [p11_child[257107]] [do_verification] (0x0040): X509_verify_cert failed [2][unable to get issuer certificate].
(Thu Jan 26 04:36:16:677438 2023) [p11_child[257107]] [read_certs] (0x0040): Certificate [Test Organization Intermediate Trusted Certificate 0001][/O=Test Organization/
(Thu Jan 26 04:36:16:677709 2023) [p11_child[257107]] [do_card] (0x4000): No certificate found.
+ grep -qs 001122334455667
+ return 2
+ echo 'Unexpected failure!'
[ Regression potential ]
SSSD p11_child functionalities did not change by default and they're now strictly tested (they were not fully before this SRU).
However we may set some systems to use a weaker auth mode for PAM authentication with smart cards, but this is still a secure mode.
Related branches
- Sergio Durigan Junior (community): Approve
-
Diff: 3411 lines (+3266/-3)18 files modifieddebian/changelog (+25/-0)
debian/patches/add-tests-multiple-certs-same-id.patch (+267/-0)
debian/patches/authtok-add-label-to-Smartcard-token.patch (+1086/-0)
debian/patches/p11_child-Add-support-for-partial_chain-certificate_verif.patch (+410/-0)
debian/patches/p11_child-Restore-functionality-of-wait_for_card.patch (+89/-0)
debian/patches/p11_child-do_card-partially-fix-loop-exit-condition-when-.patch (+36/-0)
debian/patches/p11_child_openssl-Free-X509_VERIFY_PARAM-if-initialized.patch (+28/-0)
debian/patches/pam-Add-custom-pam_cert_verification-setting-to-override-.patch (+222/-0)
debian/patches/pam_sss-add-SERVICE_IS_GDM_SMARTCARD.patch (+37/-0)
debian/patches/pam_sss-add-certificate-label-to-reply-to-pam_sss.patch (+209/-0)
debian/patches/pam_sss-fix-missing-initializer-warning.patch (+33/-0)
debian/patches/pam_sss-fix-missing-initializer.patch (+42/-0)
debian/patches/pam_sss-make-sure-old-certificate-data-is-removed-before-.patch (+35/-0)
debian/patches/pam_sss-special-handling-for-gdm-smartcard.patch (+80/-0)
debian/patches/pam_sss-use-unique-id-for-gdm-choice-list.patch (+68/-0)
debian/patches/series (+15/-0)
debian/patches/test_pam_srv-Add-test-for-CA-certificate-check-using-inte.patch (+530/-0)
debian/sssd-common.postinst (+54/-3)
information type: | Private Security → Public |
tags: | added: regression-update |
Changed in sssd (Ubuntu): | |
status: | In Progress → Fix Released |
Changed in sssd (Ubuntu Focal): | |
status: | New → In Progress |
importance: | Undecided → Medium |
importance: | Medium → High |
assignee: | nobody → Marco Trevisan (Treviño) (3v1n0) |
description: | updated |
description: | updated |
description: | updated |
Changed in sssd (Ubuntu Focal): | |
status: | In Progress → Incomplete |
description: | updated |
this was caused by the changes in https:/ /bugs.launchpad .net/ubuntu/ +source/ sssd/+bug/ 1905790