'How to set tls version in Django database settings
I have an application deployed on azure, with the new releases I want to increase minimum tls version to 1.2
Python version 3.8 production MySQL version is 8.0.15
When we increase it from the mysql server app crashes and gives us the following error. Also I have other node applications that can successfully connect to my MySQL server with minimum TLS version configured to 1.2. I am looking for a way to config my application so that it starts using TLSv1.2
exception when mysql server increases the minimum tls version
Here is my database connection settings
DATABASES[database_name] = {
'ENGINE': 'django.db.backends.mysql',
'NAME': database_name,
'USER': os.getenv("DB_USER"),
'PASSWORD': os.getenv("DB_PASSWORD"),
'HOST': os.getenv("DB_HOST"),
'OPTIONS': {
'ssl': {'ssl-ca': 'configs/public-azure-mysql-certificate.pem'}
}
I tried adding an additional field like this under the 'ssl' option field like this
import ssl
later in the code
DATABASES[database_name] = {
'ENGINE': 'django.db.backends.mysql',
'NAME': database_name,
'USER': os.getenv("DB_USER"),
'PASSWORD': os.getenv("DB_PASSWORD"),
'HOST': os.getenv("DB_HOST"),
'OPTIONS': {
'ssl': {'ssl-ca': 'configs/public-azure-mysql-certificate.pem', 'ssl-version': ssl.PROTOCOL_TLSv1_2}
}
it gives the same error as well, How can I set the TLS version to 1.2 so that I can set mysql server to accept minimum TLSv1.2 ?
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
