python-3.xamazon-web-servicestls1.2tls1.3

How to check which TLS version is used by the python services in production


Since the AWS API endpoints will now require TLS 1.2 as a minimum protocol level, I wanted to check if all my production services written in python 3.6 or python 3.10 are using TLS version >=1.2.

What did I try?

Tried all other Stack Overflow threads, Github issues, and some websites, but encountered some or the other issues.

My Question -

Since there are a bunch of production services to check and it takes significant time to build the artifacts, I need a simple and a quick method.

Also, it will be good if I can make this method as part of my build workflow so that we can enforce usage of only updated packages in python services.


Solution

  • I followed the following steps manually but these can also be automated by making them part of your build workflow -

    1. Make the virtual environment on local machine.
    2. Install the requirements for the production service using pip instal -e .
    3. Activate the virtual env, and type -

    python3 -c "import requests; print(requests.get('https://www.howsmyssl.com/a/check', verify=False).json()['tls_version'])"

    1. If the output is TLS 1.2 or TLS 1.3, you are safe.

    References

    [1] https://www.calazan.com/how-to-check-if-your-python-app-supports-tls-12/