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