Este contenido no está disponible en el idioma seleccionado.
Chapter 10. Troubleshooting authentication with smart cards
The following procedures describe how to resolve some of the issues you might encounter when setting up smart card authentication.
10.1. Testing smart card access on the system Copiar enlaceEnlace copiado en el portapapeles!
Follow this procedure to test whether you can access your smart card.
Prerequisites
- You have installed and configured your IdM Server and client for use with smart cards.
-
You have installed the
certutil
tool from thenss-tools
package. - You have the PIN or password for your smart card.
Procedure
Using the
lsusb
command, verify that the smart card reader is visible to the operating system:lsusb
$ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 072f:b100 Advanced Card Systems, Ltd ACR39U Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about the smart cards and readers tested and supported in RHEL, see Smart Card support in RHEL 9.
Ensure that the
pcscd
service and socket are enabled and running:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Using the
p11-kit list-modules
command, display information about the configured smart card and the tokens present on the smart card:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify you can access the contents of your smart card:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Display the contents of the certificate on your smart card using the
certutil
command:Run the following command to determine the correct name of your certificate:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Display the contents of the certificate on your smart card:
NoteEnsure the name of the certificate is an exact match for the output displayed in the previous step, in this example
MyEID (sctest):Certificate
.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2. Troubleshooting smart card authentication with SSSD Copiar enlaceEnlace copiado en el portapapeles!
Follow this procedure to troubleshoot authentication with SSSD using smart cards.
Prerequisites
- You have installed and configured your IdM Server and client for use with smart cards.
-
You have installed the
sssd-tools
package. - You are able to detect your smart card reader and display the contents of your smart card. See Testing smart card access on the system.
Procedure
Verify you can authenticate with your smart card using
su
:su - idmuser1 -c ‘su - idmuser1 -c whoami’
$ su - idmuser1 -c ‘su - idmuser1 -c whoami’ PIN for MyEID (sctest): idmuser1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you are not prompted for the smart card PIN, and either a password prompt or an authorization error are returned, check the SSSD logs. See Troubleshooting authentication with SSSD in IdM for information about logging in SSSD. The following is an example of an authentication failure:
su - idmuser1 -c ‘su - idmuser1 -c whoami’
$ su - idmuser1 -c ‘su - idmuser1 -c whoami’ PIN for MyEID (sctest): su: Authentication failure
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the SSSD logs indicate an issue from the
krb5_child
, similar to the following, you may have an issue with your CA certificates. To troubleshoot issues with certificates, see Verifying that IdM Kerberos KDC can use Pkinit and that the CA certificates are correctly located.[Pre-authentication failed: Failed to verify own certificate (depth 0): unable to get local issuer certificate: could not load the shared library]
[Pre-authentication failed: Failed to verify own certificate (depth 0): unable to get local issuer certificate: could not load the shared library]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the SSSD logs indicate a timeout either from
p11_child
orkrb5_child
, you may need to increase the SSSD timeouts and try authenticating again with your smart card. See Increasing SSSD timeouts for details on how to increase the timeouts.Verify your GDM smart card authentication configuration is correct. A success message for PAM authentication should be returned as shown below:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If an authentication error, similar to the following, is returned, check the SSSD logs to try and determine what is causing the issue. See Troubleshooting authentication with SSSD in IdM for information about logging in SSSD.
pam_authenticate for user [idmuser1]: Authentication failure PAM Environment: - no env -
pam_authenticate for user [idmuser1]: Authentication failure PAM Environment: - no env -
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If PAM authentication continues to fail, clear your cache and run the command again.
sssctl cache-remove
# sssctl cache-remove SSSD must not be running. Stop SSSD now? (yes/no) [yes] yes Creating backup of local data… Removing cache files… SSSD needs to be running. Start SSSD now? (yes/no) [yes] yes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.3. Verifying that IdM Kerberos KDC can use PKINIT and that the CA certificates are correctly located Copiar enlaceEnlace copiado en el portapapeles!
Follow this procedure to verify that IdM Kerberos KDC can use PKINIT and also describes how to verify your CA certificates are correctly located.
Prerequisites
- You have installed and configured your IdM Server and client for use with smart cards.
- You are able to detect your smart card reader and display the contents of your smart card. See Testing smart card access on the system.
Procedure
Run the
kinit
utility to authenticate as theidmuser1
with the certificate stored on your smart card:kinit -X X509_user_identity=PKCS11: idmuser1
$ kinit -X X509_user_identity=PKCS11: idmuser1 MyEID (sctest) PIN:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Enter your smart card PIN. If you are not prompted for your PIN, check that you can detect your smart card reader and display the contents of your smart card. See Testing smart card authentication.
If your PIN is accepted and you are then prompted for your password, you might be missing your CA signing certificate.
Verify the CA chain is listed in the default certificate bundle file using
openssl
commands:openssl crl2pkcs7 -nocrl -certfile /var/lib/ipa-client/pki/ca-bundle.pem | openssl pkcs7 -print_certs -noout
$ openssl crl2pkcs7 -nocrl -certfile /var/lib/ipa-client/pki/ca-bundle.pem | openssl pkcs7 -print_certs -noout subject=O = IDM.EXAMPLE.COM, CN = Certificate Authority issuer=O = IDM.EXAMPLE.COM, CN = Certificate Authority
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the validity of your certificates:
Find the user authentication certificate ID for
idmuser1
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Read the user certificate information from the smart card in DER format:
pkcs11-tool --read-object --id 01 --type cert --output-file cert.der
$ pkcs11-tool --read-object --id 01 --type cert --output-file cert.der Using slot 0 with a present token (0x0)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Convert the DER certificate to PEM format:
openssl x509 -in cert.der -inform DER -out cert.pem -outform PEM
$ openssl x509 -in cert.der -inform DER -out cert.pem -outform PEM
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the certificate has valid issuer signatures up to the CA:
openssl verify -CAfile /var/lib/ipa-client/pki/ca-bundle.pem <path>/cert.pem
$ openssl verify -CAfile /var/lib/ipa-client/pki/ca-bundle.pem <path>/cert.pem cert.pem: OK
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If your smart card contains several certificates,
kinit
might fail to choose the correct certificate for authentication. In this case, you need to specify the certificate ID as an argument to thekinit
command using thecertid=<ID>
option.Check how many certificates are stored on the smart card and get the certificate ID for the one you are using:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run
kinit
with certificate ID 01:kinit -X kinit -X X509_user_identity=PKCS11:certid=01 idmuser1
$ kinit -X kinit -X X509_user_identity=PKCS11:certid=01 idmuser1 MyEID (sctest) PIN:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Run
klist
to view the contents of the Kerberos credentials cache:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Destroy your active Kerberos tickets once you have finished:
kdestroy -A
$ kdestroy -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.4. Increasing SSSD timeouts Copiar enlaceEnlace copiado en el portapapeles!
If you are having issues authenticating with a smart card, check the krb5_child.log
and the p11_child.log
file for timeout entries similar to the following:
krb5_child: Timeout for child [9607] reached.....consider increasing value of krb5_auth_timeout.
krb5_child: Timeout for child [9607] reached.....consider increasing value of krb5_auth_timeout.
If there is a timeout entry in the log file, try increasing the SSSD timeouts as outlined in this procedure.
Prerequisites
- You have configured your IdM Server and client for smart card authentication.
Procedure
Open the
sssd.conf
file on the IdM client:vim /etc/sssd/sssd.conf
# vim /etc/sssd/sssd.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In your domain section, for example
[domain/idm.example.com]
, add the following option:krb5_auth_timeout = 60
krb5_auth_timeout = 60
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the
[pam]
section, add the following:p11_child_timeout = 60
p11_child_timeout = 60
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Clear the SSSD cache:
sssctl cache-remove
# sssctl cache-remove SSSD must not be running. Stop SSSD now? (yes/no) [yes] yes Creating backup of local data… Removing cache files… SSSD needs to be running. Start SSSD now? (yes/no) [yes] yes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Once you have increased the timeouts, try authenticating again using your smart card. See Testing smart card authentication for more details.
10.5. Troubleshooting certificate mapping and matching rules Copiar enlaceEnlace copiado en el portapapeles!
If you are having issues authenticating with a smart card, check that you have linked your smart card certificate correctly to a user. By default, a certificate is associated with a user when the user entry contains the full certificate as part of the usercertificate
attribute. However, if you have defined certificate mapping rules, you may have changed how certificates are associated with users.
If you are using your smart card to authenticate using SSH, you need to add the full certificate to the user entry in Identity Management (IdM). If you are not using your smart card to authenticate using SSH, you can add certificate mapping data using the ipa user-add-certmapdata
command.
10.5.1. Checking how the certificates are mapped to users Copiar enlaceEnlace copiado en el portapapeles!
By default, a certificate is associated with a user when the user entry contains the full certificate as part of the usercertificate
attribute. However, if you have defined certificate mapping rules, you may have changed how certificates are associated with users. Follow this procedure to check your certificate mapping rules.
Prerequisites
- You have installed and configured your Identity Management (IdM) server and client for use with smart cards.
- You are able to detect your smart card reader and display the contents of your smart card. See Testing smart card access on the system.
- You have mapped your smart card certificate to an IdM user. See Certificate mapping rules for configuring authentication on smart cards.
Procedure
Verify the certificate mapping rules currently configured for IdM:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can expect to see one of the following mapping rules defined:
-
ipacertmapdata
indicates that the IdM user entrycertmapdata
attribute is used. -
altSecurityIdentities
specifies that Active Directory’s user entry name mapping attribute is used. -
userCertificate;binary=
indicates that the whole certificate in either IdM or AD is used.
You can define many matching options but some of the typically configured options are as follows:
-
<ISSUER>CN=[…]
specifies the issuer attribute of the certificate being used is checked to make sure it matches this. -
<SUBJECT>.*,DC=MY,DC=DOMAIN
indicates the subject of the certificate is checked.
-
Enable System Security Services Daemon (SSSD) logging by adding
debug_level = 9
to the/etc/sssd/sssd.conf
file on the IdM server:[domain/idm.example.com] ... debug_level = 9
[domain/idm.example.com] ... debug_level = 9
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart SSSD:
systemctl restart sssd
# systemctl restart sssd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You should see the following entry in the
/var/log/sssd/sssd_idm.example.com.log
file if the mapping is read correctly:[be[idm.example.com]] [sdap_setup_certmap] (0x4000): Trying to add rule [smartcardrule][-1][<ISSUER>CN=Certificate Authority,O=IDM.EXAMPLE.COM][(|(userCertificate;binary={cert!bin})(ipacertmapdata=X509:<I>{issuer_dn!nss_x500}<S>{subject_dn!nss_x500}))].
[be[idm.example.com]] [sdap_setup_certmap] (0x4000): Trying to add rule [smartcardrule][-1][<ISSUER>CN=Certificate Authority,O=IDM.EXAMPLE.COM][(|(userCertificate;binary={cert!bin})(ipacertmapdata=X509:<I>{issuer_dn!nss_x500}<S>{subject_dn!nss_x500}))].
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If your mapping rule contains an invalid syntax, an entry similar to the following can be seen in the log file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check your mapping rule syntax.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If required, modify your certificate mapping rule:
ipa certmaprule-mod smartcardrule --maprule '(ipacertmapdata=X509:<I>{issuer_dn!nss_x500}<S>{subject_dn!nss_x500})'
# ipa certmaprule-mod smartcardrule --maprule '(ipacertmapdata=X509:<I>{issuer_dn!nss_x500}<S>{subject_dn!nss_x500})'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.5.2. Checking the user associated with a smart card certificate Copiar enlaceEnlace copiado en el portapapeles!
If you are having issues authenticating with a smart card, verify the correct user is associated with your smart card certificate.
Prerequisites
- You have installed and configured your Identity Management (IdM) server and client for use with smart cards.
- You are able to detect your smart card reader and display the contents of your smart card. See Testing smart card access on the system.
- You have mapped your smart card certificate to an IdM user. See Certificate mapping rules for configuring authentication on smart cards.
-
You have a copy of the certificate from your smart card in PEM format, for example,
cert.pem
.
Procedure
Verify the user is associated with your smart card certificate:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the user or domain are not correct, check how your certificates are mapped to users. See Checking how the certificates are mapped to users.
Check if the user entry contains the certificate:
ipa user-show idmuser1
# ipa user-show idmuser1 User login: idmuser1 [...] Certificate:MIIEejCCAuKgAwIBAgIBCzANBgkqhkiG9w0BAQsFADAzMREwDwYDVQQKDAhJUEEuVEVTVDEeMBwGA1UEAwwVQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XD
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If your user entry does not contain the certificate, add your base-64 encoded certificate to the user entry:
Create an environment variable containing the certificate with the header and footer removed and concatenated into a single line, which is the format expected by the
ipa user-add-cert
command:export CERT=`openssl x509 -outform der -in idmuser1.crt | base64 -w0 -`
$ export CERT=`openssl x509 -outform der -in idmuser1.crt | base64 -w0 -`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that the certificate in the
idmuser1.crt
file must be in PEM format.Add the certificate to the profile of
idmuser1
using theipa user-add-cert
command:ipa user-add-cert idmuser1 --certificate=$CERT
$ ipa user-add-cert idmuser1 --certificate=$CERT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Clear the System Security Services Daemon (SSSD) cache.
sssctl cache-remove
# sssctl cache-remove SSSD must not be running. Stop SSSD now? (yes/no) [yes] yes Creating backup of local data… Removing cache files… SSSD needs to be running. Start SSSD now? (yes/no) [yes] yes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Run
ipa certmap-match
again to confirm the user is associated with your smart card certificate.