How to configure sudo elevation and SSH keys
Important
This version of Operations Manager has reached the end of support, we recommend you to upgrade to Operations Manager 2022.
With System Center - Operations Manager, you can provide credentials for an unprivileged account to be elevated on a UNIX or Linux computer by using the sudo program, which allows users to run programs that have the security privileges of another user account. You can also use Secure Shell (SSH) keys instead of a password for secure communication between Operations Manager and the targeted computer.
Note
Operations Manager supports SSH Key-based authentication with key file data in the PuTTY Private Key (PPK) format. Currently supports SSH v.1 RSA keys and SSH v.2 RSA and DSA keys.
This topic provides examples for creating an account for a low-privileged user, implementing sudo, and creating an SSH key on a computer that is running Red Hat Enterprise Linux Server 6. These are examples only, and might not reflect your environment. The following examples provide a user with access to a full set of privileges.
To obtain and configure the SSH key from the UNIX and Linux computer, you have to install the following software on your Windows-based computer:
A file transfer tool, such as WinSCP, to transfer files from the UNIX or Linux computer to the Windows-based computer.
The PuTTY program, or a similar program, to run commands on the UNIX or Linux computer.
The PuTTYgen program to save the private SHH key in OpenSSH format on the Windows-based computer.
Note
The sudo program exists at different locations on UNIX and Linux operating systems. To provide uniform access to sudo, the UNIX and Linux agent installation script creates the symbolic link /etc/opt/microsoft/scx/conf/sudodir to point to the directory expected to contain the sudo program. The agent uses this symbolic link to invoke sudo. The installation script automatically creates the symbolic link, so you do not need to take any action on standard UNIX and Linux configurations; however, if you have sudo installed at a non-standard location, you should change the symbolic link to point to the directory where sudo is installed. If you change the symbolic link, its value is preserved across uninstall, re-install, and upgrade operations with the agent.
Configure a low-privileged account for sudo elevation
The following procedures create a low-privileged account and sudo elevation by using opsuser for a user name.
To create a low-privileged user
Log on to the UNIX or Linux computer as
root.Add the user:
useradd opsuserAdd a password and confirm the password:
passwd opsuser
You can now configure sudo elevation and create an SSH key for opsuser, as described in the following procedures.
To configure sudo elevation for the low-privileged user
Log on to the UNIX or Linux computer as
root.Use the visudo program to edit the sudo configuration in a vi text editor. Run the following command:
visudoFind the following line:
root ALL=(ALL) ALLInsert the following line after it:
opsuser ALL=(ALL) NOPASSWD: ALLTTY allocation is not supported. Ensure the following line is commented out:
# Defaults requirettyImportant
This step is required for sudo to work.
Save the file and exit visudo:
Press ESC + : (colon) followed by
wq!, and then press Enter.Test the configuration by entering in the following two commands. The result should be a listing of the directory without being prompted for a password:
su - opsusersudo ls /etc
You can use the opsuser account by using the password and sudo elevation for specifying credentials in Operations Manager wizards and for configuring Run As accounts.
Create an SSH key for authentication
The following procedures create an SSH key for the opsuser account that was created in the previous examples.
To generate the SSH key
Log on as
opsuser.Generate the key by using the Digital Signature Algorithm (DSA) algorithm:
ssh-keygen -t dsaNote the optional passphrase if you provided it.
The ssh-keygen creates the /home/opsuser/.ssh directory with the private key file (id_dsa) and the public key file (id_dsa.pub). You can now configure the key to be supported by opsuser as described in the next procedure.
To configure a user account to support the SSH key
At the command prompt, type the following commands. To navigate to the user account directory:
cd /home/opsuserSpecify exclusive owner access to the directory:
chmod 700 .sshNavigate to the .ssh directory:
cd .sshCreate an authorized keys file with the public key:
cat id_dsa.pub >> authorized_keysGive the user read and write permissions to the authorized keys file:
chmod 600 authorized_keys
You can now copy the private SSH key to the Windows-based computer, as described in the next procedure.
To copy the private SSH key to the Windows-based computer and save in OpenSSH format
Use a tool, such as WinSCP, to transfer the private key file (
id_dsa- with no extension) from the UNIX or Linux computer to a directory on your Windows-based computer.Run PuTTYgen.
In the PuTTY Key Generator dialog box, click the Load button, and then select the private key
(id_dsa) that you transferred from the UNIX or Linux computer.Click Save private key and name and save the file to the desired directory.
You can use the opsuser account by using the SSH key and sudo elevation for specifying credentials in Operations Manager wizards and for configuring Run As accounts.
Note
Verify that you are saving the PuTTYgen Private Key as version 2 instead of version 3. You may change the PPK file version by going to the menu and selecting, Key > Parameters for saving key files...
PPK file version 2 is currently supported for System Center Operations Manager.
Next steps
To understand how to authenticate and monitor your UNIX and Linux computers, review Credentials You Must Have to Access UNIX and Linux Computers
Review the Configuring SSL Ciphers if you need to reconfigure Operations Manager to use a different cipher.