mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(console): the console daemons hold to what the console page allowed
The token now names the console type it was made for: novncd accepts only a VNC page's token and socketiod only a serial page's, so a VNC page's token no longer opens the serial console without the VNC password. A VNC session re-checks every 10 s, as the serial one did, that its user may still open the console; a deactivated user or a removed owner loses it. The check (may_still_open) moves to console.tokens for both daemons.
This commit is contained in:
parent
f670ee7333
commit
458074df82
10 changed files with 110 additions and 74 deletions
|
|
@ -61,12 +61,12 @@ class LiveSerialConsoleTestCase(TransactionTestCase):
|
|||
dom = serial_vm(conn, f"{P}serial-{conn_type}")
|
||||
vm = Instance.objects.create(compute=compute, name=dom.name(), uuid=dom.UUIDString())
|
||||
UserInstance.objects.create(user=self.user, instance=vm)
|
||||
return tokens.SIGNER.sign(f"{compute.id}:{vm.uuid}:{self.user.id}"), dom
|
||||
return tokens.sign(compute.id, vm.uuid, self.user.id, "pty"), dom
|
||||
|
||||
def admin_token(self, token):
|
||||
host, uuid, _user = tokens.SIGNER.unsign(token).split(":")
|
||||
host, uuid, _user, _type = tokens.SIGNER.unsign(token).split(":")
|
||||
admin, _ = get_user_model().objects.get_or_create(username="serial-live-admin", is_superuser=True)
|
||||
return tokens.SIGNER.sign(f"{host}:{uuid}:{admin.id}")
|
||||
return tokens.sign(host, uuid, admin.id, "pty")
|
||||
|
||||
def test_the_console_of_a_running_vm_opens_once(self):
|
||||
for args in self.hosts:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue