Bug 1449367
| Summary: | Locked screen prompts for user password and not smartcard pin | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Roshni <rpattath> |
| Component: | opensc | Assignee: | Jakub Jelen <jjelen> |
| Status: | CLOSED WORKSFORME | QA Contact: | Release Test Team <release-test-team-automation> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | high | ||
| Version: | 7.4 | CC: | rpattath |
| Target Milestone: | rc | Keywords: | Regression, TestBlocker |
| 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: | 2017-05-10 14:54:52 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: | |||
|
Description
Roshni
2017-05-09 19:39:48 UTC
How does the debug log look like for coolkey (how it should look correctly), which I suppose is still working?
I suppose it is saying "Previously used to login yes" instead of "no" now. It would mean that the following condition [1] evaluates to false for some reason.
token_name = PK11_GetTokenName (card_slot);
if (g_strcmp0 (g_getenv ("PKCS11_LOGIN_TOKEN_NAME"), token_name) == 0)
The environment variable "PKCS11_LOGIN_TOKEN_NAME" is set to "LAST.DAY.2001428082" (from the env above) by pam_pkcs11 and from PK11_GetTokenName(), which should be the same.
Are you sure both pam_pkcs11 and gnome-settings-daemon are using the same NSS DB and the same pkcs11 library? Your log confirms this in gnome-settings, but not about the pam_pkcs11 (and the name looks more like from coolkey).
The same token with using the different driver shows different label, which is mostly the case here:
$ pkcs11-tool -T --module /usr/lib64/pkcs11/libcoolkeypk11.so
Available slots:
Slot 0 (0x1): OMNIKEY AG CardMan 3121 00 00
token label : Test E. Cardholder IV
$ pkcs11-tool -T --module /usr/lib64/pkcs11/opensc-pkcs11.so
Available slots:
Slot 0 (0x0): OMNIKEY AG CardMan 3121 00 00
token label : PIV Card Holder pin (PIV_II)
In ideal case, we should make OpenSC to use similar token names as coolkey is using. I will try to find out with upstream why OpenSC is using these names.
Until that I believe this is misconfiguration of pam_pkcs11, which is still using coolkey and therefore the environment variables do not match. Can you verify that?
[1] https://github.com/GNOME/gnome-settings-daemon/blob/5b3ac1cbf6b0bea98732f4610e340e50b69994ea/plugins/smartcard/gsd-smartcard-service.c#L497
[2] https://github.com/OpenSC/pam_pkcs11/blob/8a3e8c667ed615ca2608c04414de69fdae5b6787/src/common/pkcs11_lib.c#L708
The PKCS#11 specification (pkcs-11v2-30b-d6.pdf) is very vague about the meaning of the label field in the CK_TOKEN_INFO structure:
> application-defined label, assigned during token
initialization. Must be padded with the blank character
(‘ ‘). Should not be null-terminated.
The coolkey is obviously setting the full cardholder name to this field:
memcpy(label, personName, MIN(personLen, maxSize));
but OpenSC is using PIN label for some reason in combination with pkcs15-emulated label (one for a driver)
p15card->tokeninfo->label = strdup("PIV_II");
We can probably push similar change to OpenSC, but I don't think this should be a blocker for RHEL7.4 release unless it will prevent the above use case with Gnome.
With the following changes to pam_pkcs11.conf I do not see this issue
use_pkcs11_module = opensc;
The following already existed when the issue was seen
pkcs11_module opensc {
module = "opensc-pkcs11.so";
description = "OpenSC PKCS#11 module";
# Slot-number to use. One for the first, two for the second and so
# on. The default value is zero which means to use the first slot
# with an available token.
slot_num = 0;
nss_dir = /etc/pki/nssdb;
# Path to the directory where the CA certificates are stored. The
# directory must contain an openssl hash-link to each certificate.
# The default value is /etc/pam_pkcs11/cacerts.
ca_dir = "/etc/pam_pkcs11/cacerts";
# Path to the directory where the CRLs are stored. The directory
# must contain an openssl hash-link to each CRL. The default value
# is /etc/pam_pkcs11/crls.
crl_dir = "/etc/pam_pkcs11/crls";
# Sets the Certificate Policy, (see above)
cert_policy = ca, signature;
}
Closing the bug and opened a new bug for the label issue https://bugzilla.redhat.com/show_bug.cgi?id=1449740
|