You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if clients of the net/smtp package could access the TLS connection state in order to implement server certificate hash checking with STARTTLS. Currently net/smtp's (c *Client) does not expose the conn field, which is set during (c *Client) StartTLS(). https://github.com/golang/go/blob/go1.4/src/net/smtp/smtp.go#L154
I ended up forking net/smtp in order to access the TLS connection state after STARTTLS, which is a lot of code duplication for such a small change. If this isn't too esoteric, an additional method on smtp's Client struct could expose the connection state to clients of the package, making server certificate hash verification possible.
The text was updated successfully, but these errors were encountered:
mikioh
changed the title
net/smtp STARTTLS with server certificate hash pinning
net/smtp: STARTTLS with server certificate hash pinning
Dec 27, 2014
Apologies, @bradfitz , but I think my issue report suggested a naive fix and I'd like to bring this up now before the API change introduced with 26d5573 becomes part of the permanent stdlib API per the point release backwards compatibility guarantee. You may want to revert that change.
Two things stand out to me now that I've looked through the open issues for crypto/tls:
Using the TLSConnectionState accessor might allow for TOC/TOU races if crypto/tls ever implements renegotiation (see crypto/tls: does not support renegotiation #5742 ). That is, if TLS renegotiation occurs after smtp client.TLSConnectionState() but before smtp client.Auth(), the application could get a false negative (in terms of cert pinning) if the server switches certs.
It would be nice if clients of the net/smtp package could access the TLS connection state in order to implement server certificate hash checking with STARTTLS. Currently net/smtp's
(c *Client)
does not expose theconn
field, which is set during(c *Client) StartTLS()
.https://github.com/golang/go/blob/go1.4/src/net/smtp/smtp.go#L154
As an example, this is the kind of server certificate hash checking I'd like to do with net/smtp:
https://github.com/agl/xmpp/blob/a5b10608a5c441a99c6380efa91d7f4fb517e9c2/xmpp.go#L509-517
I ended up forking net/smtp in order to access the TLS connection state after STARTTLS, which is a lot of code duplication for such a small change. If this isn't too esoteric, an additional method on smtp's Client struct could expose the connection state to clients of the package, making server certificate hash verification possible.
The text was updated successfully, but these errors were encountered: