feat(login): get_web_login_auth on PVE and PBS, 0.20.0 (NetOrk/netork#662) #82

Merged
christianmanivong merged 4 commits from feature/web-login-auth-662 into main 2026-11-29 06:22:34 +00:00
Owner

Part of NetOrk/netork#662 (NIS2 Art. 21(2)(j): MFA on the managed systems). The OPNsense step was NetOrk/netork#2827; this is the reader for Proxmox VE and PBS.

What it adds

get_web_login_auth() on both drivers, in napalm-device-types' WebLoginAuthDict (4.50.0):

  • One source per realm with someone who can log in, by realm name (name = realm, kind = realm type).
  • password_otp when the PVE realm's own tfa is set (oath/yubico; PVE then refuses a user without a second factor, "missing required 2nd keys"), or when every enabled, unexpired user of the realm has an enabled second factor in /access/tfa (TOTP, WebAuthn, U2F, Yubico, recovery keys).
  • password when one such user has none -- often root@pam.
  • external for OpenID (its provider decides), unknown for a realm type the driver does not know.
  • Disabled or expired accounts do not count; a password realm without anyone who can log in is no source. API tokens skip TFA by design and are not web logins.

Privilege check

Neither server refuses /access/users or /access/tfa to a login that may not see other users: both answer with the caller alone. A reading from such a token would judge the server by one account and could pass. So the driver checks /access/permissions first and raises PermissionError without:

  • PVE: Sys.Audit or User.Modify on /access/groups (PVEAuditor on / has it),
  • PBS: Sys.Audit on /access/users (Audit on / has it).

Also

  • Version 0.20.0 (0.19.0 is #81), needs napalm-device-types >= 4.50.0.
  • tests/pbs_fake.py: the fake's path argument is positional-only, so a query parameter named path (/access/permissions?path=...) reaches the fake as proxmoxer passes it.
  • Tests: tests/test_web_login.py, answers shaped after the API schema of pve-access-control and proxmox-backup; full suite 797 passed locally, ruff and mypy clean.

Later commits on this branch: 93ba430 (docs: accounts that only hold API tokens), the merge of main (0.19.0, CPU microcode; this release is 0.20.0 on top and needs napalm-device-types 4.53.0), and 7d33e6d (the users by realm in a helper, within the complexity ratchet).

Part of NetOrk/netork#662 (NIS2 Art. 21(2)(j): MFA on the managed systems). The OPNsense step was NetOrk/netork#2827; this is the reader for Proxmox VE and PBS. ## What it adds `get_web_login_auth()` on both drivers, in napalm-device-types' `WebLoginAuthDict` (4.50.0): - One source per realm with someone who can log in, by realm name (`name` = realm, `kind` = realm type). - `password_otp` when the PVE realm's own `tfa` is set (`oath`/`yubico`; PVE then refuses a user without a second factor, "missing required 2nd keys"), or when every enabled, unexpired user of the realm has an enabled second factor in `/access/tfa` (TOTP, WebAuthn, U2F, Yubico, recovery keys). - `password` when one such user has none -- often `root@pam`. - `external` for OpenID (its provider decides), `unknown` for a realm type the driver does not know. - Disabled or expired accounts do not count; a password realm without anyone who can log in is no source. API tokens skip TFA by design and are not web logins. ## Privilege check Neither server refuses `/access/users` or `/access/tfa` to a login that may not see other users: both answer with the caller alone. A reading from such a token would judge the server by one account and could pass. So the driver checks `/access/permissions` first and raises `PermissionError` without: - PVE: `Sys.Audit` or `User.Modify` on `/access/groups` (`PVEAuditor` on `/` has it), - PBS: `Sys.Audit` on `/access/users` (`Audit` on `/` has it). ## Also - Version 0.20.0 (0.19.0 is #81), needs napalm-device-types >= 4.50.0. - `tests/pbs_fake.py`: the fake's `path` argument is positional-only, so a query parameter named `path` (`/access/permissions?path=...`) reaches the fake as proxmoxer passes it. - Tests: `tests/test_web_login.py`, answers shaped after the API schema of pve-access-control and proxmox-backup; full suite 797 passed locally, ruff and mypy clean. **Later commits on this branch:** 93ba430 (docs: accounts that only hold API tokens), the merge of main (0.19.0, CPU microcode; this release is 0.20.0 on top and needs napalm-device-types 4.53.0), and 7d33e6d (the users by realm in a helper, within the complexity ratchet).
christianmanivong added 1 commit 2026-11-28 23:20:11 +00:00
feat(login): get_web_login_auth on PVE and PBS, a source per realm, 0.20.0 (NetOrk/netork#662)
driver / standard (pull_request) Failing after 17s
driver / lint (pull_request) Successful in 18s
driver / types (pull_request) Successful in 56s
driver / lowest (pull_request) Successful in 37s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / test (3.13) (pull_request) Successful in 1m3s
driver / security (pull_request) Successful in 53s
driver / build (pull_request) Successful in 49s
CI / driver (pull_request) Failing after 2m8s
driver / publish (pull_request) Skipped
f554e2cc79
A Proxmox login names its realm, so each realm with someone who can log in
is a source of napalm-device-types' WebLoginAuthDict. It asks for a password
and a one-time code when the PVE realm's own tfa is set, or when every
enabled, unexpired user of it has an enabled second factor (/access/tfa);
a password alone when one user has none; OpenID is external.

Both servers list only the caller in /access/users and /access/tfa when the
login may not see the others, so the driver checks /access/permissions
first: Sys.Audit or User.Modify on /access/groups on PVE, Sys.Audit on
/access/users on PBS. Without it the read raises PermissionError rather
than judge the server by one account.

Needs napalm-device-types 4.50.0.
christianmanivong added 1 commit 2026-11-28 23:29:55 +00:00
docs(login): an account that only holds API tokens counts as a login (NetOrk/netork#662)
driver / lint (pull_request) Successful in 13s
driver / standard (pull_request) Failing after 16s
driver / lowest (pull_request) Successful in 34s
driver / types (pull_request) Successful in 1m0s
driver / test (3.12) (pull_request) Successful in 1m13s
driver / test (3.13) (pull_request) Successful in 1m5s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Failing after 1m48s
driver / publish (pull_request) Skipped
93ba43071b
The API says whether a user has a second factor, not whether it has a
password; a second factor on such an account leaves its tokens alone.
christianmanivong added 1 commit 2026-11-29 06:14:34 +00:00
Merge branch 'main' into feature/web-login-auth-662
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Failing after 18s
driver / lowest (pull_request) Successful in 32s
driver / types (pull_request) Successful in 50s
driver / test (3.12) (pull_request) Successful in 1m7s
driver / test (3.13) (pull_request) Successful in 58s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 1m0s
CI / driver (pull_request) Failing after 1m50s
driver / publish (pull_request) Skipped
4455f71bd7
christianmanivong added 1 commit 2026-11-29 06:20:15 +00:00
refactor(login): the users by realm in a helper of their own, within the complexity ratchet
driver / lint (pull_request) Successful in 12s
driver / standard (pull_request) Successful in 16s
driver / lowest (pull_request) Successful in 35s
driver / types (pull_request) Successful in 54s
driver / test (3.13) (pull_request) Successful in 1m5s
driver / build (pull_request) Successful in 24s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / security (pull_request) Successful in 59s
CI / driver (pull_request) Successful in 1m52s
driver / publish (pull_request) Skipped
7d33e6d48d
christianmanivong merged commit b7e36abcbd into main 2026-11-29 06:22:34 +00:00
christianmanivong deleted branch feature/web-login-auth-662 2026-11-29 06:22:34 +00:00
Sign in to join this conversation.