]> git.proxmox.com Git - pve-docs.git/blob - pveum.adoc
pveum: better LDAP/AD explanation + restructuring
[pve-docs.git] / pveum.adoc
1 [[chapter_user_management]]
2 ifdef::manvolnum[]
3 pveum(1)
4 ========
5 :pve-toplevel:
6
7 NAME
8 ----
9
10 pveum - Proxmox VE User Manager
11
12
13 SYNOPSIS
14 --------
15
16 include::pveum.1-synopsis.adoc[]
17
18
19 DESCRIPTION
20 -----------
21 endif::manvolnum[]
22 ifndef::manvolnum[]
23 User Management
24 ===============
25 :pve-toplevel:
26 endif::manvolnum[]
27
28 // Copied from pve wiki: Revision as of 16:10, 27 October 2015
29
30 {pve} supports multiple authentication sources, for example Linux PAM,
31 an integrated Proxmox VE authentication server, LDAP, Microsoft Active
32 Directory and OpenID Connect.
33
34 By using role-based user and permission management for all objects (VMs,
35 Storage, nodes, etc.), granular access can be defined.
36
37
38 [[pveum_users]]
39 Users
40 -----
41
42 {pve} stores user attributes in `/etc/pve/user.cfg`.
43 Passwords are not stored here; users are instead associated with the
44 <<pveum_authentication_realms,authentication realms>> described below.
45 Therefore, a user is often internally identified by their username and
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
54 * An optional expiration date
55 * A comment or note about this user
56 * Whether this user is enabled or disabled
57 * Optional two-factor authentication keys
58
59 CAUTION: When you disable or delete a user, or if the expiry date set is
60 in the past, this user will not be able to log in to new sessions or start new
61 tasks. All tasks which have already been started by this user (for example,
62 terminal sessions) will **not** be terminated automatically by any such event.
63
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
70 still be changed. System mails will be sent to the email address
71 assigned to this user.
72
73
74 [[pveum_groups]]
75 Groups
76 ------
77
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.
82
83 [[pveum_tokens]]
84 API Tokens
85 ----------
86
87 API tokens allow stateless access to most parts of the REST API from another
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
90 and duration of the access. Should the API token get compromised, it can be
91 revoked without disabling the user itself.
92
93 API tokens come in two basic types:
94
95 * Separated privileges: The token needs to be given explicit access with ACLs.
96 Its effective permissions are calculated by intersecting user and token
97 permissions.
98 * Full privileges: The token's permissions are identical to that of the
99 associated user.
100
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!
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
106 refer to your API client's documentation.
107
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
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.
121
122 [[pveum_authentication_realms]]
123 Authentication Realms
124 ---------------------
125
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:
129
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.
136
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.
145
146 LDAP::
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'
194 (`user_attr`) field.
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
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 ----
214
215 The 'Base Domain Name' would be `ou=People,dc=ldap-test,dc=com` and the user
216 attribute would be `uid`.
217
218 If {pve} needs to authenticate (bind) to the LDAP server before being
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`
222 (for example, `/etc/pve/priv/ldap/my-ldap.pw`). This file should contain a
223 single line with the raw password.
224
225 To verify certificates, you need to set `capath`. You can set it either
226 directly to the CA certificate of your LDAP server, or to the system path
227 containing all trusted CA certificates (`/etc/ssl/certs`).
228 Additionally, you need to set the `verify` option, which can also be done over
229 the web interface.
230
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
247 NOTE: In order to allow a particular user to authenticate using the LDAP server,
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>>.
250
251
252 Microsoft Active Directory (AD)
253 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
254
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
298
299 Sync Configuration
300 ^^^^^^^^^^^^^^^^^^
301
302 The configuration options for syncing LDAP-based realms can be found in the
303 `Sync Options` tab of the Add/Edit window.
304
305 The configuration options are as follows:
306
307 * `Bind User` (`bind_dn`): Refers to the LDAP account used to query users
308 and groups. This account needs access to all desired entries. If it's set, the
309 search will be carried out via binding; otherwise, the search will be carried
310 out anonymously. The user must be a complete LDAP formatted distinguished name
311 (DN), for example, `cn=admin,dc=example,dc=com`.
312
313 * Groupname attr. (group_name_attr): Represents the
314 users' groups. Only entries which adhere to the usual character limitations of
315 the `user.cfg` are synced. Groups are synced with `-$realm` attached to the
316 name, in order to avoid naming conflicts. Please ensure that a sync does not
317 overwrite manually created groups.
318
319 * `User classes` (`user_classes`): Objects classes associated with users.
320
321 * `Group classes` (`group_classes`): Objects classes associated with groups.
322
323 * `E-Mail attribute`: If the LDAP-based server specifies user email addresses,
324 these can also be included in the sync by setting the associated attribute
325 here. From the command line, this is achievable through the
326 `--sync_attributes` parameter.
327
328 * `User Filter` (`filter`): For further filter options to target specific users.
329
330 * `Group Filter` (`group_filter`): For further filter options to target specific
331 groups.
332
333 NOTE: Filters allow you to create a set of additional match criteria, to narrow
334 down the scope of a sync. Information on available LDAP filter types and their
335 usage can be found at https://ldap.com/ldap-filters/[ldap.com].
336
337
338 [[pveum_ldap_sync_options]]
339 Sync Options
340 ^^^^^^^^^^^^
341
342 [thumbnail="screenshot/gui-datacenter-realm-add-ldap-sync-options.png"]
343
344 In addition to the options specified in the previous section, you can also
345 configure further options that describe the behavior of the sync operation.
346
347 These options are either set as parameters before the sync, or as defaults via
348 the realm option `sync-defaults-options`.
349
350 The main options for syncing are:
351
352 * `Scope` (`scope`): The scope of what to sync. It can be either `users`,
353 `groups` or `both`.
354
355 * `Enable new` (`enable-new`): If set, the newly synced users are enabled and
356 can log in. The default is `true`.
357
358 * `Full` (`full`): If set, the sync uses the LDAP directory as a source of
359 truth, overwriting information set manually in the `user.cfg` and deleting
360 users and groups which are not present in the LDAP directory. If not set, only
361 new data is written to the configuration, and no stale users are deleted.
362
363 * `Purge ACLs` (`purge`): If set, sync removes all corresponding ACLs when
364 removing users and groups. This is only useful with the option `full`.
365
366 * `Preview` (`dry-run`): No data is written to the config. This is useful if you
367 want to see which users and groups would get synced to the `user.cfg`.
368
369
370 [[pveum_openid]]
371 OpenID Connect
372 ~~~~~~~~~~~~~~
373
374 The main OpenID Connect configuration options are:
375
376 * `Issuer URL` (`issuer-url`): This is the URL of the authorization server.
377 Proxmox uses the OpenID Connect Discovery protocol to automatically configure
378 further details.
379 +
380 While it is possible to use unencrypted `http://` URLs, we strongly recommend to
381 use encrypted `https://` connections.
382
383 * `Realm` (`realm`): The realm identifier for {pve} users
384
385 * `Client ID` (`client-id`): OpenID Client ID.
386
387 * `Client Key` (`client-key`): Optional OpenID Client Key.
388
389 * `Autocreate Users` (`autocreate`): Automatically create users if they do not
390 exist. While authentication is done at the OpenID server, all users still need
391 an entry in the {pve} user configuration. You can either add them manually, or
392 use the `autocreate` option to automatically add new users.
393
394 * `Username Claim` (`username-claim`): OpenID claim used to generate the unique
395 username (`subject`, `username` or `email`).
396
397 Username mapping
398 ^^^^^^^^^^^^^^^^
399
400 The OpenID Connect specification defines a single unique attribute
401 ('claim' in OpenID terms) named `subject`. By default, we use the
402 value of this attribute to generate {pve} usernames, by simple adding
403 `@` and the realm name: `${subject}@${realm}`.
404
405 Unfortunately, most OpenID servers use random strings for `subject`, like
406 `DGH76OKH34BNG3245SB`, so a typical username would look like
407 `DGH76OKH34BNG3245SB@yourrealm`. While unique, it is difficult for
408 humans to remember such random strings, making it quite impossible to
409 associate real users with this.
410
411 The `username-claim` setting allows you to use other attributes for
412 the username mapping. Setting it to `username` is preferred if the
413 OpenID Connect server provides that attribute and guarantees its
414 uniqueness.
415
416 Another option is to use `email`, which also yields human readable
417 usernames. Again, only use this setting if the server guarantees the
418 uniqueness of this attribute.
419
420 Examples
421 ^^^^^^^^
422
423 Here is an example of creating an OpenID realm using Google. You need to
424 replace `--client-id` and `--client-key` with the values
425 from your Google OpenID settings.
426
427 ----
428 pveum realm add myrealm1 --type openid --issuer-url https://accounts.google.com --client-id XXXX --client-key YYYY --username-claim email
429 ----
430
431 The above command uses `--username-claim email`, so that the usernames on the
432 {pve} side look like `example.user@google.com@myrealm1`.
433
434 Keycloak (https://www.keycloak.org/) is a popular open source Identity
435 and Access Management tool, which supports OpenID Connect. In the following
436 example, you need to replace the `--issuer-url` and `--client-id` with
437 your information:
438
439 ----
440 pveum realm add myrealm2 --type openid --issuer-url https://your.server:8080/auth/realms/your-realm --client-id XXX --username-claim username
441 ----
442
443 Using `--username-claim username` enables simple usernames on the
444 {pve} side, like `example.user@myrealm2`.
445
446 WARNING: You need to ensure that the user is not allowed to edit
447 the username setting themselves (on the Keycloak server).
448
449
450 [[pveum_tfa_auth]]
451 Two-Factor Authentication
452 -------------------------
453
454 There are two ways to use two-factor authentication:
455
456 It can be required by the authentication realm, either via 'TOTP'
457 (Time-based One-Time Password) or 'YubiKey OTP'. In this case, a newly
458 created user needs to have their keys added immediately, as there is no way to
459 log in without the second factor. In the case of 'TOTP', users can
460 also change the 'TOTP' later on, provided they can log in first.
461
462 Alternatively, users can choose to opt-in to two-factor authentication
463 via 'TOTP' later on, even if the realm does not enforce it. As another
464 option, if the server has an 'AppId' configured, a user can opt-in to
465 'U2F' authentication, provided the realm does not enforce any other
466 second factor.
467
468 Realm Enforced Two-Factor Authentication
469 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
470
471 This can be done by selecting one of the available methods via the
472 'TFA' dropdown box when adding or editing an Authentication Realm.
473 When a realm has TFA enabled, it becomes a requirement, and only users
474 with configured TFA will be able to log in.
475
476 Currently there are two methods available:
477
478 Time-based OATH (TOTP):: This uses the standard HMAC-SHA1 algorithm,
479 where the current time is hashed with the user's configured key. The
480 time step and password length parameters are configurable.
481 +
482 A user can have multiple keys configured (separated by spaces), and the keys
483 can be specified in Base32 (RFC3548) or hexadecimal notation.
484 +
485 {pve} provides a key generation tool (`oathkeygen`) which prints out a random
486 key in Base32 notation, that can be used directly with various OTP tools, such
487 as the `oathtool` command line tool, or on Android Google Authenticator,
488 FreeOTP, andOTP or similar applications.
489
490 YubiKey OTP::
491 For authenticating via a YubiKey a Yubico API ID, API KEY and validation
492 server URL must be configured, and users must have a YubiKey available. In
493 order to get the key ID from a YubiKey, you can trigger the YubiKey once
494 after connecting it via USB, and copy the first 12 characters of the typed
495 password into the user's 'Key IDs' field.
496
497 Please refer to the https://developers.yubico.com/OTP/[YubiKey OTP]
498 documentation for how to use the
499 https://www.yubico.com/products/services-software/yubicloud/[YubiCloud] or
500 https://developers.yubico.com/Software_Projects/Yubico_OTP/YubiCloud_Validation_Servers/[host your own verification server].
501
502 [[pveum_user_configured_totp]]
503 User Configured TOTP Authentication
504 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
505
506 Users can choose to enable 'TOTP' as a second factor on login, via the 'TFA'
507 button in the user list (unless the realm enforces 'YubiKey OTP').
508
509 [thumbnail="screenshot/gui-datacenter-users-tfa.png"]
510
511 After opening the 'TFA' window, the user is presented with a dialog to set up
512 'TOTP' authentication. The 'Secret' field contains the key, which can be
513 randomly generated via the 'Randomize' button. An optional 'Issuer Name' can be
514 added to provide information to the 'TOTP' app about what the key belongs to.
515 Most 'TOTP' apps will show the issuer name together with the corresponding
516 'OTP' values. The username is also included in the QR code for the 'TOTP' app.
517
518 After generating a key, a QR code will be displayed, which can be used with most
519 OTP apps such as FreeOTP. The user then needs to verify the current user
520 password (unless logged in as 'root'), as well as the ability to correctly use
521 the 'TOTP' key, by typing the current 'OTP' value into the 'Verification Code'
522 field and pressing the 'Apply' button.
523
524 [[pveum_configure_u2f]]
525 Server Side U2F Configuration
526 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
527
528 To allow users to use 'U2F' authentication, it may be necessary to use a valid
529 domain with a valid SSL certificate, otherwise, some browsers may print
530 a warning or reject U2F usage altogether. Initially, an 'AppId'
531 footnote:[AppId https://developers.yubico.com/U2F/App_ID.html]
532 needs to be configured.
533
534 NOTE: Changing the 'AppId' will render all existing 'U2F' registrations
535 unusable!
536
537 This is done via `/etc/pve/datacenter.cfg`. For instance:
538
539 ----
540 u2f: appid=https://mypve.example.com:8006
541 ----
542
543 For a single node, the 'AppId' can simply be the address of the web-interface,
544 exactly as it is used in the browser, including the 'https://' and the port, as
545 shown above. Please note that some browsers may be more strict than others when
546 matching 'AppIds'.
547
548 When using multiple nodes, it is best to have a separate `https` server
549 providing an `appid.json`
550 footnote:[Multi-facet apps: https://developers.yubico.com/U2F/App_ID.html]
551 file, as it seems to be compatible with most
552 browsers. If all nodes use subdomains of the same top level domain, it may be
553 enough to use the TLD as 'AppId'. It should however be noted that some browsers
554 may not accept this.
555
556 NOTE: A bad 'AppId' will usually produce an error, but we have encountered
557 situations when this does not happen, particularly when using a top level domain
558 'AppId' for a node that is accessed via a subdomain in Chromium. For this reason
559 it is recommended to test the configuration with multiple browsers, as changing
560 the 'AppId' later will render existing 'U2F' registrations unusable.
561
562 [[pveum_user_configured_u2f]]
563 Activating U2F as a User
564 ~~~~~~~~~~~~~~~~~~~~~~~~
565
566 To enable 'U2F' authentication, open the 'TFA' window's 'U2F' tab, type in the
567 current password (unless logged in as root), and press the 'Register' button.
568 If the server is set up correctly and the browser accepts the server's provided
569 'AppId', a message will appear prompting the user to press the button on the
570 'U2F' device (if it is a 'YubiKey', the button light should be toggling on and
571 off steadily, roughly twice per second).
572
573 Firefox users may need to enable 'security.webauth.u2f' via 'about:config'
574 before they can use a 'U2F' token.
575
576 [[pveum_permission_management]]
577 Permission Management
578 ---------------------
579
580 In order for a user to perform an action (such as listing, modifying or
581 deleting parts of a VM's configuration), the user needs to have the
582 appropriate permissions.
583
584 {pve} uses a role and path based permission management system. An entry in
585 the permissions table allows a user, group or token to take on a specific role
586 when accessing an 'object' or 'path'. This means that such an access rule can
587 be represented as a triple of '(path, user, role)', '(path, group,
588 role)' or '(path, token, role)', with the role containing a set of allowed
589 actions, and the path representing the target of these actions.
590
591
592 [[pveum_roles]]
593 Roles
594 ~~~~~
595
596 A role is simply a list of privileges. Proxmox VE comes with a number
597 of predefined roles, which satisfy most requirements.
598
599 * `Administrator`: has full privileges
600 * `NoAccess`: has no privileges (used to forbid access)
601 * `PVEAdmin`: can do most tasks, but has no rights to modify system settings (`Sys.PowerMgmt`, `Sys.Modify`, `Realm.Allocate`)
602 * `PVEAuditor`: has read only access
603 * `PVEDatastoreAdmin`: create and allocate backup space and templates
604 * `PVEDatastoreUser`: allocate backup space and view storage
605 * `PVEPoolAdmin`: allocate pools
606 * `PVESysAdmin`: User ACLs, audit, system console and system logs
607 * `PVETemplateUser`: view and clone templates
608 * `PVEUserAdmin`: manage users
609 * `PVEVMAdmin`: fully administer VMs
610 * `PVEVMUser`: view, backup, configure CD-ROM, VM console, VM power management
611
612 You can see the whole set of predefined roles in the GUI.
613
614 You can add new roles via the GUI or the command line.
615
616 [thumbnail="screenshot/gui-datacenter-role-add.png"]
617 From the GUI, navigate to the 'Permissions -> Roles' tab from 'Datacenter' and
618 click on the 'Create' button. There you can set a role name and select any
619 desired privileges from the 'Privileges' drop-down menu.
620
621 To add a role through the command line, you can use the 'pveum' CLI tool, for
622 example:
623 [source,bash]
624 ----
625 pveum role add PVE_Power-only --privs "VM.PowerMgmt VM.Console"
626 pveum role add Sys_Power-only --privs "Sys.PowerMgmt Sys.Console"
627 ----
628
629
630 Privileges
631 ~~~~~~~~~~
632
633 A privilege is the right to perform a specific action. To simplify
634 management, lists of privileges are grouped into roles, which can then
635 be used in the permission table. Note that privileges cannot be directly
636 assigned to users and paths without being part of a role.
637
638 We currently support the following privileges:
639
640 Node / System related privileges::
641
642 * `Permissions.Modify`: modify access permissions
643 * `Sys.PowerMgmt`: node power management (start, stop, reset, shutdown, ...)
644 * `Sys.Console`: console access to node
645 * `Sys.Syslog`: view syslog
646 * `Sys.Audit`: view node status/config, Corosync cluster config, and HA config
647 * `Sys.Modify`: create/modify/remove node network parameters
648 * `Group.Allocate`: create/modify/remove groups
649 * `Pool.Allocate`: create/modify/remove a pool
650 * `Pool.Audit`: view a pool
651 * `Realm.Allocate`: create/modify/remove authentication realms
652 * `Realm.AllocateUser`: assign user to a realm
653 * `User.Modify`: create/modify/remove user access and details.
654
655 Virtual machine related privileges::
656
657 * `VM.Allocate`: create/remove VM on a server
658 * `VM.Migrate`: migrate VM to alternate server on cluster
659 * `VM.PowerMgmt`: power management (start, stop, reset, shutdown, ...)
660 * `VM.Console`: console access to VM
661 * `VM.Monitor`: access to VM monitor (kvm)
662 * `VM.Backup`: backup/restore VMs
663 * `VM.Audit`: view VM config
664 * `VM.Clone`: clone/copy a VM
665 * `VM.Config.Disk`: add/modify/remove disks
666 * `VM.Config.CDROM`: eject/change CD-ROM
667 * `VM.Config.CPU`: modify CPU settings
668 * `VM.Config.Memory`: modify memory settings
669 * `VM.Config.Network`: add/modify/remove network devices
670 * `VM.Config.HWType`: modify emulated hardware types
671 * `VM.Config.Options`: modify any other VM configuration
672 * `VM.Snapshot`: create/delete VM snapshots
673
674 Storage related privileges::
675
676 * `Datastore.Allocate`: create/modify/remove a datastore and delete volumes
677 * `Datastore.AllocateSpace`: allocate space on a datastore
678 * `Datastore.AllocateTemplate`: allocate/upload templates and ISO images
679 * `Datastore.Audit`: view/browse a datastore
680
681
682 Objects and Paths
683 ~~~~~~~~~~~~~~~~~
684
685 Access permissions are assigned to objects, such as virtual machines,
686 storages or resource pools.
687 We use file system like paths to address these objects. These paths form a
688 natural tree, and permissions of higher levels (shorter paths) can
689 optionally be propagated down within this hierarchy.
690
691 [[pveum_templated_paths]]
692 Paths can be templated. When an API call requires permissions on a
693 templated path, the path may contain references to parameters of the API
694 call. These references are specified in curly braces. Some parameters are
695 implicitly taken from the API call's URI. For instance, the permission path
696 `/nodes/{node}` when calling '/nodes/mynode/status' requires permissions on
697 `/nodes/mynode`, while the path `{path}` in a PUT request to `/access/acl`
698 refers to the method's `path` parameter.
699
700 Some examples are:
701
702 * `/nodes/{node}`: Access to {pve} server machines
703 * `/vms`: Covers all VMs
704 * `/vms/{vmid}`: Access to specific VMs
705 * `/storage/{storeid}`: Access to a specific storage
706 * `/pool/{poolname}`: Access to resources contained in a specific <<pveum_pools,pool>>
707 * `/access/groups`: Group administration
708 * `/access/realms/{realmid}`: Administrative access to realms
709
710
711 Inheritance
712 ^^^^^^^^^^^
713
714 As mentioned earlier, object paths form a file system like tree, and
715 permissions can be inherited by objects down that tree (the propagate flag is
716 set by default). We use the following inheritance rules:
717
718 * Permissions for individual users always replace group permissions.
719 * Permissions for groups apply when the user is member of that group.
720 * Permissions on deeper levels replace those inherited from an upper level.
721
722 Additionally, privilege separated tokens can never have permissions on any
723 given path that their associated user does not have.
724
725 [[pveum_pools]]
726 Pools
727 ~~~~~
728
729 Pools can be used to group a set of virtual machines and datastores. You can
730 then simply set permissions on pools (`/pool/{poolid}`), which are inherited by
731 all pool members. This is a great way to simplify access control.
732
733
734 Which Permissions Do I Need?
735 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
736
737 The required API permissions are documented for each individual
738 method, and can be found at https://pve.proxmox.com/pve-docs/api-viewer/.
739
740 The permissions are specified as a list, which can be interpreted as a
741 tree of logic and access-check functions:
742
743 `["and", <subtests>...]` and `["or", <subtests>...]`::
744 Each(`and`) or any(`or`) further element in the current list has to be true.
745
746 `["perm", <path>, [ <privileges>... ], <options>...]`::
747 The `path` is a templated parameter (see
748 <<pveum_templated_paths,Objects and Paths>>). All (or, if the `any`
749 option is used, any) of the listed
750 privileges must be allowed on the specified path. If a `require-param`
751 option is specified, then its specified parameter is required even if the
752 API call's schema otherwise lists it as being optional.
753
754 `["userid-group", [ <privileges>... ], <options>...]`::
755 The caller must have any of the listed privileges on `/access/groups`. In
756 addition, there are two possible checks, depending on whether the
757 `groups_param` option is set:
758 +
759 * `groups_param` is set: The API call has a non-optional `groups` parameter
760 and the caller must have any of the listed privileges on all of the listed
761 groups.
762 * `groups_param` is not set: The user passed via the `userid` parameter
763 must exist and be part of a group on which the caller has any of the listed
764 privileges (via the `/access/groups/<group>` path).
765
766 `["userid-param", "self"]`::
767 The value provided for the API call's `userid` parameter must refer to the
768 user performing the action (usually in conjunction with `or`, to allow
769 users to perform an action on themselves, even if they don't have elevated
770 privileges).
771
772 `["userid-param", "Realm.AllocateUser"]`::
773 The user needs `Realm.AllocateUser` access to `/access/realm/<realm>`, with
774 `<realm>` referring to the realm of the user passed via the `userid`
775 parameter. Note that the user does not need to exist in order to be
776 associated with a realm, since user IDs are passed in the form of
777 `<username>@<realm>`.
778
779 `["perm-modify", <path>]`::
780 The `path` is a templated parameter (see
781 <<pveum_templated_paths,Objects and Paths>>). The user needs either the
782 `Permissions.Modify` privilege or,
783 depending on the path, the following privileges as a possible substitute:
784 +
785 * `/storage/...`: additionally requires 'Datastore.Allocate`
786 * `/vms/...`: additionally requires 'VM.Allocate`
787 * `/pool/...`: additionally requires 'Pool.Allocate`
788 +
789 If the path is empty, `Permission.Modify` on `/access` is required.
790
791 Command Line Tool
792 -----------------
793
794 Most users will simply use the GUI to manage users. But there is also
795 a fully featured command line tool called `pveum` (short for ``**P**roxmox
796 **VE** **U**ser **M**anager''). Please note that all Proxmox VE command
797 line tools are wrappers around the API, so you can also access those
798 functions through the REST API.
799
800 Here are some simple usage examples. To show help, type:
801
802 [source,bash]
803 pveum
804
805 or (to show detailed help about a specific command)
806
807 [source,bash]
808 pveum help user add
809
810 Create a new user:
811
812 [source,bash]
813 pveum user add testuser@pve -comment "Just a test"
814
815 Set or change the password (not all realms support this):
816
817 [source,bash]
818 pveum passwd testuser@pve
819
820 Disable a user:
821
822 [source,bash]
823 pveum user modify testuser@pve -enable 0
824
825 Create a new group:
826
827 [source,bash]
828 pveum group add testgroup
829
830 Create a new role:
831
832 [source,bash]
833 pveum role add PVE_Power-only -privs "VM.PowerMgmt VM.Console"
834
835
836 Real World Examples
837 -------------------
838
839
840 Administrator Group
841 ~~~~~~~~~~~~~~~~~~~
842
843 It is possible that an administrator would want to create a group of users with
844 full administrator rights (without using the root account).
845
846 To do this, first define the group:
847
848 [source,bash]
849 pveum group add admin -comment "System Administrators"
850
851 Then assign the role:
852
853 [source,bash]
854 pveum acl modify / -group admin -role Administrator
855
856 Finally, you can add users to the new 'admin' group:
857
858 [source,bash]
859 pveum user modify testuser@pve -group admin
860
861
862 Auditors
863 ~~~~~~~~
864
865 You can give read only access to users by assigning the `PVEAuditor`
866 role to users or groups.
867
868 Example 1: Allow user `joe@pve` to see everything
869
870 [source,bash]
871 pveum acl modify / -user joe@pve -role PVEAuditor
872
873 Example 2: Allow user `joe@pve` to see all virtual machines
874
875 [source,bash]
876 pveum acl modify /vms -user joe@pve -role PVEAuditor
877
878
879 Delegate User Management
880 ~~~~~~~~~~~~~~~~~~~~~~~~
881
882 If you want to delegate user management to user `joe@pve`, you can do
883 that with:
884
885 [source,bash]
886 pveum acl modify /access -user joe@pve -role PVEUserAdmin
887
888 User `joe@pve` can now add and remove users, and change other user attributes,
889 such as passwords. This is a very powerful role, and you most
890 likely want to limit it to selected realms and groups. The following
891 example allows `joe@pve` to modify users within the realm `pve`, if they
892 are members of group `customers`:
893
894 [source,bash]
895 pveum acl modify /access/realm/pve -user joe@pve -role PVEUserAdmin
896 pveum acl modify /access/groups/customers -user joe@pve -role PVEUserAdmin
897
898 NOTE: The user is able to add other users, but only if they are
899 members of the group `customers` and within the realm `pve`.
900
901 Limited API Token for Monitoring
902 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
903
904 Permissions on API tokens are always a subset of those of their corresponding
905 user, meaning that an API token can't be used to carry out a task that the
906 backing user has no permission to do. This section will demonstrate how you can
907 use an API token with separate privileges, to limit the token owner's
908 permissions further.
909
910 Give the user `joe@pve` the role PVEVMAdmin on all VMs:
911
912 [source,bash]
913 pveum acl modify /vms -user joe@pve -role PVEVMAdmin
914
915 Add a new API token with separate privileges, which is only allowed to view VM
916 information (for example, for monitoring purposes):
917
918 [source,bash]
919 pveum user token add joe@pve monitoring -privsep 1
920 pveum acl modify /vms -token 'joe@pve!monitoring' -role PVEAuditor
921
922 Verify the permissions of the user and token:
923
924 [source,bash]
925 pveum user permissions joe@pve
926 pveum user token permissions joe@pve monitoring
927
928 Resource Pools
929 ~~~~~~~~~~~~~~
930
931 An enterprise is usually structured into several smaller departments, and it is
932 common that you want to assign resources and delegate management tasks to each
933 of these. Let's assume that you want to set up a pool for a software development
934 department. First, create a group:
935
936 [source,bash]
937 pveum group add developers -comment "Our software developers"
938
939 Now we create a new user which is a member of that group:
940
941 [source,bash]
942 pveum user add developer1@pve -group developers -password
943
944 NOTE: The "-password" parameter will prompt you for a password
945
946 Then we create a resource pool for our development department to use:
947
948 [source,bash]
949 pveum pool add dev-pool --comment "IT development pool"
950
951 Finally, we can assign permissions to that pool:
952
953 [source,bash]
954 pveum acl modify /pool/dev-pool/ -group developers -role PVEAdmin
955
956 Our software developers can now administer the resources assigned to
957 that pool.
958
959
960 ifdef::manvolnum[]
961 include::pve-copyright.adoc[]
962 endif::manvolnum[]
963