vmware / vmware/pyvmomi

Guest Console - vCenter 6.0

Open
#504 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

question VMware Staff Assist Needed
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Hi community,

I use to have a HTML 5 Console access working fine with vCenter 5.1, and fine means the URL generated grants direct access to VM console without prompting user for credentials.

Now I'm trying to use the same approach to access vCenter 6.x guests console and everything works fine, but it always redirect me to SAML2/SSO login page.
Providing username and password manually will redirect the request to the VM Console but I would like to have this working without asking for user credentials.

Can anyone help me with this? any hint?

The generated URL is:

https://:9443/vsphere-client/webconsole.html?
vmId=<vm_id>
&vmName=<vm_name>
&serverGuid=<server_GUID>
&host=<vCenter_fqdn>:443
&sessionTicket=<si.AcquireCloneTicket()>
&thumbprint=<OpenSSL.crypto.load_certificate => digest('sha1')>

My Code:

import OpenSSL

ssl._create_default_https_context = ssl._create_unverified_context
service_instance = connect.SmartConnect(host=vcenter, user=username, pwd=password, port=443)

atexit.register(connect.Disconnect, service_instance)
search_index = service_instance.content.searchIndex
serverGuid = service_instance.content.about.instanceUuid

vm = search_index.FindByUuid(None, vm_uuid, True, True)
content = service_instance.RetrieveContent()
vcenter_data = content.setting
vm_moid = vm._moId
vcenter_settings = vcenter_data.setting
console_port = '9443'

for item in vcenter_settings:
	key = getattr(item, 'key')
	if key == 'VirtualCenter.FQDN':
		vcenter_fqdn = getattr(item, 'value')

session_manager = content.sessionManager
session = session_manager.AcquireCloneTicket()
vc_cert = ssl.get_server_certificate((vcenter, 443))
vc_pem = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, vc_cert)
vc_fingerprint = vc_pem.digest('sha1')

return "https://" + vcenter + ":" + console_port + "/vsphere-client/webconsole.html?vmId=" + str(vm_moid) + "&vmName=" + vm.name + "&serverGuid=" + serverGuid + "&host=" + vcenter_fqdn + ":443&sessionTicket=" + session + "&thumbprint=" + vc_fingerprint

...

Versions

pyvmomi v6.5
Python v2.7.5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python script's calls to SmartConnect, AcquireCloneTicket, and the generated /vsphere-client/webconsole.html URL, using the stated pyvmomi 6.5 and vCenter 6.x versions. Determine whether a clone ticket is expected to bypass SAML2/SSO for the guest console; completion would require a confirmed resolution or documented limitation, since no file or test is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.