pyvmomi: How do I disable the SSL cert check? --> connect.SmartConnect fails with SSL: CERTIFICATE_VERIFY_FAILED error -- h
connect.SmartConnect fails with SSL error – how do I disable the SSL cert check?
Run on Python 3.5.2 :: Anaconda 4.1.1 (x86_64)
>>> from pyvim import connect
>>> from pyVmomi import vmidl
>>> from pyVmomi import vim
>>> si = connect.SmartConnect(host=inputs['vcenter_ip'], port=443, user=inputs['vcenter_user'], pwd=inputs['vcenter_password'], service="hosted"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jsmith/anaconda3/lib/python3.5/site-packages/pyvim/connect.py", line 786, in SmartConnect
sslContext)
File "/Users/jsmith/anaconda3/lib/python3.5/site-packages/pyvim/connect.py", line 671, in __FindSupportedVersion
sslContext)
File "/Users/jsmith/anaconda3/lib/python3.5/site-packages/pyvim/connect.py", line 591, in __GetServiceVersionDescription
path + "/vimServiceVersions.xml", sslContext)
File "/Users/jsmith/anaconda3/lib/python3.5/site-packages/pyvim/connect.py", line 557, in __GetElementTree
conn.request("GET", path)
File "/Users/jsmith/anaconda3/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/Users/jsmith/anaconda3/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/Users/jsmith/anaconda3/lib/python3.5/http/client.py", line 1102, in end headers
self._send_output(message_body)
File "/Users/jsmith/anaconda3/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/Users/jsmith/anaconda3/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/Users/jsmith/anaconda3/lib/python3.5/http/client.py", line 1260, in connect
server_hostname=server_hostname)
File "/Users/jsmith/anaconda3/lib/python3.5/ssl.py", line 377, in wrap_socket
_context=self)
File "/Users/jsmith/anaconda3/lib/python3.5/ssl.py", line 752, in __init__
self.do_handshake()
File "/Users/jsmith/anaconda3/lib/python3.5/ssl.py", line 988, in do_handshake
self._sslobj.do_handshake()
File "/Users/jsmith/anaconda3/lib/python3.5/ssl.py", line 633, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)
```)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18
Use SmartConnectNoSSL to bypass SSL check,
Use “requests” package.
Meh, you really should have at least internal CA and valid certs for pyvmomi to use. All instructions thus far seem to be about disabling MITM protection for pyvmomi.
you can also… import ssl context = ssl._create_unverified_context()
si = SmartConnect(host=args.host, user=args.user, pwd=args.password, sslContext=context)
Hi
Please import urllib and disable the sslverify property at start of you code
Cheers
On Oct 4, 2017 7:49 PM, “Andy4081” notifications@github.com wrote:
python getallvms.py -s hostname -u username -p password -S
did the trick for me .