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 outlines the SSH commands that ServiceNow Discovery probes execute during horizontal discovery which require elevated (privileged) user rights. It explains the necessity of configuring these commands with appropriate sudo privileges and highlights security considerations related to SSH key authentication and host key validation.
Show less
Key Details for ServiceNow Customers
- Privileged Commands Usage: Discovery probes require certain OS commands to run with elevated privileges to gather hardware, network, and process information. These commands vary by operating system (HP-UX, Linux, Solaris, UNIX).
- User and Sudo Configuration: The example user name is
Disco, which you should replace with your actual user. Commands must be added to the sudoers file with theNOPASSWDoption to allow passwordless privilege escalation. For example:
disco ALL=(root) NOPASSWD:/usr/sbin/dmidecode,/usr/sbin/lsof,/sbin/ifconfig - SSH Authentication Considerations: Private key-based SSH authentication does not support sudo commands requiring passwords. Configuring
NOPASSWDin sudoers avoids this issue. Also, the MID Server does not validate SSH host keys, which poses a potential security risk. Limit sensitive data sent over SSH and prefer key/certificate authentication over passwords.
Commands by Operating System
Each OS uses specific privileged commands during discovery. Below are important commands and their purposes, along with example sudoers entries:
- HP-UX:
adbfor CPU speed and memory info.
Sudo example:disco ALL=(root) /usr/bin/adb - Linux (all versions):
dmidecode– hardware details including motherboard serial numberfdisk– disk and size infomultipath– device mappings for multipath I/O
disco ALL=(root) /sbin/dmidecode,
disco ALL=(root) /usr/bin/fdisk -l,
disco ALL=(root) /usr/bin/multipath -ll - Linux and Solaris:
dmsetupto examine low-level volumes.
Sudo examples:
disco ALL=(root) /usr/bin/dmsetup table
disco ALL=(root) /usr/bin/dmsetup ls - All UNIX Versions:
lsof– relationship between processes and connectionsoratab– read access for Oracle Home locationsnetstat,ss– process and connection info
disco ALL=(root) /sbin/lsof
disco ALL=(root) /bin/netstat
disco ALL=(root) /sbin/ss - Solaris Specific:
iscsiadm– iSCSI qualified namesfcinfo– World Wide Port Names for Fibre Channel portsprtvtoc– disk partition infops– process listing; alternatively, assign procowner role to avoid root accesspgrep– list PIDs with socket infopfiles– detailed file info for processes
disco ALL=(root) /usr/bin/prtvtoc
disco ALL=(root) /usr/bin/ps
disco ALL=(root) /usr/bin/pgrep
Security Recommendations
- Configure sudoers with
NOPASSWDfor required commands to allow Discovery probes to run privileged commands without password prompts. - Use SSH keys or certificates for authentication and avoid sending system credentials over SSH.
- Be aware that MID Server does not validate SSH host keys, so limit sensitive data exposure to reduce risk from man-in-the-middle attacks.
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: |