diff --git a/proxstar/__init__.py b/proxstar/__init__.py index 88f08f8..a7a4e03 100644 --- a/proxstar/__init__.py +++ b/proxstar/__init__.py @@ -194,12 +194,16 @@ def vm_console(vmid): rtp = 'rtp' in session['userinfo']['groups'] proxmox = connect_proxmox() if rtp or int(vmid) in get_user_allowed_vms(proxmox, db, user): - start_vm_vnc(proxmox, vmid) port = str(5900 + int(vmid)) token = add_vnc_target(port) node = "{}.csh.rit.edu".format(get_vm_node(proxmox, vmid)) - tunnel = start_ssh_tunnel(node, port) + print("Creating SSH tunnel to {} for VM {}.".format(node, vmid)) + try: + tunnel = start_ssh_tunnel(node, port) + except: + print('SSH tunnel already exists.') ssh_tunnels.append(tunnel) + start_vm_vnc(proxmox, vmid) return token, 200 else: return '', 403 diff --git a/proxstar/static/js/script.js b/proxstar/static/js/script.js index eed7f4f..aca8c1a 100644 --- a/proxstar/static/js/script.js +++ b/proxstar/static/js/script.js @@ -812,7 +812,7 @@ $("#console-vm").click(function(){ }).then((response) => { return response.text() }).then((token) => { - window.location = `/static/noVNC/vnc.html?autoconnect=true&?encrypt=true&?host=proxstar.csh.rit.edu&?port=8081&?path=path?token=${token}`; + window.location = `/static/noVNC/vnc.html?autoconnect=true&?encrypt=true&?host=proxstar-vnc.csh.rit.edu&?port=443&?path=path?token=${token}`; }).catch(err => { if (err) { swal("Uh oh...", `Unable to start console for ${vmname}. Please try again later.`, "error");