Skip to content

Run Manager guest exec as the authenticated user - #548

Draft
horner wants to merge 1 commit into
mainfrom
feat/exec-as-authenticated-user
Draft

horner wants to merge 1 commit into
mainfrom
feat/exec-as-authenticated-user

Conversation

@horner

@horner horner commented Dec 6, 2026

Copy link
Copy Markdown
Member

First part of mieweb/cloud#32. The current Manager opens a Proxmox root console and runs the caller’s command as UID 0. This proposal keeps the console transport and existing CLI syntax, and uses the authenticated Manager login as the guest username for every command, including admin and API-key requests.

Behavior

  • Manager uses sudo -n -H -u and verifies the effective guest username and nonzero UID before running the requested program. A missing account, a UID 0 mapping, or a refused switch returns guest_user_unavailable. The caller cannot supply a different username in the request.
  • Guests may resolve the same username to a different numeric UID than Manager. For completed commands, the audit entry records the authenticated Manager UID, guest name, and actual guest UID.
  • Existing commands that depend on root must request elevation explicitly, for example mieweb exec --site 1 --container 42 -- sudo -n apt-get update. The guest’s sudoers policy applies. The supplied base image grants passwordless sudo to members of ldapusers.
  • The root console stays separate from the command’s streams. Manager waits for sudo teardown before releasing the exec lease.

Verification

All 115 Manager v1 API tests and all 30 Linux guest-exec tests passed, including file ownership, timeout cleanup, and connection loss during teardown. A disposable Linux PTY exercised the actual bootstrap and sudo switch from a root shell. The command ran as nobody (UID 65534), had no controlling terminal, preserved literal arguments, and returned separate stderr and exit status 23. Missing-account and missing-sudo checks returned the expected errors.

The live smoke test now checks the caller’s guest username and UID. Running it against a deployed Manager and Proxmox guest is still pending. Cross-provider instance ID and name resolution remains open in mieweb/cloud#32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant