<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Troubleshooting Morpheus VDI Gateway in HPE Morpheus Enterprise Software</title>
    <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/troubleshooting-morpheus-vdi-gateway/m-p/7250394#M3568</link>
    <description />
    <pubDate>Fri, 06 Oct 2023 13:16:03 GMT</pubDate>
    <dc:creator />
    <dc:date>2023-10-06T13:16:03Z</dc:date>
    <item>
      <title>Troubleshooting Morpheus VDI Gateway</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/troubleshooting-morpheus-vdi-gateway/m-p/7250393#M3567</link>
      <description>&lt;H1&gt;&lt;A name="troubleshooting-morpheus-vdi-using-vdi-gateway-1" class="anchor" href="#troubleshooting-morpheus-vdi-using-vdi-gateway-1"&gt;&lt;/A&gt;Troubleshooting Morpheus VDI using VDI Gateway&lt;/H1&gt;
&lt;P&gt;In this post i want to give an overview of the process of opening a VDI console in Morpheus via a VDI Gateway. The diagram below attempts to show the connection sequence. Each step is then discussed in detail with some troubleshooting hints to help track down any potential issues. In the post I have used a Firefox browser with the standard Developer tools. You will also need access to the linux command window on the Morpheus Appliance and VDI Gateway.&lt;/P&gt;
&lt;H2&gt;&lt;A name="connection-sequence-diagram-2" class="anchor" href="#connection-sequence-diagram-2"&gt;&lt;/A&gt;Connection Sequence Diagram&lt;/H2&gt;
&lt;P&gt;&lt;/P&gt;&lt;DIV class="lightbox-wrapper"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="vdiSequence"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/149709iB93A6107872F5827/image-size/large?v=v2&amp;amp;px=2000" role="button" title="80e01b1ecc920453d24ec56b7ff9e9f496e16c4c.jpeg" alt="80e01b1ecc920453d24ec56b7ff9e9f496e16c4c.jpeg" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;
&lt;H2&gt;&lt;A name="narrative-3" class="anchor" href="#narrative-3"&gt;&lt;/A&gt;Narrative&lt;/H2&gt;
&lt;DIV&gt;
&lt;TABLE&gt;
    &lt;TBODY&gt;&lt;TR&gt;
        &lt;TH&gt;Step&lt;/TH&gt;
        &lt;TH&gt;Source&lt;/TH&gt;
        &lt;TH&gt;Target&lt;/TH&gt;
        &lt;TH&gt;Action&lt;/TH&gt;
        &lt;TH&gt;Narrative&lt;/TH&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;1&lt;/TD&gt;
        &lt;TD&gt;Browser&lt;/TD&gt;
        &lt;TD&gt;Appliance&lt;/TD&gt;
        &lt;TD&gt;GET &lt;A href="https://applianceUrl/vdi/allocate/&amp;lt;id&amp;gt;" target="_blank"&gt;https://applianceUrl/vdi/allocate/&amp;lt;id&amp;gt;&lt;/A&gt;;&lt;/TD&gt;
        &lt;TD&gt;From the VDI Persona - click on the vdi Pool to open up the VDI console kicking off the connection sequence
        &lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;2&lt;/TD&gt;
        &lt;TD&gt;Appliance&lt;/TD&gt;
        &lt;TD&gt;Browser&lt;/TD&gt;
        &lt;TD&gt;RESPONSE 200&lt;/TD&gt;
        &lt;TD&gt;Morpheus appliance responds with json string
            &lt;EM&gt;{"success":true,"gatewayUrl":"https://gatewayUrl","allocationId":&amp;lt;allocationId&amp;gt;,"remoteApp":null,"preparing":false}&lt;/EM&gt;
        &lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;3&lt;/TD&gt;
        &lt;TD&gt;Browser&lt;/TD&gt;
        &lt;TD&gt;VDIGateway&lt;/TD&gt;
        &lt;TD&gt;GET &lt;EM&gt;&lt;A href="https://gatewayUrl/vdi/terminal/&amp;lt;allocationId&amp;gt;" target="_blank"&gt;https://gatewayUrl/vdi/terminal/&amp;lt;allocationId&amp;gt;&lt;/A&gt;;&lt;/EM&gt;&lt;/TD&gt;
        &lt;TD&gt;Client Browser connects to VDI Gateway specified in the response from step 2 using the gatewayUrl and allocationId
            contained in the response. &lt;BR /&gt; Worker Log Entry &lt;BR /&gt; INFO c.m.worker.controller.VdiController - Checking Appliance
            URL: &lt;A href="https://applianceUrl" target="_blank"&gt;https://applianceUrl&lt;/A&gt;&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;4.1&lt;/TD&gt;
        &lt;TD&gt;VDIGateway&lt;/TD&gt;
        &lt;TD&gt;Browser&lt;/TD&gt;
        &lt;TD&gt;307 TEMP REDIRECT&lt;/TD&gt;
        &lt;TD&gt;The VDI Gateway responds with a status 307 and specifies the redirect URL &lt;EM&gt;&lt;A href="https://applianceUrl/vdi/terminal/&amp;lt;allocationId&amp;gt;" target="_blank"&gt;https://applianceUrl/vdi/terminal/&amp;lt;allocationId&amp;gt;&lt;/A&gt;;&lt;/EM&gt; in the headers&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;4.2&lt;/TD&gt;
        &lt;TD&gt;Browser&lt;/TD&gt;
        &lt;TD&gt;Appliance&lt;/TD&gt;
        &lt;TD&gt;REDIRECT &lt;A href="https://applianceUrl/vdi/terminal/&amp;lt;allocationId&amp;gt;" target="_blank"&gt;https://applianceUrl/vdi/terminal/&amp;lt;allocationId&amp;gt;&lt;/A&gt;;&lt;/TD&gt;
        &lt;TD&gt;Opens up a new tab in the browser to host the vdi console.&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;5&lt;/TD&gt;
        &lt;TD&gt;Appliance&lt;/TD&gt;
        &lt;TD&gt;Appliance&lt;/TD&gt;
        &lt;TD&gt;create consoleLease&lt;/TD&gt;
        &lt;TD&gt;The appliance creates a consoleLease in the vdi_connection_lease table. The lease has a 10 minute timeout. This action combined with step 4.3 writes a Audit entry in the appliance UI logs &lt;BR /&gt;&lt;BR /&gt;INFO  c.m.AuditLogService - CEF:0|MorpheusData|Morpheus|6.0.6|terminal#showVdi|VDI Console Accessed|src=&amp;lt;clientIpAddress&amp;gt; suid=1 suser=user request=http://applianceUrl/vdi/terminal/&amp;lt;allocationId&amp;gt; requestMethod=GET cs1Label=Object Type cs1=instance cn1=85 cn1Label=Object ID cs2=SP60-L-1095 cs2Label=Object Name cn2=1 cn2Label=Account ID&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;6&lt;/TD&gt;
        &lt;TD&gt;Browser&lt;/TD&gt;
        &lt;TD&gt;VDIGateway&lt;/TD&gt;
        &lt;TD&gt;Open Websocket &lt;BR /&gt; GET wss://gatewayUrl&amp;gt;/remote/socket?leasetoken=&amp;lt;consoleLease&amp;gt;&lt;/TD&gt;
        &lt;TD&gt;Console web page uses the Guacamole object to open a websocket on the VDIGateway. Using the browser tools you can see this happening. Watch for status code 101&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;7&lt;/TD&gt;
        &lt;TD&gt;VDIGateway&lt;/TD&gt;
        &lt;TD&gt;Appliance&lt;/TD&gt;
        &lt;TD&gt;GET &lt;A href="https://applianceUrl/api/worker/consoleInfo/&amp;lt;consoleLease&amp;gt;" target="_blank"&gt;https://applianceUrl/api/worker/consoleInfo/&amp;lt;consoleLease&amp;gt;&lt;/A&gt;;&lt;/TD&gt;
        &lt;TD&gt;VDI Gateway verifies the consolLease specified on the web socket using an api call back to the appliance. The VDIGateway APIKey must be specified on the headers &lt;BR /&gt; Logged on the Appliance
        in the UI logs &lt;BR /&gt; INFO  c.m.v.VdiGatewayService - looking for lease: &amp;lt;consoleLease&amp;gt;&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;8&lt;/TD&gt;
        &lt;TD&gt;Appliance&lt;/TD&gt;
        &lt;TD&gt;VDIGateway&lt;/TD&gt;
        &lt;TD&gt;API response. Encrypted object containing lease &lt;/TD&gt;
        &lt;TD&gt;Lease is verified and contains a encryption key for the tunnel. Logged in the Appliance UI logs &lt;BR /&gt;c.m.v.VdiGatewayService - Lease Found!  &amp;lt;consoleLease&amp;gt;&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
        &lt;TD&gt;9&lt;/TD&gt;
        &lt;TD&gt;VDIGateway/td&amp;gt;
        &lt;/TD&gt;&lt;TD&gt;VDI Instance&lt;/TD&gt;
        &lt;TD&gt;Guacamole connection opened by VDIGateway&lt;/TD&gt;
        &lt;TD&gt;An connection to the instance is opened on the VDIGateway by guacamole. This is then proxied through the encrypted tunnel over the websocket opened in step 6&lt;/TD&gt;
    &lt;/TR&gt;
&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;H2&gt;&lt;A name="troubleshooting-4" class="anchor" href="#troubleshooting-4"&gt;&lt;/A&gt;Troubleshooting&lt;/H2&gt;
&lt;P&gt;Troubleshooting VDI Gateway connection can be tricky. However, the basic requirements below must be met.&lt;/P&gt;
&lt;P&gt;For Steps 1 and 2 the client must be able to reach the Morpheus Appliance on port 443&lt;/P&gt;
&lt;P&gt;For step 3 the client must be able to resolve the url of the VDIGateway defined in /etc/morpheus/morpheus-worker.rb and also reach this host over port 443.&lt;/P&gt;
&lt;P&gt;For step 4.1 and 4.2 The redirect URL is defined in the /etc/morpheus/morpheus-worker.rb file as worker[‘appliance_url’]. This should match the url of the Morpheus appliance as defined in /etc/morpheus/morpheus.rb on the appliance.&lt;/P&gt;
&lt;P&gt;Step 5 as mentioned in the narrative, this step writes an audit entry into the Morpheus Appliance UI logs. The url in the log entry should match the REDIRECT url specified in step 4.1 and 4.2. At this point a connectionLease should also have been created in the vdi_connection_lease database table. The lease has a 10 minute timeout so the connection needs to be established within this time frame.&lt;/P&gt;
&lt;P&gt;For Step 6 use the browser developer tools to verify the websocket upgrade. The http response should be 101 Switching Protocols. On the websocket uri the consoleLease guid is shown as the leaseToken query parameter&lt;/P&gt;
&lt;P&gt;Steps 7 The worker tries to obtain the connectionLease by issuing an api call to the morpheus appliance. This is logged in the Appliance UI logs as detailed in the narrative.&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;INFO  c.m.v.VdiGatewayService - looking for lease: &amp;lt;consoleLease&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You should also see the API call recorded in the nginx logs similar to this&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;&amp;lt;gatewayIp&amp;gt; - - [06/Oct/2023:12:27:12 +0000] "GET /api/worker/consoleInfo/&amp;lt;connectionLease&amp;gt; HTTP/1.1" 200 2678 "-" "Morpheus-Worker"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step 8 contains the response to the API call in step 7 above. This is logged in the Morpheus UI logs.&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;INFO  c.m.v.VdiGatewayService - Lease Found! &amp;lt;consoleLease&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step 9 At this point the websocket should have opened up a secure encrypted Guacamole tunnel. In this final step the VDIGateway connects to the instance over the remote protocol (RDP,ssh or VNC or Hypervisor console). To acheive this the VDIGateway must be able to communicate over the remote protocol required by the VDI Instance. Connection back to the client browser is proxied through the websocket over port 443.&lt;/P&gt;
&lt;P&gt;To see the connection being established you can run this command on the VDIGateway&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;sudo watch -n 1 "ss -4 -t -p -i -a | grep guacd"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;With no connection active the output should look something like&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;Every 1.0s: ss -4 -t -p -i -a | grep guacd

LISTEN   0         5                127.0.0.1:4822              0.0.0.0:*        users:(("guacd",pid=124672,fd=4))
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As the VDI connection is launched this should be recorded in the output&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;Every 1.0s: ss -4 -t -p -i -a | grep guacd

LISTEN      0        5              127.0.0.1:4822            0.0.0.0:*          users:(("guacd",pid=173447,fd=4),("guacd",pid=124672,fd=4))
ESTAB       0        0              127.0.0.1:4822          127.0.0.1:&amp;lt;nnnnn&amp;gt;      users:(("guacd",pid=173447,fd=5),("guacd",pid=124672,fd=5))
ESTAB       0        0            &amp;lt;VDIGatewayIP&amp;gt;:&amp;lt;nnnnn&amp;gt;       &amp;lt;VDIInstanceIP&amp;gt;:ssh        users:(("guacd",pid=173447,fd=10))
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Above you can see the VDI has opened an ssh session to the vdi through the guacd service.&lt;/P&gt;
&lt;P&gt;Hope you find this guide useful for troubleshooting VDI&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 13:12:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/troubleshooting-morpheus-vdi-gateway/m-p/7250393#M3567</guid>
      <dc:creator />
      <dc:date>2023-10-06T13:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Morpheus VDI Gateway</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/troubleshooting-morpheus-vdi-gateway/m-p/7250394#M3568</link>
      <description />
      <pubDate>Fri, 06 Oct 2023 13:16:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/troubleshooting-morpheus-vdi-gateway/m-p/7250394#M3568</guid>
      <dc:creator />
      <dc:date>2023-10-06T13:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Morpheus VDI Gateway</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/troubleshooting-morpheus-vdi-gateway/m-p/7250395#M3569</link>
      <description />
      <pubDate>Fri, 06 Oct 2023 13:24:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/troubleshooting-morpheus-vdi-gateway/m-p/7250395#M3569</guid>
      <dc:creator />
      <dc:date>2023-10-06T13:24:28Z</dc:date>
    </item>
  </channel>
</rss>

