TXT & SPF Record Syntax

Chuck Aurora ca at nodns4.us
Tue Mar 2 14:42:23 UTC 2021

On 2021-02-28 17:52, Mark Andrews wrote:
> Domain names without a trailing period are relative to the current 
> origin.
> Domain names with a trailing period are absolute.

>> On 1 Mar 2021, at 10:41, Tim Daneliuk via bind-users 
>> <bind-users at lists.isc.org> wrote:
>> I am trying to understand when the LHS of a TXT record needs to be 
>> terminated with '.'.
>> For example, I see this one of the machines I am managing.  The server 
>> in question is
>> the zone authority for foo.com:
>> foo.com.             IN TXT "v=spf1 ...
>> foo.com.             IN SPF "v=spf1 ...
>> something._domainkey IN TXT "v=DKIM1 ...
>> _dmark.foo.com.      IN TXT "v=DMARC1 ...
>> Could some kind soul explain why the DKIM key name does not require 
>> the trailing period, but
>> why all the foo.com entries do?

In addition to what Mark said, you might be interested in "@".

In a zone file "@" is shorthand for the current $ORIGIN, so you could
have it like this:

;$ORIGIN example.com.
; $ORIGIN can be explicitly set anywhere in the zone file, as above, or
; if not set, it takes the value of the zone name from named.conf(5)
@              NS     ns
@              SOA    "..."
@              A
@              MX     0 mail
@              TXT    "v=spf1 ..."
mail           A
ns             A
ns             A
sel._domainkey TXT    "v=DKIM1 ..."

Each of the @ is read as "example.com.", and each unqualified name
has ".example.com." appended.  That applies on LHS and RHS, when a
record's RDATA includes a hostname (NS and MX in the example given.)

I should also point out that your question had nothing at all to do
with TXT nor SPF; it was simply about zone file syntax.  Trailing dot
applies to all records of all types.

And another nitpick, the SPF record type is deprecated.  It has been
reverted to the original method of using TXT.

More information about the bind-users mailing list