SSH commands requiring a privileged user during probe-based discovery
Summarize
Summary of SSH commands requiring a privileged user during probe-based discovery
This document details the SSH commands that ServiceNow Discovery probes run during horizontal discovery which require elevated privileges on target systems. These commands gather critical hardware, disk, process, and network information necessary for accurate discovery and mapping of IT infrastructure.
Show less
ServiceNow customers should configure the privileged user (commonly named Disco) appropriately, ensuring that the commands execute with the necessary rights to collect discovery data. The sudoers file must be configured with NOPASSWD for these commands because sudo commands do not work with private key authentication due to the absence of a password prompt.
Key Configuration Considerations
- Privileged commands require sudo with NOPASSWD. For example, a sudoers entry like
disco ALL=(root) NOPASSWD:/usr/sbin/dmidecodeenables running dmidecode without a password. - Private key authentication limitations: sudo commands cannot prompt for passwords, so NOPASSWD is essential.
- Host key validation is not performed by the MID Server. This means the connection is vulnerable to man-in-the-middle attacks, so avoid exchanging sensitive credentials over SSH. Use SSH keys or certificates for authentication exclusively.
- Substitute the actual username and verify command paths on your systems. The examples assume user
discoand common command paths, but these must be adjusted to match your environment.
Common Privileged SSH Commands by Operating System
The following tables summarize commands requiring elevated privileges. Each command should be enabled with the corresponding sudoers configuration.
- HP-UX:
adb: Gathers CPU speed and memory info.
- Linux:
dmidecode: Hardware details including motherboard serial number.fdisk -l: Disk and size info.multipath -ll: MultiPath IO device mappings.
- Linux and Solaris:
dmsetup tableanddmsetup ls: Low-level volume examination.
- All UNIX versions:
lsof: Process and connection relationships.oratab: Read access for Oracle Home and pfile locations.netstatandss: Network connection details.
- Solaris:
iscsiadm: iSCSI qualified names.fcinfo: WWPNs for ports.prtvtoc: Disk partition info.psand/usr/ucb/ps: Running processes (procowner role alternative available).pgrep: List of process IDs with socket info.pfiles: Process socket file info.
Practical Implications for ServiceNow Customers
- Ensure the privileged user account used by Discovery has sudo privileges configured with NOPASSWD for the listed commands to enable seamless execution without manual password entry.
- Verify command paths and adjust sudoers entries to match your system environment to prevent discovery failures.
- Limit sensitive data exposure over SSH connections since MID Server does not validate host keys; use key-based authentication and avoid sending credentials.
- Refer to related documentation for commands not requiring privileges and for Service Mapping-specific commands.
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 Non-privileged SSH commands 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: |