author | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-10-26 21:59:22 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-11-01 23:56:04 UTC |
parent | 54cce0c2bf1003f7e102660afa3488a5efe952b5 |
cmd/smtp-check/smtp-check.go | +15 | -2 |
diff --git a/cmd/smtp-check/smtp-check.go b/cmd/smtp-check/smtp-check.go index 6570c89..a9cc7af 100644 --- a/cmd/smtp-check/smtp-check.go +++ b/cmd/smtp-check/smtp-check.go @@ -8,6 +8,7 @@ import ( "net" "net/smtp" + "blitiri.com.ar/go/chasquid/internal/spf" "blitiri.com.ar/go/chasquid/internal/tlsconst" "golang.org/x/net/idna" @@ -43,6 +44,18 @@ func main() { for _, mx := range mxs { log.Printf("=== Testing MX: %2d %s", mx.Pref, mx.Host) + ips, err := net.LookupIP(mx.Host) + if err != nil { + log.Fatal(err) + } + for _, ip := range ips { + result, err := spf.CheckHost(ip, domain) + if result != spf.Pass { + log.Printf("SPF check != pass for IP %s: %s - %s", + ip, result, err) + } + } + c, err := smtp.Dial(mx.Host + ":" + *port) if err != nil { log.Fatal(err) @@ -55,11 +68,11 @@ func main() { } err = c.StartTLS(config) if err != nil { - log.Fatal(err) + log.Fatalf("TLS error: %v", err) } cstate, _ := c.TLSConnectionState() - log.Printf("%s - %s", tlsconst.VersionName(cstate.Version), + log.Printf("TLS OK: %s - %s", tlsconst.VersionName(cstate.Version), tlsconst.CipherSuiteName(cstate.CipherSuite)) log.Printf("")