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