1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +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:
catborise 2026-11-13 22:26:02 +03:00
parent 275bf11aed
commit cd3edf4dff
11 changed files with 257 additions and 222 deletions

View file

@ -87,9 +87,9 @@ class ConsoleForm(forms.Form):
password = data.get("password", "")
if not password:
self.add_error("password", _("Enter the new password."))
# VNC uses 8 bytes; libvirt refuses a longer password
elif len(password.encode()) > 8:
self.add_error("password", _("A VNC password takes at most 8 bytes."))
# VNC takes 8 bytes, and the browser console sends only ASCII as typed
elif len(password) > 8 or not all(" " <= c <= "~" for c in password):
self.add_error("password", _("A VNC password takes up to 8 letters, digits or symbols, without accents."))
# A console that listens beyond localhost (set by an administrator)
# keeps its password unless an administrator removes it.
if action == "none" and not self.is_superuser and not self.instance.proxy.console_listens_locally():