Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2150357

Summary: Smart Card auth does not work with p11_uri (with-smartcard-required)
Product: Red Hat Enterprise Linux 8 Reporter: Marek Havrila <mhavrila>
Component: sssdAssignee: Sumit Bose <sbose>
Status: CLOSED ERRATA QA Contact: Scott Poore <spoore>
Severity: low Docs Contact:
Priority: low    
Version: 8.7CC: aboscatt, atikhono, pbrezina, sbose, sgadekar, spoore
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sync-to-jira
Fixed In Version: sssd-2.8.2-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-16 09:08:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
p11_child.log
none
sssd_pam.log
none
sssd_shadowutils.log none

Description Marek Havrila 2022-12-02 16:16:28 UTC
Created attachment 1929393 [details]
screenshot

Description of problem:

It is not possible to login to RHEL when p11-uri is specified in sssd.conf and smart card is required for auth (i.e. authselect profile is 'sssd with-smartcard with-smartcard required'). This applies for GDM as well as console login.

Version-Release number of selected component (if applicable):
RHEL-8.7.0-20221012.5
sssd-2.7.3-4.el8.x86_64

How reproducible:
always

Steps to Reproduce:

1. get fresh system; smart card and reader
2. `useradd testuser`

3. configure system for smart-card auth:
3.1: create sssd.conf file with matchrule for user
3.2: get p11_uri (p11tool --list-tokens) of card and add it to sssd.conf 
3.3: add rootCA.cert to /etc/sssd/pki/sssd_auth_ca_db.pem
3.4:
`chmod 0700 /etc/sssd`
`chmod 0600 /etc/sssd/sssd.conf`
`chmod 0644 /etc/sssd/pki/sssd_auth_ca_db.pem`
`rm -rf /var/lib/sss/{mc,db}/*`
3.5: `systemctl restart sssd`
3.6: `authselect select sssd with-smartcard with-smartcard-required --force`

4. Open GDM login screen
5. Insert card into the reader

Actual results:
1) system reognises smart card
2) user can pick certificate object
3) user can insert pin
4) "Sorry, smart card authentication didn't work. Please try again." appears in GDM (see attached screenshot)

Expected results:
1) system reognises smart card
2) user can pick certificate object
3) user can insert pin
4) login is successful

Additional info:
This bug is present on both RHEL-8 and RHEL-9. It is manifested in GDM and also in console login. It is possible that this scenario was always broken as it was most likely tested only with "with-smartcard" profile of sssd.

Comment 2 Marek Havrila 2022-12-02 16:23:01 UTC
Created attachment 1929406 [details]
p11_child.log

Comment 3 Marek Havrila 2022-12-02 16:23:57 UTC
Created attachment 1929409 [details]
sssd_pam.log

Comment 4 Marek Havrila 2022-12-02 16:24:38 UTC
Created attachment 1929410 [details]
sssd_shadowutils.log

Comment 5 Sumit Bose 2022-12-05 06:42:19 UTC
Hi,

there are various odd items in the logs. Can you set 'debug_level = 9' in the [domain/...] section as well?

There is '[pam] [child_sig_handler] (0x0020): [CID#14] child [9412] was terminated by signal [11].', can you check, e.g. with coredumpctl if there is a core dump and sent the backtrace?

Can you send your ssssd.conf as well?

Does the test work if 'p11_uri' is not set in sssd.conf?

bye,
Sumit

Comment 15 Alexey Tikhonov 2022-12-09 12:45:29 UTC
Pushed PR: https://github.com/SSSD/sssd/pull/6480

* `master`
    * aac303e84b71325d3c45fa7a22f83f7f54d4b7a2 - p11: fix size of argument array
* `sssd-2-8`
    * 20037ae5354a874f04802844c930c6b52704c5c7 - p11: fix size of argument array

Comment 25 errata-xmlrpc 2023-05-16 09:08:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sssd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2986