project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] PegaProx is crashing Proxmoxmaagement after passwordchange of root user

Open surreal70 opened this issue 6 months ago β€’ 8 comments

Hey there! πŸ‘‹ Thanks for taking the time to report this bug β€” we appreciate it!

Please keep in mind: PegaProx is developed and maintained entirely by volunteers in our free time. We do our best, but we can't work magic πŸͺ„ β€” please be patient, we'll get to your issue as soon as we can.

Want to help keep PegaProx alive?

  • ⭐ Star the project β€” it's free and helps a lot!
  • πŸ’– Become a Sponsor β€” helps us dedicate more time to development
  • 🀝 Contributing code or docs is always welcome too!

Describe the bug

The root password on all nodes on a proxmox cluster has been changed. In Pegaprox two approaches were maid to address this: a) reconfigure the cluster (pegaprox contxt option for the respective cluster and b) remove the cluster from pegaprox and reatach it.

After some debugging the following behavior has been observed: rebooting the clusternodes, login via the proxmox web-amin-interface...works doing some actions on pegraprox site against the same cluster leads to a non responding cluster admin-interface. from this point on, the node pegaprox used for that purpose (and subsequent all failovernodes as seen from pegaprox) failed to respond. From that point onward, the cluster is no longer acessible via the web-admin-inerface, neither from proxmox webui itselfe nor from pegraprox.

this is consistent even after cleaning the browser cache, using another browser or even trying to access the web-ui from a machine the definite where never connected to the proxmox cluster.

The only way to get the webui on proxmox working again was to disable pegaprox and reboot all clusternodes.

Steps to Reproduce

  1. change password for root user to one at least 16 characters long
  2. reboot all clusternodes, to get this properly established
  3. access a rebooted cluster node via pmx webui, check if it works..it should
  4. access the cluster via pegaprox, in my case i wanted to check all node for outstanding updates
  5. after that the webui access to your cluster dies (had this accross two clusters)

Expected behavior

no such impact on the hypervisornodes initiated by pegaprox

Environment

  • PegaProx Version: Beta 0.9.10.3
  • Installation Method: shell
  • OS: various
  • Browser: various
  • Behind Reverse Proxy? no
  • UI? both

Logs


Screenshots

Checklist

  • [yes ] I have searched existing issues to make sure this is not a duplicate
  • [yes ] I am using the latest version of PegaProx

surreal70 avatar May 21 '26 16:05 surreal70

Hey @surreal70 β€” confirmed as a real PegaProx bug, not anything wrong on your side.

What's happening

When the PVE root password changes, PegaProx still holds the old one across several background workers (scheduler, metrics, alerts, broadcast). Every poll cycle, each worker tries to log in against /access/ticket with the stale credentials. With 4 nodes per cluster, our login path was iterating to every fallback host on each cycle β€” so a single poll could fire 4 failed /access/ticket requests, four times a minute. PVE's pveproxy has built-in brute-force protection; once your IP crosses its threshold, it stops processing new ticket requests for several minutes. The legit Proxmox web UI hits the same /access/ticket endpoint, so once we lock pveproxy out, your own browser can't authenticate either. Restarting a node restarts pveproxy cleanly β€” which is why a reboot was the only way out.

Yes, the Reconfigure cluster path should propagate new credentials, but it had a gap: in-flight worker threads kept using the original credentials object until they finished their current cycle, and we had zero rate-limiting on our login retries either way.

Fixed on the Testing branch (commit e1366b3)

Auth circuit breaker per cluster manager:

  1. Three consecutive 401s β†’ backoff window (60 s β†’ 5 min β†’ 30 min). While in backoff we don't touch the network at all; connect_to_proxmox() returns immediately with a clear error.
  2. On 401 from the primary host we no longer iterate to fallback hosts (same creds β†’ same outcome). One failed ticket request per cycle max.
  3. REST calls (_api_get/_post/_put) detect 401 too, invalidate the cached ticket, and feed the same counter β€” so a working ticket that gets revoked mid-session also trips the breaker.
  4. Reconfigure cluster now seals the old manager when it's swapped out, so any straggler in-flight task can't trigger one last login with the old creds.

Backoff cascade verified end-to-end against a real PVE cluster:

attempts 1–2  β†’ 401, no block yet
attempt 3     β†’ 401 + 60 s block engaged
attempt 4     β†’ bailed in 0.000 s, never touched the network

Workaround until the fix lands:

  • Stop PegaProx β†’ restart pveproxy on all nodes (systemctl restart pveproxy) β†’ start PegaProx with the corrected credentials, or
  • Use API token auth instead (user@pam!tokenid). Tokens go through /access/permissions not /access/ticket, so a wrong token doesn't count against pveproxy's brute-force counter the same way.

Heads-up on PVE 9.2

PegaProx does not officially support PVE 9.2 yet. Proxmox shipped significant API changes in 9.2 (custom CPU models endpoint, HA CRS schema renamed to percent, QMP block-job-complete β†’ job-complete, a handful of permission shifts). We're working through compatibility right now β€” the QMP rename and the CRS handling are already on Testing, the rest is in flight. If you're on 9.1.x you're fine; if you're considering 9.2, please hold off until the next PegaProx release.

β€” Marcus

mkellermann97 avatar May 21 '26 16:05 mkellermann97

OK, tnx. However I ve a followup: IMGO Pegaprox is creating an API token and (observing pvaproxy access.log) it uses the token for access...are the still calls beside that using the "normal" login? Do I need to delete "old" API tokens (I guess every time I delete and then add a cluster it seems to create a new token.

Regarding your hint about 9.2...unfortunately i already updated the two problematic clusters...so i am somewhat limited on testing and giving feedback regarding this top ;), for now I remove the affected clusters from pegaprox until 9.2 is supported...

surreal70 avatar May 22 '26 05:05 surreal70

Hey @surreal70 β€” three answers.

1. Mix of token vs password login. Mostly the API token now, with a couple of holdouts:

  • REST API calls (cluster polling, VM lifecycle, storage queries, etc.) all go through the auto-created API token. That's why you see token-auth in pveproxy access.log β€” it's the bulk of the traffic.
  • VNC / SPICE console tickets still need to come from /access/ticket because the PVE web socket endpoints accept the PVE auth cookie, not an API token (PVE limitation, not ours). So when someone opens a VM console in PegaProx, we fetch a fresh ticket via password / TFA-cookie. That's why you occasionally still see ticket logins.
  • SSH into the node (Shell, SMBIOS auto-config deploy, the v2p migration tooling) uses either the configured SSH key or the cluster password directly β€” it doesn't go through pveproxy at all. So pveproxy access.log won't show those.

So no, the password is not being used in any kind of polling loop. If you stop opening consoles, the ticket flow goes quiet.

2. Old API tokens accumulating. Yes, that can happen. The cluster-delete flow does revoke the token before removing the cluster (api/clusters.py:394) β€” but if a cluster was wiped some other way (DB drop, manual config edit, abandoned setup), the auto-created token survives on PVE. Naming convention is pegaprox_<6 digits> so you can identify them under Datacenter β†’ Permissions β†’ API Tokens in the PVE UI and clean them up. We don't have a "scan for orphan PegaProx tokens" feature yet β€” could be worth a follow-up ticket if it's a recurring nuisance.

3. Re: 9.2. Understood, no pressure. We've now got the bulk of 9.2 compatibility on our Testing branch β€” QEMU 11 QMP rename, HA-resources changes, SDN path corrections, plus we verified everything against a real 9.2.2 host instead of just the release notes (which turned out to have a few wrong claims about the schema). Next release will officially support 9.2.

β€” Marcus

mkellermann97 avatar May 22 '26 08:05 mkellermann97

OK, took me a while: Have a 9.1 and 9.2 testenvirionment available...so if there is someting to test.. let me know

surreal70 avatar May 24 '26 18:05 surreal70

Thanks for the testing offer β€” taking you up on it.

Two things shipped on Testing that should unblock you:

  • Auth circuit-breaker (e1366b3) β€” the core fix for this ticket. After three /access/ticket failures we lock the cluster out of further login attempts for a growing backoff window (8s β†’ 32s β†’ 2min) instead of hammering pveproxy. Stale-cred scenarios can no longer brute-force-DoS a PVE node back into the corner you were in.
  • PVE 9.2 surface coverage (7088b7a + a follow-up a98b5c0 after live verification against a real 9.2.2 host) β€” HA / SDN / storage / access / LXC / OIDC endpoints are all wired through. The 9.2-only quirks I had to revert (cpu.reported-model, CRS scheduling-mode removal) are in too.

If you can spin up your 9.1 + 9.2 test envs against a Testing build and re-add a cluster, the most useful smoke-tests would be: (1) a deliberate root-password change followed by a Reconfigure β€” workers should pick up the new creds without locking pveproxy, and (2) a quick scroll through the new HA / SDN / Access tabs on the 9.2 side to confirm nothing 500s. Bundle from each side would seal it.

Testing build via local docker build from the Testing branch, since CI only publishes :latest from main β€” full instructions are over in #413 if you want the copy-paste.

opencollective.com/pegaprox if PegaProx earns the test-env hours back.

β€” MK

mkellermann97 avatar May 29 '26 10:05 mkellermann97

@surreal70 β€” v0.9.12 is out with both layers shipped: the per-node circuit breaker that was on Testing when we last spoke, plus the auth-only breaker that closes the slow-DoS path when root-password rotation kicks off retry storms against pveproxy. Both ride together on ghcr.io/pegaprox/pegaprox:v0.9.12 and through the in-app updater.

Closing this one against the released fix. If the cluster connection still won't re-arm cleanly after a root password swap on v0.9.12+, reopen and we'll dig back in with the support bundle.

If PegaProx has earned a beer this month, opencollective.com/pegaprox keeps the volunteer hours flowing.

β€” Marcus

mkellermann97 avatar Jun 01 '26 14:06 mkellermann97

The scenario is as follows: 3 hosts in a cluster, but each host has a different root password. Have run into some issues which seems to be related to ssh login, which is what PegaProx seems to use sync iso's, etc across all hosts, as well as on the Harden PVE Node to apply hardening controls. Host 1 applies fine, as it's IP was initially used to add the cluster to PegaProx. Is there other way to make this work, without changing the root passwords of hosts 2 and 3 to match host 1?

blackshocks avatar Jun 07 '26 11:06 blackshocks

@blackshocks β€” short version: per-node different root passwords aren't something PegaProx supports. It stores one credential per cluster and reuses it for every SSH job (ISO sync, node hardening, host shell, fencing…), so node 2/3 fail the moment their root password diverges from the one the cluster was added with. Making that per-node would mean reworking the whole SSH credential layer β€” not a road we're going down.

Clean way out without touching any passwords: add/edit the cluster in PegaProx with an SSH key instead of a password. PegaProx tries the key first on all its SSH jobs and falls back to the password only if there's no key β€” and a PVE cluster already shares root's SSH across its nodes (cluster join distributes the keys), so one key authenticates on all three regardless of their individual root passwords. Drop the private key in the cluster's SSH-key field and you're sorted.

opencollective.com/pegaprox if PegaProx is earning its keep. β€” Marcus

mkellermann97 avatar Jun 07 '26 14:06 mkellermann97