vsphere-automation-sdk-python icon indicating copy to clipboard operation
vsphere-automation-sdk-python copied to clipboard

Failure to Create Session with vSphere Client Using Self-Signed Certificate

Open AradCarmi opened this issue 1 year ago • 6 comments

Describe the bug

The create_vsphere_client function encountered an issue when attempting to establish a session with a self-signed server, despite having the session object configured with verify=False. This failure was triggered by an SSLError, specifically an SSLZeroReturnError (error code 6), indicating that the TLS/SSL connection was closed unexpectedly (EOF) at line 997

Reproduction steps

  1. Create a self-signed server.
  2. Create a Session object with session.verify=false.
  3. create a Python script calling the create_vsphere_client with server, username&password, and session.
  4. Run the script.

Expected behavior

The created session will allow us to connect the VMware Vcenter server even if the server is a self-signed certificate.

Additional context

No response

AradCarmi avatar Apr 11 '24 07:04 AradCarmi

Hi, AFAIK, VC certificates cannot be updated with self signed certificates. Can you tell me what exactly are you trying to do? If you want to verify the SSL cert then why are you setting session.verify=false

bhagatp10 avatar Apr 18 '24 05:04 bhagatp10

Hey @bhagatp10 thank you for the fast response! My VC server is updated with self-signed certificates and it is working fine. I'm trying to retrieve some data using the Client and I want the Client not to verify my certificate when creating the session. As I mentioned before, I tried to send a session object to the Client with the right configuration but from viewing the Client code it ignored this configuration.

AradCarmi avatar Apr 18 '24 08:04 AradCarmi

Hi, Can you show me the snippet of the code you are using?

bhagatp10 avatar Apr 18 '24 13:04 bhagatp10

Sure. image

AradCarmi avatar Apr 18 '24 13:04 AradCarmi

What python version you are using? What are the urllib3 and openssl version?

kunalpmj avatar Apr 24 '24 05:04 kunalpmj

python version 3.10.14 urllib3 version 2.2.1

AradCarmi avatar May 08 '24 13:05 AradCarmi

Kindly refer to following troubleshooting section.

https://github.com/vmware/vsphere-automation-sdk-python/wiki/Troubleshooting#certificate-verification-failed-when-making-api-calls

kunalpmj avatar May 29 '24 06:05 kunalpmj