Create certificates and implement smart card authentication.
Outcomes
Configure IdM for smart card authentication, and authenticate to the IdM web UI using a certificate.
This exercise imports certificates directly into the browser to perform certificate-based authentication because the classroom environment does not support smart cards for all modalities.
As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available:
[student@workstation ~]$ lab start alternative-smartcard
Instructions
Configure IdM to support smart card authentication. This is required to enable certificate-based authentication, even without smart cards.
Log in to the idm machine as the student user, and change to the root user:
[student@workstation ~]$ssh idm[student@idm ~]$sudo -i[sudo] password for student:student[root@idm ~]#
Authenticate to IdM as the admin user:
[root@idm ~]#kinit adminPassword for admin@LAB.EXAMPLE.COM:RedHat123^
Run the ipa-advise config-server-for-smart-card-auth command to generate a configuration script.
Make the script executable, and then run it:
[root@idm ~]#ipa-advise \config-server-for-smart-card-auth > ~/server_smart_card_script.sh[root@idm ~]#chmod u+x ~/server_smart_card_script.sh[root@idm ~]#~/server_smart_card_script.sh /etc/ipa/ca.crtTicket cache: KCM:0 Default principal: admin@LAB.EXAMPLE.COM Valid starting Expires Service principal 06/15/23 08:15:57 06/16/23 07:30:54 krbtgt/LAB.EXAMPLE.COM@LAB.EXAMPLE.COM 06/15/23 08:17:42 06/16/23 07:30:54 HTTP/idm.lab.example.com@LAB.EXAMPLE.COM -------------------- 1 IPA server matched -------------------- Server name: idm.lab.example.com Min domain level: 1 Max domain level: 1 ---------------------------- Number of entries returned 1 ---------------------------- The ipa-pkinit-manage command was successful PKINIT already enabled Installing CA certificate, please wait Verified CN=Certificate Authority,O=LAB.EXAMPLE.COM CA certificate successfully installed The ipa-cacert-manage command was successful Systemwide CA database updated. Systemwide CA database updated. The ipa-certupdate command was successful
Export the idmuser01 certificate to PKCS12 format, and then log out.
Use the pk12util command to export the idmuser01 certificate from the /root/idmuser01-cert Name Service Switch (NSS) database:
[root@idm ~]#pk12util \-d ~/idmuser01-cert/ \-o ~/idmuser01.p12 \-n idmuser01Enter Password or Pin for "NSS Certificate DB":RedHat123^Enter password for PKCS12 file:RedHat123^Re-enter password:RedHat123^pk12util: PKCS12 EXPORT SUCCESSFUL
Authenticate to IdM as the idmuser01 user to ensure that the password has not expired:
[root@idm ~]#kinit idmuser01Password for idmuser01@LAB.EXAMPLE.COM:RedHat123^
Log out of the idm machine:
[root@idm ~]#logout[student@idm ~]$logoutConnection to idm closed. [student@workstation ~]$
Copy the /root/idmuser01.p12 file to workstation:
Only perform the following step if you have not previously imported the CA certificate for IdM. If you have reset the IdM VM, then it is possible that a previously imported CA certificate is no longer valid. To resolve this issue, remove the currently trusted certificate, and then reimport.
[student@workstation ~]$ scp root@idm:idmuser01.p12 ./On workstation, import the CA certificate into Firefox.
Save the IdM CA certificate locally.
Navigate to https://idm.lab.example.com.
Click on the warning page, and then click .
Click the icon, , and then .
Click , , and then click to save the CA certificate.
Close the tab when finished.
Import the IdM CA certificate:
Open Firefox and navigate to about:preferences.
Click , and navigate to the section.
Click , , and then .
Navigate to the Downloads directory and open the idm-lab-example-com.pem file.
Trust the certificate to identify websites, and then click and .
Import the idmuser01 certificate and enable TLS 1.3.
Import the idmuser01 certificate.
Open Firefox and navigate to about:preferences.
Click and navigate to the section.
Click , , and then .
Navigate to the student home directory and open the idmuser01.p12 file.
Enter RedHat123^ to unlock the file, and then click and .
Enable TLS 1.3 post-handshake authentication. This is supported in Firefox 68.0 and later, but is disabled by default.
Navigate to about:config, and then click .
Type post_handshake in the search field, and double-click the security.tls.enable_post_handshake_auth Boolean to set it as true.
Log in to the IdM web UI using a certificate.
Navigate to https://idm.lab.example.com or refresh the tab if already open.
On the IdM web UI login page, click .
The idmuser01 certificate should already be selected.
Leave selected, and then click .
You are now logged in, and you can see the details for the idmuser01 user.