I want to create one include with SPF IP address to be used from all dns zones in my server. Can you suggest me how to do it? I work on BIND9. Thank you.
1 Answer
There are two approaches:
- The bind zone file syntax provides an
$INCLUDE
statement to "include" content/resource records from a different file into the zone.
See for example: https://www.zytrax.com/books/dns/ch8/include.html where the zone file for the uk.example.com zone includes a second file /var/named/include.txt
$ORIGIN uk.example.com.
@ IN NS ns2.example.com.
; ns2.example.com services uk.example.com
$INCLUDE /var/named/include.txt ; absolute path
...
ftp IN A 192.168.35.16
That second file, /var/named/include.txt
can then be something like:
# when this /var/named/include.txt is included
# it sets up a generic SPF record for the zone
@ IN TXT "v=spf1 a mx ip4:10.9.8.7 -all
# EOF /var/named/include.txt
The alternative approach uses the native SPF
include
directive to include the SPF record values from another domain:"v=spf1 a mx include:example.com. -all
A similar alternative approach uses the native SPF
redirect
directive to use the SPF record from another domain:"v=spf1 redirect=example.com
Both the native SPF methods come with their own caveats, explained here: https://dmarcian.com/spf-syntax-table/