mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 17:06:09 +00:00
fix(instances): a VNC password the browser console can send, kept as set
The console settings accepted any password of at most 8 bytes, so "éééé" was saved, but noVNC derives its key from the characters while QEMU compares the UTF-8 bytes: the browser console could not log in. A new password now takes up to 8 printable ASCII characters, which also keeps control characters out of the definition. The .vv file wrote the password and the VM name as they are; virt-viewer reads it as a GLib key file, so a backslash or a leading space changed the password. Both are escaped as a key file expects. A new or removed password also drops a passwdValidTo set elsewhere: an expired one left the new password unusable.
This commit is contained in:
parent
275bf11aed
commit
cd3edf4dff
11 changed files with 257 additions and 222 deletions
|
|
@ -1706,8 +1706,9 @@ class wvmInstance(wvmConnect):
|
|||
if passwd:
|
||||
graphic.set("passwd", passwd)
|
||||
else:
|
||||
with contextlib.suppress(Exception):
|
||||
graphic.attrib.pop("passwd")
|
||||
graphic.attrib.pop("passwd", None)
|
||||
# an expiry set elsewhere would leave the new password unusable
|
||||
graphic.attrib.pop("passwdValidTo", None)
|
||||
|
||||
newxml = etree.tostring(root).decode()
|
||||
return self._defineXML(newxml)
|
||||
|
|
@ -2521,6 +2522,7 @@ class wvmInstance(wvmConnect):
|
|||
# the clone's console gets a password of its own: one copied from the source would open both
|
||||
for graphics in tree.findall("devices/graphics[@type='vnc']"):
|
||||
graphics.set("passwd", util.randomPasswd(8)) # the length VNC allows
|
||||
graphics.attrib.pop("passwdValidTo", None) # an expired source's would leave it unusable
|
||||
|
||||
nvram = tree.find("os/nvram")
|
||||
if nvram is not None and nvram.get("type", "file") != "file":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue