This GIST trying to demonstrates how to set up a Python server and client to support TLS 1.1, including the necessary configurations to bypass the default security restrictions.
Due to security concerns https://bugs.python.org/issue43998 and python/cpython#25778, TLS 1.0 and TLS 1.1 are deprecated and disabled by default in many environments. However, there are scenarios where you might need to support these older protocols. This GIST trying to provides a workaround to enable TLS 1.1 using Python and OpenSSL.
As mentioned in this issue openssl/openssl#13299, in FIPS mode, the default cipher suite does not support TLS 1.1. However, OpenSSL 3.0 still supports TLS 1.1 and Python can also support TLS 1.1 with a warning. We don't need to rebuild Python; we just need to adjust the security level.
- Python: 3.10.12
- OpenSSL: 3.0.2
First, generate a self-signed certificate and a private key:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
Run the server.py
script to start the server:
python server.py
Run the client.py
script to connect to the server:
python client.py
You can query OpenSSL to see the supported ciphers for TLS 1.1:
openssl ciphers -v | grep TLSv1
Example output:
ECDHE-ECDSA-AES256-SHA TLSv1 Kx=ECDH Au=ECDSA Enc=AES(256) Mac=SHA1
ECDHE-RSA-AES256-SHA TLSv1 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA1
ECDHE-ECDSA-AES128-SHA TLSv1 Kx=ECDH Au=ECDSA Enc=AES(128) Mac=SHA1
ECDHE-RSA-AES128-SHA TLSv1 Kx=ECDH Au=RSA Enc=AES(128) Mac=SHA1
By setting the security level to 0, you can enable support for TLS 1.1 in both Python and OpenSSL. This setup is useful for testing and legacy systems that still require these older protocols.