Enabling long-lived Tanium sessions through API tokens

API tokens overview

Tanium™ API authentication tokens enable users to establish long-lived sessions with Tanium Cloud without repeatedly re-authenticating for workflows that are long-lived but not continuously running. For example, you can add a token that enables the synchronization of patch definitions and statuses between the Tanium Patch module and the Tanium Patch Management for IT Operations application in a ServiceNow instance.

Tokens have a configurable expiration interval. To prevent interruptions to long-lived workflows, users must rotate tokens: request new tokens and revoke the current ones before they expire.

Note: For the user role permissions that are required to manage API tokens, see Manage API tokens.

Token permissions

A token can authenticate only the service account, user account, or persona that you select for the token when creating it. Each account or persona can have multiple tokens. The role permissions of a token are those of the account or persona that you select when creating the token. If the permissions of an account or persona change after the token is created, the token permissions change to match those of the account or persona.

Best practices for tokens

Observe the following best practices when you create tokens:

  • Use service accounts

    Select a service account for every token unless the token is for workflows that a specific user account or persona must run according to the mandates of your organization. If users or personas are deleted, disabled, or locked out (such as when a user leaves your organization), their tokens produce 401 Unauthorized errors when other accounts or personas try to use those tokens. Such errors are less likely for tokens that are bound to service accounts because those accounts are more often permanent.

  • Use one token per process

    Do not use a single token for multiple processes. For example, do not use a single token for a ServiceNow integration and a Splunk integration, or for multiple ServiceNow instances, or for multiple connections from one ServiceNow instance to Tanium Cloud. When a token rotates for any process, that token stops working for any other processes that use it.

View API token details

Viewing API token attributes can help you to determine if new tokens are necessary and to manage or troubleshoot existing tokens. For example, you can check if a token is about to expire and for which user the token is bound. The API Tokens grid shows only valid tokens and stops showing tokens that you revoke.

  1. From the Main menu, go to Administration > Permissions > API Tokens.

    The page displays API token attributes but not token strings.

  2. (Optional) To display a token value, select the token in the grid and click View Token.
    Important:

    The token value includes the token- prefix.

    You cannot view the token value in Tanium Console after:

    • The visibility timeout expires (five minutes)

    • You refresh the API Tokens page or grid

    • You navigate to another Console page

  3. (Optional) Use the filters to find specific tokens:
    • Filter by text: Enter a text string in the Filter items field to filter the grid by any column values.
    • Filter by attribute: Expand Expand the Filters section, select a token attribute (such as User), select an operator (such as contains), enter a text string that contains all or part of the attribute value, and click Apply Apply. For each additional filter, click Add, select Add Row, and configure the filter. Boolean AND logic applies if you configure multiple filters.

Create an API token

  1. From the Main menu, go to Administration > Permissions > API Tokens.
  2. Click New API Token and configure the token settings:
    Table 1. API token attributes

    Attribute

    Description

    Notes

    Enter an optional description of the purpose for this token.

    Expiration

    Enter the expiration interval in days. By default, the maximum interval is 365 days. If you do not enter a value, the interval defaults to 7 days.

    Persona

    Select the user account (Default persona) or alternative persona to which the token is bound. The default option is the currently selected persona for your Tanium Console session.

    Trusted IP addresses

    Enter the external IP addresses of the systems from which you will use this token to authenticate with Tanium Cloud. The addresses can be IPv4 (such as 192.0.2.0/24) or IPv6 (such as 2001:db8::/32). Use commas or new lines to separate multiple entries.

    Tip: To enable any system to use the token, enter 0.0.0.0/0. However, for security, enable the token for all systems only in a non-production environment.
  3. Click Save and review the token details.
  4. Copy Copy the token to your clipboard if you want to record it for future reference, and then click Close.
    Important: The token value includes the token- prefix. You cannot view the token value in Tanium Console after the visibility timeout (five minutes) expires, or you refresh the API Tokens page or grid, or you navigate to another Console page. If you later rotate the token, you must re-enter its value. Therefore, if you want rotation to be an option, copy the value (including token-) before the timeout and save it in a secure location.

Rotate an API token

To extend the expiration interval of a token without changing any of its other settings, rotate the token. Rotation deletes the existing token and creates a new one. The expiration timer of the new token is reset and has the same interval as the deleted token.

Note: You cannot rotate a token unless you saved a record of its value after creating the token. After you rotate the token, the visibility timeout for its value resets to five minutes. For more information, see View API token details.
Note: If you integrate your Tanium deployment with another platform such as ServiceNow or Splunk, use the Tanium API to configure the integration to automatically rotate its tokens when their expiration is imminent. Automatic rotation reduces the maintenance workload for an integration. For more information about APIs and integrations, see APIs & Integrations. For help configuring your integrations, see Contact Tanium Support.
  1. Sign in to Tanium Console as a user who has the Token - Rotate permission.
  2. From the Main menu, go to Administration > Permissions > API Tokens.
  3. Select the token and click Rotate Token.
  4. Enter the Token value (including the token- prefix) and click Confirm.
    Note: The token for which you enter a value is the token that is rotated regardless of which token you select on the API Tokens page in the previous step.
  5. Copy Copy the new token value to your clipboard if you want to record it for future use (such as for rotating the token again), and then click Close.

Revoke API tokens

You might want to revoke an API token if you have doubts about its security or if its associated user is no longer with your organization.

  1. From the Main menu, go to Administration > Permissions > API Tokens.
  2. Select one or more API tokens, click Delete Selected Delete Selected, and Confirm the operation.

    The revoked tokens no longer appear in the API Tokens grid.