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 1690552 - ssh-agent stops working with certificate in alternate yubikey slot
Summary: ssh-agent stops working with certificate in alternate yubikey slot
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: opensc
Version: 7.6
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jakub Jelen
QA Contact: Asha Akkiangady
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-19 16:37 UTC by Orion Poplawski
Modified: 2019-04-04 14:08 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-04 14:08:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Orion Poplawski 2019-03-19 16:37:59 UTC
Description of problem:

I'm trying to make use of a YubiKey configured as follows:

 * Certificate for PIV Authentication - slot 9a: USER certificate
 * Certificate for Key Management - slot 9d: MacOS encryption certificate
 * Retired Certificate for Key Management 1 - slot 82: USER-admin certificate

This is because the of the apparent requirement for an encryption certificate to use the yubikey on a Mac: https://support.yubico.com/support/solutions/articles/15000010854-macos-native-smart-card-support-for-logon-with-windows-server and the need for a separate -admin certificate.

The Windows minidriver puts the admin certificate into slot 82 will look at the retired certificate slots automatically, so that works out of the box. For Linux though, we need to tell OpenSC that the extra slots are available. The magic incantation to do this is:

echo C10114C20100FE00 | xxd -r -p |  ykman piv write-object 0x5FC10C -

See https://github.com/OpenSC/OpenSC/issues/847#issuecomment-238119888 for more information about that.

This allows me to login/su using the certificates and pin.  However, using the ssh agent with my orion-admin certificate in slot 82 is flaky.  It works fine until some other authentication operation is done with the card (su - orion-admin for example): 

sign_and_send_pubkey: signing failed: agent refused operation

ssh-pkcs11-helper[28856]: error: C_Sign failed: 257
ssh-agent[28815]: error: process_sign_request2: sshkey_sign: error in libcrypto

or 

ssh-pkcs11-helper[28856]: error: cannot find private key
ssh-agent[28815]: error: process_sign_request2: sshkey_sign: error in libcrypto

I enabled opensc debugging - and I see entries when I successfully add the card to the agent, but I don't see any further activity when I ssh to other machines.

I do not have this problem with a different yubikey with my orion-admin certificate in the Key Management slot 9d.

Version-Release number of selected component (if applicable):
openssh-7.4p1-16.el7.x86_64

Comment 2 Jakub Jelen 2019-03-19 17:15:59 UTC
The current RHEL7.6 OpenSC does not have any mechanisms to detect and resolve concurrent access to the PIV card from different applications. Actually even existence of the "magic object" (0x5FC10C) and some operation might break the login state so I really think this should be filled against opensc.

To follow up from here, we actually know about this issue and it should be already resolved in the current opensc. Can you check that current master will work for you? If not, I will need some more debugging information from OpenSC.

Comment 3 Orion Poplawski 2019-03-19 17:43:11 UTC
From a quick test it appears that current OpenSC master does work.  Thanks!

Comment 4 Jakub Jelen 2019-04-04 14:08:27 UTC
This will most probably be fixed in the next release of OpenSC in RHEL7. Please, reopen if the problems persist.


Note You need to log in before you can comment on or make changes to this bug.