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