ietf-corpus

rfc-2845

Secret Key Transaction Authentication for DNS (TSIG)

P. Vixie, O. Gudmundsson, D. Eastlake 3rd, B. Wellington
date2000-05 streamIETF areaint wgdnsext statusPROPOSED STANDARD pages15 canonicalhttps://www.rfc-editor.org/rfc/rfc2845 doi10.17487/RFC2845
This protocol allows for transaction level authentication using shared secrets and one way hashing. It can be used to authenticate dynamic updates as coming from an approved client, or to authenticate responses as coming from an approved recursive name server. [STANDARDS-TRACK]

obsoleted by

updated by

updates

Extracted elements (25)

design-rationale §3.3

Timer values (Time Signed and Fudge) are included in the digest to defend against replay attacks. Without this, an attacker could replay old messages by updating just the Time Signed and Fudge fields to make the message appear fresh.

dns, security

design-rationale §1.5

TSIG is intentionally unsuitable for general server-to-server authentication among many servers because key management becomes unwieldy as the number of shared secrets grows quadratically. It is designed for the common case of a few resolvers each talking to a small number of recursive servers.

dns, security

design-rationale §1.2

TSIG was designed as a lightweight alternative to the computationally expensive public-key signatures in RFC2535. HMAC-MD5 provides efficient point-to-point authentication suitable for stub resolvers and dynamic update clients that cannot perform full public-key cryptography.

dns, security, crypto

interoperability-note §4.1

Some older name servers will not accept requests with a non-empty additional data section. Clients SHOULD only attempt signed transactions with servers known to support TSIG and share a secret key, avoiding compatibility failures with legacy implementations.

dns, security

normative-requirement §4.7 MUST

A forwarding server that does not share the key used in the incoming TSIG MUST forward the message unchanged including the TSIG. If it does share the key, it MUST process the TSIG and, if it passes, include its own TSIG to the next destination.

dns, security

normative-requirement §4.6.2 MUST NOT

DNS resolvers MUST NOT adjust any clocks in the client based on BADTIME errors. The server's time in the Other Data field SHOULD be logged so operators can diagnose clock skew.

dns, security, ntp

normative-requirement §4.4 SHOULD

For TCP sessions, if the client does not receive TSIG records frequently enough, it SHOULD assume the connection has been hijacked and SHOULD close the connection. Subsequent TCP messages use a running digest chaining prior digest, any unsigned messages, and current TSIG Timers.

dns, security, tcp

normative-requirement §4.5.3 MUST

If a TSIG MAC fails to verify, the server MUST generate an error response with RCODE 9 (NOTAUTH) and TSIG ERROR 16 (BADSIG); this response MUST be unsigned. The server SHOULD log the error.

dns, security

normative-requirement §3.1 MUST

If a TSIG record cannot be added to a response without truncation, the server MUST alter the response to include only the question and a TSIG record, set the TC bit, and use RCODE 0 (NOERROR). The client SHOULD retry using TCP.

dns, security, tcp

normative-requirement §3.2 MUST

If an incoming message contains a TSIG record, it MUST be the last record in the additional section. Multiple TSIG records are not allowed. If a TSIG record is in any other position, the packet is dropped and a response with RCODE 1 (FORMERR) MUST be returned.

dns, security

normative-requirement §4.7 MUST

If no transaction security is available to the destination and the response has the AD flag set, the forwarding server MUST unset the AD flag before adding its own TSIG to the answer.

dns, security

normative-requirement §3.2 MUST

If the algorithm name or key name is unknown, or if message digests do not match, the whole DNS message MUST be discarded. If the message is a query, a response with RCODE 9 (NOTAUTH) MUST be returned with TSIG ERROR 17 (BADKEY) or 16 (BADSIG).

dns, security

normative-requirement §4.5.2 MUST

If the server time is outside the interval (Time Signed ± Fudge), the server MUST respond with RCODE 9 (NOTAUTH) and TSIG ERROR 18 (BADTIME). The BADTIME response MUST be signed with the same key as the request and MUST include the server's current time in the Other Data field (6 octets, u_int48_t).

dns, security, ntp

normative-requirement §4.4 MUST

On a TCP connection, TSIG MUST be included on the first and last DNS envelopes. It MUST be placed on at least every 100th envelope. If a client TSIG verification fails, the client MUST close the connection.

dns, security, tcp

normative-requirement §2.2 MUST

The only mandatory message digest algorithm specified is HMAC-MD5 (per RFC1321 and RFC2104). Implementations MUST implement HMAC-MD5 for interoperability; other algorithms may be defined later but MUST be registered with IANA.

dns, crypto, security

normative-requirement §4.2 MUST NOT

The server MUST NOT generate a signed response to an unsigned request. When generating a response to a signed request, the digest components are: Request MAC, DNS Message (response), TSIG Variables (response).

dns, security

normative-requirement §4.5 MUST

Upon receipt, the server MUST perform checks in this order: check KEY, check TIME values, check MAC. If a server does not recognize the key, it MUST respond with RCODE 9 (NOTAUTH) and TSIG ERROR 17 (BADKEY), unsigned.

dns, security

protocol-element §3.4

The TSIG digest covers: the full DNS message (before TSIG is appended), TSIG Variables (key name, class, TTL, algorithm name, time signed, fudge, error, other len, other data), and for responses also the Request MAC. Components are fed into the hash as a continuous octet stream with no interfield padding.

dns, security, crypto

protocol-element §2.1

TSIG is a new DNS RR type with type code 250 (mnemonic TSIG). It is a meta-RR used for transaction-level authentication between DNS entities sharing a secret key; it MUST NOT be cached and is discarded after use.

dns, security

registry §7

IANA is to create and maintain a registry of TSIG Error values. Initial values are: 0–15 (DNS RCODEs), 16 (BADSIG), 17 (BADKEY), 18 (BADTIME). New error codes assigned via IETF Consensus.

dns, registry

security-consideration §6.2

Shared secret keys must be protected like private keys. Secrets should never be shared by more than two entities, never transmitted in the clear, and should be stored in encrypted form where possible. Compromised client hosts require the server to suspend all secrets known to that client.

dns, security

security-consideration §5.3

Strong random shared secrets are essential; the secret MUST be at least as long as the keyed message digest — 16 bytes for HMAC-MD5, 20 bytes for HMAC-SHA1 (per RFC1750). Secrets should be changed periodically.

dns, security, crypto

security-consideration §6.4

The Fudge value trades off security against operational reliability. A too-large Fudge opens the server to replay attacks; a too-small Fudge causes failures on unsynchronized clocks or delayed networks. The recommended value is 300 seconds.

dns, security

security-consideration §6.3

TSIG only authenticates transmission between two parties sharing a secret; it does not authenticate the original source data. A compromised zone master or caching forwarder can still inject corrupt data unless full RFC2535 security checks are performed end-to-end.

dns, security

wire-format §2.3

TSIG RDATA contains: Algorithm Name (domain-name), Time Signed (u_int48_t, seconds since epoch), Fudge (u_int16_t), MAC Size (u_int16_t), MAC (octet stream), Original ID (u_int16_t), Error (u_int16_t), Other Len (u_int16_t), Other Data (octet stream). All multi-octet integers are in network byte order.

dns, security