Manually creating patch requests

Overview of manual patching

Use the ServiceNow Flow Designer to create flows that integrate with the Tanium Patch module to manually deploy patches to endpoints through ad-hoc patch requests. The flow orchestrates all the deployment actions based on the trigger that you specify, such as an item request in the ServiceNow Service Catalog. You typically create manual patch requests to deploy patches to endpoints that are not included in automatic flows. For example, some endpoints might perform a critical function in your network at a time that coincides with an automated flow for Patch Tuesday patching. In this case, you can exclude those endpoints from the automated flow and patch them through a manual request at a time that has less impact on your network.

The following figure shows an example flow for a manual patch request. This example is useful for understanding the triggers and actions that are common to many manual patch flows.

Figure 1. Flow for Patch Requested Endpoints
Flow for Patch Requested Endpoints

The sections in this topic describe the components of the preceding example flow. After you create or edit the flow, be sure to Save, test, and activate the flow. Then you can Create a Tanium Patch Request in the Service Catalog to trigger the flow.

Tanium Patch Management for IT Operations provides several of the components in the example flow as predefined actions that you can reuse for your own custom flows, as described in Predefined actions for patch management. The processes and policies of your organization determine the specific triggers and actions that you configure for patch flows.

Note: The following sections assume familiarity with the ServiceNow Flow Designer. For more information, see the Flow Designer documenation.
Note: Test each action before adding it to a flow. For more information, see Test an action.

Predefined actions for patch management

Tanium provides the following actions that you can use to create patch management flows.

Table 1. Predefined actions for patch management

Action

Description

Create Tanium Patch Request

Creates an empty record in the Tanium Patch Request table

To populate the record with endpoints and patches, use other actions, such as Add endpoints to Patch Request from Change and Add Patches by Filter to Patch Request. For an example of how to use this action in a flow, see Create a Tanium Patch Request.

Add endpoints to Patch Request from Change

Adds endpoints that you specify in a change request to a patch request

In a flow for deploying patches, creating a change request is a prerequisite for creating the patch request. On a change request record, the Affected CIs tab shows the targeted endpoints. For an example of how to use this action in a flow, see Add endpoints from a change request to a patch request.

Add Endpoints by Filter to Patch Request

Adds all endpoints that match the specified filters to a Tanium patch request

Configure the filters to include only endpoints with the same operating system (OS) as the OS that the patch request specifies. The following example shows a filter that includes only Windows endpoints that are virtual machines (VMs).

Figure 2. Add Endpoints by Filter to Patch Request
Add Endpoints by Filter to Patch Request

Add endpoints missing selected patches

Adds endpoints to a patch request if its patches meet the following conditions:

  • The patches are applicable to the endpoints. For example, if the request specifies Windows patches, this action adds Windows endpoints but not Linux endpoints.

  • The patches are not already installed on the endpoints.

For example, you can use the action to add Windows endpoints that do not have a specific Windows patch installed. The Tanium Patch Status table records the patch installation status for endpoints. For an example of how to use this action in a flow, see Add endpoints missing selected patches.

Add Patches by CVE to Patch Request

Adds patches that are associated with specific common vulnerabilities and exposures (CVE) to a patch request

This action is useful for addressing specific security flaws on endpoints. For an example of how to use this action in a flow, see Add patches by CVE to a patch request.

Add Patches by Filter to Patch Request

Adds all patches that match the specified filters to a Tanium patch request

The Tanium Patch Definition table has a record for each available patch. For an example of how to use this action in a flow, see Add patches by filter to a patch request.

Add Patch Lists by Filter to Patch Request

Adds all patch lists that match the specified filters to a Tanium patch request

The Tanium Patch List table has a record for each available patch list. For an example of how to use this action in a flow, see Add patch lists by filter to a patch request.

Check if Patch Request is ready

Checks whether all the required fields in a patch request are populated, in which case the request is ready to proceed with deployment

Use this action to verify that a deployment can succeed or to generate useful error messages if the request is not ready. Error messages can help you troubleshoot the deployment. For an example of how to use this action in a flow, see Check if the patch request is ready.

Get Confidence Scores for a Tanium Patch Request

Outputs a formatted string that contains the confidence score status for patches associated with a Tanium Patch Request

Use this action for informational purposes, such as adding the confidence score information to a Change Request for review. You can also open the action in Action Designer and complete a Test run. Then, copy the output string to a Patch Request or Change Request description.

Trigger Patch Request Deployment

Runs a patch request, which creates a deployment in the Tanium Patch module

For an example of how to use this action in a flow, see Trigger patch request deployment.

Important: Always run the action Check if Patch Request is ready before running Trigger Patch Request Deployment.

View, edit, or create flows

Perform the following steps to view, edit, or create a flow. Each new or existing flow opens in a separate tab in the ServiceNow Flow Designer. Switching between tabs can help you create a new flow by basing it on the components of an existing flow.

  1. Sign in to your ServiceNow instance.

  2. In the Main menu, click All, enter flow designer in the filter Filter field, and click Flow Designer.

  3. Click Flows to view all the existing flows. To view all the components of a specific flow, click its Name to open the flow in a new tab. If you edit any component, click Done in the corresponding section. After you finish making all your edits, click Save in the flow toolbar.

  4. Create a flow by selecting New > Flow. For the remaining steps, see Building flows.

Figure 3. Flow Designer
Flow Designer

Configure the trigger

Configure a trigger that starts the flow actions, such as a request for a Service Catalog item. In this example, the requested item is a Tanium Patch Request. You can run the flow in the background if you want to set a priority for the flow in relation to other flows.

Note: For more information, see Create a flow with a Service Catalog trigger and Flow priority.
Figure 4. Service Catalog trigger
Service Catalog trigger

Set flow variables

Set the variables that provide input for other actions in the flow. In this example, you add the following variables for the action Create a change request:

  • Requestor: Select the user role that is responsible for creating change requests. In this example, the role is System Administrator because patching can have a significant impact on your network and therefore warrants a highly privileged role.

  • Assignment Group: Select the team that is responsible for reviewing and approving change requests that initiate patch requests. In the example flow, the team is Patch request approval group.

Figure 5. Set flow variables
Set flow variables

Get catalog variables

The Patch Requested Endpoints flow resolves the following variables when a Service Catalog request triggers the flow. You set the variable values when you Create a Tanium Patch Request in the Service Catalog.

  • patch_from_date: ServiceNow searches for patches to deploy as far back as the specified date.

  • os: The OS of the endpoints to patch.

  • scheduled_start: This is the date to start deploying the patch.

Figure 6. Get catalog variables
Get catalog variables

Look up computer records

This action searches the Computer table for endpoints that match the conditions that you specify:

  • Owned by, Supported by, and Support group.Manager are set to the user who created a Tanium Patch Request in the Service Catalog.

  • Operating System is set to the value of the os variable that the action Get catalog variables retrieved.

Specify the Max Results if you want to limit the number of endpoint records that the action returns. For example, your organization might limit the number of endpoints that you can patch in a single deployment to reduce the impact to your network. You can click New Criteria to configure more conditions that filter the search. For example, add the Is Virtual condition to patch only virtual machines (VMs).

The next action depends on whether the search finds endpoints that match the condition:

Figure 7. Look up computer records
Look up computer records

Close the Service Catalog request if no endpoints are found

This action changes the State of the Tanium Patch Request to Closed Skipped if the action Look up computer records did not find endpoints that matched the specified conditions. The flow then ends.

Figure 8. Close request if no endpoints found
Close request if no endpoints found

Create a change request

A change request is required to initiate patch deployment. Therefore, this action creates a record (State equals New) in the Change Request table and populates the record fields with the values that you specify. This example uses the following values:

  • Short description helps other users understand the purpose of the change request.

  • Requested by and Assignment group are set to the variables that you specified in Set flow variables.

  • Planned start/end date are set to the variables that you configured in Get catalog variables.

Figure 9. Create change request record
Create change request record

Created CIs affected record for each item in computer records

This action creates a record in the CIs Affected table for each endpoint that the Look up computer records action found.

Figure 10. Create CI Affected records for found endpoints
Create CI Affected records for found endpoints

Create a patch request and add patches and endpoints

Creating a patch request from a change request involves multiple actions for adding the patches and endpoints to the patch request. The sequence of actions might be useful in other flows, such as for manual patch requests. Therefore, instead of reconfiguring each action for each flow that uses the same action sequence, you can create a reusable subflow that contains the entire sequence. This example uses the Create Patch Request & Add Patches/Endpoints subflow with the following settings:

Table 2. Patching subflow settings

Setting

Description

wait_for_completion

Select this setting to specify that the parent flow Patch Requested Endpoints does not continue until all the actions in the subflow finish.

Patch Request [Name | Description]

Enter a name to identify the patch request and a description to help other users understand its purpose. In this example, both settings have the value Patch Endpoints requested by <requestor> , where <requestor> is the name of the user who opens the Service Catalog request to initiate the flow.

Operating System Type

Specify the OS of the endpoints you plan to patch.

Change Request

Select the change request that you configured in Create a change request.

Add Endpoints from Change

Select this setting run the action Add endpoints from a change request to a patch request.

CVE IDs

Enter common CVE identifiers to run the action Add patches by CVE to a patch request.

Include Superseded in CVE Patches

Select this setting to include patches for all CVEs even if the patches have been replaced by more recent patches.

Additional Patches Filter

Add additional filters for selecting endpoints to include in the patch request to run the action Add patches by filter to a patch request.

Patch Lists Filter

Add additional filters for selecting patch lists to include in the patch request to run the action Add patch lists by filter to a patch request.

Figure 11. Create Patch Request & Add Patches/Endpoints subflow
Subflow to create patch request

The preceding subflow runs the following actions in the following sequence:

  1. Create a Tanium Patch Request.
  2. Add endpoints from a change request to a patch request.
  3. Add patches by CVE to a patch request.
  4. Add patches by filter to a patch request.
  5. Add patch lists by filter to a patch request.
  6. Assign flow outputs.

Create a Tanium Patch Request

This action creates an empty record in the Tanium Patch Request table. The subsequent actions in the Create Patch Request & Add Patches/Endpoints subflow all have a Tanium Patch Request setting that specifies this patch request and they populate the record with endpoints and patches.

Figure 12. Create Tanium patch request
Create Tanium patch request

The settings in this request are similar to the Patching subflow settings and includes the following additional options:

Table 3. Tanium Patch Request additional settings

Setting

Description

Restart After Install

Select whether to restart the endpoint after a successful patch deployment.

Restart Client Notification [Tanium End User Notification]

If you enabled restarts, you can optionally add an end-user notification to warn the user about the restart. Select the deployment template that includes the notification message to display to the user. This setting is available only if you enabled and imported Tanium Patch deployment templates. For more information, see Import patch deployment templates.

Note: Do not update the ServiceNow Tanium End User Notification records that were created during the import process. Any edits to those records are overwritten during the next import. To add more notification message options, create more deployment templates in Tanium and then run the import again.

Add endpoints from a change request to a patch request

If you selected the Add Endpoints from Change option in the Create Patch Request & Add Patches/Endpoints subflow, then the action Add Endpoints to Patch Request from Change copies the endpoints from a change request to the patch request. The Change Request identifies the request created in Create a change request.

Figure 13. Add endpoints from change request to patch request
Add endpoints from change request to patch request

Add patches by CVE to a patch request

If you specified CVE IDs in the Create Patch Request & Add Patches/Endpoints subflow, then the action Add Patches by CVE to Patch Request adds patches that are associated with specific CVEs to the patch request. The Include Superseded setting indicates whether you selected the Include Superseded in CVE Patches option in the subflow.

Figure 14. Add endpoints from change request to patch request
Add endpoints from change request to patch request

Add patches by filter to a patch request

If you configured an Additional Patches Filter in the Create Patch Request & Add Patches/Endpoints subflow, then the action Add Patches by Filter to Patch Request adds a list of patches to the patch request based on the filter.

Figure 15. Add endpoints from change request to patch request
Add endpoints from change request to patch request

Add patch lists by filter to a patch request

If you configured a Patch Lists Filter in the Create Patch Request & Add Patches/Endpoints subflow, then the action Add Patch Lists by Filter to Patch Request adds a list of patch lists to the patch request based on the filter.

Figure 16. Add Patch Lists by Filter to Patch Request
Add Patch Lists by Filter to Patch Request

Assign flow outputs

Assign Flow Outputs assigns the outputs of the Create Patch Request & Add Patches/Endpoints subflow to the Tanium patch request, thereby populating the empty record in the Tanium Patch Request table.

Figure 17. Assign flow outputs
Assign flow outputs

Update the change request state to assess

This action updates the change request State to Assess, which initiates the process that your organization uses for assessing and approving change requests. In this example, the Patch request approval group that you selected in Set flow variables assesses the change request and sets its state to scheduled (approved) or cancelled (rejected).

Figure 18. Update change request record for assessment
Update change request record for assessment

Wait for change request to be scheduled or cancelled

The action pauses the flow until the users who assess change requests (the Patch request approval group in this example) set the change request State to:

Figure 19. Wait condition for scheduled change request
Wait condition for scheduled change request

Update the patch request state to cancelled

If the users who assess the change request decide to cancel the request, this action updates the State of the associated patch request to Cancelled and then ends the flow. The error handler flow then starts if you configured it, as described in Add actions for errors.

Figure 20. Update patch request record for change request cancellation
Update patch request record for change request cancellation

Check if the patch request is ready

This action checks whether all the required fields in the patch request are populated. The next action in the flow depends on whether the request is ready:

Important: When you create a patching flow that is customized for your organization, always include this action before the action Trigger patch request deployment.
Figure 21. Check if the patch request is ready
Check if the patch request is ready

Update the change request if the patch request is not ready

This action updates the change request to note that the patch request is not ready for deployment if the action Check if the patch request is ready returns that result. The flow ends. The error handler flow then starts if you configured it, as described in see Add actions for errors.

Figure 22. If the patch request is not ready
If the patch request is not ready

Trigger patch request deployment

This action runs the patch request, which creates a deployment in the Tanium Patch module. To review the deployment details, see Reviewing deployments.

The next action in the flow depends on whether the deployment encountered issues:

Figure 23. Trigger patch request deployment
Trigger patch request deployment

Update the change request if deployment issues occurred

If the patch request failed to run or the deployment ID from the Patch module is missing, this action adds a note that provides details about the issue to the change request and then ends the flow. The error handler flow then starts if you configured it, as described in Add actions for errors.

Figure 24. Update change request for deployment issue
Update change request for deployment issue

Wait for the change request to close or be cancelled

The action pauses the flow until the change request State updates to:

  • Closed: The patch deployment finished.

  • Cancelled: The patch deployment encountered issues and timed out before it could finish. The End Time in the Service Catalog request determines when the deployment times out, as described in Manually creating a patch request.

After the request updates to either state, the flow runs the next action: Update the Service Catalog request.

Figure 25. Wait for change request to close
Wait for change request to close

Update the Service Catalog request

This action updates the State of the requested item (the Tanium Patch Request, in this example) with the state of the change request (closed or cancelled).

Figure 26. Update requested item record
Update requested item record

Add actions for errors

Optionally enable the Error Handler and add subflows, actions, and flow logic if you want to run a sequence of actions to identify and correct issues that occur during the patch flow. For example, you might want to log an error message and notify certain users by email. For more information, see Flow error handler.

Figure 27. Error Handler actions
Error Handler actions

Save, test, and activate the flow

Perform the following tasks after you configure all the triggers and actions for your patch flow:

  1. Click Save to save the flow configuration.

  2. Click Test to simulate a trigger and run the flow. Edit the flow if the test execution details show unexpected results. For more information, see Test a flow and Flow execution details. To troubleshoot patch request errors, see Troubleshooting patch requests in ServiceNow.

  3. Click Activate when the flow is ready to use.

After you activate the flow, it is triggered whenever users Create a Tanium Patch Request in the Service Catalog.

Create a Tanium Patch Request in the Service Catalog

Trigger the example flow Patch Requested Endpoints by creating a Tanium patch request in the ServiceNow Service Catalog.

  1. Sign in to your ServiceNow instance.
  2. In the Main menu, click All, enter service catalog in the filter Filter field, and click Service Catalog.
  3. Click Software and enter tanium patch request in the Search Search field.
  4. Click Tanium Patch Request, select answers to the following questions, and click Order Now.
    Table 4. Tanium Patch Request in Service Catalog

    Field

    Description

    How far back should we look up patches to deploy?

    Click Choose Date Choose Date and select the earliest date to search for available patches. ServiceNow searches from the selected date to the present.

    Has this been tested?

    Select Yes if the patch deployment has been tested or select No otherwise.

    What OS/Platform is this for?

    Select Windows or Linux as the OS for the target endpoints.

    When do you want to deploy this patch request?

    Click Choose Date Choose Date and select a date to start the patch deployment.

  5. (Optional) On the Order Status page, Expand Expand the Stage section to see the state of the patch request.