1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 20:26:48 +00:00

feat(instances): a VM's access in one strip, its console password kept to its rule

The Access tab hid the console, the root password, the SSH key and the
remote viewer behind four sub-tabs. The owner chose a compact layout
from three rendered options: the state, a strip with the console and
the remote viewer, then two rows for root's password and key, each
saying why it waits when it does.

Codex reviewed access end to end; these are fixed:

- console.vv carries the console password only for users with the
  passwordless console permission, as the console page passes it; it
  gave it to every user who may open the console.
- The root password field is a labelled password input, not plain text
  with a 24-character limit.
- Without a saved public key the key row is disabled and points to the
  profile, instead of offering "None".
- A paused VM's console opens, as the console view allows.
- The remote viewer address and console.vv show only for a VNC or SPICE
  console that listens beyond the host's loopback; a viewer on the
  user's computer cannot reach the others, and a serial console gave a
  pty://…:None address.
This commit is contained in:
catborise 2026-10-30 20:39:40 +03:00
parent efb77dd866
commit 60f12cefa1
6 changed files with 152 additions and 115 deletions

View file

@ -265,6 +265,10 @@ def _instance_page(request, pk, instance, compute):
can_open_console = utils.can_open_console(request.user, instance)
can_power = request.user.is_superuser or userinstance is not None
power_actions = allowed_actions(request.user, instance, instance.status)
# a remote viewer on the user's computer reaches a VNC or SPICE console that listens beyond the host's loopback
vdi_reachable = instance.console_type in ("vnc", "spice") and not util.is_loopback(instance.console_listener_address)
# root's password and keys change in a shut-off VM's disk (gstfsd on the host), or through a running VM's agent
guest_access_ready = instance.status == 5 or (instance.status == 1 and instance.guest_agent_ready)
# get_instance(perm_type="delete"): a template only for superusers and staff owners
can_delete = request.user.is_superuser or bool(
userinstance and userinstance.is_delete and (request.user.is_staff or not instance.is_template)
@ -2225,7 +2229,9 @@ def getvvfile(request, pk):
response.writelines(f"host={proxy.host if listen == '0.0.0.0' else listen}\n")
response.writelines(f"port={proxy.get_console_port()}\n")
response.writelines(f"title={proxy.instance.name()}\n")
response.writelines(f"password={proxy.get_console_passwd() or ''}\n")
# as the console page: without the permission the viewer asks for the password
if request.user.has_perm("instances.passwordless_console"):
response.writelines(f"password={proxy.get_console_passwd() or ''}\n")
response.writelines("enable-usbredir=1\n")
response.writelines("disable-effects=all\n")
response.writelines("secure-attention=ctrl+alt+ins\n")