Merge branch '16923-auth-api-client' refs #16923
[arvados.git] / doc / admin / federation.html.textile.liquid
1 ---
2 layout: default
3 navsection: admin
4 title: Configuring federation
5 ...
6
7 {% comment %}
8 Copyright (C) The Arvados Authors. All rights reserved.
9
10 SPDX-License-Identifier: CC-BY-SA-3.0
11 {% endcomment %}
12
13 This page describes how to enable and configure federation capabilities between clusters.
14
15 An overview on how this feature works is discussed in the "architecture section":{{site.baseurl}}/architecture/federation.html
16
17 h2. Configuration
18
19 To enable a cluster to communicate with other clusters, some settings need to be added to the @config.yml@ file.  Federated clusters are identified by listing the cluster-to-hostname mapping in the @RemoteClusters@ section.
20
21 Here is an example of the settings that should be added to the @/etc/arvados/config.yml@ file:
22
23 <pre>
24 Clusters:
25   clsr1:
26     RemoteClusters:
27       clsr2:
28         Host: api.cluster2.com
29         Proxy: true
30         ActivateUsers: true
31       clsr3:
32         Host: api.cluster3.com
33         Proxy: true
34         ActivateUsers: false
35 </pre>
36
37 Similar settings should be added to @clsr2@ & @clsr3@ hosts, so that all clusters in the federation can talk to each other.
38
39 The @ActivateUsers@ setting indicates whether users from a given cluster are automatically activated or they require manual activation.  User activation is covered in more detail in the "user activation section":{{site.baseurl}}/admin/activation.html.  In the current example, users from @clsr2@ would be automatically, activated, but users from @clsr3@ would require an admin to activate the account.
40
41 h2(#LoginCluster). User management
42
43 A federation of clusters can be configured to use a separate user database per cluster, or delegate a central cluster to manage the database.
44
45 h3. Peer federation
46
47 If clusters belong to separate organizations, each cluster will have its own user database for the members of that organization.  Through federation, a user from one organization can be granted access to the cluster of another organization.  The admin of the second cluster can control access on a individual basis by choosing to activate or deactivate accounts from other organizations.
48
49 h3. Centralized (LoginCluster) federation
50
51 If all clusters belong to the same organization, and users in that organization should have access to all the clusters, user management can be simplified by setting the @LoginCluster@ which manages the user database used by all other clusters in the federation.  To do this, choose one cluster in the federation which will be the 'login cluster'.  Set the the @Login.LoginCluster@ configuration value on all clusters in the federation to the cluster id of the login cluster.  After setting @LoginCluster@, restart arvados-api-server and arvados-controller.
52
53 <pre>
54 Clusters:
55   clsr2:
56     Login:
57       LoginCluster: clsr1
58 </pre>
59
60 The @LoginCluster@ configuration redirects all user logins to the LoginCluster, and the LoginCluster will issue API tokens which will be accepted by the federation.  Users are activated or deactivated across the entire federation based on their status on the master cluster.
61
62 Note: tokens issued by the master cluster need to be periodically re-validated when used on other clusters in the federation.  The period between revalidation attempts is configured with @Login.RemoteTokenRefresh@.  The default is 5 minutes.  A longer period reduces overhead from validating tokens, but means it may take longer for other clusters to notice when a token has been revoked or a user has changed status (being activated/deactivated, admin flag changed).
63
64 To migrate users of existing clusters with separate user databases to use a single LoginCluster, use "arv-federation-migrate":merge-remote-account.html .
65
66 h2. Groups
67
68 In order for a user to see (and be able to share with) other users, the admin needs to create a "can_read" permission link from the user to either the "All users" group, or another group that grants visibility to a subset of users.
69
70 In a peer federation, this means that for a user that has joined a second cluster, that user needs to be added to the "All users" group on the second cluster as well, to be able to share with other users.
71
72 In a LoginCluster federation, all visibility of users to share with other users is set by the LoginCluster.  It is not necessary to add users to "All users" on the other clusters.
73
74 h3. Trusted clients
75
76 When a cluster is configured to use a LoginCluster, the login flow goes to the LoginCluster to log in and issue a token, then returns the user to the starting workbench.  In this case, you want to configure the LoginCluster to "trust" the workbench instances associated with the other clusters.
77
78 <pre>
79 Clusters:
80   clsr1:
81     Login:
82       TrustedClients:
83         "https://workbench.cluster2.com": {}
84         "https://workbench.cluster3.com": {}
85 </pre>
86
87 h2. Testing
88
89 Following the above example, let's suppose @clsr1@ is our "home cluster", that is to say, we use our @clsr1@ user account as our federated identity and both @clsr2@ and @clsr3@ remote clusters are set up to allow users from @clsr1@ and to auto-activate them. The first thing to do would be to log into a remote workbench using the local user token. This can be done following these steps:
90
91 1. Log into the local workbench and get the user token
92 2. Visit the remote workbench specifying the local user token by URL: @https://workbench.cluster2.com?api_token=token_from_clsr1@
93 3. You should now be logged into @clsr2@ with your account from @clsr1@
94
95 To further test the federation setup, you can create a collection on @clsr2@, uploading some files and copying its UUID. Next, logged into a shell node on your home cluster you should be able to get that collection by running:
96
97 <pre>
98 user@clsr1:~$ arv collection get --uuid clsr2-xvhdp-xxxxxxxxxxxxxxx
99 </pre>
100
101 The returned collection metadata should show the local user's uuid on the @owner_uuid@ field. This tests that the @arvados-controller@ service is proxying requests correctly.
102
103 One last test may be performed, to confirm that the @keepstore@ services also recognize remote cluster prefixes and proxy the requests. You can ask for the previously created collection using any of the usual tools, for example:
104
105 <pre>
106 user@clsr1:~$ arv-get clsr2-xvhdp-xxxxxxxxxxxxxxx/uploaded_file .
107 </pre>