8장. Authenticating to sudo remotely using smart cards
You can authenticate to sudo remotely using smart cards. After the ssh-agent service is running locally and can forward the ssh-agent socket to a remote machine, you can use the SSH authentication protocol in the sudo PAM module to authenticate users remotely.
After logging in locally using a smart card, you can log in through SSH to the remote machine and run the sudo command without being prompted for a password by using SSH forwarding of the smart card authentication.
For the purposes of this example, a client is connecting to the IPA server through SSH and running the sudo command on the IPA server with credentials stored on a smart card.
8.1. Creating sudo rules in IdM 링크 복사링크가 클립보드에 복사되었습니다!
Follow this procedure to create sudo rules in IdM to give <idm_user> permission to run sudo on the remote host.
For the purposes of this example, the less and whoami commands are added as sudo commands to test the procedure.
Prerequisites
-
The IdM user has been created. For the purpose of this example, the user is
<idm_user>. -
You have the hostname of the system where you are running
sudoremotely. For the purpose of this example, the host isserver.ipa.test.
Procedure
Create a
sudorule named <sudorule_name> to allow a user to run commands. Replace <sudorule_name> with the actual name of the sudo rule you want to create.# ipa sudorule-add <sudorule_name>Add
lessandwhoamiassudocommands:# ipa sudocmd-add /usr/bin/less # ipa sudocmd-add /usr/bin/whoamiAdd the
lessandwhoamicommands to the <sudorule_name>:# ipa sudorule-add-allow-command <sudorule_name> --sudocmds /usr/bin/less # ipa sudorule-add-allow-command <sudorule_name> --sudocmds /usr/bin/whoamiAdd the
<idm_user>user to the <sudorule_name>:# ipa sudorule-add-user <sudorule_name> --users <idm_user>Add the host on which you are running
sudoto the <sudorule_name>:# ipa sudorule-add-host <sudorule_name> --hosts server.ipa.test