mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Add SPF flattening feature. (#126)
This commit is contained in:
committed by
Tom Limoncelli
parent
707f7e5d99
commit
823e8bb1a3
@@ -1,66 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/pkg/dnsresolver"
|
||||
"github.com/StackExchange/dnscontrol/pkg/spflib"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
h := dnsresolver.NewResolverLive("spf-store.json")
|
||||
fmt.Println(h.GetTxt("_spf.google.com"))
|
||||
fmt.Println(h.GetTxt("spf-basic.fogcreek.com"))
|
||||
h.Close()
|
||||
|
||||
i, err := dnsresolver.NewResolverPreloaded("spf-store.json")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(i.GetTxt("_spf.google.com"))
|
||||
fmt.Println(i.GetTxt("spf-basic.fogcreek.com"))
|
||||
fmt.Println(i.GetTxt("wontbefound"))
|
||||
|
||||
fmt.Println()
|
||||
fmt.Println("---------------------")
|
||||
fmt.Println()
|
||||
|
||||
//res := dnsresolver.NewResolverLive("spf-store2.json")
|
||||
res, err := dnsresolver.NewResolverPreloaded("spf-store2.json")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
rec, err := spflib.Parse(strings.Join([]string{"v=spf1",
|
||||
"ip4:198.252.206.0/24",
|
||||
"ip4:192.111.0.0/24",
|
||||
"include:_spf.google.com",
|
||||
"include:mailgun.org",
|
||||
"include:spf-basic.fogcreek.com",
|
||||
"include:mail.zendesk.com",
|
||||
"include:servers.mcsv.net",
|
||||
"include:sendgrid.net",
|
||||
"include:spf.mtasv.net",
|
||||
"~all"}, " "), res)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
spflib.DumpSPF(rec, "")
|
||||
|
||||
fmt.Println()
|
||||
fmt.Println("---------------------")
|
||||
fmt.Println()
|
||||
|
||||
var spf string
|
||||
spf, err = spflib.Lookup("whatexit.org", res)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
rec, err = spflib.Parse(spf, res)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
spflib.DumpSPF(rec, "")
|
||||
//res.Close()
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"_spf.google.com": {
|
||||
"txt": [
|
||||
"v=spf1 include:_netblocks.google.com include:_netblocks2.google.com include:_netblocks3.google.com ~all"
|
||||
]
|
||||
},
|
||||
"spf-basic.fogcreek.com": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:64.34.80.172 -all"
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
{
|
||||
"_netblocks.google.com": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:64.18.0.0/20 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:207.126.144.0/20 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all"
|
||||
]
|
||||
},
|
||||
"_netblocks2.google.com": {
|
||||
"txt": [
|
||||
"v=spf1 ip6:2001:4860:4000::/36 ip6:2404:6800:4000::/36 ip6:2607:f8b0:4000::/36 ip6:2800:3f0:4000::/36 ip6:2a00:1450:4000::/36 ip6:2c0f:fb50:4000::/36 ~all"
|
||||
]
|
||||
},
|
||||
"_netblocks3.google.com": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:172.217.0.0/19 ip4:108.177.96.0/19 ~all"
|
||||
]
|
||||
},
|
||||
"_spf.google.com": {
|
||||
"txt": [
|
||||
"v=spf1 include:_netblocks.google.com include:_netblocks2.google.com include:_netblocks3.google.com ~all"
|
||||
]
|
||||
},
|
||||
"mail.zendesk.com": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:192.161.144.0/20 ip4:185.12.80.0/22 ip4:96.46.150.192/27 ip4:174.137.46.0/24 ip4:188.172.128.0/20 ip4:216.198.0.0/18 ~all"
|
||||
]
|
||||
},
|
||||
"mailgun.org": {
|
||||
"txt": [
|
||||
"google-site-verification=FIGVOKZm6lQFDBJaiC2DdwvBy8TInunoGCt-1gnL4PA",
|
||||
"v=spf1 include:spf1.mailgun.org include:spf2.mailgun.org ~all"
|
||||
]
|
||||
},
|
||||
"sendgrid.net": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:167.89.0.0/17 ip4:208.117.48.0/20 ip4:50.31.32.0/19 ip4:198.37.144.0/20 ip4:198.21.0.0/21 ip4:192.254.112.0/20 ip4:168.245.0.0/17 ~all",
|
||||
"google-site-verification=NxyooVvVaIgddVa23KTlOEuVPuhffcDqJFV8RzWrAys"
|
||||
]
|
||||
},
|
||||
"servers.mcsv.net": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:205.201.128.0/20 ip4:198.2.128.0/18 ip4:148.105.8.0/21 ?all"
|
||||
]
|
||||
},
|
||||
"spf-basic.fogcreek.com": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:64.34.80.172 -all"
|
||||
]
|
||||
},
|
||||
"spf.mtasv.net": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:50.31.156.96/27 ip4:104.245.209.192/26 ~all"
|
||||
]
|
||||
},
|
||||
"spf1.mailgun.org": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:173.193.210.32/27 ip4:50.23.218.192/27 ip4:174.37.226.64/27 ip4:208.43.239.136/30 ip4:184.173.105.0/24 ip4:184.173.153.0/24 ip4:104.130.122.0/23 ip4:146.20.112.0/26 ~all"
|
||||
]
|
||||
},
|
||||
"spf2.mailgun.org": {
|
||||
"txt": [
|
||||
"v=spf1 ip4:209.61.151.0/24 ip4:166.78.68.0/22 ip4:198.61.254.0/23 ip4:192.237.158.0/23 ip4:23.253.182.0/23 ip4:104.130.96.0/28 ip4:146.20.113.0/24 ip4:146.20.191.0/24 ~all"
|
||||
]
|
||||
},
|
||||
"whatexit.org": {
|
||||
"txt": [
|
||||
"v=spf1 ip6:2607:f2f8:a9c0::3 ip4:174.136.107.195 include:servers.mcsv.net include:_spf.google.com mx:evite.com -all"
|
||||
]
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user