SSH commands requiring a privileged user during probe-based discovery
Summarize
Summary of SSH commands requiring a privileged user during probe-based discovery
This content outlines the SSH commands used by ServiceNow Discovery probes during horizontal discovery that require elevated (privileged) user rights. These commands help gather detailed system information essential for accurate discovery of target machines. The commands run under a user account (commonly namedDisco), which must have sudo privileges configured appropriately to execute these commands without password prompts.
Show less
It is important to configure the sudoers file with the NOPASSWD option for the required commands, as sudo commands cannot be used with private key authentication without password prompts. This ensures smooth automated discovery operations.
Key Considerations
- SSH key validation: The MID Server does not validate host keys, so the SSH connection is treated as untrusted. To mitigate risks such as man-in-the-middle attacks, avoid sending sensitive credentials over these connections and prefer using SSH keys or certificates for authentication.
- Sudo configuration: The user running Discovery probes should have specific commands permitted with NOPASSWD in the sudoers file to allow seamless command execution.
- Command paths: Verify and adjust command paths in the sudoers file and Discovery configurations to match the target system's environment.
Commands Requiring Elevated Privileges
The commands vary depending on the operating system. Below are examples with suggested sudoers entries for the user Disco:
- HP-UX:
adbto gather CPU speed and memory (Disco ALL=(root) /usr/bin/adb). - Linux:
dmidecodefor hardware info including serial numbers (Disco ALL=(root) /sbin/dmidecode).fdisk -lto retrieve disk and size info (Disco ALL=(root) /usr/bin/fdisk -l).multipath -llfor multipath device mappings (Disco ALL=(root) /usr/bin/multipath -ll).
- Linux and Solaris:
dmsetupfor low-level volume examination (Disco ALL=(root) /usr/bin/dmsetup tableandDisco ALL=(root) /usr/bin/dmsetup ls).
- All UNIX versions:
lsofto map processes to connections (Disco ALL=(root) /sbin/lsof).netstatorssto understand process connection relationships (Disco ALL=(root) /bin/netstatandDisco ALL=(root) /sbin/ss).- Read access to
oratabfor Oracle home and pfile location.
- Solaris:
iscsiadmto get iSCSI qualified names.fcinfoto retrieve WWPNs for ports.prtvtocfor disk partition info (Disco ALL=(root) /usr/bin/prtvtoc).pscommand to list running processes (can be run with root or by assigning aprocownerrole). Solaris 11 requires manual installation of/usr/ucb/psas it is deprecated (Disco ALL=(root) /usr/ucb/ps).pgrepfor process IDs with socket info (Disco ALL=(root) /usr/bin/pgrep).pfilesto process socket file info (Disco ALL=(root) /usr/bin/pfiles).
Practical Application for ServiceNow Customers
To enable successful probe-based horizontal discovery using SSH on your target systems, ensure the Discovery user is configured with passwordless sudo rights for the listed commands relevant to your operating systems. Confirm that command paths and sudoers configurations are accurate to prevent probe failures. Use SSH keys or certificates for authentication and avoid transmitting sensitive credentials to minimize security risks.
By implementing these configurations, your Discovery probes can efficiently gather comprehensive system information, leading to a more complete and accurate CMDB population.
These tables display the SSH commands run by Discovery probes during horizontal discovery. These SSH commands require elevated privileges to run.
Operating system commands requiring elevated rights
disco ALL=(root)
NOPASSWD:/usr/sbin/dmidecode,/usr/sbin/lsof,/sbin/ifconfig.For information on commands that don’t require elevated rights, see SSH commands not requiring a privileged user during probe-based discovery.
For information on commands used by Service Mapping during the top-down discovery, see Service Mapping commands requiring a privileged user and Service Mapping commands not requiring a privileged user.
SSH key not validated
When the MID Server connects to a system, the MID Server doesn’t perform host key validation against that system and so treats it as untrusted. If an attacker performs a man-in-the-middle attack and redirects the traffic to a malicious SSH service, the attacker can intercept or modify any data sent over the connection.
Therefore, limit any sensitive information exchanged between the MID Server and the target SSH server. Only use keys or certificates for SSH authentication, and avoid sending system credentials. Configure NOPASSWD in the sudoers file for the required privileged commands.
| Command | Purpose |
|---|---|
| adb | Gathers CPU speed and memory. /etc/sudoers line example: |
| Command | Purpose |
|---|---|
| dmidecode | Gathers several pieces of information about the hardware, including the serial number embedded within the motherboard. /etc/sudoers line example: |
| fdisk | Gathers the disks and size information on the system. /etc/sudoers line example: |
| multipath | Gathers device mappings for MultiPath Input Output (MPIO). /etc/sudoers line example: |
| Command | Purpose |
|---|---|
| dmsetup | Examines a low-level volume. /etc/sudoers line example
|
| Command | Purpose |
|---|---|
| lsof | Determines the relationship between processes and the connections being made to the system. /etc/sudoers line example: |
| oratab | Grants read access to the oratab file for locating the Oracle Home and pfile. |
| netstat | Determines the relationship between processes and the connections being made to the system. /etc/sudoers line example: |
| ss | Determines the relationship between processes and the connections being made to the system. /etc/sudoers line example: |
| Command | Purpose |
|---|---|
| iscsiadm | Gets iSCSI qualified names (IQNs). /etc/sudoers line example: |
| fcinfo | Gets World Wide Port Names (WWPNs) for ports. /etc/sudoers line example: |
| prtvtoc | Reports information about disk partitions. /etc/sudoers line example: |
| /usr/bin/ps | Lists running process. As an alternative to running with root access, add a proc_owner role.sola. /etc/sudoers line example: |
| /usr/ucb/ps | Lists running process. As an alternative to running with root access, add a proc_owner role. The use of the /etc/sudoers line example: |
| pgrep | Gets list of process IDs (PIDs) with socket information. /etc/sudoers line example: |
| pfiles | For each PID, gets and processes the output for S_IFSOCK. /etc/sudoers line example: |