8.2. Connecting to sudo remotely using a smart card
Follow this procedure to configure the SSH agent and client to connect to sudo remotely using a smart card.
Prerequisites
-
You have created
sudorules in IdM. - You have configured IdM to support passkey authentication using FIDO2 Yubikeys or PKINIT authentication using smart cards.
-
You have configured the
pam_sss_gssmodule forsudoauthentication on the remote system where you are going to runsudo.
Procedure
Start the SSH agent (if not already running).
# eval `ssh-agent`Add your smart card to the SSH agent. Enter your PIN when prompted:
# ssh-add -s /usr/lib64/opensc-pkcs11.soConnect to the system where you need to run
sudoremotely by using SSH with ssh-agent forwarding enabled. Use the-Aoption:# ssh -A ipauser1@server.ipa.test
Verification
Run the
whoamicommand withsudo:# sudo /usr/bin/whoami
You are not prompted for a PIN or password when the smart card is inserted.
If the SSH agent is configured to use other sources, such as the GNOME Keyring, and you run the sudo command after removing the smart card, you might not be prompted for a PIN or password, as one of the other sources might provide access to a valid private key. To check the public keys of all identities known by the SSH agent, run the ssh-add -L command.