diff options
-rw-r--r-- | config/config.json | 5 | ||||
-rw-r--r-- | model/config.go | 48 | ||||
-rw-r--r-- | utils/mail.go | 4 |
3 files changed, 32 insertions, 25 deletions
diff --git a/config/config.json b/config/config.json index 68810e4cc..3b28ae917 100644 --- a/config/config.json +++ b/config/config.json @@ -132,7 +132,8 @@ "PushNotificationContents": "generic", "EnableEmailBatching": false, "EmailBatchingBufferSize": 256, - "EmailBatchingInterval": 30 + "EmailBatchingInterval": 30, + "SkipServerCertificateVerification": false }, "RateLimitSettings": { "Enable": false, @@ -260,4 +261,4 @@ "TurnUsername": "", "TurnSharedKey": "" } -}
\ No newline at end of file +} diff --git a/model/config.go b/model/config.go index 8a2a5cc47..4486b64ad 100644 --- a/model/config.go +++ b/model/config.go @@ -231,27 +231,28 @@ type FileSettings struct { } type EmailSettings struct { - EnableSignUpWithEmail bool - EnableSignInWithEmail *bool - EnableSignInWithUsername *bool - SendEmailNotifications bool - RequireEmailVerification bool - FeedbackName string - FeedbackEmail string - FeedbackOrganization *string - SMTPUsername string - SMTPPassword string - SMTPServer string - SMTPPort string - ConnectionSecurity string - InviteSalt string - PasswordResetSalt string - SendPushNotifications *bool - PushNotificationServer *string - PushNotificationContents *string - EnableEmailBatching *bool - EmailBatchingBufferSize *int - EmailBatchingInterval *int + EnableSignUpWithEmail bool + EnableSignInWithEmail *bool + EnableSignInWithUsername *bool + SendEmailNotifications bool + RequireEmailVerification bool + FeedbackName string + FeedbackEmail string + FeedbackOrganization *string + SMTPUsername string + SMTPPassword string + SMTPServer string + SMTPPort string + ConnectionSecurity string + InviteSalt string + PasswordResetSalt string + SendPushNotifications *bool + PushNotificationServer *string + PushNotificationContents *string + EnableEmailBatching *bool + EmailBatchingBufferSize *int + EmailBatchingInterval *int + SkipServerCertificateVerification *bool } type RateLimitSettings struct { @@ -680,6 +681,11 @@ func (o *Config) SetDefaults() { *o.EmailSettings.EmailBatchingInterval = EMAIL_BATCHING_INTERVAL } + if o.EmailSettings.SkipServerCertificateVerification == nil { + o.EmailSettings.SkipServerCertificateVerification = new(bool) + *o.EmailSettings.SkipServerCertificateVerification = false + } + if !IsSafeLink(o.SupportSettings.TermsOfServiceLink) { o.SupportSettings.TermsOfServiceLink = nil } diff --git a/utils/mail.go b/utils/mail.go index 7e62c2c54..959a60fb2 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -25,7 +25,7 @@ func connectToSMTPServer(config *model.Config) (net.Conn, *model.AppError) { if config.EmailSettings.ConnectionSecurity == model.CONN_SECURITY_TLS { tlsconfig := &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: *config.EmailSettings.SkipServerCertificateVerification, ServerName: config.EmailSettings.SMTPServer, } @@ -56,7 +56,7 @@ func newSMTPClient(conn net.Conn, config *model.Config) (*smtp.Client, *model.Ap } } else if config.EmailSettings.ConnectionSecurity == model.CONN_SECURITY_STARTTLS { tlsconfig := &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: *config.EmailSettings.SkipServerCertificateVerification, ServerName: config.EmailSettings.SMTPServer, } c.StartTLS(tlsconfig) |