From bebf2d89d335c48659d2e25cb9f6f8310e867fc5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Mar 2018 16:12:52 +0100 Subject: [PATCH] Add option to disable starttls --- config/default.yaml | 1 + config/production.yaml.example | 1 + config/test.yaml | 1 + server/initializers/constants.ts | 1 + server/lib/emailer.ts | 2 +- support/docker/production/config/production.yaml | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/default.yaml b/config/default.yaml index 48e5bd067..26fc5c128 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -25,6 +25,7 @@ smtp: username: null password: null tls: true + disable_starttls: false ca_file: null # Used for self signed certificates from_address: 'admin@example.com' diff --git a/config/production.yaml.example b/config/production.yaml.example index 45eeffec7..43f45ae80 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -26,6 +26,7 @@ smtp: username: null password: null tls: true + disable_starttls: false ca_file: null # Used for self signed certificates from_address: 'admin@example.com' diff --git a/config/test.yaml b/config/test.yaml index b830a42e7..7e395db04 100644 --- a/config/test.yaml +++ b/config/test.yaml @@ -12,6 +12,7 @@ smtp: hostname: null port: 1025 tls: false + disable_starttls: true from_address: 'test-admin@localhost' username: null password: null diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 3cf9ea36d..705d9b520 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -106,6 +106,7 @@ const CONFIG = { USERNAME: config.get('smtp.username'), PASSWORD: config.get('smtp.password'), TLS: config.get('smtp.tls'), + DISABLE_STARTTLS: config.get('smtp.disable_starttls'), CA_FILE: config.get('smtp.ca_file'), FROM_ADDRESS: config.get('smtp.from_address') }, diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index 1b905e510..f34d141ea 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -46,7 +46,7 @@ class Emailer { secure: CONFIG.SMTP.TLS, debug: CONFIG.LOG.LEVEL === 'debug', logger: bunyanLogger as any, - ignoreTLS: isTestInstance() || CONFIG.SMTP.HOSTNAME === 'localhost' || CONFIG.SMTP.HOSTNAME === '127.0.0.1', + ignoreTLS: CONFIG.SMTP.DISABLE_STARTTLS, tls, auth }) diff --git a/support/docker/production/config/production.yaml b/support/docker/production/config/production.yaml index 9a6cb1094..fdcbeb5a0 100644 --- a/support/docker/production/config/production.yaml +++ b/support/docker/production/config/production.yaml @@ -28,6 +28,7 @@ smtp: username: null password: null tls: true + disable_starttls: false ca_file: null # Used for self signed certificates from_address: 'admin@example.com'