From d7477ba34838fc08e4dfbfbe654c82a947674f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Mon, 8 Jul 2019 06:24:35 +0800 Subject: [PATCH] Add support for SMTP SSL, in addition to TLS Note that SSL and TLS are incompatible. Close #231. --- CHANGELOG.md | 2 +- docs/configuration.rst | 3 ++- tutor/templates/apps/openedx/settings/cms/common.py | 2 ++ tutor/templates/apps/openedx/settings/lms/common.py | 2 ++ tutor/templates/config.yml | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 030a297..3970565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Note: Breaking changes between versions are indicated by "💥". - [Bugfix] Fix insecure static asset loading when web proxy is enabled - [Improvement] Rename ``SECRET_KEY`` configuration parameter to ``OPENEDX_SECRET_KEY`` -- [Improvement] Add support for TLS in external SMTP server (#231) +- [Improvement] Add support for SSL and TLS in external SMTP server (#231) - [Bugfix] Fix missing video transcripts in LMS (#229) - [Improvement] Make it possible to enable/disable multiple plugins at once - [Improvement] Add 'local-docker-compose-nginx-volumes' patch diff --git a/docs/configuration.rst b/docs/configuration.rst index 51e95a2..3fe3ddc 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -141,8 +141,9 @@ SMTP - ``SMTP_USERNAME`` (default: ``""``) - ``SMTP_PASSWORD`` (default: ``""``) - ``SMTP_USE_TLS`` (default: ``false``) +- ``SMTP_USE_SSL`` (default: ``false``) -Note that the SMTP server shipped with Tutor by default does not implement TLS. +Note that the SMTP server shipped with Tutor by default does not implement TLS. With external servers, only one of SSL or TLS should be enabled, at most. SSL/TLS certificates for HTTPS access ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tutor/templates/apps/openedx/settings/cms/common.py b/tutor/templates/apps/openedx/settings/cms/common.py index 71629db..7eaba20 100644 --- a/tutor/templates/apps/openedx/settings/cms/common.py +++ b/tutor/templates/apps/openedx/settings/cms/common.py @@ -22,6 +22,8 @@ LOGGING["handlers"]["tracking"] = { } LOGGING["loggers"]["tracking"]["handlers"] = ["console", "local", "tracking"] +EMAIL_USE_SSL = {{ SMTP_USE_SSL }} + LOCALE_PATHS.append("/openedx/locale") # Create folders if necessary diff --git a/tutor/templates/apps/openedx/settings/lms/common.py b/tutor/templates/apps/openedx/settings/lms/common.py index cb0ba24..22a71b4 100644 --- a/tutor/templates/apps/openedx/settings/lms/common.py +++ b/tutor/templates/apps/openedx/settings/lms/common.py @@ -24,6 +24,8 @@ LOGGING["handlers"]["tracking"] = { } LOGGING["loggers"]["tracking"]["handlers"] = ["console", "local", "tracking"] +EMAIL_USE_SSL = {{ SMTP_USE_SSL }} + # Fix media files paths VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"] = MEDIA_ROOT VIDEO_TRANSCRIPTS_SETTINGS["STORAGE_KWARGS"]["location"] = MEDIA_ROOT diff --git a/tutor/templates/config.yml b/tutor/templates/config.yml index ac7f697..254c347 100644 --- a/tutor/templates/config.yml +++ b/tutor/templates/config.yml @@ -67,4 +67,5 @@ SMTP_PORT: 25 SMTP_USERNAME: "" SMTP_PASSWORD: "" SMTP_USE_TLS: false +SMTP_USE_SSL: false WEB_PROXY: false