On 2012-12-08 at 02:51 -0800, Lars Pensjö wrote:
> If I decide to trust it anyway, how can I make smtp.SendMail() accept it?
>
> I don't know much about certificates, and how they are involved in the SMTP
> protocol.
Badly.
There are two distinct modes of using SMTP. Mode 1 is "delivery to MX
for a domain", mode 2 is "initial submission of a message by the
author".
Mode 2 usage _should_ be happening on port 587 (instead of 25) and the
mail server operator should be using a certificate from an authority
trusted by all their users. In this case, SMTP usage of certificates is
very much like any normal application's usage of TLS certificates.
There's no problem, beyond server mis-configuration.
The mode 1 usage has protocol-level issues about choosing a trustworthy
name for verification. In the typical case, these names are not
verified at all, which means that SMTP/TLS is vulnerable to
man-in-the-middle attacks.
For Go, you create a TLS config and set the InsecureSkipVerify bool to
true. Promoting a rawConn connection might be done with:
cfg := &tls.Config{ServerName: "
mx.example.org", InsecureSkipVerify: true}
tlsConn := tls.Client(rawConn, cfg)
If you're interested, then:
http://tools.ietf.org/html/draft-fanf-dane-smtp
is the only current proposal for fixing the TLS naming issue for SMTP on
the MX port; it requires DNSSEC and use of TLSA records.
-Phil