SSH commands requiring a privileged user during probe-based discovery
Summarize
Summary of SSH commands requiring a privileged user during probe-based discovery
This information details the SSH commands used by ServiceNow Discovery probes during horizontal discovery that require elevated privileges. These commands are executed on target systems via SSH and necessitate privileged access to gather critical system and hardware information.
Show less
It is important to configure the target systems properly to allow these commands to run securely and effectively, using the appropriate sudo permissions without requiring passwords, especially when using SSH key-based authentication.
Key Configuration Considerations
- Username substitution: Replace the example user "disco" with your actual user configured on the target system.
- Path verification: Ensure the command paths in the sudoers file match those on the target system.
- Sudo NOPASSWD option: Since sudo commands won’t work with private key credentials without a password prompt, configure sudo to allow specified commands to run without a password by adding NOPASSWD entries in the sudoers file.
- SSH host key validation: The MID Server does not validate SSH host keys, which can expose connections to man-in-the-middle attacks. To mitigate risk, avoid sending sensitive credentials and use SSH keys or certificates for authentication.
Commands Requiring Elevated Privileges
The commands vary by operating system. Below are key commands and their purposes, along with example sudoers file entries:
- HP-UX:
adbto gather CPU speed and memory information. - Linux (all versions):
dmidecode: hardware details, including motherboard serial numberfdisk -l: disk and size informationmultipath -ll: MultiPath I/O device mappings
- Linux and Solaris:
dmsetup tableanddmsetup ls: low-level volume examination
- All UNIX versions:
lsof,netstat,ss: process and connection relationshipsoratab: read access for Oracle Home and pfile locations
- Solaris-specific:
iscsiadm: iSCSI qualified names (IQNs)fcinfo: World Wide Port Names (WWPNs)prtvtoc: disk partition reportspsand/usr/ucb/ps: lists running processes (note: /usr/ucb/ps is deprecated in Solaris 11 and requires manual installation)pgrep: process IDs with socket infopfiles: process file information
Practical Recommendations for ServiceNow Customers
- Configure sudoers entries explicitly for each privileged command needed by Discovery probes, specifying absolute command paths and using NOPASSWD to enable passwordless execution.
- Use SSH keys or certificates for authentication and avoid transmitting plaintext system credentials over SSH.
- Review and match command paths on each target system to ensure Discovery commands run successfully.
- Be aware that lack of SSH host key validation by the MID Server requires minimizing sensitive data over SSH and ensuring secure network environments.
- For Solaris 11, manually install the ucb utility if required for Discovery compatibility.
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: |