Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
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:


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.