cloud-guest-tool: add set-password command via the Qemu Guest Agent - #14080
Open
wido wants to merge 1 commit into
Open
cloud-guest-tool: add set-password command via the Qemu Guest Agent#14080wido wants to merge 1 commit into
wido wants to merge 1 commit into
Conversation
Add a set-password command to cloud-guest-tool that resets the password of a user inside a KVM Instance through the Qemu Guest Agent (guest-set-user-password), with no password server or reset script needed inside the guest. The password is passed base64-encoded as QGA requires. It can be given with --password, or - preferred, since arguments are visible in the process list - read from stdin: piped input is read as a single line, and an interactive terminal gets a no-echo getpass prompt. --username selects the user (default root) and --crypted marks the value as an already-hashed crypt(3) string, which QGA applies verbatim. agent_command() learns an optional arguments parameter for this, the first QGA command the tool sends with a payload; the existing info, ping and fstrim commands are unaffected. Claude-Session: https://claude.ai/code/session_01LkswKyuC2a58YCHFTEPnay
Contributor
Author
Thanks. Fairly simple fix for a script which is not in any true code path. Useful for debugging. In the future we can also think that the "reset password" function of CloudStack does this live on the running VM if the VM supports it on KVM. Should be easy fix. I might open a PR for this as well. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14080 +/- ##
============================================
+ Coverage 3.53% 19.78% +16.24%
- Complexity 0 19992 +19992
============================================
Files 487 6371 +5884
Lines 41865 575907 +534042
Branches 7913 70496 +62583
============================================
+ Hits 1479 113928 +112449
- Misses 40171 449548 +409377
- Partials 215 12431 +12216
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
This PR adds a
set-passwordcommand tocloud-guest-tool(the KVM host-side helper that talks to Instances through the Qemu Guest Agent via libvirt).It resets the password of a user inside a running Instance using QGA's
guest-set-user-passwordcommand — no password server reachable from the guest and no reset script inside the template required, only a running qemu-guest-agent.Usage:
The password is base64-encoded as the QGA protocol requires.
agent_command()gained an optionalargumentsparameter for this — the first QGA command the tool sends with a payload; the existinginfo,pingandfstrimcommands are unchanged.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
How Has This Been Tested?
root@hv-138-d03-21:~# cloudstack-guest-tool --username root --password cloudstack --command set-password i-2-30-VM {"result": true} root@hv-138-d03-21:~#I was now able to login with root/cloudstack into this VM via the console.