From 93ba43071bbe98e197fdd8d0723246970ec10580 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Sun, 29 Nov 2026 00:29:54 +0100 Subject: [PATCH] docs(login): an account that only holds API tokens counts as a login (NetOrk/netork#662) 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. --- README.md | 2 +- napalm_proxmox/web_login.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c34bf2..143da9e 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ device = driver( | `get_pve_firewall` | the PVE firewall as the operator wrote it, read only (NetOrk/netork#2654): the datacenter's `options`, `rules`, security `groups` (name → rules), `ipsets` (name → `[{cidr, nomatch, comment}]`) and `aliases` (name → cidr), this node's `options` and `rules`, and every guest's on this node (`vmid`, `type`, `name`, `options`, `rules`, and `nics`: `[{name, firewall}]` from `netN … firewall=1`). Each rule keeps PVE's fields and its `origin` (`cluster`, `group`, `node`, `guest`). A part PVE refuses is `null`, never empty | | `get_host_firewall` | what the node has loaded, as for any Linux host (napalm-device-types' `HostFirewallMixin`): `nft list ruleset` (PVE 9's proxmox-firewall) or `iptables-save` (pve-firewall), as root over SSH | | `get_hardening` | how the node is hardened (napalm-device-types' `HardeningMixin`, NetOrk/netork#2776): security modules, SELinux and AppArmor, crypto policy, FIPS mode, CPU vulnerabilities, kernel command line, as root over SSH. On the backup server too | -| `get_web_login_auth` | how the web interface lets people log in (napalm-device-types' `WebLoginAuthDict`, NetOrk/netork#662): one source per realm with someone who can log in, by realm name. `password_otp` when the realm's own `tfa` is set or every enabled, unexpired user of it has an enabled second factor (`GET /access/tfa`: TOTP, WebAuthn, U2F, Yubico or recovery keys), `password` when one has none (often `root@pam`), `external` for OpenID, `unknown` for a realm type the driver does not know. Needs `Sys.Audit` or `User.Modify` on `/access/groups` (the `PVEAuditor` role on `/` has it): without it PVE lists only the caller, so the driver raises `PermissionError` instead of judging the datacenter by one account. API tokens skip the second factor by design and are not web logins. On the backup server too | +| `get_web_login_auth` | how the web interface lets people log in (napalm-device-types' `WebLoginAuthDict`, NetOrk/netork#662): one source per realm with someone who can log in, by realm name. `password_otp` when the realm's own `tfa` is set or every enabled, unexpired user of it has an enabled second factor (`GET /access/tfa`: TOTP, WebAuthn, U2F, Yubico or recovery keys), `password` when one has none (often `root@pam`, or an account that only holds API tokens: the API does not say whether a user has a password, and a second factor on it does not affect its tokens), `external` for OpenID, `unknown` for a realm type the driver does not know. Needs `Sys.Audit` or `User.Modify` on `/access/groups` (the `PVEAuditor` role on `/` has it): without it PVE lists only the caller, so the driver raises `PermissionError` instead of judging the datacenter by one account. API tokens skip the second factor by design and are not web logins. On the backup server too | **Not implemented** (raise `NotImplementedError`): `get_bgp_config`, `get_bgp_neighbors`, `get_bgp_neighbors_detail`, diff --git a/napalm_proxmox/web_login.py b/napalm_proxmox/web_login.py index b86a0e8..2f7aef5 100644 --- a/napalm_proxmox/web_login.py +++ b/napalm_proxmox/web_login.py @@ -21,6 +21,10 @@ password alone gets in. So a realm is - ``password_otp`` when every user of the realm who can log in has a second factor; - ``password`` otherwise. ``root@pam`` always exists and is often the one without. +The API says whether a user has a second factor, not whether it has a password, so +an account that only holds API tokens counts as a login too. Giving it a second +factor is the fix: its tokens do not ask for one. + A user who is disabled or whose account has expired cannot log in and does not count; a realm without anyone who can is no source (except OpenID, which can create its users at their first login). API tokens bypass the second factor by