PLT-5904 (Server): Config flag for SMTP Cert Check. (#5857)

This commit is contained in:
George Goldberg
2017-03-27 08:43:27 -03:00
committed by enahum
parent 01aaccb340
commit b489a5bb01
3 changed files with 32 additions and 25 deletions
+3 -2
View File
@@ -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": ""
}
}
}
+27 -21
View File
@@ -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
}
+2 -2
View File
@@ -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)