[TOP TIP] Consolidate SPF records from multiple domains into one

What happens when you have lots and lots of domains (try 10+ or even 100+ or more) and you want to change their SPF TXT records? Potentially, you could just edit each one, if you don't mind repetitive, boring tasks and you are also an immortal vampire with infinite amounts of free time. Even then, you'd still need to go out at night to feed.

The solution, is to use a single SPF TXT record that contains all your records and making individual domains point to that specific record by using the include option. The same method is being used by popular services, like MailChip and Gmail.

Step 1: Create the _spf record

Create an SPF record named "spf.domain.tld". In case you are using the Linode DNS Manager, create an SPF record and in the Name field type just spf. If you are using cPanel then use the DNS zone editor and in the first field use the full domain like _spf.domain.tld.

The value of the SPF record is where we merge all SPF records into one, for example: v=spf1 ip4:192.168.1.1 ip4:192.168.2.2 -all. You could list a single IP address for your email server or public facing cluster address, or you could list all individual IP addresses, it all depends on your setup and requirements/specifications. In some cases you could get away with just v=spf1 a mx -all. But how to write SPF line is not within the scope of this post.

Step 2: Set individual domain records

Remember all those 10+ or 100+ domains? Now its time you set them all, to point to the record above. Simply set the Name field as empty and the Value field to: v=spf1 include:_spf.domain.tld -all, repeat this step for any subdomains that you may have.

Now when a remote server checks your SPF record, it will parse the include option, resolve the _spf.domain.tld TXT record, which will in turn produce your desired SPF value. Any future changes may now be done to a SINGLE record and the change will affect all your servers at once.

Enjoy!

PS:

Be warned, if you use the Linode DNS Manager, then the value field SHOULD NOT have quotes, but if you use the cPanel DNS zone editor then quotes ARE REQUIRED. No vampires were harmed during the making of this post.

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct