10.3. Verifying that IdM Kerberos KDC can use PKINIT and that the CA certificates are correctly located
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
kinitutility to authenticate as theidmuser1with the certificate stored on your smart card:$ kinit -X X509_user_identity=PKCS11: idmuser1 MyEID (sctest) PIN:- 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 link:https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/managing_smart_card_authentication/troubleshooting-authentication-with-smart-cards#testing-smart-card-access-on-the-system
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
opensslcommands:$ 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 AuthorityVerify the validity of your certificates:
Find the user authentication certificate ID for
idmuser1:$ pkcs11-tool --list-objects --login [...] Certificate Object; type = X.509 cert label: Certificate subject: DN: O=IDM.EXAMPLE.COM, CN=idmuser1 ID: 01Read the user certificate information from the smart card in DER format:
$ pkcs11-tool --read-object --id 01 --type cert --output-file cert.der Using slot 0 with a present token (0x0)Convert the DER certificate to PEM format:
$ openssl x509 -in cert.der -inform DER -out cert.pem -outform PEMVerify the certificate has valid issuer signatures up to the CA:
$ openssl verify -CAfile /var/lib/ipa-client/pki/ca-bundle.pem <path>/cert.pem cert.pem: OK
If your smart card contains several certificates,
kinitmight fail to choose the correct certificate for authentication. In this case, you need to specify the certificate ID as an argument to thekinitcommand 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:
$ pkcs11-tool --list-objects --type cert --login Using slot 0 with a present token (0x0) Logging in to "MyEID (sctest)". Please enter User PIN: Certificate Object; type = X.509 cert label: Certificate subject: DN: O=IDM.EXAMPLE.COM, CN=idmuser1 ID: 01 Certificate Object; type = X.509 cert label: Second certificate subject: DN: O=IDM.EXAMPLE.COM, CN=ipauser1 ID: 02Run
kinitwith certificate ID 01:$ kinit -X kinit -X X509_user_identity=PKCS11:certid=01 idmuser1 MyEID (sctest) PIN:
Run
klistto view the contents of the Kerberos credentials cache:$ klist Ticket cache: KCM:0:11485 Default principal: idmuser1@EXAMPLE.COM Valid starting Expires Service principal 10/04/2021 10:50:04 10/05/2021 10:49:55 krbtgt/EXAMPLE.COM@EXAMPLE.COMDestroy your active Kerberos tickets once you have finished:
$ kdestroy -A