salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-cloud -u is not working with SSL error

Open grep4linux opened this issue 11 years ago • 16 comments

# salt-cloud --version
salt-cloud 2015.5.0 (Lithium)

# salt-cloud -u 
[INFO    ] Starting new HTTPS connection (1): bootstrap.saltstack.com
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
SSLError: hostname 'bootstrap.saltstack.com' doesn't match either of '*.wpengine.com', 'wpengine.com'
Traceback (most recent call last):
  File "/usr/bin/salt-cloud", line 10, in <module>
    salt_cloud()
  File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 316, in salt_cloud
    client.run()
  File "/usr/lib/python2.6/site-packages/salt/cloud/cli.py", line 78, in run
    ret = salt.utils.cloud.update_bootstrap(self.config)
  File "/usr/lib/python2.6/site-packages/salt/utils/cloud.py", line 2252, in update_bootstrap
    req = requests.get(url)
  File "/usr/lib/python2.6/site-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/usr/lib/python2.6/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 279, in request
    resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
  File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 374, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.6/site-packages/requests/adapters.py", line 213, in send
    raise SSLError(e)
SSLError: hostname 'bootstrap.saltstack.com' doesn't match either of '*.wpengine.com', 'wpengine.com'
Traceback (most recent call last):
  File "/usr/bin/salt-cloud", line 10, in <module>
    salt_cloud()
  File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 316, in salt_cloud
    client.run()
  File "/usr/lib/python2.6/site-packages/salt/cloud/cli.py", line 78, in run
    ret = salt.utils.cloud.update_bootstrap(self.config)
  File "/usr/lib/python2.6/site-packages/salt/utils/cloud.py", line 2252, in update_bootstrap
    req = requests.get(url)
  File "/usr/lib/python2.6/site-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/usr/lib/python2.6/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 279, in request
    resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
  File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 374, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.6/site-packages/requests/adapters.py", line 213, in send
    raise SSLError(e)
requests.exceptions.SSLError: hostname 'bootstrap.saltstack.com' doesn't match either of '*.wpengine.com', 'wpengine.com'

grep4linux avatar Jun 02 '15 03:06 grep4linux

@grep4linux, I just tested from the 2015.5 branch and had no errors. Perhaps it already got patched? Would you be willing/able to switch to a git install of that branch and try it?

techhat avatar Jun 02 '15 12:06 techhat

The site bootstrap.saltstack.com resides on an IP that requires the client to support the SNI feature of SSL in order to work properly. If you are on an older system that doesn't support SNI (e.g., RHEL5/CentOS5) then you will receive that error when trying to access the bootstrap script.

dexxtreme avatar Jun 02 '15 19:06 dexxtreme

Work around for those who are running into this (python-dev may not be required):

apt-get install python-dev apt-get install python-openssl apt-get install python-ndg-httpsclient

randybias avatar Jun 07 '15 08:06 randybias

alternatively you could just curl -LO /etc/salt/cloud.deploy.d/salt-bootstrap.sh https://bootstrap.saltstack.com/ as a work around.

gtmanfred avatar Jun 11 '15 21:06 gtmanfred

I'm seeing this on a CentOS6.6 machine.

kitplummer avatar Jun 12 '15 00:06 kitplummer

I'm also only seeing this with the 2015.5.0 version that gets installed via the RPM. It doesn't happen with the 2015.5.1 version installed via Pip.

kitplummer avatar Jun 12 '15 13:06 kitplummer

Is there a workaround for this on Centos7? I'd rather keep to the Stock RPMs rather than to update with pip.

does salt-cloud -u downloads the latest version to /etc/salt/cloud.deploy.d/? I notice that the salt-cloud RPM does not install bootstrap on the local disk? Does this mean that, if it cant find it on the local disk it will call the URL?

mooperd avatar Jun 15 '15 12:06 mooperd

It never pulls it from the url.

By default it is stored in the package, and salt-cloud -u updates it, if it doesn't save it to /usr/lib somewhere, it saves it in /etc/salt/cloud.deploy.d/salt-bootstrap.sh which takes precedence over the location in the install.

gtmanfred avatar Jun 15 '15 13:06 gtmanfred

Same issue, Centos 6.6

Linked from: https://github.com/saltstack/salt/issues/25236

The minion function caused an exception: Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/salt/minion.py", line 1161, in _thread_return return_data = func(*args, **kwargs) File "/usr/lib/python2.6/site-packages/salt/modules/lxc.py", line 1566, in init bootstrap_args=bootstrap_args) File "/usr/lib/python2.6/site-packages/salt/modules/lxc.py", line 3198, in bootstrap bootstrap=bootstrap_url) File "/usr/lib/python2.6/site-packages/salt/modules/config.py", line 401, in gather_bootstrap_script ret = salt.utils.cloud.update_bootstrap(__opts__, url=bootstrap) File "/usr/lib/python2.6/site-packages/salt/utils/cloud.py", line 2325, in update_bootstrap req = requests.get(url) File "/usr/lib/python2.6/site-packages/requests/api.py", line 55, in get return request('get', url, **kwargs) File "/usr/lib/python2.6/site-packages/requests/api.py", line 44, in request return session.request(method=method, url=url, **kwargs) File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 279, in request resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies) File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 374, in send r = adapter.send(request, **kwargs) File "/usr/lib/python2.6/site-packages/requests/adapters.py", line 213, in send raise SSLError(e) SSLError: hostname 'bootstrap.saltstack.com' doesn't match either of '*.wpengine.com', 'wpengine.com'

Paul-PSDigital avatar Jul 09 '15 15:07 Paul-PSDigital

I'm having the same issue Ubuntu 14.04.

$ salt --versions-report
                  Salt: 2015.5.2
                Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
                Jinja2: 2.7.2
              M2Crypto: 0.21.1
        msgpack-python: 0.3.0
          msgpack-pure: Not Installed
              pycrypto: 2.6.1
               libnacl: Not Installed
                PyYAML: 3.10
                 ioflo: Not Installed
                 PyZMQ: 14.0.1
                  RAET: Not Installed
                   ZMQ: 4.0.4
                  Mako: 0.9.1
 Debian source package: 2015.5.2+ds-1trusty1

hernanc avatar Jul 13 '15 23:07 hernanc

Work around :D:D:D:D - the illustrious 'script' parameter

In your cloud.profiles

my-lxc:
  provider: my-lxc
  script: https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh

Paul-PSDigital avatar Jul 16 '15 19:07 Paul-PSDigital

Same error, CentOS 6.6

           Salt: 2015.5.2
         Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
         Jinja2: 2.2.1
       M2Crypto: 0.20.2
 msgpack-python: 0.1.13
   msgpack-pure: Not Installed
       pycrypto: 2.0.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.3.1
           RAET: Not Installed
            ZMQ: 3.2.5
           Mako: Not Installed

sambanshee avatar Jul 22 '15 09:07 sambanshee

This is possibly related to the fact that CentOS Salt bundles Python 2.6.x, but TLS SNI is only 'natively' supported by requests in Python >= 2.7.9 (without adding a bunch of 3rd-party dependencies) (see https://www.python.org/dev/peps/pep-0466/) ?

TheBigBear avatar Aug 05 '15 16:08 TheBigBear

That is the reason.

└─╼ openssl s_client -connect bootstrap.saltstack.com:443 2>&1 | openssl x509 -noout -text |& grep -E '\s+DNS:'                                                                                                                                                                                                                                                                         (⌐■_■)
                DNS:*.wpengine.com, DNS:wpengine.com
^C
└─╼ openssl s_client -connect bootstrap.saltstack.com:443 -servername bootstrap.saltstack.com 2>&1 | openssl x509 -noout -text |& grep -E '\s+DNS:'                                                                                                                                                                                                                                     (⌐■_■)
                DNS:*.saltstack.com, DNS:saltstack.com

@techhat does your http library work with sni? and can it replace requests here in salt-cloud?

gtmanfred avatar Aug 06 '15 01:08 gtmanfred

Hey everyone! @UtahDave has been working on this bug lately, and it is fixed for me:

# salt-cloud -u
[INFO    ] Starting new HTTP connection (1): bootstrap.saltstack.com
Success:
    ----------
    Files updated:
        - /etc/salt/cloud.deploy.d/bootstrap-salt.sh
        - /salt/salt/cloud/deploy/bootstrap-salt.sh

Can you all give this a try and confirm that it's fixed for you as well?

rallytime avatar Aug 17 '15 22:08 rallytime

I didn't hear anything back on this one, but I haven't run into it again. I am fairly certain this is fixed. If anyone continues to run into problems with this bug, please do let us know and we'll look into it. Thanks all!

rallytime avatar Aug 27 '15 22:08 rallytime