Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If you pass a string verify path to create_client, you will get a ClientConnectorCertificateError #850

Closed
6 tasks done
FHTMitchell opened this issue Feb 9, 2021 · 1 comment · Fixed by #851
Closed
6 tasks done

Comments

@FHTMitchell
Copy link
Contributor

Describe the bug
Currently, the verify parameter does not work like the equivalent parameter in requests or botocore where verify can either be a bool or a str

  • False => do not use SSL
  • True => use default SSL cert
  • str => use SSL cert found at the path verify

Often the latter is needed to access internal endpoints.

aiobotocore also seems to make this assumption since we pass verify through botocore.EndPointCreator._get_verify_value which can return a str. However we pass verify to the verify_ssl method of aiohttp.TCPConnector, which simply treats that value as a bool.

This means that passing a certificate file path as a string does not work as expected and throws the following exception:

ClientConnectorCertificateError: Cannot connect to host <REDACTED> ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)')]

What we should be doing, and I have tested this, is creating an SSLContext(cafile=verify) object if verify is a str (or pathlib.Path perhaps). This then works as expected.

Checklist

  • I have reproduced in environment where pip check passes without errors
  • I have provided pip freeze results
  • I have provided sample code or detailed way to reproduce
  • I have tried the same code in botocore to ensure this is an aiobotocore specific issue
  • I have tried similar code in aiohttp to ensure this is is an aiobotocore specific issue
  • I have checked the latest and older versions of aiobotocore/aiohttp/python to see if this is a regression / injection

pip freeze results (really conda env export but same thing)

  • aiobotocore=1.1.2=py_0
  • aiohttp=3.6.3=py38h7b6447c_0
  • aioitertools=0.7.0=py_0
  • async-timeout=3.0.1=py38_0
  • attrs=20.2.0=py_0
  • backcall=0.2.0=py_0
  • botocore=1.17.44=py_0
  • brotlipy=0.7.0=py38h7b6447c_1000
  • ca-certificates=2020.10.14=0
  • certifi=2020.6.20=py38_0
  • cffi=1.14.3=py38he30daa8_0
  • chardet=3.0.4=py38_1003
  • cryptography=3.1.1=py38h1ba5d50_0
  • decorator=4.4.2=py_0
  • docutils=0.15.2=py38h578d9bd_1
  • idna=2.10=py_0
  • iniconfig=1.1.1=py_0
  • ipython=7.20.0=py38h81c977d_2
  • ipython_genutils=0.2.0=py38_0
  • jedi=0.18.0=py38h578d9bd_2
  • jmespath=0.10.0=py_0
  • ld_impl_linux-64=2.33.1=h53a641e_7
  • libedit=3.1.20191231=h14c3975_1
  • libffi=3.3=he6710b0_2
  • libgcc-ng=9.1.0=hdf63c60_0
  • libstdcxx-ng=9.1.0=hdf63c60_0
  • more-itertools=8.5.0=py_0
  • multidict=4.7.6=py38h7b6447c_1
  • ncurses=6.2=he6710b0_1
  • openssl=1.1.1h=h7b6447c_0
  • packaging=20.4=py_0
  • parso=0.8.0=py_0
  • pexpect=4.8.0=py38_0
  • pickleshare=0.7.5=py38_1000
  • pip=20.2.4=py38_0
  • pluggy=0.13.1=py38_0
  • prompt-toolkit=3.0.8=py_0
  • ptyprocess=0.6.0=py38_0
  • py=1.9.0=py_0
  • pycparser=2.20=py_2
  • pygments=2.7.1=py_0
  • pyopenssl=19.1.0=py_1
  • pyparsing=2.4.7=py_0
  • pysocks=1.7.1=py38_0
  • pytest=6.1.1=py38_0
  • python=3.8.5=h7579374_1
  • python-dateutil=2.8.1=py_0
  • python_abi=3.8=1_cp38
  • readline=8.0=h7b6447c_0
  • setuptools=50.3.0=py38hb0f4dca_1
  • six=1.15.0=py_0
  • sqlite=3.33.0=h62c20be_0
  • tk=8.6.10=hbc83047_0
  • toml=0.10.1=py_0
  • traitlets=5.0.5=py_0
  • typing_extensions=3.7.4.3=py_0
  • urllib3=1.25.11=py_0
  • wcwidth=0.2.5=py_0
  • wheel=0.35.1=py_0
  • wrapt=1.12.1=py38h7b6447c_1
  • xz=5.2.5=h7b6447c_0
  • yarl=1.5.1=py38h7b6447c_0
  • zlib=1.2.11=h7b6447c_3

Environment:

  • Python Version: 3.7, 3.8
  • OS name and version: NAME="Red Hat Enterprise Linux" VERSION="8.2 (Ootpa)"
@thehesiod
Copy link
Collaborator

closing as I believe this was fixed by the linked PR, please re-open if not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants