Skip to content

VMWare SSL check doesn't work for pyVmomi 6.0 #29537

Closed

Description

@rallytime

pyVmomi 6.0 is now available in PyPi. The check that we're doing in salt.utils.vmware.get_service_instance to handle SSL errors works very well for pyVmomi version 5.5.x, but pyVmomi 6.0 does not enter the if block where we're handling SSL errors.

We need to amend this function so that SSL errors are handled both for pyVmomi 5.5.x and pyVmomi 6.0.

The error I get on 6.0 is:

[INFO    ] Starting new HTTPS connection (1): <redacted>
[WARNING ] /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:100: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

[DEBUG   ] [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
[INFO    ] Starting new HTTPS connection (1): <redacted>
[WARNING ] /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:100: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

[DEBUG   ] [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
[WARNING ] Stopping the Salt Proxy Minion
[ERROR   ] Cannot complete login due to an incorrect user name or password.
[INFO    ] The proxy minion is shut down

Versions report:

# salt --versions
Salt Version:
           Salt: 2015.8.3-29-g55589f8

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: Not Installed
           Mako: 0.9.1
         PyYAML: 3.10
          PyZMQ: 14.4.0
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.3.0
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: 0.8.2
        timelib: Not Installed

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-66-generic
         system: Ubuntu 14.04 trusty

Activity

  1. added
    bug
    severity-medium
    P1
    RIoT
    on Dec 8, 2015
  2. added this to the Approved milestone on Dec 8, 2015
  3. rallytime commented on Dec 9, 2015

    @rallytime
    ContributorAuthor

    @nmadhok You might be interested in this one. I can take a look in a couple of days, but thought you'd like to be aware of it. I don't think pyVmomi 6.0 was out until only recently.

  4. nmadhok commented on Dec 10, 2015

    @nmadhok
    Contributor

    @rallytime I'll take a look at it.

  5. skandyla commented on Jan 8, 2016

    @skandyla

    Hi,
    also have this issue.

    salt-cloud -f list_nodes my-vmware -l debug

    2016-01-08 15:49:41,627 [salt.cloud       ][DEBUG   ][4258] Trying to execute 'vmware.list_nodes' with the following kwargs: {}
    2016-01-08 15:49:41,840 [salt.utils.vmware][DEBUG   ][4258] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:765) 
    
    # pip list | grep pyvmomi
    pyvmomi (6.0.0)
    

    Versions report:

    # salt-cloud --versions
    Salt Version:
                Salt: 2015.8.3
    
    Dependency Versions:
     Apache Libcloud: 0.18.0
              Jinja2: 2.7.3
            M2Crypto: Not Installed
                Mako: Not Installed
              PyYAML: 3.11
               PyZMQ: 14.7.0
              Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
                RAET: Not Installed
             Tornado: 4.2.1
                 ZMQ: 4.0.5
                cffi: Not Installed
            cherrypy: Not Installed
            dateutil: 2.4.2
               gitdb: Not Installed
           gitpython: Not Installed
               ioflo: Not Installed
             libnacl: Not Installed
        msgpack-pure: Not Installed
      msgpack-python: 0.4.6
        mysql-python: Not Installed
           pycparser: Not Installed
            pycrypto: 2.6.1
              pygit2: Not Installed
        python-gnupg: Not Installed
               smmap: Not Installed
             timelib: Not Installed
    
    System Versions:
                dist: centos 7.2.1511 Core
             machine: x86_64
             release: 3.10.0-327.3.1.el7.x86_64
              system: CentOS Linux 7.2.1511 Core
    

    Temporary solution:

    pip uninstall pyvmomi
    pip install -Iv pyvmomi==5.5
    
  6. nmadhok commented on Jan 8, 2016

    @nmadhok
    Contributor

    @skandyla I'm working on fixing this. pyVmomi 5.5 is old. Please uninstall it and reinstall pyVmomi 5.5.0-2014.1.1.

    pip uninstall pyvmomi
    pip install pyvmomi==5.5.0-2014.1.1
    
  7. nmadhok commented on Jan 8, 2016

    @nmadhok
    Contributor

    @skandyla Would it be possible for you to install pyvmomi 6.0.0 and test it with the PR referenced above? I have tested it to work but just want to make sure it works for others.

  8. nmadhok commented on Jan 8, 2016

    @nmadhok
    Contributor

    @rallytime After merging #30231, you won't see the SSL issue. The SSL issue will only appear when pyVmomi >= 6.0.0 is installed on systems using Python < 2.7. I will submit another PR to mention this in the docs that pyVmomi >= 6.0.0 is only supported on systems using Python >= 2.7 and for systems using Python < 2.7, they should use pyVmomi 5.5.0-2014.1.1 by doing pip install pyvmomi==5.5.0-2014.1.1

  9. skandyla commented on Jan 8, 2016

    @skandyla

    @nmadhok I've tested your PR - seems all working good (under Centos7).

    I've setuped virtualenv, and installed pyvmomi (6.0.0)
    also

    #pip list|grep pyvmomi
    pyvmomi (6.0.0)
    
    git fetch upstream refs/pull/30231/head:bp-30231
    git checkout bp-30231
    
    salt-cloud -f list_nodes vmware1 
    

    Thanks!

  10. nmadhok commented on Jan 8, 2016

    @nmadhok
    Contributor

    @skandyla Not a problem. Glad it's working for you now. Should be merged into develop and 2015.8 branch very soon.

  11. rallytime commented on Jan 8, 2016

    @rallytime
    ContributorAuthor

    @nmadhok Awesome! Thanks for submitting that, and thanks @skandyla for testing. I'll test that out today.

  12. rallytime commented on Jan 8, 2016

    @rallytime
    ContributorAuthor

    @nmadhok Hrm...After applying these changes to the 2015.8 and upgrading my version of pyVmomi to 6.0, the proxy minion stops with these errors:

    [INFO    ] Starting new HTTPS connection (1): 10.4.28.150
    [WARNING ] /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
      SNIMissingWarning
    
    [WARNING ] /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
      InsecurePlatformWarning
    
    [DEBUG   ] [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
    [WARNING ] Stopping the Salt Proxy Minion
    [ERROR   ] Cannot complete login due to an incorrect user name or password.
    [INFO    ] The proxy minion is shut down
    

    I am running this on an Ubuntu 14 machine.

    # salt --versions
    Salt Version:
               Salt: 2015.8.3-172-g8d37bab
    
    Dependency Versions:
             Jinja2: 2.7.2
           M2Crypto: Not Installed
               Mako: 0.9.1
             PyYAML: 3.10
              PyZMQ: 14.4.0
             Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
               RAET: Not Installed
            Tornado: 4.2.1
                ZMQ: 4.0.4
               cffi: Not Installed
           cherrypy: Not Installed
           dateutil: 1.5
              gitdb: 0.5.4
          gitpython: 0.3.2 RC1
              ioflo: Not Installed
            libnacl: Not Installed
       msgpack-pure: Not Installed
     msgpack-python: 0.3.0
       mysql-python: 1.2.3
          pycparser: Not Installed
           pycrypto: 2.6.1
             pygit2: Not Installed
       python-gnupg: Not Installed
              smmap: 0.8.2
            timelib: Not Installed
    
    System Versions:
               dist: Ubuntu 14.04 trusty
            machine: x86_64
            release: 3.13.0-66-generic
             system: Ubuntu 14.04 trusty
    
  13. 10 remaining items

  14. nmadhok commented on Jan 11, 2016

    @nmadhok
    Contributor

    @skandyla it is going to work but a lot of features won't work as expected because of the difference in features between versions.

  15. nmadhok commented on Jan 12, 2016

    @nmadhok
    Contributor

    @rallytime @cro @skandyla

    From https://urllib3.readthedocs.org/en/latest/security.html#pyopenssl and https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning

    pip install requests[security] --upgrade
    pip install pyopenssl ndg-httpsclient pyasn1 --upgrade
    

    On Ubuntu, you may run into trouble installing pyopenssl, you'll need these dependencies:

    apt-get install libffi-dev libssl-dev
    

    Please install/upgrade required dependencies if they're already installed and try this PR again.

    Can you also post the output of pip show pyopenssl and pip show pyasn1

  16. cro commented on Jan 12, 2016

    @cro
    Contributor

    Well, Salt already deps on PyOpenSSL, so we're OK there. I'll give this a
    try.

    On Mon, Jan 11, 2016 at 5:23 PM, Nitin Madhok [email protected]
    wrote:

    @rallytime https://github.com/rallytime @cro https://github.com/cro

    From https://urllib3.readthedocs.org/en/latest/security.html#pyopenssl
    and
    https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning

    pip install pyopenssl ndg-httpsclient pyasn1

    On Ubuntu, you may run into trouble installing pyopenssl, you'll need
    these dependencies:

    apt-get install libffi-dev libssl-dev

    —
    Reply to this email directly or view it on GitHub
    #29537 (comment).

    --cro
    C. R. Oldham, Platform Engineer, SaltStack
    [email protected] / 801-564-4673

  17. cro commented on Jan 12, 2016

    @cro
    Contributor

    Sorry, this didn't work. :-(

    I checked out your PR and made sure the right items were installed with pip.

    root@ub14:~# pip install requests[security] --upgrade
    Requirement already up-to-date: requests[security] in /usr/local/lib/python2.7/dist-packages
    Requirement already up-to-date: pyOpenSSL>=0.13 in /usr/local/lib/python2.7/dist-packages (from requests[security])
    Requirement already up-to-date: ndg-httpsclient in /usr/local/lib/python2.7/dist-packages (from requests[security])
    Requirement already up-to-date: pyasn1 in /usr/local/lib/python2.7/dist-packages (from requests[security])
    Requirement already up-to-date: six>=1.5.2 in /usr/local/lib/python2.7/dist-packages (from pyOpenSSL>=0.13->requests[security])
    Requirement already up-to-date: cryptography>=0.7 in /usr/local/lib/python2.7/dist-packages (from pyOpenSSL>=0.13->requests[security])
    Requirement already up-to-date: idna>=2.0 in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
    Collecting setuptools>=1.0 (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
      Downloading setuptools-19.2-py2.py3-none-any.whl (463kB)
        100% |████████████████████████████████| 466kB 1.2MB/s
    Requirement already up-to-date: enum34 in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
    Requirement already up-to-date: ipaddress in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
    Requirement already up-to-date: cffi>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
    Requirement already up-to-date: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.4.1->cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
    Installing collected packages: setuptools
      Found existing installation: setuptools 3.3
        Uninstalling setuptools-3.3:
          Successfully uninstalled setuptools-3.3
    Successfully installed setuptools-19.2
    root@ub14:~# pip install pyopenssl ndg-httpsclient pyasn1 --upgrade
    Requirement already up-to-date: pyopenssl in /usr/local/lib/python2.7/dist-packages
    Requirement already up-to-date: ndg-httpsclient in /usr/local/lib/python2.7/dist-packages
    Requirement already up-to-date: pyasn1 in /usr/local/lib/python2.7/dist-packages
    Requirement already up-to-date: six>=1.5.2 in /usr/local/lib/python2.7/dist-packages (from pyopenssl)
    Requirement already up-to-date: cryptography>=0.7 in /usr/local/lib/python2.7/dist-packages (from pyopenssl)
    Requirement already up-to-date: idna>=2.0 in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyopenssl)
    Requirement already up-to-date: setuptools>=1.0 in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyopenssl)
    Requirement already up-to-date: enum34 in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyopenssl)
    Requirement already up-to-date: ipaddress in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyopenssl)
    Requirement already up-to-date: cffi>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from cryptography>=0.7->pyopenssl)
    Requirement already up-to-date: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.4.1->cryptography>=0.7->pyopenssl)
    root@ub14:~# ls
    get_si.py
    root@ub14:~# python get_si.py
    Could not connect to host 'salt-vsphere.lehi.saltstack.net'. Please check the debug log for more information.
    

    where get_si.py just contains two lines:

    import salt.utils.vmware
    salt.utils.vmware.get_service_instance('salt-vsphere','user','password')
    
  18. nmadhok commented on Jan 12, 2016

    @nmadhok
    Contributor

    @cro Looking at the error you got, I don't see you got any SSL related errors. You're getting a different error I think. You can also use https://docs.saltstack.com/en/latest/ref/clouds/all/salt.cloud.clouds.vmware.html#salt.cloud.clouds.vmware.test_vcenter_connection to test connection to vcenter using salt-cloud in debug mode:

    nitinmadhok@nitinmadhok:~/Repos/salt$ sudo salt-cloud -f test_vcenter_connection vcenter01 -l debug
    [DEBUG   ] Reading configuration from /etc/salt/cloud
    [DEBUG   ] Reading configuration from /etc/salt/master
    [DEBUG   ] Missing configuration file: /etc/salt/cloud.providers
    [DEBUG   ] Including configuration from '/etc/salt/cloud.providers.d/providers.conf'
    [DEBUG   ] Reading configuration from /etc/salt/cloud.providers.d/providers.conf
    [DEBUG   ] Missing configuration file: /etc/salt/cloud.profiles
    [DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/profiles.conf'
    [DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/profiles.conf
    [DEBUG   ] Reading configuration from /etc/salt/cloud
    [DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
    [DEBUG   ] Configuration file path: /etc/salt/cloud
    [INFO    ] salt-cloud starting
    [DEBUG   ] Could not LazyLoad parallels.avail_sizes
    [DEBUG   ] LazyLoaded parallels.avail_locations
    [DEBUG   ] LazyLoaded proxmox.avail_sizes
    [DEBUG   ] Could not LazyLoad saltify.destroy
    [DEBUG   ] Could not LazyLoad saltify.avail_sizes
    [DEBUG   ] Could not LazyLoad saltify.avail_images
    [DEBUG   ] Could not LazyLoad saltify.avail_locations
    [DEBUG   ] LazyLoaded rackspace.reboot
    [DEBUG   ] LazyLoaded openstack.list_locations
    [DEBUG   ] LazyLoaded rackspace.list_locations
    [DEBUG   ] Trying to execute 'vmware.test_vcenter_connection' with the following kwargs: {}
    [DEBUG   ] LazyLoaded nested.output
    vcenter03:
        ----------
        vmware:
            connection successful
    
  19. added
    fixed-pls-verify
    on Jan 12, 2016
  20. jbfriedrich commented on Apr 17, 2016

    @jbfriedrich
    Contributor

    Not sure if my problem is related or not, but I still have issues connecting to a vSphere vCSA 6.0u2 with a self-signed certificate. As far as I understand from this thread, my python version should work fine. I even added the self-signed CA to the the operating system's keystore.

    Do I have to add the CA somewhere else as well? Maybe in a keystore of a python library? Or to the keystore of salt itself?

    root@saltmaster:~# salt-cloud -f test_vcenter_connection vmware -l debug
    [DEBUG   ] Reading configuration from /etc/salt/cloud
    [DEBUG   ] Reading configuration from /etc/salt/master
    [DEBUG   ] Using cached minion ID from /etc/salt/minion_id: saltmaster.<redacted>
    [DEBUG   ] Key 'file_ignore_glob' with value None has an invalid type of NoneType, a list is required for this value
    [DEBUG   ] Missing configuration file: /etc/salt/cloud.providers
    [DEBUG   ] Including configuration from '/etc/salt/cloud.providers.d/digitalocean.conf'
    [DEBUG   ] Reading configuration from /etc/salt/cloud.providers.d/digitalocean.conf
    [DEBUG   ] Including configuration from '/etc/salt/cloud.providers.d/vmware.conf'
    [DEBUG   ] Reading configuration from /etc/salt/cloud.providers.d/vmware.conf
    [DEBUG   ] Missing configuration file: /etc/salt/cloud.profiles
    [DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/digitalocean.conf'
    [DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/digitalocean.conf
    [DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/vmware.conf'
    [DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/vmware.conf
    [DEBUG   ] Configuration file path: /etc/salt/cloud
    [WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
    [INFO    ] salt-cloud starting
    [DEBUG   ] Could not LazyLoad parallels.avail_sizes
    [DEBUG   ] LazyLoaded parallels.avail_locations
    [DEBUG   ] LazyLoaded proxmox.avail_sizes
    [DEBUG   ] Could not LazyLoad saltify.destroy
    [DEBUG   ] Could not LazyLoad saltify.avail_sizes
    [DEBUG   ] Could not LazyLoad saltify.avail_images
    [DEBUG   ] Could not LazyLoad saltify.avail_locations
    [DEBUG   ] LazyLoaded rackspace.reboot
    [DEBUG   ] LazyLoaded openstack.list_locations
    [DEBUG   ] LazyLoaded rackspace.list_locations
    [DEBUG   ] Trying to execute 'vmware.test_vcenter_connection' with the following kwargs: {}
    [DEBUG   ] ("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)
    Could not connect to host 'vcsa.<redacted>'. Please check the debug log for more information.
    

    Python version

    root@saltmaster:~# python --version
    Python 2.7.9
    

    Salt version report

    root@saltmaster:~# salt --versions-report
    Salt Version:
               Salt: 2015.8.8.2
    
    Dependency Versions:
             Jinja2: 2.7.3
           M2Crypto: Not Installed
               Mako: Not Installed
             PyYAML: 3.11
              PyZMQ: 14.4.0
             Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
               RAET: Not Installed
            Tornado: 4.2.1
                ZMQ: 4.0.5
               cffi: 1.5.2
           cherrypy: 3.5.0
           dateutil: 2.2
              gitdb: 0.5.4
          gitpython: 0.3.2 RC1
              ioflo: Not Installed
            libgit2: Not Installed
            libnacl: Not Installed
       msgpack-pure: Not Installed
     msgpack-python: 0.4.2
       mysql-python: 1.2.3
          pycparser: 2.14
           pycrypto: 2.6.1
             pygit2: Not Installed
       python-gnupg: Not Installed
              smmap: 0.8.2
            timelib: Not Installed
    
    System Versions:
               dist: debian 8.4 
            machine: x86_64
            release: 3.16.0-4-amd64
             system: debian 8.4 
    

    Pip versions

    root@saltmaster:~# pip list -v
    apache-libcloud (0.20.0)
    async (0.6.1)
    cffi (1.5.2)
    chardet (2.3.0)
    CherryPy (3.5.0)
    croniter (0.3.4)
    cryptography (1.3.1)
    enum34 (1.1.3)
    gitdb (0.5.4)
    GitPython (0.3.2rc1)
    idna (2.1)
    ipaddress (1.0.16)
    Jinja2 (2.7.3)
    lockfile (0.8)
    MarkupSafe (0.23)
    msgpack-python (0.4.2)
    MySQL-python (1.2.3)
    ndg-httpsclient (0.4.0)
    netaddr (0.7.12)
    pip (8.1.1)
    ply (3.4)
    pyasn1 (0.1.9)
    pycparser (2.14)
    pycrypto (2.6.1)
    pycurl (7.19.5)
    pyOpenSSL (16.0.0)
    python-apt (0.9.3.12)
    python-dateutil (2.2)
    pytz (2012rc0)
    pyvmomi (6.0.0)
    PyYAML (3.11)
    pyzmq (14.4.0)
    repoze.lru (0.6)
    requests (2.9.1)
    Routes (2.0)
    salt (2015.8.8.2)
    setuptools (20.9.0)
    simplejson (3.6.5)
    six (1.10.0)
    smmap (0.8.2)
    tornado (4.2.1)
    urllib3 (1.10.4)
    WebOb (1.4)
    
  21. nmadhok commented on Apr 17, 2016

    @nmadhok
    Contributor

    @jbfriedrich Can you install previous version of pyVmomi and see if you get the same error? I'll have to test this on Debian 8.4. I will be working on rewriting the SSL certification check code sometime soon.

  22. jbfriedrich commented on Apr 17, 2016

    @jbfriedrich
    Contributor

    @nmadhok I will test with pyvmomi 5.x but my vsphere environment is 6.x so I am not sure if it will work. I have edited the '/salt/utils/vmware.py' file and it works now for me. Would it be worth it for me to create a pull request so you can take a look at my changes? Might not be the prettiest solution but seems to work for me ;)

  23. nmadhok commented on Apr 18, 2016

    @nmadhok
    Contributor

    @jbfriedrich I'll take a look at your commit when I get a chance. You can create a Pull request for it but it'll be reviewed before it gets merged in. I don't have time at the moment to work on this since I'm too swamped at work.

  24. jbfriedrich commented on Apr 18, 2016

    @jbfriedrich
    Contributor

    @nmadhok Sure thing, take your time. Of course it needs to be reviewed first :). I will prepare the pull request tonight after work (I am not doing this all too often). Thanks!

  25. jbfriedrich commented on Apr 21, 2016

    @jbfriedrich
    Contributor

    @nmadhok Sorry for my late reply, had some busy days at work. I have tested with pyVmomi 5.5.0-2014.1.1 and my unmodified salt installation worked fine with that version. When switched back to PyVmomi 6.0.0 the SSL error from above came up again.

    I then applied my fix (see pull request) to my local salt installation and the connectivity test succeeded. I could use pyVmomi 6.0.0 just fine with my vSphere 6.0U2 cluster. I also tested pyVmomi 5.5.0-2014.1.1 with my modified salt version, which also seems to work correctly.

  26. nishantdh commented on Oct 3, 2017

    @nishantdh

    Hi guys, I am very new to Python world. My goal is to collect VMs info (like CPU, RAM usage) from ESXi and was using this link as reference https://virtualwires.wordpress.com/2016/07/25/using-pyvmomi-to-collect-esxi-info

    I have both python 2.7 and 3.5 running on Ubuntu box:

    root@ubuntu:~$ python3 --version
    Python 3.5.2
    root@ubuntu:~$ python --version
    Python 2.7.12
    

    When I run the script using Python 2.7, it gives "SSL: CERTIFICATE_VERIFY_FAILED" error like below:

    root@ubuntu:~$ python esx.py -s 'Host_IP' -u 'user' -p 'pwd'
    Traceback (most recent call last):
      File "esx.py", line 33, in <module>
        main()
      File "esx.py", line 19, in main
        si = SmartConnect(host=opts.shost,user=opts.username,pwd=opts.password )
      ...
    ....
      conn.request("GET", path)
      File "/usr/lib/python2.7/httplib.py", line 1057, in request
        self._send_request(method, url, body, headers)
      File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request
        self.endheaders(body)
      File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
        self._send_output(message_body)
      File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
        self.send(msg)
      File "/usr/lib/python2.7/httplib.py", line 859, in send
        self.connect()
      File "/usr/lib/python2.7/httplib.py", line 1278, in connect
        server_hostname=server_hostname)
      File "/usr/lib/python2.7/ssl.py", line 353, in wrap_socket
        _context=self)
      File "/usr/lib/python2.7/ssl.py", line 601, in __init__
        self.do_handshake()
      File "/usr/lib/python2.7/ssl.py", line 830, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
    root@ubuntu:~$
    

    When I run using Python3 I get syntax error:

    root@ubuntu:~$ python3 esx.py -s 'Host_IP' -u 'user' -p 'pwd'
      File "esx.py", line 25
        print 'The CPU vendor is %s and the model is %s'  %(cpuobj.vendor,cpuobj.description)
                                                       ^
    SyntaxError: invalid syntax
    root@ubuntu:~$
    

    The script is the same as shown in the article -
    https://virtualwires.wordpress.com/2016/07/25/using-pyvmomi-to-collect-esxi-info

    How do I make it work?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1RIoTbugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions