TSIG Record
Transaction Signature
- Type code
- 250
- Status
- Query or pseudo-record type, never stored in a zone
- Defined in
- RFC 8945
What the TSIG record is for
TSIG signs a DNS message with an HMAC over the message and a shared secret. It is used between servers and tools that already share a key: to authenticate zone transfers between primary and secondary servers, dynamic updates (RFC 2136), and sometimes queries from a trusted client.
The TSIG record is added as the last record in the additional section of a message. Its owner name is the name of the key, its class is ANY and its TTL is 0. It is built for each message and is not cached or loaded from a zone file.
The receiver checks the MAC and that the time signed is within the fudge window of its own clock. RFC 8945 makes hmac-sha256 mandatory to implement and says HMAC-MD5 must not be used.
Wire format and fields
| Field | Size | Meaning |
|---|---|---|
| Algorithm Name | domain name | The MAC algorithm, e.g. hmac-sha256. |
| Time Signed | 48 bits | Seconds since 1 January 1970 UTC when the message was signed. |
| Fudge | 16 bits | The allowed clock difference in seconds; RFC 8945 recommends 300. |
| MAC Size | 16 bits | The length of the MAC in octets. |
| MAC | variable | The message authentication code. |
| Original ID | 16 bits | The message ID of the original message, so the MAC can be checked after a forwarder changes the ID. |
| Error | 16 bits | The extended RCODE, e.g. BADSIG, BADKEY or BADTIME. |
| Other Len | 16 bits | The length of Other Data in octets. |
| Other Data | variable | Empty, except in a BADTIME error, where it carries the server's current time. |
The owner name of the TSIG record is the key name, its CLASS is ANY and its TTL is 0. It must be the last record in the additional section.
Common mistakes
- Letting server clocks drift. A difference larger than the fudge (usually 300 seconds) makes every signed message fail with BADTIME.
- Configuring the same secret but a different key name or algorithm on each side. All three must match, or the receiver returns BADKEY.
- Still using hmac-md5 keys. RFC 8945 says HMAC-MD5 must not be used; generate hmac-sha256 keys instead.
- Leaving the key secret in a world-readable config file or committing it to a repository. Anyone with it can transfer or update the zone.
Specifications
- RFC 8945: Secret Key Transaction Authentication for DNS (TSIG)
- RFC 3645: Generic Security Service Algorithm for Secret Key Transaction Authentication for DNS (GSS-TSIG) (Defines the gss-tsig algorithm, which uses Kerberos instead of a static shared key.)
- IANA DNS Resource Record (RR) TYPEs registry: type code and status
Related record types
Domain Intelligence APIs
Get started with our easy-to-use API docs.