PLT-5904 (Server): Config flag for SMTP Cert Check. (#5857)
Этот коммит содержится в:
коммит произвёл
enahum
родитель
01aaccb340
Коммит
b489a5bb01
@@ -132,7 +132,8 @@
|
|||||||
"PushNotificationContents": "generic",
|
"PushNotificationContents": "generic",
|
||||||
"EnableEmailBatching": false,
|
"EnableEmailBatching": false,
|
||||||
"EmailBatchingBufferSize": 256,
|
"EmailBatchingBufferSize": 256,
|
||||||
"EmailBatchingInterval": 30
|
"EmailBatchingInterval": 30,
|
||||||
|
"SkipServerCertificateVerification": false
|
||||||
},
|
},
|
||||||
"RateLimitSettings": {
|
"RateLimitSettings": {
|
||||||
"Enable": false,
|
"Enable": false,
|
||||||
@@ -260,4 +261,4 @@
|
|||||||
"TurnUsername": "",
|
"TurnUsername": "",
|
||||||
"TurnSharedKey": ""
|
"TurnSharedKey": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,27 +231,28 @@ type FileSettings struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type EmailSettings struct {
|
type EmailSettings struct {
|
||||||
EnableSignUpWithEmail bool
|
EnableSignUpWithEmail bool
|
||||||
EnableSignInWithEmail *bool
|
EnableSignInWithEmail *bool
|
||||||
EnableSignInWithUsername *bool
|
EnableSignInWithUsername *bool
|
||||||
SendEmailNotifications bool
|
SendEmailNotifications bool
|
||||||
RequireEmailVerification bool
|
RequireEmailVerification bool
|
||||||
FeedbackName string
|
FeedbackName string
|
||||||
FeedbackEmail string
|
FeedbackEmail string
|
||||||
FeedbackOrganization *string
|
FeedbackOrganization *string
|
||||||
SMTPUsername string
|
SMTPUsername string
|
||||||
SMTPPassword string
|
SMTPPassword string
|
||||||
SMTPServer string
|
SMTPServer string
|
||||||
SMTPPort string
|
SMTPPort string
|
||||||
ConnectionSecurity string
|
ConnectionSecurity string
|
||||||
InviteSalt string
|
InviteSalt string
|
||||||
PasswordResetSalt string
|
PasswordResetSalt string
|
||||||
SendPushNotifications *bool
|
SendPushNotifications *bool
|
||||||
PushNotificationServer *string
|
PushNotificationServer *string
|
||||||
PushNotificationContents *string
|
PushNotificationContents *string
|
||||||
EnableEmailBatching *bool
|
EnableEmailBatching *bool
|
||||||
EmailBatchingBufferSize *int
|
EmailBatchingBufferSize *int
|
||||||
EmailBatchingInterval *int
|
EmailBatchingInterval *int
|
||||||
|
SkipServerCertificateVerification *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type RateLimitSettings struct {
|
type RateLimitSettings struct {
|
||||||
@@ -680,6 +681,11 @@ func (o *Config) SetDefaults() {
|
|||||||
*o.EmailSettings.EmailBatchingInterval = EMAIL_BATCHING_INTERVAL
|
*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) {
|
if !IsSafeLink(o.SupportSettings.TermsOfServiceLink) {
|
||||||
o.SupportSettings.TermsOfServiceLink = nil
|
o.SupportSettings.TermsOfServiceLink = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func connectToSMTPServer(config *model.Config) (net.Conn, *model.AppError) {
|
|||||||
|
|
||||||
if config.EmailSettings.ConnectionSecurity == model.CONN_SECURITY_TLS {
|
if config.EmailSettings.ConnectionSecurity == model.CONN_SECURITY_TLS {
|
||||||
tlsconfig := &tls.Config{
|
tlsconfig := &tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: *config.EmailSettings.SkipServerCertificateVerification,
|
||||||
ServerName: config.EmailSettings.SMTPServer,
|
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 {
|
} else if config.EmailSettings.ConnectionSecurity == model.CONN_SECURITY_STARTTLS {
|
||||||
tlsconfig := &tls.Config{
|
tlsconfig := &tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: *config.EmailSettings.SkipServerCertificateVerification,
|
||||||
ServerName: config.EmailSettings.SMTPServer,
|
ServerName: config.EmailSettings.SMTPServer,
|
||||||
}
|
}
|
||||||
c.StartTLS(tlsconfig)
|
c.StartTLS(tlsconfig)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user