-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/smtp: NewClient should initialize tls based on the incoming connection type #22166
Comments
I believe this was just fixed for the future 1.10 release by https://golang.org/cl/68470. It will not be fixed for 1.9. Closing. Please comment if you disagree. |
@ianlancetaylor I have a local workaround which installs a PlainAuth implementation without the TLS check when the connection is already known to be encrypted. The 1.9.1 release closed the MITM vulnerability but broke a long-valid SMTP use-case. If 1.9.1 were still open, I would argue for this fix to be included. Probably doesn't justify a release on its own, but should be noted as a known problem in the 1.9.1 release notes. Folks using SMTP+SSL will need a similar workaround to mine. |
OK, reopening to consider backporting https://golang.org/cl/68470 to 1.9.2. |
+1 to backporting to 1.9.2. We got a bit more than we bargained for when we upgraded for the security fixes, and all our servers are now unable to send emails. Fortunately it's easy to create a type plainAuthOverTLSConn struct {
smtp.Auth
}
func PlainAuthOverTLSConn(identity, username, password, host string) smtp.Auth {
return &plainAuthOverTLSConn{smtp.PlainAuth(identity, username, password, host)}
}
func (a *plainAuthOverTLSConn) Start(server *smtp.ServerInfo) (string, []byte, error) {
server.TLS = true
return a.Auth.Start(server)
} |
I am now in favor of backporting to 1.9.2. |
CL 68470 OK for Go 1.9.2. |
go1.9.2 has been packaged and includes: The release is posted at golang.org/dl. — golang.org/x/build/cmd/releasebot, Oct 26 21:09:21 UTC |
What version of Go are you using (
go version
)?1.9.1
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?What did you do?
Attempted to perform SMTP PLAIN authentication over an SSL connection (without
STARTTLS
).Code resembles:
What did you expect to see?
Successful authentication and mail-sending.
What did you see instead?
Authentication failed with an "unencrypted connection" error.
This approach worked before #22134/#22133
smtp.NewClient
could look at its incomingnet.Conn
and if it is an*tls.Conn
, initializeClient.tls
as true.The text was updated successfully, but these errors were encountered: