烧结管理S3 SSL错误



我正在尝试使用几个不同的实现将文件上传到blask Admin的S3。在这两种情况下,我都会遇到SSL错误。我已经尝试了一些我发现的事情,例如将其添加到配置:

    S3_USE_HTTPS = False

我还更新了我在另一个线程上推荐的认证软件包。我无法解决这个错误。知道为什么我得到这个?

错误msg下面:

> File
> "/Users/kevin/dev/allstarrma/flask-env/lib/python3.6/site-packages/boto/connection.py",
> line 1071, in make_request
>     retry_handler=retry_handler)   File "/Users/kevin/dev/allstarrma/flask-env/lib/python3.6/site-packages/boto/connection.py",
> line 1030, in _mexe
>     raise ex   File "/Users/kevin/dev/allstarrma/flask-env/lib/python3.6/site-packages/boto/connection.py",
> line 943, in _mexe
>     request.body, request.headers)   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1239, in request
>     self._send_request(method, url, body, headers, encode_chunked)   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1285, in _send_request
>     self.endheaders(body, encode_chunked=encode_chunked)   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1234, in endheaders
>     self._send_output(message_body, encode_chunked=encode_chunked)   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1026, in _send_output
>     self.send(msg)   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 964, in send
>     self.connect()   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1400, in connect
>     server_hostname=server_hostname)   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
> line 407, in wrap_socket
>     _context=self, _session=session)   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
> line 814, in __init__
>     self.do_handshake()   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
> line 1068, in do_handshake
>     self._sslobj.do_handshake()   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
> line 689, in do_handshake
>     self._sslobj.do_handshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

有关默认HTTPS验证的信息:https://www.python.org/dev/peps/pep-0476/

红帽也有很棒的文章。https://access.redhat.com/articles/2039753现在开放,但如果在付费墙后,我决定写关键点。

如在评论中所述,您可以使用PYTHONHTTPSVERIFY=0 /path/to/script.py

调用Python脚本

您还可以配置 - 文件/etc/python/cert-verification.cfg中的默认行为,然后更改

[https]
verify=platform_default

to

[https]
verify=disable

如果您使用的是最新的Python 2.7,也可以使用以动态禁用证书验证。

import ssl
ssl._https_verify_certificates(0)

不幸的是,对于Python> 3.4(我尝试了3.4.5和3.6.3),我找不到类似的功能。文档中的结果相同https://docs.python.org/3/library/ssl.html。

最新更新