Fix LXC password reset (501 on nonexistent lxc/exec endpoint) - #33
Merged
Conversation
Resetting an LXC root password called POST /nodes/{node}/lxc/{vmid}/exec,
which Proxmox does not implement (LXC has no REST exec, unlike QEMU's guest
agent), so it returned 501 Not Implemented.
Run 'pct exec <vmid> -- chpasswd' on the node over the existing SSH / node-Shell
channels instead, feeding root:<password> on stdin so the secret never appears
on the command line. Requires ProxUI SSH access to the node or a root@pam
connection; the container must be running.
The SSH tier connected to the configured API endpoint for every node (connection_metadata maps discovered nodes to that endpoint), so resetting a container on a non-endpoint node ran pct exec on the wrong node: 'Configuration file nodes/<endpoint>/lxc/<vmid>.conf does not exist'. Resolve the owning node's real address via cluster status and target it for the SSH tier (new host override on the SSH helpers). The termproxy tier already reaches the right node, since /nodes/<node>/termproxy is proxied there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a
501 Not Implementedwhen resetting an LXC container's root password.The handler called
POST /nodes/{node}/lxc/{vmid}/exec, which Proxmox does not implement — LXC has no REST exec endpoint (unlike QEMU's guest-agentagent/exec);pct execis CLI-only.Fix
Run
pct exec <vmid> -- chpasswdon the node over the same channels ProxUI already uses for snippet writes, feedingroot:<password>on stdin so the secret never appears in the process list or shell history:_ssh_run_rootgained an optionalstdin_data; a new_reset_lxc_root_passwordhelper does the tiering; the route returns a clear, actionable error if no channel is usable.Requirements / behavior
Testing
blackclean. Livepct execpath should be exercised against a running container on deploy.