← Pablo Murad

Note XVI

Proxmox VE logs in through OpenID Connect just fine, and Pocket ID, with LDAP behind it, works as the provider.1 The catch shows up later. Even with the Administrator role on /, an OIDC user still can't do a few things, because the check is written straight into the code as $user ne 'root@pam':

  • the Upgrade button in Node, Updates;
  • the node Shell without a password (everyone else gets a /bin/login prompt);
  • some container options, like Features and bind mounts, and resetting another user's password.

That's bug 2582, open since 2020.2 So I patched my way around it.

The realm #

In Pocket ID: an OIDC client with the callback pointing at the Proxmox web interface, and access limited to the admins group. In Proxmox:

$ pveum realm add pocketid --type openid --issuer-url https://<your-pocket-id> --client-id <client-id> --client-key <client-secret> --username-claim preferred_username --autocreate 1 --scopes "email profile groups" --groups-claim groups --groups-overwrite 1 --groups-autocreate 0 --default 1
$ pveum group add admins-pocketid
$ pveum acl modify / --groups admins-pocketid --roles Administrator
Source
$ pveum realm add pocketid --type openid --issuer-url https://<your-pocket-id> --client-id <client-id> --client-key <client-secret> --username-claim preferred_username --autocreate 1 --scopes "email profile groups" --groups-claim groups --groups-overwrite 1 --groups-autocreate 0 --default 1
$ pveum group add admins-pocketid
$ pveum acl modify / --groups admins-pocketid --roles Administrator

Four details:

  • openid stays out of --scopes. Proxmox adds it by itself, and repeating it breaks the login.
  • The group name carries the realm. The provider's admins group becomes admins-pocketid in Proxmox.
  • With --groups-autocreate 0, only groups that already exist come in. That's the filter: the other LDAP groups never show up in Proxmox.
  • With --groups-overwrite 1, membership is checked on every login. Whoever leaves the group in LDAP loses access on the next one.

The user itself (someone@pocketid) gets created on the first login.

Only Pocket ID at the door #

The pam and pve realms ship with Proxmox and can't be removed, so I did two things.

First, root@pam is blocked on the web for real:

$ pveum user modify root@pam --enable 0
Source
$ pveum user modify root@pam --enable 0

A root login through the web or the API now gets a 401, "user is disabled". The command line (qm, pct, pvesh), SSH, the console and scheduled jobs keep working, because the enabled check only lives in the login and ticket path. For an emergency, the same command with --enable 1 over SSH brings it back. One catch: API tokens that belong to root@pam stop working too, and Proxmox Datacenter Manager creates one of those.

Second, the login window. The realm combo in PVE.window.LoginWindow (in pvemanagerlib.js) takes a storeFilter, so one line leaves Pocket ID as the only choice:

storeFilter: (rec) => rec.data.realm === 'pocketid',

The patch #

In /usr/share/perl5/PVE/API2/Nodes.pm, inside the PVE::API2::Nodes::Nodeinfo package, a small function decides who counts as a superuser:

The pocketid_superuser function in Perl, shown in a dark code window titled Nodes.pm over a purple gradient. It returns 1 for root@pam, 0 for undefined users and API tokens, 0 for disabled users, and otherwise checks membership in the admins-pocketid group.
The whole rule: root@pam, or an enabled member of admins-pocketid. API tokens never.

Then three checks switch to it:

  • in get_shell_command, if ($user eq 'root@pam') becomes if (pocketid_superuser($user)). That's what unlocks pveupgrade --shell and login -f root;
  • in vncshell and spiceshell, the two checks of the form cmd ne 'login' && $user ne 'root@pam' use !pocketid_superuser($user) instead.

And on the interface, the Upgrade button:

disabled: Proxmox.UserName !== 'root@pam' && !Proxmox.UserName.endsWith('@pocketid'),

The frontend only unlocks the button. The backend is the one that decides, by the group. Then:

$ systemctl reload-or-restart pvedaemon pveproxy
Source
$ systemctl reload-or-restart pvedaemon pveproxy

Surviving updates #

pve-manager overwrites these files on every update, so two idempotent scripts put the patches back:

  • each one looks for a marker in the file and does nothing if the patch is already there;
  • the backend one runs perl -c on the patched copy and only swaps the original if the syntax passes;
  • if the Proxmox code changed and the pattern isn't found, the script says so and touches nothing.

An apt hook calls both after every dpkg run:

// /etc/apt/apt.conf.d/99-pve-pocketid
DPkg::Post-Invoke { "/usr/local/sbin/pve-login-so-pocketid || true; /usr/local/sbin/pve-pocketid-superuser || true"; };

To undo it all: apt reinstall pve-manager, then delete the scripts and the hook.

There's a ready-made alternative. PVE-mods has an oidc_console_access module that does the same group-based unlock. I went with my own patch because it's a few lines, all of them known, without bringing other mods into Proxmox.

Whoever is in that group becomes root on the host, so the real lock is now the Pocket ID login, with a passkey. API tokens and users outside the group keep the original rule.

Notes

  1. Pocket ID is a small, self-hosted OIDC provider built around passkeys, so there's no password to steal in the first place. ↩

  2. A "Super-Admin" role, equivalent to root@pam, was proposed as a patch series on the pve-devel list in 2022 and never merged. In July 2026 the team said on the forum that these restrictions are being removed bit by bit, with no date. ↩