Bug 1710899

Summary: opensc failure for ssh with myeid card
Product: Red Hat Enterprise Linux 7 Reporter: Scott Poore <spoore>
Component: openscAssignee: Jakub Jelen <jjelen>
Status: CLOSED NOTABUG QA Contact: Scott Poore <spoore>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.7   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-17 07:10:47 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
opensc debug log none

Description Scott Poore 2019-05-16 14:26:44 UTC
Description of problem:

Authentication with a MyEID Smart Card via ssh with an AD issued certificate is failing:

# ssh -I /usr/lib64/opensc-pkcs11.so -l ipauser1 localhost hostname
Enter PIN for 'sctest (MyEID)': 
C_Sign failed: 33
sign_and_send_pubkey: signing failed: error in libcrypto
no such identity: /root/.ssh/id_ed25519: No such file or directory
Password: 


I am able to su though with the same card/setup:

# su - ipauser1 -c "su - ipauser1 -c whoami"
PIN for sctest (MyEID)
ipauser1


Version-Release number of selected component (if applicable):
opensc-0.19.0-3.el7.x86_64


How reproducible:
always

Steps to Reproduce:
1.  Setup IPA Server and client for Smart Card Authentication
2.  add AD generated key/certificate to Smart Card
3.  ssh -I /usr/lib64/opensc-pkcs11.so -l ipauser1 localhost hostname


Actual results:
Failure as listed above

Expected results:
succeeds and returns hostname

Additional info:

Comment 2 Scott Poore 2019-05-16 14:28:26 UTC
Created attachment 1569531 [details]
opensc debug log

Comment 3 Scott Poore 2019-05-16 21:46:26 UTC
FYI, I realized the key was only 1024bit.  Having seen similar issues with weaker keys elsewhere, I tried regenerating my certificate with the key length set to 2048.  Now it's working as expected.

So, I'm not sure if we want to pursue this any further.  If so, I can give access to my card and system.  Otherwise, I think we can close this as NOTABUG.

Comment 4 Jakub Jelen 2019-05-17 07:10:47 UTC
Given that the problem is caused by the very small key size on a card we really do not officially support, I do not think we should spend more time on this.

I think this is a limitation of the RSA_PKCS mechanism (the card needs to add the PKCS#1.5 padding), but this error comes from inside of the card (the data size is fine for the PKCS#11 specification).