DEX policies for macOS
Summarize
Summary of DEX policies for macOS
DEX policies for macOS provide structured guidelines and rules that enable organizations to use the ServiceNow application consistently, securely, and in compliance with internal standards. These policies help reduce data breach risks, enhance data quality, and optimize application performance and availability on macOS devices.
Show less
To facilitate comprehensive data retrieval on macOS, specific sudoers configurations must be applied to the /private/etc/sudoers.d/servicenow file. This configuration grants the servicenow user passwordless sudo access to a defined set of system commands and scripts essential for data collection and management.
Key Features
- Sudoers Configuration: Defines a command alias
SNALLOWEDthat includes system utilities and ServiceNow agent scripts permitted for execution by theservicenowuser without password prompts. This enables secure and automated execution of data collection tasks and system interactions. - User Permissions: The
servicenowuser is allowed to run theosqueryitool and allSNALLOWEDcommands with preserved environment variables and without requiring a TTY, supporting automated and script-driven operations. - Policy Definitions for Applications and Devices: Multiple scheduled policies collect metrics and compliance data from macOS devices and applications. These include historical and latest data collection intervals ranging from every 60 seconds to 24 hours, covering metrics such as CPU usage, memory, uptime, disk details, network status, and application crashes.
- Jamf Integration Fields: Policies include fields like action name, activation status, application identification, and policy ID to streamline policy management and execution through Jamf, facilitating automated application actions such as reinstall or uninstall.
Key Outcomes
- Automated and secure data collection from macOS devices, ensuring timely and accurate monitoring of device and application health.
- Improved data quality and operational efficiency through standardized command and script execution permissions tailored for ServiceNow agents.
- Enhanced compliance tracking with policies that gather both historical and latest metrics, enabling proactive device and application management.
- Seamless policy execution and action management integrated with Jamf, reducing manual intervention and supporting dynamic device management workflows.
Policies for macOS are guidelines and rules to promote that the application is used in a consistent, secure, and conforming manner. DEX policies your organization to reduce the risk of data breaches, improve data quality and accuracy, and optimize application performance and availability.
For macOS systems, to retrieve the entire data, include the subsequent content to /private/etc/sudoers.d/_servicenow.
# ServiceNow Agent Collector - Sudoers Configuration for macOS
# Command alias for ServiceNow allowed commands
# These commands can be executed by the _servicenow user with sudo privileges
Cmnd_Alias SN_ALLOWED = /usr/bin/powermetrics, \
/usr/bin/mdls, \
/usr/bin/log, \
/usr/bin/log show *, \
/bin/kill, \
/usr/bin/defaults, \
/usr/local/bin/jamf, \
/bin/rm, \
/bin/ls, \
/usr/bin/pgrep, \
/usr/bin/find, \
/usr/bin/pmset, \
/usr/bin/open, \
/Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/app_freeze.sh, \
/Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/zscaler_zpa_reconnect.sh, \
/Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/clear_google_chrome_browsing_data.sh, \
/Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/services.sh, \
/Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/restart_service.sh *, \
/Applications/Zscaler/Zscaler.app/Contents/PlugIns/zscli, \
/Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/elevate_temporary_admin.sh
# ServiceNow user permissions
# _servicenow user can run osqueryi and all SN_ALLOWED commands without password
# SETENV allows environment variables to be preserved
_servicenow ALL=NOPASSWD: SETENV: /Library/Application\ Support/servicenow/agent-client-collector/cache/osquery/bin/osqueryi *, SN_ALLOWED
# Defaults for _servicenow user
# !requiretty: Allow sudo without a TTY (required for automated scripts)
Defaults:_servicenow !requiretty
Cmnd_Alias SN_ALLOWED = /usr/bin/powermetrics, /usr/bin/mdls, /usr/bin/log, /bin/kill, /usr/bin/defaults, /usr/local/bin/jamf, /bin/rm, /bin/ls, /usr/bin/pgrep, /usr/bin/find, /usr/bin/pmset, /usr/bin/open, /Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/app_freeze.sh, /Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/zscaler_zpa_reconnect.sh, /Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/clear_google_chrome_browsing_data.sh, /bin/sh /Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/services.sh, /bin/sh /Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/restart_service.sh *, /Applications/Zscaler/Zscaler.app/Contents/PlugIns/zscli, /Library/Application\ Support/servicenow/agent-client-collector/cache/acc-dex-modules/bin/scripts/sudo/elevate_temporary_admin.sh
_servicenow ALL=NOPASSWD: SETENV: /Library/Application\ Support/servicenow/agent-client-collector/cache/osquery/bin/osqueryi *, SN_ALLOWED
Defaults:_servicenow !requiretty
Defaults timestamp_timeout=0
Defaults log_allowed
Policies for Mac — Application
| Policy name | Description | Check instances | Frequency | Historical or latest | Check instance parameters |
|---|---|---|---|---|---|
| DEX Mac Apps Metrics | Collects the application metrics in the Mac device and sends metric data to Metric Base. | os.mac.check-app-historical | 5 mins | Historical | cpu_usage, memory_usage, uptime, io_usage_read, io_usage_write, is_running, last_access_time, crashes |
Policies for Mac — Device
| Policy name | Description | Check instances | Frequency | Historical or latest | Check instance parameters |
|---|---|---|---|---|---|
| DEX Mac Device Metrics | Collects macOS device metrics and sends the metric data to the ServiceNow instance. | os.mac.check-system-metrics-latest | 24 hours | Latest | uptime, logged_in, firewall_enabled, session_details, disk_details, os_details, cpu_details, battery_details, device_details, network_details, pending_updates, device_events, cpu_usage, memory_details, os_setup_details, last_access_time, reboot_details |
| DEX Mac Device Metrics | Collects macOS device metrics and sends the metric data to MetricBase. | os.mac.check-system-metrics-historical | 5 mins | Historical | disk_usage, io_usage_write, io_usage_read, power_consumption, cpu_usage, memory_details, uptime, crashes, battery_charge_percentage, wifi_transmit_rate, wifi_rssi |
| DEX Mac Device Metrics | Collects data for running macOS processes and sends the data to the ServiceNow instance. | os.mac.check-process-data | 24 hours | N/A | N/A |
| DEX Mac Device Metrics | Collects macOS device metrics and sends the metric data to the ServiceNow instance. |
os.mac.check-sys-compliance-historical |
5 minutes | Historical | N/A |
| DEX Mac Device Metrics | Collects macOS device metrics and sends the metric data to the ServiceNow instance. |
os.mac.check-sys-compliance-latest |
24 Hours | Latest | N/A |
| DEX Mac Device Metrics |
Collects macOS device metrics and sends the metric data to the ServiceNow instance.
Note: If the previous check runs for more than five minutes, the current check gets skipped. |
os.mac.check-energy-consum-historical |
5 minutes | Historical | N/A |
| DEX Mac Device Metrics |
Collects macOS device metrics and sends the metric data to the ServiceNow instance. |
os.mac.check-system-metrics-historical | 30 minutes | Historical | vpn_details |
| DEX Get online macOS user on change | Gets a logged-in user's data on a macOS device whenever there’s a change. | os.mac.check-system-custom-query-on-chan | 60 secs | Latest | query,query_sys_id, query_type |
| DEX Get device configuration on change | Gets a logged-in user's device configuration whenever there’s a change. | os.all.check.internal.get-device-configu | 60 secs | Latest | N/A |
| Field name | Description |
|---|---|
| Action name | Name of the action that is defined in the policy. Admins can predefine an action name so that SD agents don't need the policy ID to execute any action. The format is <action> <application name> <version>. For example, Reinstall Zoom 3.4.1 or Uninstall Firefox 134.2. |
| Active true/false | Enables the action to appear in action library. |
| Application | Identifies the application for which the policy is defined. |
| Policy ID | ID of the policy defined in Jamf server for the corresponding action. |