]>
Commit | Line | Data |
---|---|---|
80c0adcb | 1 | [[chapter_user_management]] |
3c8533f2 | 2 | ifdef::manvolnum[] |
b2f242ab DM |
3 | pveum(1) |
4 | ======== | |
5f09af76 DM |
5 | :pve-toplevel: |
6 | ||
3c8533f2 DM |
7 | NAME |
8 | ---- | |
9 | ||
10 | pveum - Proxmox VE User Manager | |
11 | ||
12 | ||
49a5e11c | 13 | SYNOPSIS |
3c8533f2 DM |
14 | -------- |
15 | ||
16 | include::pveum.1-synopsis.adoc[] | |
17 | ||
18 | ||
19 | DESCRIPTION | |
20 | ----------- | |
21 | endif::manvolnum[] | |
3c8533f2 DM |
22 | ifndef::manvolnum[] |
23 | User Management | |
24 | =============== | |
5f09af76 | 25 | :pve-toplevel: |
194d2f29 | 26 | endif::manvolnum[] |
5f09af76 | 27 | |
3c8533f2 DM |
28 | // Copied from pve wiki: Revision as of 16:10, 27 October 2015 |
29 | ||
96942248 | 30 | {pve} supports multiple authentication sources, for example Linux PAM, |
5462c161 | 31 | an integrated Proxmox VE authentication server, LDAP, Microsoft Active |
96942248 | 32 | Directory and OpenID Connect. |
3c8533f2 | 33 | |
96942248 DW |
34 | By using role-based user and permission management for all objects (VMs, |
35 | Storage, nodes, etc.), granular access can be defined. | |
5eba0743 | 36 | |
3c8533f2 | 37 | |
80c0adcb | 38 | [[pveum_users]] |
c80b9ee6 WB |
39 | Users |
40 | ----- | |
41 | ||
42 | {pve} stores user attributes in `/etc/pve/user.cfg`. | |
96942248 | 43 | Passwords are not stored here; users are instead associated with the |
80c0adcb | 44 | <<pveum_authentication_realms,authentication realms>> described below. |
96942248 | 45 | Therefore, a user is often internally identified by their username and |
c80b9ee6 WB |
46 | realm in the form `<userid>@<realm>`. |
47 | ||
48 | Each user entry in this file contains the following information: | |
49 | ||
50 | * First name | |
51 | * Last name | |
52 | * E-mail address | |
53 | * Group memberships | |
96942248 | 54 | * An optional expiration date |
c80b9ee6 WB |
55 | * A comment or note about this user |
56 | * Whether this user is enabled or disabled | |
74662f51 | 57 | * Optional two-factor authentication keys |
c80b9ee6 | 58 | |
96942248 | 59 | CAUTION: When you disable or delete a user, or if the expiry date set is |
f06ba6a6 | 60 | in the past, this user will not be able to log in to new sessions or start new |
96942248 | 61 | tasks. All tasks which have already been started by this user (for example, |
f06ba6a6 | 62 | terminal sessions) will **not** be terminated automatically by any such event. |
8d02d0a2 | 63 | |
c80b9ee6 WB |
64 | |
65 | System administrator | |
66 | ~~~~~~~~~~~~~~~~~~~~ | |
67 | ||
68 | The system's root user can always log in via the Linux PAM realm and is an | |
69 | unconfined administrator. This user cannot be deleted, but attributes can | |
96942248 | 70 | still be changed. System mails will be sent to the email address |
c80b9ee6 WB |
71 | assigned to this user. |
72 | ||
73 | ||
80c0adcb | 74 | [[pveum_groups]] |
c80b9ee6 | 75 | Groups |
a10a91c2 | 76 | ------ |
c80b9ee6 | 77 | |
96942248 DW |
78 | Each user can be a member of several groups. Groups are the preferred |
79 | way to organize access permissions. You should always grant permissions | |
80 | to groups instead of individual users. That way you will get a | |
81 | much more maintainable access control list. | |
c80b9ee6 | 82 | |
181db098 FG |
83 | [[pveum_tokens]] |
84 | API Tokens | |
a10a91c2 | 85 | ---------- |
181db098 | 86 | |
96942248 | 87 | API tokens allow stateless access to most parts of the REST API from another |
710713ea TL |
88 | system, software or API client. Tokens can be generated for individual users |
89 | and can be given separate permissions and expiration dates to limit the scope | |
96942248 | 90 | and duration of the access. Should the API token get compromised, it can be |
710713ea | 91 | revoked without disabling the user itself. |
181db098 FG |
92 | |
93 | API tokens come in two basic types: | |
94 | ||
96942248 DW |
95 | * Separated privileges: The token needs to be given explicit access with ACLs. |
96 | Its effective permissions are calculated by intersecting user and token | |
181db098 | 97 | permissions. |
96942248 | 98 | * Full privileges: The token's permissions are identical to that of the |
181db098 FG |
99 | associated user. |
100 | ||
c6e098a2 TL |
101 | CAUTION: The token value is only displayed/returned once when the token is |
102 | generated. It cannot be retrieved again over the API at a later time! | |
181db098 FG |
103 | |
104 | To use an API token, set the HTTP header 'Authorization' to the displayed value | |
105 | of the form `PVEAPIToken=USER@REALM!TOKENID=UUID` when making API requests, or | |
96942248 | 106 | refer to your API client's documentation. |
c80b9ee6 | 107 | |
23b447be DW |
108 | [[pveum_resource_pools]] |
109 | Resource Pools | |
110 | -------------- | |
111 | ||
112 | [thumbnail="screenshot/gui-datacenter-pool-window.png"] | |
113 | ||
114 | A resource pool is a set of virtual machines, containers, and storage | |
115 | devices. It is useful for permission handling in cases where certain users | |
116 | should have controlled access to a specific set of resources, as it allows for a | |
117 | single permission to be applied to a set of elements, rather than having to | |
96942248 DW |
118 | manage this on a per-resource basis. Resource pools are often used in tandem |
119 | with groups, so that the members of a group have permissions on a set of | |
120 | machines and storage. | |
23b447be | 121 | |
80c0adcb | 122 | [[pveum_authentication_realms]] |
3c8533f2 DM |
123 | Authentication Realms |
124 | --------------------- | |
125 | ||
d6614202 WB |
126 | As {pve} users are just counterparts for users existing on some external |
127 | realm, the realms have to be configured in `/etc/pve/domains.cfg`. | |
128 | The following realms (authentication methods) are available: | |
3c8533f2 | 129 | |
78000a64 DW |
130 | Linux PAM Standard Authentication:: |
131 | ||
132 | Linux PAM is a framework for system-wide user authentication. These users are | |
133 | created on the host system with commands such as `adduser`. If PAM users exist | |
134 | on the {pve} host system, corresponding entries can be added to {pve}, to allow | |
135 | these users to log in via their system username and password. | |
3c8533f2 | 136 | |
78000a64 DW |
137 | {pve} Authentication Server:: |
138 | ||
139 | This is a Unix-like password store, which stores hashed passwords in | |
140 | `/etc/pve/priv/shadow.cfg`. Passwords are hashed using the SHA-256 hashing | |
141 | algorithm. This is the most convenient realm for small-scale (or even | |
142 | mid-scale) installations, where users do not need access to anything outside of | |
143 | {pve}. In this case, users are fully managed by {pve} and are able to change | |
144 | their own passwords via the GUI. | |
d6614202 WB |
145 | |
146 | LDAP:: | |
78000a64 DW |
147 | |
148 | LDAP (Lightweight Directory Access Protocol) is an open, cross-platform protocol | |
149 | for authentication using directory services. OpenLDAP is a popular open-source | |
150 | implementations of the LDAP protocol. | |
151 | ||
152 | Microsoft Active Directory (AD):: | |
153 | ||
154 | Microsoft Active Directory (AD) is a directory service for Windows domain | |
155 | networks and is supported as an authentication realm for {pve}. It supports LDAP | |
156 | as an authentication protocol. | |
157 | ||
158 | OpenID Connect:: | |
159 | ||
160 | OpenID Connect is implemented as an identity layer on top of the OATH 2.0 | |
161 | protocol. It allows clients to verify the identity of the user, based on | |
162 | authentication performed by an external authorization server. | |
163 | ||
164 | Linux PAM Standard Authentication | |
165 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
166 | ||
167 | As Linux PAM corresponds to host system users, a system user must exist on each | |
168 | node which the user is allowed to log in on. The user authenticates with their | |
169 | usual system password. This realm is added by default and can't be removed. In | |
170 | terms of configurability, an administrator can choose to require two-factor | |
171 | authentication with logins from the realm and to set the realm as the default | |
172 | authentication realm. | |
173 | ||
174 | ||
175 | {pve} Authentication Server | |
176 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
177 | ||
178 | The {pve} authentication server realm is a simple Unix-like password store. | |
179 | The realm is created by default, and as with Linux PAM, the only configuration | |
180 | items available are the ability to require two-factor authentication for users | |
181 | of the realm, and to set it as the default realm for login. | |
182 | ||
183 | Unlike the other {pve} realm types, users are created and authenticated entirely | |
184 | through {pve}, rather than authenticating against another system. Hence, you are | |
185 | required to set a password for this type of user upon creation. | |
186 | ||
187 | ||
188 | LDAP | |
189 | ~~~~ | |
190 | ||
191 | You can also use an external LDAP server for user authentication (for examle, | |
192 | OpenLDAP). In this realm type, users are searched under a 'Base Domain Name' | |
193 | (`base_dn`), using the username attribute specified in the 'User Attribute Name' | |
d6614202 | 194 | (`user_attr`) field. |
78000a64 DW |
195 | |
196 | A server and optional fallback server can be configured, and the connection can | |
197 | be encrypted via SSL. Furthermore, filters can be configured for directories and | |
198 | groups. Filters allow you to further limit the scope of the realm. | |
199 | ||
200 | For instance, if a user is represented via the following LDIF dataset: | |
201 | ||
d6614202 WB |
202 | ---- |
203 | # user1 of People at ldap-test.com | |
204 | dn: uid=user1,ou=People,dc=ldap-test,dc=com | |
205 | objectClass: top | |
206 | objectClass: person | |
207 | objectClass: organizationalPerson | |
208 | objectClass: inetOrgPerson | |
209 | uid: user1 | |
210 | cn: Test User 1 | |
211 | sn: Testers | |
212 | description: This is the first test user. | |
213 | ---- | |
78000a64 | 214 | |
d6614202 WB |
215 | The 'Base Domain Name' would be `ou=People,dc=ldap-test,dc=com` and the user |
216 | attribute would be `uid`. | |
78000a64 | 217 | |
3a433e9b | 218 | If {pve} needs to authenticate (bind) to the LDAP server before being |
d6614202 WB |
219 | able to query and authenticate users, a bind domain name can be |
220 | configured via the `bind_dn` property in `/etc/pve/domains.cfg`. Its | |
221 | password then has to be stored in `/etc/pve/priv/ldap/<realmname>.pw` | |
96942248 DW |
222 | (for example, `/etc/pve/priv/ldap/my-ldap.pw`). This file should contain a |
223 | single line with the raw password. | |
78000a64 | 224 | |
96942248 | 225 | To verify certificates, you need to set `capath`. You can set it either |
4ab527b1 TL |
226 | directly to the CA certificate of your LDAP server, or to the system path |
227 | containing all trusted CA certificates (`/etc/ssl/certs`). | |
3a433e9b | 228 | Additionally, you need to set the `verify` option, which can also be done over |
4ab527b1 | 229 | the web interface. |
d6614202 | 230 | |
78000a64 DW |
231 | The main configuration options for an LDAP server realm are as follows: |
232 | ||
233 | * `Realm` (`realm`): The realm identifier for {pve} users | |
234 | ||
235 | * `Base Domain Name` (`base_dn`): The directory which users are searched under | |
236 | ||
237 | * `User Attribute Name` (`user_attr`): The LDAP attribute containing the | |
238 | username that users will log in with | |
239 | ||
240 | * `Server` (`server1`): The server hosting the LDAP directory | |
241 | ||
242 | * `Fallback Server` (`server2`): An optional fallback server address, in case | |
243 | the primary server is unreachable | |
244 | ||
245 | * `Port` (`port`): The port that the LDAP server listens on | |
246 | ||
96942248 | 247 | NOTE: In order to allow a particular user to authenticate using the LDAP server, |
78000a64 DW |
248 | you must also add them as a user of that realm from the {pve} server. This can |
249 | be carried out automatically with <<pveum_ldap_sync, syncing>>. | |
3c8533f2 | 250 | |
3c8533f2 | 251 | |
78000a64 DW |
252 | Microsoft Active Directory (AD) |
253 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
f3ee27eb | 254 | |
78000a64 DW |
255 | To set up Microsoft AD as a realm, a server address and authentication domain |
256 | need to be specified. Active Directory supports most of the same properties as | |
257 | LDAP, such as an optional fallback server, port, and SSL encryption. | |
258 | Furthermore, users can be added to {pve} automatically via | |
259 | <<pveum_ldap_sync, sync>> operations, after configuration. | |
260 | ||
261 | As with LDAP, if {pve} needs to authenticate before it binds to the AD server, | |
262 | you must configure the 'Bind User' (`bind_dn`) property. This property is | |
263 | typically required by default for Microsoft AD. | |
264 | ||
265 | The main configuration settings for Microsoft Active Directory are: | |
266 | ||
267 | * `Realm` (`realm`): The realm identifier for {pve} users | |
268 | ||
269 | * `Domain` (`domain`): The AD domain of the server | |
270 | ||
271 | * `Server` (`server1`): The FQDN or IP address of the server | |
272 | ||
273 | * `Fallback Server` (`server2`): An optional fallback server address, in case | |
274 | the primary server is unreachable | |
275 | ||
276 | * `Port` (`port`): The port that the Microsoft AD server listens on | |
277 | ||
278 | [[pveum_ldap_sync]] | |
279 | Syncing LDAP-Based Realms | |
280 | ~~~~~~~~~~~~~~~~~~~~~~~~~ | |
281 | ||
282 | [thumbnail="screenshot/gui-datacenter-realm-add-ldap.png"] | |
283 | ||
284 | It's possible to automatically sync users and groups for LDAP-based realms (LDAP | |
285 | & Microsoft Active Directory), rather than having to add them to {pve} manually. | |
286 | You can access the sync options from the Add/Edit window of the web interface's | |
287 | `Authentication` panel or via the `pveum realm add/modify` commands. You can | |
288 | then carry out the sync operation from the `Authentication` panel of the GUI or | |
289 | using the following command: | |
290 | ||
291 | ---- | |
292 | pveum realm sync <realm> | |
293 | ---- | |
294 | ||
295 | Users and groups are synced to the cluster-wide configuration file, | |
296 | `/etc/pve/user.cfg`. | |
297 | ||
78881712 DC |
298 | If the sync response includes user attributes, they will be synced into the |
299 | matching user property in the `user.cfg` (for example: 'firstname', 'lastname', | |
300 | etc.). If the names of the attributes are not matching the PVE properties, you | |
301 | can set a custom field-to-field map in the config with the 'sync_attributes' | |
302 | option. | |
78000a64 DW |
303 | |
304 | Sync Configuration | |
305 | ^^^^^^^^^^^^^^^^^^ | |
306 | ||
307 | The configuration options for syncing LDAP-based realms can be found in the | |
308 | `Sync Options` tab of the Add/Edit window. | |
309 | ||
310 | The configuration options are as follows: | |
311 | ||
312 | * `Bind User` (`bind_dn`): Refers to the LDAP account used to query users | |
313 | and groups. This account needs access to all desired entries. If it's set, the | |
314 | search will be carried out via binding; otherwise, the search will be carried | |
315 | out anonymously. The user must be a complete LDAP formatted distinguished name | |
316 | (DN), for example, `cn=admin,dc=example,dc=com`. | |
317 | ||
318 | * Groupname attr. (group_name_attr): Represents the | |
319 | users' groups. Only entries which adhere to the usual character limitations of | |
320 | the `user.cfg` are synced. Groups are synced with `-$realm` attached to the | |
321 | name, in order to avoid naming conflicts. Please ensure that a sync does not | |
322 | overwrite manually created groups. | |
323 | ||
324 | * `User classes` (`user_classes`): Objects classes associated with users. | |
325 | ||
326 | * `Group classes` (`group_classes`): Objects classes associated with groups. | |
327 | ||
328 | * `E-Mail attribute`: If the LDAP-based server specifies user email addresses, | |
329 | these can also be included in the sync by setting the associated attribute | |
330 | here. From the command line, this is achievable through the | |
331 | `--sync_attributes` parameter. | |
332 | ||
333 | * `User Filter` (`filter`): For further filter options to target specific users. | |
334 | ||
335 | * `Group Filter` (`group_filter`): For further filter options to target specific | |
336 | groups. | |
337 | ||
338 | NOTE: Filters allow you to create a set of additional match criteria, to narrow | |
339 | down the scope of a sync. Information on available LDAP filter types and their | |
340 | usage can be found at https://ldap.com/ldap-filters/[ldap.com]. | |
341 | ||
78000a64 DW |
342 | [[pveum_ldap_sync_options]] |
343 | Sync Options | |
344 | ^^^^^^^^^^^^ | |
345 | ||
346 | [thumbnail="screenshot/gui-datacenter-realm-add-ldap-sync-options.png"] | |
347 | ||
348 | In addition to the options specified in the previous section, you can also | |
349 | configure further options that describe the behavior of the sync operation. | |
350 | ||
351 | These options are either set as parameters before the sync, or as defaults via | |
352 | the realm option `sync-defaults-options`. | |
353 | ||
354 | The main options for syncing are: | |
355 | ||
356 | * `Scope` (`scope`): The scope of what to sync. It can be either `users`, | |
357 | `groups` or `both`. | |
358 | ||
359 | * `Enable new` (`enable-new`): If set, the newly synced users are enabled and | |
360 | can log in. The default is `true`. | |
361 | ||
217b2cae DC |
362 | * `Remove Vanished` (`remove-vanished`): This is a list of options which, when |
363 | activated, determine if they are removed when they are not returned from | |
364 | the sync response. The options are: | |
78000a64 | 365 | |
217b2cae DC |
366 | - `ACL` (`acl)`: Remove ACLs of users and groups which were not returned |
367 | returned in the sync response. This most often makes sense together with | |
368 | `Entry`. | |
369 | ||
370 | - `Entry` (`entry`): Removes entries (i.e. users and groups) when they are | |
371 | not returned in the sync response. | |
372 | ||
78881712 DC |
373 | - `Properties` (`properties`): Removes properties of entries where the user |
374 | in the sync response did not contain those attributes. This includes | |
375 | all properties, even those never set by a sync. Exceptions are tokens | |
376 | and the enable flag, these will be retained even with this option enabled. | |
78000a64 DW |
377 | |
378 | * `Preview` (`dry-run`): No data is written to the config. This is useful if you | |
379 | want to see which users and groups would get synced to the `user.cfg`. | |
f3ee27eb DM |
380 | |
381 | ||
382 | [[pveum_openid]] | |
96942248 | 383 | OpenID Connect |
f3ee27eb DM |
384 | ~~~~~~~~~~~~~~ |
385 | ||
386 | The main OpenID Connect configuration options are: | |
387 | ||
78000a64 DW |
388 | * `Issuer URL` (`issuer-url`): This is the URL of the authorization server. |
389 | Proxmox uses the OpenID Connect Discovery protocol to automatically configure | |
f3ee27eb DM |
390 | further details. |
391 | + | |
96942248 | 392 | While it is possible to use unencrypted `http://` URLs, we strongly recommend to |
f3ee27eb DM |
393 | use encrypted `https://` connections. |
394 | ||
78000a64 | 395 | * `Realm` (`realm`): The realm identifier for {pve} users |
f3ee27eb | 396 | |
78000a64 | 397 | * `Client ID` (`client-id`): OpenID Client ID. |
f3ee27eb | 398 | |
78000a64 | 399 | * `Client Key` (`client-key`): Optional OpenID Client Key. |
f3ee27eb | 400 | |
78000a64 DW |
401 | * `Autocreate Users` (`autocreate`): Automatically create users if they do not |
402 | exist. While authentication is done at the OpenID server, all users still need | |
403 | an entry in the {pve} user configuration. You can either add them manually, or | |
404 | use the `autocreate` option to automatically add new users. | |
405 | ||
406 | * `Username Claim` (`username-claim`): OpenID claim used to generate the unique | |
407 | username (`subject`, `username` or `email`). | |
f3ee27eb DM |
408 | |
409 | Username mapping | |
410 | ^^^^^^^^^^^^^^^^ | |
411 | ||
96942248 DW |
412 | The OpenID Connect specification defines a single unique attribute |
413 | ('claim' in OpenID terms) named `subject`. By default, we use the | |
f3ee27eb DM |
414 | value of this attribute to generate {pve} usernames, by simple adding |
415 | `@` and the realm name: `${subject}@${realm}`. | |
416 | ||
96942248 | 417 | Unfortunately, most OpenID servers use random strings for `subject`, like |
f3ee27eb | 418 | `DGH76OKH34BNG3245SB`, so a typical username would look like |
96942248 | 419 | `DGH76OKH34BNG3245SB@yourrealm`. While unique, it is difficult for |
f3ee27eb | 420 | humans to remember such random strings, making it quite impossible to |
96942248 | 421 | associate real users with this. |
f3ee27eb DM |
422 | |
423 | The `username-claim` setting allows you to use other attributes for | |
96942248 DW |
424 | the username mapping. Setting it to `username` is preferred if the |
425 | OpenID Connect server provides that attribute and guarantees its | |
f3ee27eb DM |
426 | uniqueness. |
427 | ||
96942248 | 428 | Another option is to use `email`, which also yields human readable |
62547dfa | 429 | usernames. Again, only use this setting if the server guarantees the |
f3ee27eb DM |
430 | uniqueness of this attribute. |
431 | ||
432 | Examples | |
433 | ^^^^^^^^ | |
434 | ||
96942248 | 435 | Here is an example of creating an OpenID realm using Google. You need to |
f3ee27eb | 436 | replace `--client-id` and `--client-key` with the values |
96942248 | 437 | from your Google OpenID settings. |
f3ee27eb DM |
438 | |
439 | ---- | |
440 | pveum realm add myrealm1 --type openid --issuer-url https://accounts.google.com --client-id XXXX --client-key YYYY --username-claim email | |
441 | ---- | |
442 | ||
96942248 DW |
443 | The above command uses `--username-claim email`, so that the usernames on the |
444 | {pve} side look like `example.user@google.com@myrealm1`. | |
f3ee27eb | 445 | |
96942248 DW |
446 | Keycloak (https://www.keycloak.org/) is a popular open source Identity |
447 | and Access Management tool, which supports OpenID Connect. In the following | |
f3ee27eb | 448 | example, you need to replace the `--issuer-url` and `--client-id` with |
96942248 | 449 | your information: |
f3ee27eb DM |
450 | |
451 | ---- | |
452 | pveum realm add myrealm2 --type openid --issuer-url https://your.server:8080/auth/realms/your-realm --client-id XXX --username-claim username | |
453 | ---- | |
454 | ||
96942248 | 455 | Using `--username-claim username` enables simple usernames on the |
f3ee27eb DM |
456 | {pve} side, like `example.user@myrealm2`. |
457 | ||
96942248 DW |
458 | WARNING: You need to ensure that the user is not allowed to edit |
459 | the username setting themselves (on the Keycloak server). | |
f3ee27eb DM |
460 | |
461 | ||
0523992b | 462 | [[pveum_tfa_auth]] |
96942248 | 463 | Two-Factor Authentication |
9e8f2770 WB |
464 | ------------------------- |
465 | ||
74662f51 | 466 | There are two ways to use two-factor authentication: |
2837cf1d | 467 | |
74662f51 | 468 | It can be required by the authentication realm, either via 'TOTP' |
96942248 DW |
469 | (Time-based One-Time Password) or 'YubiKey OTP'. In this case, a newly |
470 | created user needs to have their keys added immediately, as there is no way to | |
74662f51 OB |
471 | log in without the second factor. In the case of 'TOTP', users can |
472 | also change the 'TOTP' later on, provided they can log in first. | |
2837cf1d | 473 | |
96942248 | 474 | Alternatively, users can choose to opt-in to two-factor authentication |
1245cebe WB |
475 | later on, even if the realm does not enforce it. |
476 | ||
477 | Available Second Factors | |
478 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
479 | ||
480 | You can set up multiple second factors, in order to avoid a situation in | |
481 | which losing your smartphone or security key locks you out of your | |
482 | account permanently. | |
483 | ||
484 | The following two-factor authentication methods are available in | |
485 | addition to realm-enforced TOTP and YubiKey OTP: | |
486 | ||
487 | * User configured TOTP | |
488 | (https://en.wikipedia.org/wiki/Time-based_One-Time_Password[Time-based One-Time Password]). | |
489 | A short code derived from a shared secret and the current time, it changes | |
490 | every 30 seconds. | |
491 | * WebAuthn (https://en.wikipedia.org/wiki/WebAuthn[Web Authentication]). | |
492 | A general standard for authentication. It is implemented by various | |
493 | security devices, like hardware keys or trusted platform modules (TPM) | |
494 | from a computer or smart phone. | |
495 | * Single use Recovery Keys. A list of keys which should either be | |
496 | printed out and locked in a secure place or saved digitally in an | |
497 | electronic vault. Each key can be used only once. These are perfect for | |
498 | ensuring that you are not locked out, even if all of your other second | |
499 | factors are lost or corrupt. | |
500 | ||
501 | Before WebAuthn was supported, U2F could be setup by the user. Existing | |
502 | U2F factors can still be used, but it is recommended to switch to | |
503 | WebAuthn, once it is configured on the server. | |
2837cf1d | 504 | |
96942248 | 505 | Realm Enforced Two-Factor Authentication |
2837cf1d WB |
506 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
507 | ||
74662f51 OB |
508 | This can be done by selecting one of the available methods via the |
509 | 'TFA' dropdown box when adding or editing an Authentication Realm. | |
96942248 DW |
510 | When a realm has TFA enabled, it becomes a requirement, and only users |
511 | with configured TFA will be able to log in. | |
9e8f2770 WB |
512 | |
513 | Currently there are two methods available: | |
514 | ||
96942248 | 515 | Time-based OATH (TOTP):: This uses the standard HMAC-SHA1 algorithm, |
74662f51 | 516 | where the current time is hashed with the user's configured key. The |
96942248 | 517 | time step and password length parameters are configurable. |
9e8f2770 | 518 | + |
74662f51 OB |
519 | A user can have multiple keys configured (separated by spaces), and the keys |
520 | can be specified in Base32 (RFC3548) or hexadecimal notation. | |
9e8f2770 | 521 | + |
74662f51 | 522 | {pve} provides a key generation tool (`oathkeygen`) which prints out a random |
96942248 | 523 | key in Base32 notation, that can be used directly with various OTP tools, such |
74662f51 OB |
524 | as the `oathtool` command line tool, or on Android Google Authenticator, |
525 | FreeOTP, andOTP or similar applications. | |
9e8f2770 WB |
526 | |
527 | YubiKey OTP:: | |
528 | For authenticating via a YubiKey a Yubico API ID, API KEY and validation | |
529 | server URL must be configured, and users must have a YubiKey available. In | |
530 | order to get the key ID from a YubiKey, you can trigger the YubiKey once | |
96942248 | 531 | after connecting it via USB, and copy the first 12 characters of the typed |
9e8f2770 | 532 | password into the user's 'Key IDs' field. |
74662f51 | 533 | |
74662f51 OB |
534 | Please refer to the https://developers.yubico.com/OTP/[YubiKey OTP] |
535 | documentation for how to use the | |
9e8f2770 | 536 | https://www.yubico.com/products/services-software/yubicloud/[YubiCloud] or |
96942248 | 537 | https://developers.yubico.com/Software_Projects/Yubico_OTP/YubiCloud_Validation_Servers/[host your own verification server]. |
9e8f2770 | 538 | |
0523992b | 539 | [[pveum_user_configured_totp]] |
96942248 | 540 | User Configured TOTP Authentication |
2837cf1d WB |
541 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
542 | ||
1245cebe WB |
543 | Users can choose to enable 'TOTP' or 'WebAuthn' as a second factor on login, via |
544 | the 'TFA' button in the user list (unless the realm enforces 'YubiKey OTP'). | |
2837cf1d | 545 | |
1245cebe WB |
546 | Users can always add and use one time 'Recovery Keys'. |
547 | ||
548 | [thumbnail="screenshot/gui-datacenter-two-factor.png"] | |
2b59fcfb | 549 | |
96942248 DW |
550 | After opening the 'TFA' window, the user is presented with a dialog to set up |
551 | 'TOTP' authentication. The 'Secret' field contains the key, which can be | |
552 | randomly generated via the 'Randomize' button. An optional 'Issuer Name' can be | |
553 | added to provide information to the 'TOTP' app about what the key belongs to. | |
2837cf1d | 554 | Most 'TOTP' apps will show the issuer name together with the corresponding |
96942248 | 555 | 'OTP' values. The username is also included in the QR code for the 'TOTP' app. |
2837cf1d | 556 | |
96942248 DW |
557 | After generating a key, a QR code will be displayed, which can be used with most |
558 | OTP apps such as FreeOTP. The user then needs to verify the current user | |
2837cf1d | 559 | password (unless logged in as 'root'), as well as the ability to correctly use |
96942248 DW |
560 | the 'TOTP' key, by typing the current 'OTP' value into the 'Verification Code' |
561 | field and pressing the 'Apply' button. | |
2837cf1d | 562 | |
1245cebe WB |
563 | [[user_tfa_setup_totp]] |
564 | === TOTP | |
565 | ||
566 | [thumbnail="screenshot/pve-gui-tfa-add-totp.png"] | |
567 | ||
568 | There is no server setup required. Simply install a TOTP app on your | |
569 | smartphone (for example, https://freeotp.github.io/[FreeOTP]) and use | |
570 | the Proxmox Backup Server web-interface to add a TOTP factor. | |
571 | ||
572 | [[user_tfa_setup_webauthn]] | |
573 | === WebAuthn | |
574 | ||
575 | For WebAuthn to work, you need to have two things: | |
576 | ||
577 | * A trusted HTTPS certificate (for example, by using | |
578 | https://pve.proxmox.com/wiki/Certificate_Management[Let's Encrypt]). | |
579 | While it probably works with an untrusted certificate, some browsers may | |
580 | warn or refuse WebAuthn operations if it is not trusted. | |
581 | * Setup the WebAuthn configuration (see *Datacenter -> Options -> | |
582 | WebAuthn Settings* in the Proxmox VE web interface). This can be | |
583 | auto-filled in most setups. | |
584 | ||
585 | Once you have fulfilled both of these requirements, you can add a WebAuthn | |
586 | configuration in the *Two Factor* panel under *Datacenter -> Permissions -> Two | |
587 | Factor*. | |
588 | ||
589 | [[user_tfa_setup_recovery_keys]] | |
590 | === Recovery Keys | |
591 | ||
592 | [thumbnail="screenshot/pve-gui-tfa-add-recovery-keys.png"] | |
593 | ||
594 | Recovery key codes do not need any preparation; you can simply create a | |
595 | set of recovery keys in the *Two Factor* panel under *Datacenter -> Permissions | |
596 | -> Two Factor*. | |
597 | ||
598 | NOTE: There can only be one set of single-use recovery keys per user at any | |
599 | time. | |
600 | ||
601 | ||
e455949b | 602 | [[pveum_configure_webauthn]] |
1245cebe WB |
603 | Server Side Webauthn Configuration |
604 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
605 | ||
606 | [thumbnail="screenshot/gui-datacenter-webauthn-edit.png"] | |
607 | ||
608 | To allow users to use 'WebAuthn' authentication, it is necessaary to use a valid | |
609 | domain with a valid SSL certificate, otherwise some browsers may warn or refuse | |
610 | to authenticate altogether. | |
611 | ||
612 | NOTE: Changing the 'WebAuthn' configuration may render all existing 'WebAuthn' | |
613 | registrations unusable! | |
614 | ||
615 | This is done via `/etc/pve/datacenter.cfg`. For instance: | |
616 | ||
617 | ---- | |
618 | webauthn: | |
619 | rp=mypve.example.com,origin=https://mypve.example.com:8006,id=mypve.example.com | |
620 | ---- | |
621 | ||
97d63abc | 622 | [[pveum_configure_u2f]] |
96942248 | 623 | Server Side U2F Configuration |
2837cf1d WB |
624 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
625 | ||
1245cebe WB |
626 | NOTE: It is recommended to use WebAuthn instead. |
627 | ||
58df830b | 628 | To allow users to use 'U2F' authentication, it may be necessary to use a valid |
96942248 DW |
629 | domain with a valid SSL certificate, otherwise, some browsers may print |
630 | a warning or reject U2F usage altogether. Initially, an 'AppId' | |
2837cf1d WB |
631 | footnote:[AppId https://developers.yubico.com/U2F/App_ID.html] |
632 | needs to be configured. | |
633 | ||
634 | NOTE: Changing the 'AppId' will render all existing 'U2F' registrations | |
635 | unusable! | |
636 | ||
96942248 | 637 | This is done via `/etc/pve/datacenter.cfg`. For instance: |
2837cf1d WB |
638 | |
639 | ---- | |
640 | u2f: appid=https://mypve.example.com:8006 | |
641 | ---- | |
642 | ||
96942248 DW |
643 | For a single node, the 'AppId' can simply be the address of the web-interface, |
644 | exactly as it is used in the browser, including the 'https://' and the port, as | |
645 | shown above. Please note that some browsers may be more strict than others when | |
646 | matching 'AppIds'. | |
2837cf1d WB |
647 | |
648 | When using multiple nodes, it is best to have a separate `https` server | |
649 | providing an `appid.json` | |
650 | footnote:[Multi-facet apps: https://developers.yubico.com/U2F/App_ID.html] | |
651 | file, as it seems to be compatible with most | |
652 | browsers. If all nodes use subdomains of the same top level domain, it may be | |
96942248 DW |
653 | enough to use the TLD as 'AppId'. It should however be noted that some browsers |
654 | may not accept this. | |
2837cf1d WB |
655 | |
656 | NOTE: A bad 'AppId' will usually produce an error, but we have encountered | |
96942248 DW |
657 | situations when this does not happen, particularly when using a top level domain |
658 | 'AppId' for a node that is accessed via a subdomain in Chromium. For this reason | |
659 | it is recommended to test the configuration with multiple browsers, as changing | |
660 | the 'AppId' later will render existing 'U2F' registrations unusable. | |
2837cf1d | 661 | |
0523992b | 662 | [[pveum_user_configured_u2f]] |
96942248 | 663 | Activating U2F as a User |
2837cf1d WB |
664 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
665 | ||
666 | To enable 'U2F' authentication, open the 'TFA' window's 'U2F' tab, type in the | |
667 | current password (unless logged in as root), and press the 'Register' button. | |
96942248 | 668 | If the server is set up correctly and the browser accepts the server's provided |
2837cf1d | 669 | 'AppId', a message will appear prompting the user to press the button on the |
96942248 DW |
670 | 'U2F' device (if it is a 'YubiKey', the button light should be toggling on and |
671 | off steadily, roughly twice per second). | |
2837cf1d WB |
672 | |
673 | Firefox users may need to enable 'security.webauth.u2f' via 'about:config' | |
674 | before they can use a 'U2F' token. | |
9e8f2770 | 675 | |
80c0adcb | 676 | [[pveum_permission_management]] |
04f44730 | 677 | Permission Management |
3c8533f2 DM |
678 | --------------------- |
679 | ||
04f44730 | 680 | In order for a user to perform an action (such as listing, modifying or |
96942248 | 681 | deleting parts of a VM's configuration), the user needs to have the |
04f44730 WB |
682 | appropriate permissions. |
683 | ||
684 | {pve} uses a role and path based permission management system. An entry in | |
181db098 | 685 | the permissions table allows a user, group or token to take on a specific role |
96942248 | 686 | when accessing an 'object' or 'path'. This means that such an access rule can |
181db098 FG |
687 | be represented as a triple of '(path, user, role)', '(path, group, |
688 | role)' or '(path, token, role)', with the role containing a set of allowed | |
689 | actions, and the path representing the target of these actions. | |
04f44730 | 690 | |
5eba0743 | 691 | |
80c0adcb | 692 | [[pveum_roles]] |
853d288b WB |
693 | Roles |
694 | ~~~~~ | |
695 | ||
696 | A role is simply a list of privileges. Proxmox VE comes with a number | |
96942248 | 697 | of predefined roles, which satisfy most requirements. |
853d288b | 698 | |
96942248 | 699 | * `Administrator`: has full privileges |
853d288b | 700 | * `NoAccess`: has no privileges (used to forbid access) |
96942248 DW |
701 | * `PVEAdmin`: can do most tasks, but has no rights to modify system settings (`Sys.PowerMgmt`, `Sys.Modify`, `Realm.Allocate`) |
702 | * `PVEAuditor`: has read only access | |
853d288b WB |
703 | * `PVEDatastoreAdmin`: create and allocate backup space and templates |
704 | * `PVEDatastoreUser`: allocate backup space and view storage | |
705 | * `PVEPoolAdmin`: allocate pools | |
706 | * `PVESysAdmin`: User ACLs, audit, system console and system logs | |
707 | * `PVETemplateUser`: view and clone templates | |
96942248 | 708 | * `PVEUserAdmin`: manage users |
853d288b | 709 | * `PVEVMAdmin`: fully administer VMs |
96942248 | 710 | * `PVEVMUser`: view, backup, configure CD-ROM, VM console, VM power management |
853d288b | 711 | |
96942248 | 712 | You can see the whole set of predefined roles in the GUI. |
853d288b | 713 | |
96942248 | 714 | You can add new roles via the GUI or the command line. |
5e6b02ff TL |
715 | |
716 | [thumbnail="screenshot/gui-datacenter-role-add.png"] | |
96942248 DW |
717 | From the GUI, navigate to the 'Permissions -> Roles' tab from 'Datacenter' and |
718 | click on the 'Create' button. There you can set a role name and select any | |
719 | desired privileges from the 'Privileges' drop-down menu. | |
853d288b | 720 | |
96942248 DW |
721 | To add a role through the command line, you can use the 'pveum' CLI tool, for |
722 | example: | |
853d288b WB |
723 | [source,bash] |
724 | ---- | |
96942248 DW |
725 | pveum role add PVE_Power-only --privs "VM.PowerMgmt VM.Console" |
726 | pveum role add Sys_Power-only --privs "Sys.PowerMgmt Sys.Console" | |
853d288b WB |
727 | ---- |
728 | ||
729 | ||
3c8533f2 DM |
730 | Privileges |
731 | ~~~~~~~~~~ | |
732 | ||
733 | A privilege is the right to perform a specific action. To simplify | |
734 | management, lists of privileges are grouped into roles, which can then | |
96942248 | 735 | be used in the permission table. Note that privileges cannot be directly |
0e1fda70 | 736 | assigned to users and paths without being part of a role. |
3c8533f2 | 737 | |
96942248 | 738 | We currently support the following privileges: |
3c8533f2 DM |
739 | |
740 | Node / System related privileges:: | |
741 | ||
742 | * `Permissions.Modify`: modify access permissions | |
96942248 DW |
743 | * `Sys.PowerMgmt`: node power management (start, stop, reset, shutdown, ...) |
744 | * `Sys.Console`: console access to node | |
745 | * `Sys.Syslog`: view syslog | |
746 | * `Sys.Audit`: view node status/config, Corosync cluster config, and HA config | |
747 | * `Sys.Modify`: create/modify/remove node network parameters | |
748 | * `Group.Allocate`: create/modify/remove groups | |
749 | * `Pool.Allocate`: create/modify/remove a pool | |
696ebb3c | 750 | * `Pool.Audit`: view a pool |
96942248 | 751 | * `Realm.Allocate`: create/modify/remove authentication realms |
3c8533f2 | 752 | * `Realm.AllocateUser`: assign user to a realm |
96942248 | 753 | * `User.Modify`: create/modify/remove user access and details. |
3c8533f2 DM |
754 | |
755 | Virtual machine related privileges:: | |
756 | ||
96942248 | 757 | * `VM.Allocate`: create/remove VM on a server |
3c8533f2 DM |
758 | * `VM.Migrate`: migrate VM to alternate server on cluster |
759 | * `VM.PowerMgmt`: power management (start, stop, reset, shutdown, ...) | |
760 | * `VM.Console`: console access to VM | |
761 | * `VM.Monitor`: access to VM monitor (kvm) | |
762 | * `VM.Backup`: backup/restore VMs | |
763 | * `VM.Audit`: view VM config | |
764 | * `VM.Clone`: clone/copy a VM | |
96942248 | 765 | * `VM.Config.Disk`: add/modify/remove disks |
3a433e9b | 766 | * `VM.Config.CDROM`: eject/change CD-ROM |
3c8533f2 | 767 | * `VM.Config.CPU`: modify CPU settings |
96942248 DW |
768 | * `VM.Config.Memory`: modify memory settings |
769 | * `VM.Config.Network`: add/modify/remove network devices | |
770 | * `VM.Config.HWType`: modify emulated hardware types | |
3c8533f2 | 771 | * `VM.Config.Options`: modify any other VM configuration |
96942248 | 772 | * `VM.Snapshot`: create/delete VM snapshots |
3c8533f2 DM |
773 | |
774 | Storage related privileges:: | |
775 | ||
96942248 | 776 | * `Datastore.Allocate`: create/modify/remove a datastore and delete volumes |
3c8533f2 | 777 | * `Datastore.AllocateSpace`: allocate space on a datastore |
96942248 | 778 | * `Datastore.AllocateTemplate`: allocate/upload templates and ISO images |
3c8533f2 DM |
779 | * `Datastore.Audit`: view/browse a datastore |
780 | ||
5eba0743 | 781 | |
b8eeec52 WB |
782 | Objects and Paths |
783 | ~~~~~~~~~~~~~~~~~ | |
784 | ||
96942248 DW |
785 | Access permissions are assigned to objects, such as virtual machines, |
786 | storages or resource pools. | |
b8eeec52 | 787 | We use file system like paths to address these objects. These paths form a |
96942248 | 788 | natural tree, and permissions of higher levels (shorter paths) can |
b8eeec52 WB |
789 | optionally be propagated down within this hierarchy. |
790 | ||
7d48940b | 791 | [[pveum_templated_paths]] |
b8eeec52 WB |
792 | Paths can be templated. When an API call requires permissions on a |
793 | templated path, the path may contain references to parameters of the API | |
794 | call. These references are specified in curly braces. Some parameters are | |
96942248 | 795 | implicitly taken from the API call's URI. For instance, the permission path |
b8eeec52 WB |
796 | `/nodes/{node}` when calling '/nodes/mynode/status' requires permissions on |
797 | `/nodes/mynode`, while the path `{path}` in a PUT request to `/access/acl` | |
798 | refers to the method's `path` parameter. | |
799 | ||
800 | Some examples are: | |
801 | ||
802 | * `/nodes/{node}`: Access to {pve} server machines | |
803 | * `/vms`: Covers all VMs | |
804 | * `/vms/{vmid}`: Access to specific VMs | |
96942248 DW |
805 | * `/storage/{storeid}`: Access to a specific storage |
806 | * `/pool/{poolname}`: Access to resources contained in a specific <<pveum_pools,pool>> | |
b8eeec52 WB |
807 | * `/access/groups`: Group administration |
808 | * `/access/realms/{realmid}`: Administrative access to realms | |
809 | ||
810 | ||
3c8533f2 DM |
811 | Inheritance |
812 | ^^^^^^^^^^^ | |
813 | ||
5eba0743 | 814 | As mentioned earlier, object paths form a file system like tree, and |
96942248 DW |
815 | permissions can be inherited by objects down that tree (the propagate flag is |
816 | set by default). We use the following inheritance rules: | |
3c8533f2 | 817 | |
74936daf WB |
818 | * Permissions for individual users always replace group permissions. |
819 | * Permissions for groups apply when the user is member of that group. | |
96942248 | 820 | * Permissions on deeper levels replace those inherited from an upper level. |
3c8533f2 | 821 | |
96942248 | 822 | Additionally, privilege separated tokens can never have permissions on any |
181db098 | 823 | given path that their associated user does not have. |
5eba0743 | 824 | |
80c0adcb | 825 | [[pveum_pools]] |
3c8533f2 DM |
826 | Pools |
827 | ~~~~~ | |
828 | ||
96942248 DW |
829 | Pools can be used to group a set of virtual machines and datastores. You can |
830 | then simply set permissions on pools (`/pool/{poolid}`), which are inherited by | |
831 | all pool members. This is a great way to simplify access control. | |
3c8533f2 | 832 | |
74936daf | 833 | |
96942248 DW |
834 | Which Permissions Do I Need? |
835 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
74936daf WB |
836 | |
837 | The required API permissions are documented for each individual | |
96942248 | 838 | method, and can be found at https://pve.proxmox.com/pve-docs/api-viewer/. |
74936daf | 839 | |
96942248 | 840 | The permissions are specified as a list, which can be interpreted as a |
74936daf WB |
841 | tree of logic and access-check functions: |
842 | ||
843 | `["and", <subtests>...]` and `["or", <subtests>...]`:: | |
844 | Each(`and`) or any(`or`) further element in the current list has to be true. | |
845 | ||
846 | `["perm", <path>, [ <privileges>... ], <options>...]`:: | |
7d48940b | 847 | The `path` is a templated parameter (see |
87ba80b0 | 848 | <<pveum_templated_paths,Objects and Paths>>). All (or, if the `any` |
7d48940b | 849 | option is used, any) of the listed |
74936daf WB |
850 | privileges must be allowed on the specified path. If a `require-param` |
851 | option is specified, then its specified parameter is required even if the | |
852 | API call's schema otherwise lists it as being optional. | |
853 | ||
854 | `["userid-group", [ <privileges>... ], <options>...]`:: | |
470d4313 | 855 | The caller must have any of the listed privileges on `/access/groups`. In |
96942248 | 856 | addition, there are two possible checks, depending on whether the |
74936daf WB |
857 | `groups_param` option is set: |
858 | + | |
859 | * `groups_param` is set: The API call has a non-optional `groups` parameter | |
860 | and the caller must have any of the listed privileges on all of the listed | |
861 | groups. | |
862 | * `groups_param` is not set: The user passed via the `userid` parameter | |
863 | must exist and be part of a group on which the caller has any of the listed | |
864 | privileges (via the `/access/groups/<group>` path). | |
865 | ||
866 | `["userid-param", "self"]`:: | |
867 | The value provided for the API call's `userid` parameter must refer to the | |
96942248 DW |
868 | user performing the action (usually in conjunction with `or`, to allow |
869 | users to perform an action on themselves, even if they don't have elevated | |
870 | privileges). | |
74936daf WB |
871 | |
872 | `["userid-param", "Realm.AllocateUser"]`:: | |
873 | The user needs `Realm.AllocateUser` access to `/access/realm/<realm>`, with | |
470d4313 | 874 | `<realm>` referring to the realm of the user passed via the `userid` |
74936daf WB |
875 | parameter. Note that the user does not need to exist in order to be |
876 | associated with a realm, since user IDs are passed in the form of | |
877 | `<username>@<realm>`. | |
878 | ||
879 | `["perm-modify", <path>]`:: | |
7d48940b DM |
880 | The `path` is a templated parameter (see |
881 | <<pveum_templated_paths,Objects and Paths>>). The user needs either the | |
96942248 | 882 | `Permissions.Modify` privilege or, |
74936daf WB |
883 | depending on the path, the following privileges as a possible substitute: |
884 | + | |
885 | * `/storage/...`: additionally requires 'Datastore.Allocate` | |
886 | * `/vms/...`: additionally requires 'VM.Allocate` | |
887 | * `/pool/...`: additionally requires 'Pool.Allocate` | |
888 | + | |
889 | If the path is empty, `Permission.Modify` on `/access` is required. | |
890 | ||
3c8533f2 DM |
891 | Command Line Tool |
892 | ----------------- | |
893 | ||
894 | Most users will simply use the GUI to manage users. But there is also | |
87ba80b0 | 895 | a fully featured command line tool called `pveum` (short for ``**P**roxmox |
4f6e7e05 WB |
896 | **VE** **U**ser **M**anager''). Please note that all Proxmox VE command |
897 | line tools are wrappers around the API, so you can also access those | |
87ba80b0 | 898 | functions through the REST API. |
3c8533f2 | 899 | |
96942248 | 900 | Here are some simple usage examples. To show help, type: |
3c8533f2 DM |
901 | |
902 | [source,bash] | |
903 | pveum | |
904 | ||
905 | or (to show detailed help about a specific command) | |
906 | ||
907 | [source,bash] | |
9135e321 | 908 | pveum help user add |
3c8533f2 DM |
909 | |
910 | Create a new user: | |
911 | ||
912 | [source,bash] | |
9135e321 | 913 | pveum user add testuser@pve -comment "Just a test" |
3c8533f2 | 914 | |
96942248 | 915 | Set or change the password (not all realms support this): |
3c8533f2 DM |
916 | |
917 | [source,bash] | |
918 | pveum passwd testuser@pve | |
919 | ||
920 | Disable a user: | |
921 | ||
922 | [source,bash] | |
9135e321 | 923 | pveum user modify testuser@pve -enable 0 |
3c8533f2 DM |
924 | |
925 | Create a new group: | |
926 | ||
927 | [source,bash] | |
9135e321 | 928 | pveum group add testgroup |
3c8533f2 DM |
929 | |
930 | Create a new role: | |
931 | ||
932 | [source,bash] | |
9135e321 | 933 | pveum role add PVE_Power-only -privs "VM.PowerMgmt VM.Console" |
3c8533f2 DM |
934 | |
935 | ||
936 | Real World Examples | |
937 | ------------------- | |
938 | ||
5eba0743 | 939 | |
3c8533f2 DM |
940 | Administrator Group |
941 | ~~~~~~~~~~~~~~~~~~~ | |
942 | ||
96942248 DW |
943 | It is possible that an administrator would want to create a group of users with |
944 | full administrator rights (without using the root account). | |
3c8533f2 | 945 | |
96942248 | 946 | To do this, first define the group: |
3c8533f2 DM |
947 | |
948 | [source,bash] | |
9135e321 | 949 | pveum group add admin -comment "System Administrators" |
3c8533f2 | 950 | |
96942248 | 951 | Then assign the role: |
3c8533f2 DM |
952 | |
953 | [source,bash] | |
9135e321 | 954 | pveum acl modify / -group admin -role Administrator |
3c8533f2 | 955 | |
96942248 | 956 | Finally, you can add users to the new 'admin' group: |
3c8533f2 DM |
957 | |
958 | [source,bash] | |
9135e321 | 959 | pveum user modify testuser@pve -group admin |
3c8533f2 DM |
960 | |
961 | ||
962 | Auditors | |
963 | ~~~~~~~~ | |
964 | ||
965 | You can give read only access to users by assigning the `PVEAuditor` | |
966 | role to users or groups. | |
967 | ||
96942248 | 968 | Example 1: Allow user `joe@pve` to see everything |
3c8533f2 DM |
969 | |
970 | [source,bash] | |
9135e321 | 971 | pveum acl modify / -user joe@pve -role PVEAuditor |
3c8533f2 | 972 | |
96942248 | 973 | Example 2: Allow user `joe@pve` to see all virtual machines |
3c8533f2 DM |
974 | |
975 | [source,bash] | |
9135e321 | 976 | pveum acl modify /vms -user joe@pve -role PVEAuditor |
3c8533f2 | 977 | |
5eba0743 | 978 | |
3c8533f2 DM |
979 | Delegate User Management |
980 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
981 | ||
96942248 | 982 | If you want to delegate user management to user `joe@pve`, you can do |
3c8533f2 DM |
983 | that with: |
984 | ||
985 | [source,bash] | |
9135e321 | 986 | pveum acl modify /access -user joe@pve -role PVEUserAdmin |
3c8533f2 | 987 | |
96942248 DW |
988 | User `joe@pve` can now add and remove users, and change other user attributes, |
989 | such as passwords. This is a very powerful role, and you most | |
990 | likely want to limit it to selected realms and groups. The following | |
991 | example allows `joe@pve` to modify users within the realm `pve`, if they | |
8c1189b6 | 992 | are members of group `customers`: |
3c8533f2 DM |
993 | |
994 | [source,bash] | |
9135e321 TL |
995 | pveum acl modify /access/realm/pve -user joe@pve -role PVEUserAdmin |
996 | pveum acl modify /access/groups/customers -user joe@pve -role PVEUserAdmin | |
3c8533f2 | 997 | |
0abc65b0 | 998 | NOTE: The user is able to add other users, but only if they are |
96942248 | 999 | members of the group `customers` and within the realm `pve`. |
8c1189b6 | 1000 | |
96942248 | 1001 | Limited API Token for Monitoring |
181db098 FG |
1002 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1003 | ||
a13a971d DW |
1004 | Permissions on API tokens are always a subset of those of their corresponding |
1005 | user, meaning that an API token can't be used to carry out a task that the | |
1006 | backing user has no permission to do. This section will demonstrate how you can | |
1007 | use an API token with separate privileges, to limit the token owner's | |
1008 | permissions further. | |
1009 | ||
1010 | Give the user `joe@pve` the role PVEVMAdmin on all VMs: | |
181db098 FG |
1011 | |
1012 | [source,bash] | |
9135e321 | 1013 | pveum acl modify /vms -user joe@pve -role PVEVMAdmin |
181db098 FG |
1014 | |
1015 | Add a new API token with separate privileges, which is only allowed to view VM | |
96942248 | 1016 | information (for example, for monitoring purposes): |
181db098 FG |
1017 | |
1018 | [source,bash] | |
1019 | pveum user token add joe@pve monitoring -privsep 1 | |
9135e321 | 1020 | pveum acl modify /vms -token 'joe@pve!monitoring' -role PVEAuditor |
181db098 FG |
1021 | |
1022 | Verify the permissions of the user and token: | |
1023 | ||
1024 | [source,bash] | |
1025 | pveum user permissions joe@pve | |
1026 | pveum user token permissions joe@pve monitoring | |
3c8533f2 | 1027 | |
23b447be DW |
1028 | Resource Pools |
1029 | ~~~~~~~~~~~~~~ | |
3c8533f2 | 1030 | |
23b447be DW |
1031 | An enterprise is usually structured into several smaller departments, and it is |
1032 | common that you want to assign resources and delegate management tasks to each | |
1033 | of these. Let's assume that you want to set up a pool for a software development | |
96942248 | 1034 | department. First, create a group: |
3c8533f2 DM |
1035 | |
1036 | [source,bash] | |
9135e321 | 1037 | pveum group add developers -comment "Our software developers" |
3c8533f2 | 1038 | |
96942248 | 1039 | Now we create a new user which is a member of that group: |
3c8533f2 DM |
1040 | |
1041 | [source,bash] | |
9135e321 | 1042 | pveum user add developer1@pve -group developers -password |
3c8533f2 | 1043 | |
96942248 | 1044 | NOTE: The "-password" parameter will prompt you for a password |
3c8533f2 | 1045 | |
96942248 | 1046 | Then we create a resource pool for our development department to use: |
23b447be DW |
1047 | |
1048 | [source,bash] | |
9135e321 | 1049 | pveum pool add dev-pool --comment "IT development pool" |
23b447be | 1050 | |
96942248 | 1051 | Finally, we can assign permissions to that pool: |
3c8533f2 DM |
1052 | |
1053 | [source,bash] | |
9135e321 | 1054 | pveum acl modify /pool/dev-pool/ -group developers -role PVEAdmin |
3c8533f2 | 1055 | |
96942248 | 1056 | Our software developers can now administer the resources assigned to |
3c8533f2 DM |
1057 | that pool. |
1058 | ||
1059 | ||
1060 | ifdef::manvolnum[] | |
1061 | include::pve-copyright.adoc[] | |
1062 | endif::manvolnum[] | |
1063 |