mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
qga: add guest-set-user-password command
Add a new 'guest-set-user-password' command for changing the password of guest OS user accounts. This command is needed to enable OpenStack to support its API for changing the admin password of guests running on KVM/QEMU. It is not practical to provide a command at the QEMU level explicitly targetting administrator account password change only, since different guest OS have different names for the admin account. While UNIX systems use 'root', Windows systems typically use 'Administrator' and even that can be renamed. Higher level apps like OpenStack have the ability to figure out the correct admin account name since they have info that QEMU/libvirt do not. The command accepts either the clear text password string, encoded in base64 to make it 8-bit safe in JSON: $ echo -n "123456" | base64 MTIzNDU2 $ virsh -c qemu:///system qemu-agent-command f21x86_64 \ '{ "execute": "guest-set-user-password", "arguments": { "crypted": false, "username": "root", "password": "MTIzNDU2" } }' {"return":{}} Or a password that has already been run though a crypt(3) like algorithm appropriate for the guest, again then base64 encoded: $ echo -n '$6$n01A2Tau$e...snip...DfMOP7of9AJ1I8q0' | base64 JDYkb...snip...YT2Ey $ virsh -c qemu:///system qemu-agent-command f21x86_64 \ '{ "execute": "guest-set-user-password", "arguments": { "crypted": true, "username": "root", "password": "JDYkb...snip...YT2Ey" } }' NB windows support is desirable, but not implemented in this patch. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
parent
cd2d554127
commit
215a2771a7
3 changed files with 146 additions and 0 deletions
|
@ -446,6 +446,14 @@ int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void qmp_guest_set_user_password(const char *username,
|
||||
const char *password,
|
||||
bool crypted,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
/* add unsupported commands to the blacklist */
|
||||
GList *ga_command_blacklist_init(GList *blacklist)
|
||||
{
|
||||
|
@ -454,6 +462,7 @@ GList *ga_command_blacklist_init(GList *blacklist)
|
|||
"guest-file-write", "guest-file-seek", "guest-file-flush",
|
||||
"guest-suspend-hybrid", "guest-network-get-interfaces",
|
||||
"guest-get-vcpus", "guest-set-vcpus",
|
||||
"guest-set-user-password",
|
||||
"guest-fsfreeze-freeze-list", "guest-get-fsinfo",
|
||||
"guest-fstrim", NULL};
|
||||
char **p = (char **)list_unsupported;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue