From d307b86b0740caa3fb63553fc6996a829c7d4aee Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Wed, 6 Oct 2010 17:34:28 -0700 Subject: [PATCH] Temporarily add a blank system vm for vmware testing, explcitly check the ticket info in console access URL --- .../com/cloud/consoleproxy/ConsoleProxyManagerImpl.java | 7 ++++++- setup/db/templates.sql | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index 82d6f94dece..84e64df0721 100644 --- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -1276,8 +1276,13 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach public AgentControlAnswer onConsoleAccessAuthentication(ConsoleAccessAuthenticationCommand cmd) { long vmId = 0; - String ticket = ConsoleProxyServlet.genAccessTicket(cmd.getHost(), cmd.getPort(), cmd.getSid(), cmd.getVmId()); String ticketInUrl = cmd.getTicket(); + if(ticketInUrl == null) { + s_logger.error("Access ticket could not be found, you could be running an old version of console proxy. vmId: " + cmd.getVmId()); + return new ConsoleAccessAuthenticationAnswer(cmd, false); + } + + String ticket = ConsoleProxyServlet.genAccessTicket(cmd.getHost(), cmd.getPort(), cmd.getSid(), cmd.getVmId()); if(!ticket.startsWith(ticketInUrl)) { s_logger.error("Access ticket expired or has been modified. vmId: " + cmd.getVmId()); return new ConsoleAccessAuthenticationAnswer(cmd, false); diff --git a/setup/db/templates.sql b/setup/db/templates.sql index 03872d4003c..c9e2143ee4d 100644 --- a/setup/db/templates.sql +++ b/setup/db/templates.sql @@ -18,6 +18,8 @@ INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) VALUES (7, 'centos53-x64', 'centos53-x64', 1, now(), 'builtin', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/vmware/CentOS5.3-x86_64.ova.bz2', '', 0, 'centos53-x64', 'OVA', 112, 1, 1, 'VMware'); +INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) + VALUES (8, 'routing_vmware', 'SystemVM Template (VMWare)', 0, now(), 'system', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/vmware/Blank.ova.bz2', '', 0, 'SystemVM Template VMWare', 'OVA', 47, 0, 1, 'VMware'); INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS'); INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Debian');