public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH v2 cluster/access-control/docs/manager/proxmox 0/19] fix #7805: add a datacenter-wide API token policy
@ 2026-11-15 19:40 Thomas Lamprecht
  2026-11-15 19:40 ` [PATCH v2 cluster 1/19] datacenter config: add token-policy option Thomas Lamprecht
                   ` (20 more replies)
  0 siblings, 21 replies; 26+ messages in thread
From: Thomas Lamprecht @ 2026-11-15 19:40 UTC (permalink / raw)
  To: pve-devel

Compliance rules like PCI DSS, SOC 2, or ISO 27001 often require
that credentials have a limited lifetime, but there is no central way
to enforce that for API tokens.

Add an optional token-policy option to datacenter.cfg to require an
expiration date, limit the maximum token lifetime, forbid extending
the expiration date of existing tokens, and require privilege
separation. Two further opt-in settings help tools that manage their
own tokens: one gives tokens created without an expiration date the
maximum lifetime, the other allows extending a token if its secret is
regenerated in the same request.

The policy is only checked when a token is created or updated, and
only for values that actually change, so existing tokens stay valid
even if their lifetime exceeds a newly configured maximum one.
Extending the expiration date within the limit stays possible, unless
the opt-in 'disallow-expiry-extension' switch is set (see [0] for the
rationale).

The web UI exposes these options under Datacenter -> Options and
adjusts the token dialogs to the policy. Changing the policy requires
Sys.Modify on '/', like any other datacenter option; an extra
auth-specific privilege check was skipped for now, for the current
built-in roles it would land in the same roles as Sys.Modify, adding new
built-in roles here is IMO scope creep and this can still be done later
(with some more thoughts on how to handle all these datacenter options).

FWIW, the first manager patch (10/19 overall) fixes a pre-existing issue
w.r.t. only submitting the expiration date when changed, which the
policy checks would expose more often, but it'd also make sense on its
own and could be applied independently already.

The last four patches port the backend part to the common rust stack, so
PBS and PDM can opt in through their AccessControlConfig, and to prepare
moving pve-access-control over to rust later. Only the expiry parts
apply there, tokens in the rust stack always use separate ACLs, i.e. no
sharing with the underlying users there.

Dependencies: access-control needs the cluster patches, manager needs
both, and building manager needs the pve-doc-generator with the new
online-help anchor from the docs patches (or ALLOW_MISSING=1), which is
why the docs patches come before the manager ones; the proxmox patches
are independent. d/control needs the respective versioned dependency
bumps added on applying, and the generated datacenter option reference
in pve-docs needs the usual make update once the cluster side is
packaged.

Changes since v1 (thanks @Shannon for the review):
- rename 'disallow-expiry-changes' to 'disallow-expiry-extension', which
  only rejects removing the expiration date or moving it later
- add the two settings for tools managing their own tokens, suggested by
  Shannon. They are part of this series, not a follow-up, as nodes not
  knowing them would drop the whole policy
- docs: warn to only configure the policy once all nodes are upgraded
- token dialog: follow the server clock, not the browser's
- rebase on current master; smaller changes are noted per patch

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=7805

cluster:

Thomas Lamprecht (3):
  datacenter config: add token-policy option
  datacenter config: token policy: add default-to-max-lifetime setting
  datacenter config: token policy: allow extension on regeneration

 src/PVE/DataCenterConfig.pm   | 69 +++++++++++++++++++++++++++++++++++++++
 src/test/Makefile             |  6 +++-
 src/test/test_token_policy.pl | 75 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 149 insertions(+), 1 deletion(-)

access-control:

Thomas Lamprecht (3):
  fix #7805: api: token: enforce datacenter token policy
  api: token: apply the default lifetime from the token policy
  api: token: allow extending tokens on secret regeneration

 src/PVE/API2/User.pm              |  37 ++++-
 src/PVE/AccessControl.pm          |  80 ++++++++++
 src/test/Makefile                 |   2 +
 src/test/token-policy-api-test.pl | 148 +++++++++++++++++++
 src/test/token-policy-test.pl     | 304 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 568 insertions(+), 3 deletions(-)

docs:

Thomas Lamprecht (3):
  user management: document the API token policy
  user management: document the default-to-max-lifetime setting
  user management: document extending tokens on secret regeneration

 pveum.adoc | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

manager:

Thomas Lamprecht (6):
  ui: token edit: only submit the expiration date when changed
  api: cluster options: return token-policy without Sys.Audit
  ui: dc options: allow editing the API token policy
  ui: token edit: adapt to the datacenter API token policy
  ui: token policy: expose the default-to-max-lifetime setting
  ui: token policy: allow extension on secret regeneration

 PVE/API2/Cluster.pm           |   2 +-
 www/manager6/UIOptions.js     |  23 ++++-
 www/manager6/dc/OptionView.js | 195 ++++++++++++++++++++++++++++++++++++++++++
 www/manager6/dc/TokenEdit.js  | 193 ++++++++++++++++++++++++++++++++++++++++-
 www/manager6/dc/TokenView.js  |  36 ++++----
 5 files changed, 431 insertions(+), 18 deletions(-)

proxmox:

Thomas Lamprecht (4):
  access-control: add API token policy type with expiry checks
  access-control: enforce token policy on token create and update
  access-control: apply a default token lifetime from the policy
  access-control: allow extending tokens on secret regeneration

 proxmox-access-control/src/api/tokens.rs |  24 +++
 proxmox-access-control/src/init.rs       |  14 ++
 proxmox-access-control/src/types.rs      | 309 +++++++++++++++++++++++++++++++
 3 files changed, 347 insertions(+)

-- 
2.47.3




^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2026-11-18  2:19 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 19:40 [PATCH v2 cluster/access-control/docs/manager/proxmox 0/19] fix #7805: add a datacenter-wide API token policy Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 cluster 1/19] datacenter config: add token-policy option Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 cluster 2/19] datacenter config: token policy: add default-to-max-lifetime setting Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 cluster 3/19] datacenter config: token policy: allow extension on regeneration Thomas Lamprecht
2026-11-17 13:30   ` Shannon Sterz
2026-11-15 19:40 ` [PATCH v2 access-control 4/19] fix #7805: api: token: enforce datacenter token policy Thomas Lamprecht
2026-11-17 13:30   ` Shannon Sterz
2026-11-15 19:40 ` [PATCH v2 access-control 5/19] api: token: apply the default lifetime from the " Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 access-control 6/19] api: token: allow extending tokens on secret regeneration Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 docs 7/19] user management: document the API token policy Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 docs 8/19] user management: document the default-to-max-lifetime setting Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 docs 9/19] user management: document extending tokens on secret regeneration Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 manager 10/19] ui: token edit: only submit the expiration date when changed Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 manager 11/19] api: cluster options: return token-policy without Sys.Audit Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 manager 12/19] ui: dc options: allow editing the API token policy Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 manager 13/19] ui: token edit: adapt to the datacenter " Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 manager 14/19] ui: token policy: expose the default-to-max-lifetime setting Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 manager 15/19] ui: token policy: allow extension on secret regeneration Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 proxmox 16/19] access-control: add API token policy type with expiry checks Thomas Lamprecht
2026-11-17 13:29   ` Shannon Sterz
2026-11-15 19:40 ` [PATCH v2 proxmox 17/19] access-control: enforce token policy on token create and update Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 proxmox 18/19] access-control: apply a default token lifetime from the policy Thomas Lamprecht
2026-11-15 19:40 ` [PATCH v2 proxmox 19/19] access-control: allow extending tokens on secret regeneration Thomas Lamprecht
2026-11-17 13:29   ` Shannon Sterz
2026-11-17 13:29 ` [PATCH v2 cluster/access-control/docs/manager/proxmox 0/19] fix #7805: add a datacenter-wide API token policy Shannon Sterz
2026-11-18  2:17 ` applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal