forked from cloudfoundry/docs-cf-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uaa-user-management.html.md.erb
305 lines (238 loc) · 10.2 KB
/
uaa-user-management.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
---
title: Creating and Managing Users with the UAA CLI (UAAC)
---
<strong><%= modified_date %></strong>
Using the UAA Command Line Interface (UAAC), an administrator can create users
and manage organization and space roles.
For additional details and information, refer to the following topics:
* [UAA Overview](../concepts/architecture/uaa.html)
* [UAA Sysadmin Guide](https://github.com/cloudfoundry/uaa/blob/master/docs/Sysadmin-Guide.rst)
* [Other UAA Documentation](https://github.com/cloudfoundry/uaa/tree/master/docs)
## <a id='creating-admin-users'></a>Create an Admin User ##
1. Install the UAA CLI, `uaac`.
<pre class="terminal">
$ gem install cf-uaac
</pre>
1. Use `uaac target uaa.YOUR-DOMAIN` to target your UAA server.
<pre class="terminal">
$ uaac target uaa.example.com
</pre>
1. Record the **uaa:admin:client_secret** from your deployment manifest.
1. Use `uaac token client get admin -s ADMIN-CLIENT-SECRET` to authenticate and
obtain an access token for the admin client from the UAA server.
UAAC stores the token in `~/.uaac.yml`.
<pre class="terminal">
$ uaac token client get admin -s MyAdminPassword
</pre>
1. Use `uaac contexts` to display the users and applications authorized by the
UAA server, and the permissions granted to each user and application.
<pre class="terminal">
$ uaac contexts
[1]*[admin]
client_id: admin
access_token: yJhbGciOiJIUzI1NiJ9.e
token_type: bearer
expires_in: 43200
scope: uaa.admin clients.secret scim.read
jti: 91b3-abcd1233
</pre>
1. In the output from `uaac contexts`, search in the `scope` section of the
`client_id: admin` user for **scim.write**.
The value **scim.write** represents sufficient permissions to create accounts.
1. If the admin user lacks permissions to create accounts:
* Use `uaac client update admin --authorities "EXISTING-PERMISSIONS
scim.write"` to add the necessary permissions to the admin user account on
the UAA server. Replace EXISTING-PERMISSIONS with the current contents of
the `scope` section from `uaac contexts`.
* Use `uaac token delete` to delete the local token.
* Use `uaac token client get admin` to obtain an updated access token from
the UAA server.
<pre class="terminal">
$ uaac contexts
[1]*[admin]
client_id: admin
. . .
scope: uaa.admin clients.secret scim.read
. . .
$ uaac client update admin --authorities "`uaac client get admin | \
awk '/:/{e=0}/authorities:/{e=1;if(e==1){$1="";print}}'` scim.write"
$ uaac token delete
$ uaac token client get admin
</pre>
1. Use `uaac user add NEW-ADMIN-USERNAME -p NEW-ADMIN-PASSWORD --emails NEW-ADMIN-EMAIL` to create an admin user.
<pre class="terminal">
$ uaac user add Adam -p newAdminSecretPassword --emails newadmin@example.com
</pre>
1. Use `uaac member add GROUP NEW-ADMIN-USERNAME` to add the
new admin to the groups `cloud_controller.admin`, `uaa.admin`, `scim.read`, `scim.write`.
<pre class="terminal">
$ uaac member add cloud_controller.admin Adam
$ uaac member add uaa.admin Adam
$ uaac member add scim.read Adam
$ uaac member add scim.write Adam
</pre>
## <a id='ldap-group'></a>Grant Admin Permissions to an LDAP Group ##
To grant all users under an LDAP Group admin permissions:
1. Obtain the credentials of an admin client created using UAAC as above, or
refer to the `uaa: scim` section of your deployment manifest for the user
name and password of an admin user.
1. Use `uaac token client get admin -s ADMIN-CLIENT-SECRET` to authenticate and
obtain an access token for the admin client from the UAA server.
UAAC stores the token in `~/.uaac.yml`.
<pre class="terminal">
$ uaac token client get admin -s MyAdminPassword
</pre>
1. Run the following commands to grant all user under the mapped LDAP Group admin permissions:
* `uaac group map --name scim.read "GROUP-DISTINGUISHED-NAME"`
* `uaac group map --name cloud_controller.admin "GROUP-DISTINGUISHED-NAME"`
## <a id='creating-users'></a>Create Users ##
1. Obtain the credentials of an admin client created using UAAC as above, or
refer to the `uaa: scim` section of your deployment manifest for the user
name and password of an admin user.
1. Use `cf login -u NEW-ADMIN-USERNAME -p NEW-ADMIN-PASSWORD` to log in.
<pre class="terminal">
$ cf login -u Adam -p newAdminSecretPassword
</pre>
1. Use `cf create-user NEW-USER-NAME NEW-USER-PASSWORD` to create a new
user.
<pre class="terminal">
$ cf create-user Charlie aNewPassword
</pre>
## <a id='changing-passwords'></a>Change Passwords ##
1. Obtain the credentials of an admin client created using UAAC as above, or
refer to the `uaa: scim` section of your deployment manifest for the user
name and password of an admin user.
1. Use `uaac token client get admin -s ADMIN-CLIENT-SECRET` to authenticate and
obtain an access token for the admin client from the UAA server.
UAAC stores the token in `~/.uaac.yml`.
<pre class="terminal">
$ uaac token client get admin -s MyAdminPassword
</pre>
1. Use `uaac contexts` to display the users and applications authorized by the
UAA server, and the permissions granted to each user and application.
<pre class="terminal">
$ uaac contexts
[1]*[admin]
client_id: admin
access_token: yJhbGciOiJIUzI1NiJ9.e
token_type: bearer
expires_in: 43200
scope: uaa.admin clients.secret password.read
jti: 91b3-abcd1233
</pre>
1. In the output from `uaac contexts`, search in the `scope` section of the
`client_id: admin` user for **password.write**.
The value **password.write** represents sufficient permissions to change
passwords.
1. If the admin user lacks permissions to change passwords:
* Use `uaac client update admin --authorities "EXISTING-PERMISSIONS
password.write"` to add the necessary permissions to the admin user account
on the UAA server. Replace EXISTING-PERMISSIONS with the current contents of
the `scope` section from `uaac contexts`.
* Use `uaac token delete` to delete the local token.
* Use `uaac token client get admin` to obtain an updated access token from
the UAA server.
<pre class="terminal">
$ uaac contexts
[1]*[admin]
client_id: admin
. . .
scope: uaa.admin clients.secret password.read
. . .
$ uaac client update admin --authorities "`uaac client get admin | \
awk '/:/{e=0}/authorities:/{e=1;if(e==1){$1="";print}}'` password.write"
$ uaac token delete
$ uaac token client get admin
</pre>
1. Use `uaac password set USER-NAME -p TEMP-PASSWORD` to change an
existing user password to a temporary password.
<pre class="terminal">
$ uaac password set Charlie -p ThisIsATempPassword
</pre>
1. Provide the `TEMP-PASSWORD` to the user.
Have the user use `cf target api.YOUR-DOMAIN`, `cf login -u USER-NAME -p TEMP-PASSWORD`, and `cf passwd` to change the temporary password.
<pre class="terminal">
$ cf target api.example.com
$ cf login -u Charlie -p ThisIsATempPassword
$ cf passwd
Current Password>ThisIsATempPassword
New Password>*******
Verify Password>*******
Changing password...
</pre>
## <a id='retrieving-email-addresses'></a>Retrieve User Email Addresses ##
Some Cloud Foundry components, like Cloud Controller, only use GUIDs for user
identification.
You can use the UAA to retrieve the emails of your Cloud Foundry instance users
either as a list or for a specific user with that user's GUID.
To retrieve user email addresses:
1. Use `uaac target uaa.YOUR-DOMAIN` to target your UAA server.
<pre class="terminal">
$ uaac target uaa.example.com
</pre>
1. Record the **uaa:admin:client_secret** from your deployment manifest.
1. Use `uaac token client get admin -s ADMIN-CLIENT-SECRET` to authenticate and
obtain an access token for the admin client from the UAA server.
UAAC stores the token in `~/.uaac.yml`.
<pre class="terminal">
$ uaac token client get admin -s MyAdminPassword
</pre>
1. Use `uaac contexts` to display the users and applications authorized by the
UAA server, and the permissions granted to each user and application.
<pre class="terminal">
$ uaac contexts
[1]*[admin]
client_id: admin
access_token: yJhbGciOiJIUzI1NiJ9.e
token_type: bearer
expires_in: 43200
scope: uaa.admin clients.secret
jti: 91b3-abcd1233
</pre>
1. In the output from `uaac contexts`, search in the `scope` section of the
`client_id: admin` user for **scim.read**.
The value **scim.read** represents sufficient permissions to query the UAA
server for user information.
1. If the admin user lacks permissions to query the UAA server for user
information:
* Use `uaac client update admin --authorities "EXISTING-PERMISSIONS
scim.write"` to add the necessary permissions to the admin user account on
the UAA server. Replace EXISTING-PERMISSIONS with the current contents of
the `scope` section from `uaac contexts`.
* Use `uaac token delete` to delete the local token.
* Use `uaac token client get admin` to obtain an updated access token from
the UAA server.
<pre class="terminal">
$ uaac contexts
[1]*[admin]
client_id: admin
. . .
scope: uaa.admin clients.secret
. . .
$ uaac client update admin --authorities "uaa.admin clients.secret scim.read"
$ uaac token delete
$ uaac token client get admin
</pre>
1. Use `uaac users` to list your Cloud Foundry instance users.
By default, the `uaac users` command returns information about each user account
including GUID, name, permission groups, activity status, and metadata.
Use the `--attributes emails` or `-a emails` flag to limit the output of `uaac
users` to email addresses.
<pre class="terminal">
$ uaac users --attributes emails
resources:
emails:
value: user1@example.com
emails:
value: user2@example.com
emails:
value: user3@example.com
</pre>
1. Use `uaac users "id eq GUID" --attributes emails` with the GUID of a specific
user to retrieve that user's email address.
<pre class="terminal">
$ uaac users "id eq 'aabbcc11-22a5-87-8056-beaf84'" --attributes emails
resources:
emails:
value: user1@example.com
</pre>