mesosphere / universe

The Mesosphere Universe package repository.
http://mesosphere.github.io/universe
Apache License 2.0
304 stars 426 forks source link

ssl error when build local dcos universe #785

Open zerix opened 7 years ago

zerix commented 7 years ago

when we build local dcos universe with the web: https://dcos.io/docs/1.8/administration/installing/deploying-a-local-dcos-universe/#default

run to the 4 step:

$ sudo make local-universe

error info: `Stopping docker registry. registry Traceback (most recent call last): File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/urllib/request.py", line 1254, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/http/client.py", line 1106, in request self._send_request(method, url, body, headers) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/http/client.py", line 1151, in _send_request self.endheaders(body) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/http/client.py", line 1102, in endheaders self._send_output(message_body) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/http/client.py", line 934, in _send_output self.send(msg) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/http/client.py", line 877, in send self.connect() File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/http/client.py", line 1260, in connect server_hostname=server_hostname) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/ssl.py", line 377, in wrap_socket _context=self) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/ssl.py", line 752, in init self.do_handshake() File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/ssl.py", line 988, in do_handshake self._sslobj.do_handshake() File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/data/universe/docker/local-universe/../../scripts/local-universe.py", line 314, in sys.exit(main()) File "/data/universe/docker/local-universe/../../scripts/local-universe.py", line 104, in main args.selected)): File "/opt/mesosphere/lib/python3.5/site-packages/concurrent/futures/_base.py", line 580, in map yield future.result() File "/opt/mesosphere/lib/python3.5/site-packages/concurrent/futures/_base.py", line 407, in result return self.get_result() File "/opt/mesosphere/lib/python3.5/site-packages/concurrent/futures/_base.py", line 359, in get_result reraise(self._exception, self._traceback) File "/opt/mesosphere/lib/python3.5/site-packages/concurrent/futures/_compat.py", line 111, in reraise raise exc File "/opt/mesosphere/lib/python3.5/site-packages/concurrent/futures/thread.py", line 61, in run result = self.fn(_self.args, _self.kwargs) File "/data/universe/docker/local-universe/../../scripts/local-universe.py", line 87, in handle_package add_http_resource(http_artifacts, url, archive_path) File "/data/universe/docker/local-universe/../../scripts/local-universe.py", line 245, in add_http_resource urllib.request.urlretrieve(url, str(archive_path)) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/urllib/request.py", line 188, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/urllib/request.py", line 163, in urlopen return opener.open(url, data, timeout) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/urllib/request.py", line 466, in open response = self._open(req, data) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/urllib/request.py", line 484, in _open '_open', req) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/urllib/request.py", line 444, in _call_chain result = func(args) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/urllib/request.py", line 1297, in https_open context=self._context, check_hostname=self._check_hostname) File "/opt/mesosphere/packages/python--85de4172618f2a149f5e9b00223b50725249e98f/lib/python3.5/urllib/request.py", line 1256, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)>`

I have google it, should change the open url code.

how to resolve it?

Thanks,

zerix commented 7 years ago

ok, I have fix the question .

patch the scripts/local-universe.py. disabled the ssl check:

> def add_http_resource(dir_path, url, base_path):
>     archive_path = (dir_path / base_path /
>         pathlib.Path(urllib.parse.urlparse(url).path).name)
>     print('Adding {} at {}.'.format(url, archive_path))
>     os.makedirs(str(archive_path.parent), exist_ok=True)
>     with open(str(archive_path), 'wb') as f:
>         resq = requests.get(url, verify=False)
>         f.write(resq.content)

you could also find the source question:

http://stackoverflow.com/questions/33770129/how-do-i-disable-the-ssl-check-in-python-3-x

big-loser commented 7 years ago

find add_http_resource() function.

def add_http_resource(dir_path, url, base_path):
       pass

fix the question