Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guest Console - vCenter 6.0 #504

Open
fchivite opened this issue Feb 6, 2017 · 6 comments
Open

Guest Console - vCenter 6.0 #504

fchivite opened this issue Feb 6, 2017 · 6 comments

Comments

@fchivite
Copy link

fchivite commented Feb 6, 2017

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

@fchivite
Copy link
Author

fchivite commented Feb 7, 2017

I figured out that this function redirects me to PSC SSO login page... damn!
Is there a way to authenticate through the PSC SSO during the request console process?

Regards,

@borland667
Copy link

I'm very keen to see this working too! Anything we can do to help?

@zhangzhenhao
Copy link

meet same issue.

@enzok
Copy link

enzok commented Feb 28, 2019

Did anyone get this working?

@ElieDeloumeau
Copy link

Any news?

@muslu
Copy link

muslu commented Jan 4, 2024

still waiting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants