feat: get_web_login_auth on the vCenter (0.6.0) #14

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

Part of NetOrk/netork#662 (MFA on the managed systems, NIS2 Art. 21(2)(j)): the vCenter's web interface.

What it adds

  • get_web_login_auth() on vmware_vcenter, in napalm-device-types' WebLoginAuthDict (4.50.0).
    • Each identity provider of identity federation (GET /api/vcenter/identity/providers) is one source, external, the default first. Its kind is its config_tag, lowercased.
    • Each SSO domain the vSphere API names (UserDirectory.domainList) is one source, unknown. Its kind is localos for the appliance's own accounts and sso for the others. Smart card and RSA SecurID are set in SSO's authentication policy, and neither API exposes that policy, so the driver does not guess.
    • An SSO domain that a provider serves is listed once, as the provider. Federation does not switch the local domain off, so the SSO domains stay sources.
  • Privileges (best effort, decided 2026-11-29): the SSO domains need only System.View. A refused domainList raises PermissionError. The provider list needs VcIdentityProviders.Read and VcIdentityProviders.Manage. Manage allows changing the IdP configuration, and the verdict is "not assessed" either way, so the driver does not require it, and the README advises against granting it.
    • A 401/403 on the provider list is not an error. The reading is the SSO domains plus one source, identity federation (not read) (federation, unknown).
    • With both privileges, the providers are named instead.
  • _session.rest_get: a REST session of its own (POST /api/session with the same account, the read, then DELETE). A 401/403 raises PermissionError, which the reader turns into "federation not read"; any other error raises HTTPError (for example 404 before vCenter 7.0 U2).
  • Inventory.sso_domains().
  • The ESXi driver has no reader.
  • Requires napalm-device-types >= 4.50.0. Version 0.6.0.

Tests: 369 passed, coverage 97.58% (floor 97). ruff and mypy (strict) are clean.

Unverified against real hardware: that a real vCenter's domainList names its SSO domains. vcsim leaves the list empty.

Part of NetOrk/netork#662 (MFA on the managed systems, NIS2 Art. 21(2)(j)): the vCenter's web interface. **What it adds** - `get_web_login_auth()` on `vmware_vcenter`, in napalm-device-types' `WebLoginAuthDict` (4.50.0). - Each identity provider of identity federation (`GET /api/vcenter/identity/providers`) is one source, `external`, the default first. Its `kind` is its `config_tag`, lowercased. - Each SSO domain the vSphere API names (`UserDirectory.domainList`) is one source, `unknown`. Its `kind` is `localos` for the appliance's own accounts and `sso` for the others. Smart card and RSA SecurID are set in SSO's authentication policy, and neither API exposes that policy, so the driver does not guess. - An SSO domain that a provider serves is listed once, as the provider. Federation does not switch the local domain off, so the SSO domains stay sources. - **Privileges (best effort, decided 2026-11-29):** the SSO domains need only `System.View`. A refused `domainList` raises `PermissionError`. The provider list needs `VcIdentityProviders.Read` **and** `VcIdentityProviders.Manage`. *Manage* allows changing the IdP configuration, and the verdict is "not assessed" either way, so the driver does not require it, and the README advises against granting it. - A 401/403 on the provider list is not an error. The reading is the SSO domains plus one source, `identity federation (not read)` (`federation`, `unknown`). - With both privileges, the providers are named instead. - `_session.rest_get`: a REST session of its own (`POST /api/session` with the same account, the read, then `DELETE`). A 401/403 raises `PermissionError`, which the reader turns into "federation not read"; any other error raises `HTTPError` (for example 404 before vCenter 7.0 U2). - `Inventory.sso_domains()`. - The ESXi driver has no reader. - Requires napalm-device-types >= 4.50.0. Version 0.6.0. **Tests:** 369 passed, coverage 97.58% (floor 97). ruff and mypy (strict) are clean. **Unverified against real hardware:** that a real vCenter's `domainList` names its SSO domains. vcsim leaves the list empty.
christianmanivong added 2 commits 2026-11-29 19:10:26 +00:00
The vCenter driver reads how people log in to the vSphere Client, in
napalm-device-types' WebLoginAuthDict: each identity provider of identity
federation (GET /api/vcenter/identity/providers) is a source that decides
itself (external), the default first; each SSO domain the vSphere API names
(UserDirectory.domainList) is a source whose second factor cannot be read
(unknown), since smart card and RSA SecurID live in SSO's authentication
policy, which neither API exposes.

Listing the providers needs VcIdentityProviders.Read and .Manage; without
them the vCenter answers 403 and the driver raises PermissionError naming
them. The REST read logs in to /api/session with the same account and logs
out after. The ESXi driver has no reader.
chore(release): 0.6.0
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 15s
driver / lowest (pull_request) Successful in 34s
driver / types (pull_request) Successful in 1m3s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / test (3.13) (pull_request) Successful in 57s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 59s
CI / driver (pull_request) Successful in 1m48s
driver / publish (pull_request) Skipped
cf4d115475
christianmanivong added 1 commit 2026-11-29 21:41:03 +00:00
feat: read the identity providers best effort; a refused list is federation not read (NetOrk/netork#662)
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Failing after 17s
driver / lowest (pull_request) Successful in 34s
driver / test (3.12) (pull_request) Successful in 1m3s
driver / types (pull_request) Successful in 1m5s
driver / test (3.13) (pull_request) Successful in 1m2s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Failing after 1m59s
driver / publish (pull_request) Skipped
6a66c05f5e
Listing the providers needs VcIdentityProviders.Manage besides .Read,
which allows changing the identity provider configuration. The verdict is
not assessed either way, so the driver no longer needs it: a 401/403 on
GET /api/vcenter/identity/providers yields the SSO domains plus one
source, "identity federation (not read)" (federation, unknown), instead
of an error. PermissionError stays for a refused domainList; any other
error of the REST read is raised as before. Part of 0.6.0, not yet tagged.
christianmanivong added 1 commit 2026-11-29 22:38:14 +00:00
refactor: split web_login_sources so it stays within the complexity ratchet (NetOrk/netork#662)
driver / lint (pull_request) Successful in 13s
driver / standard (pull_request) Successful in 14s
driver / lowest (pull_request) Successful in 51s
driver / types (pull_request) Successful in 1m24s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / test (3.12) (pull_request) Successful in 1m26s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m10s
CI / driver (pull_request) Successful in 2m15s
driver / publish (pull_request) Skipped
3275f06615
christianmanivong merged commit 8339e7b548 into main 2026-11-29 22:41:24 +00:00
christianmanivong deleted branch feature/web-login-auth-662 2026-11-29 22:41:25 +00:00
Sign in to join this conversation.