Example: Sensor-sourced packages
Overview of sensor-sourced packages
Sensor-sourced packages are designed like parameterized packages (see Example: Parameterized packages), but take sensor output instead of user input as run-time arguments. The command syntax requires a sensor result that Tanium Cloud passes from the Interact Question Results grid when you initiate the action deployment workflow. For example, the following action workflow runs a package that removes the CSV file extension from the exclusions list of Microsoft Defender on Windows endpoints:
-
Issue a question with the sensor Microsoft Defender Extension Exclusions. Tanium Clients run the sensor and return results that you can select on the Questions Results page.
-
Select the csv result, which is from Clients on which Defender excludes that extension.
-
Deploy an action with the package Microsoft Defender - Remove Extension Exclusion [Windows].
To deploy an action, you click Deploy Action on the Question Results page. The Action Deployment page then opens and provides the Deployment Package dropdown list for you to select the package. The list includes sensor-sourced packages only if your selections in the Question Results have a value to pass to the package. For example, if you select the result row with the value csv, the Deployment Package list shows the package Microsoft Defender - Remove Extension Exclusion [Windows]. If you select a result with the value [no results], the list does not show that package.
On the Action Deployment page, the Target Question specifies the selected result. Tanium Cloud passes this value to the package command line.
To create a sensor-sourced package, configure the script and settings as described in the following sections when you perform the steps in Create a package:
Script for a sensor-sourced package
When you deploy an action with a sensor-sourced package, Tanium Cloud encodes the parameter values from sensor output before passing the values to the package script. Tanium Cloud includes the encoded values in the temporary package that it deploys in an action to Tanium Clients. When Clients start the action, they run the package script, which applies UTF-8 decoding to the encoded values.
PowerShell package scripts use the .NET method [System.Uri]::UnescapeDataString() to decode UTF-8 encoded parameters. For example, the script RemoveDefenderExtensionExclusion.ps1 for the package Microsoft Defender - Remove Extension Exclusion [Windows] uses:
$decoded_value = [System.Uri]::UnescapeDataString($args[0])
The VBScript script startservice.vbs for the package Start Service - ||Stopped Service|| uses the following method for decoding:
strService = Trim(UTF8Decode(colArguments.Item(0)))
For more information, see UTF-8 encoding and decoding.
Configure settings for a sensor-sourced package
To configure a sensor-sourced package, add sensors to the Command and (optionally) Package Name settings on the Create Package page when you perform the steps in Create a package.
Command setting
When you Create a package that uses sensor-sourced parameters, add a sensor variable to the Command setting on the Create Package page:
-
Place the cursor where the sensor output is needed in the command and click Add sensor variable.
-
Select a sensor and click Confirm.
Package Name setting (optional)
When you Create a package that uses sensor-sourced parameters, you can add the sensor output to the Package Name setting on the Create Package page. Place the cursor where you want the output to appear in the package name and type ||<sensor name>||. This option helps you to distinguish among actions that use the same package but use different sensor output.
For example, the following workflow creates an action named Deploy Start Service - Windows Defender Network Inspection Service:
-
Issue a question that uses the sensor Stopped Service.
-
Select question results that have the sensor output Windows Defender Network Inspection Service.
-
Deploy an action that uses the package named Start Service - ||Stopped Service||.
If you select results with multiple output values for a sensor, Tanium Cloud creates a separate action for each value. For example, if the package name includes the sensor Computer Name, the action deployment workflow automatically creates an action for each endpoint in the selected results because each has a unique computer name. Because you can select a maximum of 100 results for one action deployment, Tanium Cloud creates a maximum of 100 actions for a single package that has a sensor in its name.