Enabling long-lived Tanium sessions through API tokens
API tokens overview
Tanium™ API authentication tokens enable users to establish long-lived sessions with the Tanium Server 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.
To troubleshoot issues with API tokens, see Tanium Core Platform troubleshooting and logs in an Appliance deployment or Authentication log.
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 the Tanium Server. 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.
Create an API token
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.
Enable API token authentication behind a reverse proxy
Enable the setting authenticate_api_token_with_x_forwarded_for_ip only if all API token access to the Tanium Server must go through a reverse proxy server.
- From the Main menu, go to .
- In the Name column, click authenticate_api_token_with_x_forwarded_for_ip.
- Set the Value to 1 and click Save.
Configure token expiration settings
By default, API tokens expire one week after you create them if you did not specify the expiration interval during token creation. Also by default, you cannot specify an interval beyond 365 days during token creation. You can change both the default interval and maximum interval. However, changes to the default interval apply only to tokens that are created after you change the setting; you cannot change the interval for existing tokens.
Perform the following steps to change the settings that control the expiration interval:
- From the Main menu, go to .
- To change the default expiration interval, click api_token_expiration_in_days in the Name column, set the Value to a new interval (in days), and click Save.
- To change the maximum expiration interval, click api_token_max_expiration_in_days in the Name column, set the Value to a new maximum (in days), and click Save.
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.