From bbc6156bd76c1e45d63282f214d3b283ceefa460 Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 22 Mar 2019 18:06:46 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=95=B0=E6=8D=AE=E5=BA=93=E6=94=AF?= =?UTF-8?q?=E6=8C=81CA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/settings.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index fadd6700e..02e48c3c4 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -160,6 +160,7 @@ MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' # Database # https://docs.djangoproject.com/en/1.10/ref/settings/#databases +DB_OPTIONS = {} DATABASES = { 'default': { 'ENGINE': 'django.db.backends.{}'.format(CONFIG.DB_ENGINE), @@ -169,8 +170,13 @@ DATABASES = { 'USER': CONFIG.DB_USER, 'PASSWORD': CONFIG.DB_PASSWORD, 'ATOMIC_REQUESTS': True, + 'OPTIONS': DB_OPTIONS } } +DB_CA_PATH = os.path.join(PROJECT_DIR, 'data', 'ca.pem') +if CONFIG.DB_ENGINE == 'mysql' and os.path.isfile(DB_CA_PATH): + DB_OPTIONS['ssl'] = {'ca': DB_CA_PATH} + # Password validation # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators