Chapter 5. Configuring smart card authentication with the web console for centrally managed users
Configure smart card authentication in the RHEL web console for users who are centrally managed by:
- Identity Management
- Active Directory which is connected in the cross-forest trust with Identity Management
Smart card authentication does not elevate administrative privileges yet and the web console opens in the web browser in the read-only mode.
You can run administrative commands in the built-in terminal with `sudo`.
The system for which you want to use the smart card authentication must be a member of an Active Directory or Identity Management domain.
For details about joining the RHEL 8 system into a domain using the web console, see Joining a RHEL 8 system to an IdM domain using the web console.
The certificate used for the smart card authentication must be associated with a particular user in Identity Management or Active Directory.
For more details about associating a certificate with the user in Identity Management, see Adding a certificate to a user entry in the IdM Web UI or Adding a certificate to a user entry in the IdM CLI.
5.1. Smart card authentication for centrally managed users
A smart card is a physical device, which can provide personal authentication using certificates stored on the card. Personal authentication means that you can use smart cards in the same way as user passwords.
You can store user credentials on the smart card in the form of a private key and a certificate. Special software and hardware is used to access them. You insert the smart card into a reader or a USB socket and supply the PIN code for the smart card instead of providing your password.
Identity Management (IdM) supports smart card authentication with:
- User certificates issued by the IdM certificate authority. For details, see Configuring Identity Management for smart card authentication.
- User certificates issued by the Active Directory Certificate Service (ADCS) certificate authority. For details, see Configuring certificates issued by ADCS for smart card authentication in IdM.
If you want to start using smart card authentication, see the hardware requirements: Smart Card support in RHEL8+.
5.2. Installing tools for managing and using smart cards
To configure your smart card, you need tools which can generate certificates and store them on a smart card.
gnutls-utilspackage, which helps you to manage certificates.
openscpackage, which provides a set of libraries and utilities to work with smart cards.
pcscdservice, which communicates with the smart card reader.
# dnf -y install opensc gnutls-utils
# systemctl start pcscd
Verify that the
pcscd service is up and running.
5.3. Preparing your smart card and uploading your certificates and keys to your smart card
This section describes smart card configuration with the
pkcs15-init tool, which helps you to configure:
- Erasing your smart card
- Setting new PINs and optional PIN Unblocking Keys (PUKs)
- Creating a new slot on the smart card
- Storing the certificate, private key, and public key in the slot
- If required, locking the smart card settings as certain smart cards require this type of finalization
pkcs15-init tool may not work with all smart cards. You must use the tools that work with the smart card you are using.
openscpackage, which includes the
pkcs15-inittool, is installed.
For details, see Installing tools for managing and using smart cards.
- The card is inserted in the reader and connected to the computer.
You have the private key, public key, and certificate to store on the smart card. In this procedure,
testuser.crtare the names used for the private key, public key, and the certificate.
- You have your current smart card user PIN and Security Officer PIN (SO-PIN).
Erase your smart card and authenticate yourself with your PIN:
$ pkcs15-init --erase-card --use-default-transport-keys Using reader with a card: Reader name PIN [Security Officer PIN] required. Please enter PIN [Security Officer PIN]:
The card has been erased.
Initialize your smart card, set your user PIN and PUK, and your Security Officer PIN and PUK:
$ pkcs15-init --create-pkcs15 --use-default-transport-keys \ --pin 963214 --puk 321478 --so-pin 65498714 --so-puk 784123 Using reader with a card: Reader name
pcks15-inittool creates a new slot on the smart card.
Set the label and the authentication ID for the slot:
$ pkcs15-init --store-pin --label testuser \ --auth-id 01 --so-pin 65498714 --pin 963214 --puk 321478 Using reader with a card: Reader name
The label is set to a human-readable value, in this case,
auth-idmust be two hexadecimal values, in this case it is set to
Store and label the private key in the new slot on the smart card:
$ pkcs15-init --store-private-key testuser.key --label testuser_key \ --auth-id 01 --id 01 --pin 963214 Using reader with a card: Reader nameNote
The value you specify for
--idmust be the same when storing your private key and storing your certificate in the next step. Specifying your own value for
--idis recommended as otherwise a more complicated value is calculated by the tool.
Store and label the certificate in the new slot on the smart card:
$ pkcs15-init --store-certificate testuser.crt --label testuser_crt \ --auth-id 01 --id 01 --format pem --pin 963214 Using reader with a card: Reader name
(Optional) Store and label the public key in the new slot on the smart card:
$ pkcs15-init --store-public-key testuserpublic.key --label testuserpublic_key --auth-id 01 --id 01 --pin 963214 Using reader with a card: Reader nameNote
If the public key corresponds to a private key or certificate, specify the same ID as the ID of the private key or certificate.
(Optional) Certain smart cards require you to finalize the card by locking the settings:
$ pkcs15-init -F
At this stage, your smart card includes the certificate, private key, and public key in the newly created slot. You have also created your user PIN and PUK and the Security Officer PIN and PUK.
5.4. Enabling smart card authentication for the web console
To be able to use smart card authentication in the web console, enable smart card authentication in the
Additionally, you can disable password authentication in the same file.
The RHEL web console has been installed.
For details, see Installing the web console.
Log in to the RHEL web console with administrator privileges.
For details, see Logging in to the web console.
- Click Terminal.
/etc/cockpit/cockpit.conf, set the
[WebService] ClientCertAuthentication = yes
Optionally, disable password based authentication in
[Basic] action = none
This configuration disables password authentication and you must always use the smart card.
Restart the web console to ensure that the
cockpit.serviceaccepts the change:
# systemctl restart cockpit
5.5. Logging in to the web console with smart cards
You can use smart cards to log in to the web console.
- A valid certificate stored in your smart card that is associated to a user account created in a Active Directory or Identity Management domain.
- PIN to unlock the smart card.
- The smart card has been put into the reader.
Open your web browser and add the web console’s address in the address bar.
The browser asks you to add the PIN protecting the certificate stored on the smart card.
- In the Password Required dialog box, enter PIN and click OK.
- In the User Identification Request dialog box, select the certificate stored in the smart card.
Select Remember this decision.
The system does not open this window next time.Note
This step does not apply to Google Chrome users.
- Click OK.
You are now connected and the web console displays its content.
5.6. Limiting user sessions and memory to prevent a DoS attack
Certificate authentication is protected by separating and isolating instances of the
cockpit-ws web server against attackers who wants to impersonate another user. However, this introduces a potential Denial of Service (DoS) attack: A remote attacker could create a large number of certificates and send a large number of HTTPS requests to
cockpit-ws each using a different certificate.
To prevent this DoS, the collective resources of these web server instances are limited. By default, limits to the number of connections and to memory usage are set to 200 threads and a 75% (soft) / 90% (hard) memory limit.
The following procedure describes resource protection by limiting the number of connections and memory.
In the terminal, open the
# systemctl edit system-cockpithttps.slice
TasksMaxto 100 and
[Slice] # change existing value TasksMax=100 # add new restriction CPUQuota=30%
To apply the changes, restart the system:
# systemctl daemon-reload # systemctl stop cockpit
Now, the new memory and user session limits protect the
cockpit-ws web server from DoS attacks.