4 title: Setting token expiration policy
8 Copyright (C) The Arvados Authors. All rights reserved.
10 SPDX-License-Identifier: CC-BY-SA-3.0
13 When a user logs in to Workbench, they receive a newly created token that grants access to the Arvados API on behalf of that user. By default, this token does not expire until the user explicitly logs off.
15 Security policies, such as for GxP Compliance, may require that tokens expire by default in order to limit the risk associated with a token being leaked.
17 The @Login.TokenLifetime@ configuration enables the administrator to set a expiration lifetime for tokens granted through the login flow.
19 h2. Setting token expiration
21 Suppose that the organization's security policy requires that user sessions should not be valid for more than 12 hours, the cluster configuration should be set like the following:
32 With this configuration, users will have to re-login every 12 hours.
34 When this configuration is active, the workbench client will also be "untrusted" by default. This means tokens issued to workbench cannot be used to list other tokens issued to the user, and cannot be used to grant new tokens. This stops an attacker from leveraging a leaked token to aquire other tokens.
36 The default @TokenLifetime@ is zero, which disables this feature.
38 h2. Applying policy to existing tokens
40 If you have an existing Arvados installation and want to set a token lifetime policy, there may be user tokens already granted. The administrator can use the following @rake@ tasks to enforce the new policy.
42 The @db:check_long_lived_tokens@ task will list which users have tokens with no expiration date.
45 <pre><code># <span class="userinput">bundle exec rake db:check_long_lived_tokens</span>
46 Found 6 long-lived tokens from users:
47 user2,user2@example.com,zzzzz-tpzed-5vzt5wc62k46p6r
48 admin,admin@example.com,zzzzz-tpzed-6drplgwq9nm5cox
49 user1,user1@example.com,zzzzz-tpzed-ftz2tfurbpf7xox
53 To apply the new policy to existing tokens, use the @db:fix_long_lived_tokens@ task.
56 <pre><code># <span class="userinput">bundle exec rake db:fix_long_lived_tokens</span>
57 Setting token expiration to: 2020-08-25 03:30:50 +0000
62 NOTE: These rake tasks adjust the expiration of all tokens except those belonging to the system root user (@zzzzz-tpzed-000000000000000@). If you have tokens used by automated service accounts that need to be long-lived, you can "create tokens that don't expire using the command line":user-management-cli.html#create-token .