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