RFC 9953

DNS over CoAP (DoC)

๐Ÿ“… published March 2026, from ietf

RFC 9953: DNS over CoAP (DoC) ๐Ÿ’–

Okay bestie, let's get into it! ๐ŸŽ€ This is part 1 of 6.


  • RFC number: 9953 โœจ
  • Title: DNS over CoAP (DoC)
  • Authors: M. S. Lenders (TU Dresden), C. Amsรผss, C. GรผndoฤŸan (NeuralAgent GmbH), T. C. Schmidt (HAW Hamburg), and M. Wรคhlisch (TU Dresden & Barkhausen Institut)
  • Category: Standards Track ๐Ÿฆ‹
  • ISSN: 2070-1721
  • Date: March 2026
  • Obsoletes/Updates: The title block doesn't list anything being obsoleted or updated ๐Ÿ™ˆ

Abstract ๐ŸŒธ

So this doc defines a way to send DNS queries (OPCODE 0) over the Constrained Application Protocol (CoAP). ๐Ÿ’… The CoAP messages can be protected with (D)TLS-Secured CoAP or Object Security for Constrained RESTful Environments (OSCORE), so you get encrypted DNS message exchange for constrained devices in the Internet of Things (IoT). It's giving private DNS for tiny devices ๐Ÿซถ

Status of This Memo ๐Ÿ“œ

This is an Internet Standards Track document. โœจ

It's a product of the Internet Engineering Task Force (IETF), and it represents the consensus of the IETF community. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG). If you want more info on Internet Standards, check out Section 2 of RFC 7841.

For the current status of this document, any errata, and how to give feedback, go to https://www.rfc-editor.org/info/rfc9953.

Copyright (c) 2026 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, because they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions, and they are provided without warranty as described in the Revised BSD License.

Table of Contents ๐Ÿ—‚๏ธ

1.  Introduction
2.  Terminology and Conventions
3.  Selection of a DoC Server
  3.1.  Discovery by Resource Type
  3.2.  Discovery Using SVCB Resource Records or DNR
    3.2.1.  Examples
4.  Basic Message Exchange
  4.1.  The "application/dns-message" Content-Format
  4.2.  DNS Queries in CoAP Requests
    4.2.1.  Request Format
    4.2.2.  Support of CoAP Caching
    4.2.3.  Example
  4.3.  DNS Responses in CoAP Responses
    4.3.1.  Response Codes and Handling DNS and CoAP Errors
    4.3.2.  Support of CoAP Caching
    4.3.3.  Examples
5.  Interaction with Other CoAP and CoRE Features
  5.1.  DNS Push Notifications and CoAP Observe
  5.2.  OSCORE
  5.3.  Mapping DoC to DoH
6.  Considerations for Unprotected Use
7.  Security Considerations
8.  IANA Considerations
  8.1.  CoAP Content-Formats Registry
  8.2.  DNS SVBC Service Parameter Keys (SvcParamKeys) Registry
  8.3.  Resource Type (rt=) Link Target Attribute Values Registry
9.  Operational Considerations
  9.1.  Coexistence of Different DNS and CoAP Transports
  9.2.  Redirects
  9.3.  Proxy Hop Limit
  9.4.  Error Handling
  9.5.  DNS Extensions
10. References
  10.1.  Normative References
  10.2.  Informative References
Appendix A.  Evaluation
Acknowledgments
Authors' Addresses

1. Introduction ๐ŸŒˆ

Okay so, this doc defines DNS over CoAP (DoC), which is a protocol for sending DNS [STD13] queries and getting DNS responses back over the Constrained Application Protocol (CoAP) [RFC7252], using OPCODE 0 (Query). Each DNS query-response pair maps onto one CoAP message exchange. Each CoAP message can be secured by any combination of DTLS 1.2 or newer [RFC6347] [RFC9147], TLS 1.3 or newer [RFC8323] [RFC8446], or Object Security for Constrained RESTful Environments (OSCORE) [RFC8613], so you get message integrity and confidentiality. ๐Ÿ”

DoC is inspired by DNS over HTTPS (DoH) [RFC8484], but it's built for the constrained Internet of Things (IoT), where the requirements of HTTPS usually clash with what the devices can handle. ๐Ÿ˜ญ Constrained IoT devices can be limited in memory, power consumption, link-layer frame sizes, throughput, and latency. They might only have a handful of kilobytes of both RAM and ROM. They may also sleep for long stretches, and then they have to refresh the named resources they know about. So name resolution in these scenarios has to account for link-layer frame sizes of only a few hundred bytes, bit rates in the magnitude of kilobits per second, and latencies of several seconds [RFC7228] [RFC7228bis]. Very tight! ๐Ÿ’€

To avoid the TCP and HTTPS overhead, constrained IoT devices could use DNS over DTLS [RFC8094]. DoC is different: it can take advantage of CoAP features to deal with the drawbacks of datagram-based communication. โœจ Those features include (1) block-wise transfer [RFC7959], which solves the Path MTU problem of DNS over DTLS (see [RFC8094], Section 5), (2) CoAP proxies, which provide an extra level of caching, and (3) reuse of data structures for application traffic and DNS information, which saves memory on constrained devices. Main character energy ๐Ÿ‘‘

DNS over DTLS [RFC8094] and DNS over QUIC [RFC9250] both need the DTLS or TLS machinery on top of UDP, which is heavy. So DoC allows for lightweight message protection based on OSCORE instead. ๐Ÿฆ‹

              . FETCH coaps://[2001:db8::1]/
             /
            /
          CoAP request
+------+  [DNS query]  +------+------+   DNS query     .--------------.
| DoC  |-------------->| DoC  | DNS  |--- --- --- --->|      DNS       |
|Client|<--------------|Server|Client|<--- --- --- ---| Infrastructure |
+------+ CoAP response +------+------+  DNS response   '--------------'
         [DNS response]
   \                         / \                                    /
    '-----DNS over CoAP-----'   '----DNS over UDP/HTTPS/QUIC/...---'

                   Figure 1: Basic DoC Architecture

So here's the big picture ๐Ÿ–ผ๏ธ A DoC client tries to resolve DNS information by sending DNS queries inside CoAP requests to a DoC server. That DoC server can be the authoritative name server for the queried record, or it can be a DNS client (a stub or recursive resolver) that gets the answers using other DNS transports, like DNS over UDP [STD13], DNS over HTTPS [RFC8484], or DNS over QUIC [RFC9250] when it talks to the upstream DNS infrastructure. With that info, the DoC server sends DNS responses back to the DoC client, carried inside CoAP responses. A DoC server MAY also act as a DNSSEC validator, which gives DNSSEC validation to the more constrained DoC clients. Such a helpful bestie ๐Ÿซถ

Note that this spec is distinct from DoH, because it uses the CoAP-specific FETCH method [RFC8132]. The benefit is that the DNS query goes in the body, like with POST, but you still get the caching advantages of responses to requests that use GET. Having the query in the body means there's no need for extra base64 encoding, which would make the code more complex and the messages bigger. It also allows block-wise transfer of queries [RFC7959]. It's so clean ๐Ÿ˜ญโœจ

2. Terminology and Conventions ๐Ÿ“š

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. ๐Ÿ’œ

A server that provides the service in this document is called a "DoC server", to tell it apart from a classic "DNS server". A DoC server acts as either a DNS stub resolver or a DNS recursive resolver [BCP219]. So the DoC server talks to an "upstream DNS infrastructure" or a single "upstream DNS server". A "DoC resource" is a CoAP resource [RFC7252] at the DoC server that DoC clients can target when they want to send a DNS query in a CoAP request. ๐ŸŽฏ

A client that uses the service in this document to retrieve DNS information is called a "DoC client". ๐Ÿงš

The term "constrained nodes" is used as defined in [RFC7228]. [RFC6690] describes how Constrained RESTful Environments (CoRE) realize the Representational State Transfer (REST) architecture [REST] in a form that suits these constrained nodes. ๐ŸŒธ

A DoC server can provide Observe capabilities, as defined in [RFC7641], Section 1.2. As part of that, it keeps a "list of observers". DoC clients that use these capabilities are "observers", as defined in [RFC7641], Section 1.2. A "notification" is a CoAP response message with an Observe option; see [RFC7641], Section 4.2. ๐Ÿ‘€

The terms "payload" and "body" are used as defined in [RFC7959], Section 2. When block-wise transfer isn't used, the terms "payload" and "body" should be understood as equal. ๐Ÿ“

In the examples in this document, the binary payload and resource records are shown in hexadecimal, plus a human-readable format for easier reading. But in the actual messages sent and received, they're encoded in the binary message format defined in [STD13]. Just so you know what you're looking at ๐Ÿ™ˆ

3. Selection of a DoC Server ๐ŸŽ€

There's no path specified for the DoC resource, but it is RECOMMENDED to use the root path "/" to keep the CoAP requests small. Small and cute ๐Ÿฅน

The DoC client needs to know the DoC server and the DoC resource on that server. There are a couple of options to make sure of this: (1) manual configuration of a Uniform Resource Identifier (URI) [RFC3986] or Constrained Resource Identifier (CRI) [CRI], or (2) automatic configuration, e.g., using a CoRE resource directory [RFC9176], DHCP or Router Advertisement options [RFC9463], or discovery of designated resolvers [RFC9462]. Automatic configuration MUST only be done from a trusted source. This part is really important, so please don't skip it! โš ๏ธ

Heads up: automatic configuration MUST only come from a trusted source. No vibes-based config, fr fr ๐Ÿ’€

3.1. Discovery by Resource Type ๐Ÿ”

For discovering the DoC resource through a link mechanism that lets you describe a resource type (for example, the Resource Type attribute in [RFC6690]), this document introduces the resource type "core.dns". It can be used to identify a generic DNS resolver that's available to the client. Simple, iconic, and easy to find โœจ

(Part 2 is coming up next, bestie! ๐Ÿซถ)

3.2. Discovery Using SVCB Resource Records or DNR โœจ

Okay bestie, there's another way to find a DoC server ๐Ÿซถ A DoC server can be discovered using Service Binding (SVCB) Resource Records (RRs) [RFC9460] [RFC9461] that get resolved through another DNS service (like an unencrypted local resolver ๐ŸŒธ), or through Discovery of Network-designated Resolvers (DNR) Service Parameters [RFC9463] delivered via DHCP or Router Advertisements. [RFC8323] defines the Application-Layer Protocol Negotiation (ALPN) ID for CoAP over TLS servers, and [RFC9952] defines the ALPN ID for CoAP over DTLS servers. DoC servers that use only OSCORE [RFC8613] and Ephemeral Diffie-Hellman Over COSE (EDHOC) [RFC9528] to support security can't be discovered with these SVCB RR or DNR mechanisms ๐Ÿ’€ (COSE stands for "Concise Binary Object Notation (CBOR) Object Signing and Encryption" [RFC9052]). Specifying an alternate discovery mechanism is out of the scope of this document, so that's a different story ๐Ÿงš

This document is not an SVCB mapping document for the CoAP schemes as defined in Section 2.4.3 of [RFC9460]. A full SVCB mapping is specified in [TRANSPORT-IND], which generalizes mechanisms for all CoAP services. This document only introduces the discovery of DoC services ๐Ÿ’œ

This document specifies "docpath" as a single-valued Service Parameter Key (SvcParamKey) that is mandatory for DoC SVCB records. If the "docpath" SvcParamKey is absent, the service should not be considered a valid DoC service ๐Ÿ™ˆ

The docpath is divided up into segments of the absolute path to the DoC resource (docpath-segment), each one a sequence of 1-255 octets. In ABNF [RFC5234]:

docpath-segment = 1*255OCTET

Note that this restricts the length of each docpath-segment to at most 255 octets. Paths with longer segments cannot be advertised with the "docpath" SvcParam, so they are NOT RECOMMENDED for the path to the DoC resource ๐Ÿšซ

The presentation format value of "docpath" SHALL be a comma-separated list (Appendix A.1 of [RFC9460]) of 0 or more docpath-segments. The root path "/" is represented by 0 docpath-segments, i.e., an empty list. The same considerations apply for the "," and "" characters in docpath-segments for zone-file implementations, and for the alpn-ids in an "alpn" SvcParam (Section 7.1.1 of [RFC9460]) ๐ŸŽ€

The wire-format value for "docpath" consists of 0 or more sequences of octets, each prefixed by its length as a single octet. We call this single octet the length octet. The length octet and the corresponding sequence form a length-value pair, and these length-value pairs are concatenated to form the SvcParamValue. These pairs MUST exactly fill the SvcParamValue; otherwise, the SvcParamValue is malformed ๐Ÿ˜ญ Each length-value pair represents one segment of the absolute path to the DoC resource. The root path "/" is represented by 0 length-value pairs, i.e., SvcParamValue length 0.

Note that this format uses the same encoding as the "alpn" SvcParam, so it can reuse the decoders and encoders for that SvcParam, with the adaption that a length of zero is allowed. As long as each docpath-segment has a length between 0 and 23 octets, inclusive, it's easily transferred into the path representation in CRIs [CRI] by masking each length octet with the CBOR text string major type 3 (0x60 as an octet; see [RFC8949]). It's also easily transferable into a sequence of CoAP Uri-Path options by mapping each length octet into the Option Delta and Option Length of the corresponding CoAP Uri-Path option, provided the docpath-segments are all between 0 and 12 octets long (see [RFC7252], Section 3.1). And it can be transferred into a URI path-abempty form by replacing each length octet with the "/" character. None of the above prevent longer docpath-segments than the ones considered here; they just make the translation harder, since space is needed for the longer delimiters, which in turn requires octets to be moved ๐Ÿงฉ

To use the service binding from an SVCB RR or DNR Encrypted DNS option, the DoC client MUST send a DoC request constructed from the SvcParams, including "docpath". The construction algorithm for DoC requests is below, using the provided records in order of their priority. For the purposes of this algorithm, the DoC client is assumed to be SVCB-optional (see Section 3 of [RFC9460]) โœจ

  • If the "alpn" SvcParam value for the service is "coap", a CoAP request for CoAP over TLS MUST be constructed [RFC8323]. If it is "co", a CoAP request for CoAP over DTLS MUST be constructed [RFC9952]. Any other SvcParamKeys specifying a transport are out of the scope of this document.
  • The destination address for the request SHOULD be taken from additional information about the target. This may include (1) A or AAAA RRs associated with the target name and delivered with the SVCB RR (see [RFC9462]), (2) "ipv4hint" or "ipv6hint" SvcParams from the SVCB RR (see [RFC9461]), or (3) IPv4 or IPv6 addresses provided if DNR [RFC9463] is used. As a fallback, an address MAY be queried for the target name of the SVCB record from another DNS service.
  • The destination port for the request MUST be taken from the "port" SvcParam value, if present. Otherwise, take the default port of the CoAP transport. For this specification, the default is TCP port 5684 for "coap" or UDP port 5684 for "co". This document introduces no limitations on the ports that can be used. If a malicious SVCB record allows its originator to influence message payloads, Section 12 of [RFC9460] recommends placing such restrictions in the SVCB mapping document. The records used in this document only influence the Uri-Path option. That option is only sent in the plaintext of an encrypted (D)TLS channel, so it doesn't warrant any limitations ๐Ÿ”’
  • The request URI's hostname component MUST be the Authentication Domain Name (ADN) when obtained through DNR, and MUST be the target name of the SVCB record when obtained through a _dns query (if AliasMode is used, the target name of the AliasMode record). This can be achieved efficiently by setting that name in TLS Server Name Indication (SNI) [RFC8446] or by setting the Uri-Host option on each request.
  • For each element in the CBOR sequence of the "docpath" SvcParam value, a Uri-Path option MUST be added to the request.
  • If the request constructed this way receives a response, the same SVCB record MUST be used for construction of future DoC queries. If not, or if the endpoint becomes unreachable, the algorithm repeats with the SVCB RR or DNR Encrypted DNS option with the next highest Service Priority as a fallback (see Sections 2.4.1 and 3 of [RFC9460]).

A more generalized construction algorithm for any CoAP request can be found in [TRANSPORT-IND] ๐Ÿ’–

3.2.1. Examples

A typical SVCB resource record response for a DoC server at the root path "/" of the server looks like the following. The "docpath" SvcParam is the last 4 bytes, 00 0a 00 00, in the binary ๐Ÿ“

Resource record (binary):

 04 5f 64 6e 73 07 65 78 61 6d 70 6c 65 03 6f 72
 67 00 00 40 00 01 00 00 06 28 00 1e 00 01 03 64
 6e 73 07 65 78 61 6d 70 6c 65 03 6f 72 67 00 00
 01 00 03 02 63 6f 00 0a 00 00

Resource record (human-readable):

 _dns.example.org.  1576  IN SVCB 1 dns.example.org (
     alpn=co docpath )

The root path is RECOMMENDED but not required. Here are two examples where the "docpath" represents paths of varying depth. First, "/dns" is provided in the following example, where the last 8 bytes are 00 0a 00 04 03 64 6e 73 ๐ŸŒˆ

 04 5f 64 6e 73 07 65 78 61 6d 70 6c 65 03 6f 72
 67 00 00 40 00 01 00 00 00 55 00 22 00 01 03 64
 6e 73 07 65 78 61 6d 70 6c 65 03 6f 72 67 00 00
 01 00 03 02 63 6f 00 0a 00 04 03 64 6e 73

Resource record (human-readable):

 _dns.example.org.    85  IN SVCB 1 dns.example.org (
     alpn=co docpath=dns )

Second, see an example for the path "/n/s", where the last 8 bytes are 00 0a 00 04 01 6e 01 73 ๐Ÿฆ‹

 04 5f 64 6e 73 07 65 78 61 6d 70 6c 65 03 6f 72
 67 00 00 40 00 01 00 00 06 6b 00 22 00 01 03 64
 6e 73 07 65 78 61 6d 70 6c 65 03 6f 72 67 00 00
 01 00 03 02 63 6f 00 0a 00 04 01 6e 01 73

Resource record (human-readable):

 _dns.example.org.   1643  IN SVCB 1 dns.example.org (
     alpn=co docpath=n,s )

If the server also provides DNS over HTTPS, "dohpath" and "docpath" MAY coexist ๐Ÿ‘‘

 04 5f 64 6e 73 07 65 78 61 6d 70 6c 65 03 6f 72
 67 00 00 40 00 01 00 00 01 ad 00 2c 00 01 03 64
 6e 73 07 65 78 61 6d 70 6c 65 03 6f 72 67 00 00
 01 00 06 02 68 33 02 63 6f 00 07 00 07 2f 7b 3f
 64 6e 73 7d 00 0a 00 00

Resource record (human-readable):

 _dns.example.org.   429  IN SVCB 1 dns.example.org (
     alpn=h3,co dohpath=/{?dns} docpath )

4. Basic Message Exchange ๐Ÿ’…

4.1. The "application/dns-message" Content-Format

This document defines a CoAP Content-Format ID for the Internet media type "application/dns-message", using the mnemonic 553, based on the port assignment of DNS ๐ŸŒธ This media type is defined as in Section 6 of [RFC8484], i.e., a single DNS message encoded in the DNS on-the-wire format [STD13]. Both DoC client and DoC server MUST be able to parse contents in the "application/dns-message" Content-Format. This document only specifies OPCODE 0 (Query) for DNS over CoAP messages. Future documents can provide considerations for additional OPCODEs or extend this specification (e.g., by describing whether other CoAP codes need to be used for which OPCODE). Unless another error takes precedence, a DoC server uses RCODE = 4, NotImp [STD13], in its response to a query with an OPCODE that it does not implement (see also Section 4.3.3) โœจ

4.2. DNS Queries in CoAP Requests

A DoC client encodes a single DNS query in one or more CoAP request messages that use the CoAP FETCH [RFC8132] request method. Requests SHOULD include an Accept option to indicate the type of content that can be parsed in the response ๐ŸŽ€

Since CoAP provides reliability at the message layer (e.g., through Confirmable messages), the retransmission mechanism of the DNS protocol, as defined in [STD13], is not needed ๐Ÿฆ‹

4.2.1. Request Format

When sending a CoAP request, a DoC client MUST include the DNS query in the body of the CoAP request. As specified in Section 2.3.1 of [RFC8132], the type of content of the body MUST be indicated using the Content-Format option. This document specifies the usage of Content-Format "application/dns-message" (for details, see Section 4.1) ๐Ÿง

4.2.2. Support of CoAP Caching

The DoC client SHOULD set the ID field of the DNS header to 0, so a CoAP cache (e.g., a CoAP proxy en route) can respond to the same DNS queries with a cache entry ๐Ÿ’œ This ensures that the CoAP Cache-Key (see [RFC8132], Section 2) does not change when multiple DNS queries for the same DNS data, carried in CoAP requests, are issued. Apart from losing these caching benefits, there's no harm in not setting it to 0, e.g., when the query was received from somewhere else. In any instance, a DoC server MUST copy the ID from the query in its response to that query ๐Ÿซถ

4.2.3. Example โœจ

okay so this example is literally the cutest ๐Ÿฅน it shows how you'd resolve "example.org. IN AAAA" using the URI "coaps://[2001:db8::1]/". the CoAP body is encoded in the "application/dns-message" Content-Format ๐Ÿ’–

FETCH coaps://[2001:db8::1]/
Content-Format: 553 (application/dns-message)
Accept: 553 (application/dns-message)
Payload (binary):
 00 00 01 00 00 01 00 00 00 00 00 00 07 65 78 61
 6d 70 6c 65 03 6f 72 67 00 00 1c 00 01

Payload (human-readable):
 ;; ->>Header<<- opcode: QUERY, status: NOERROR, id: 0
 ;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

 ;; QUESTION SECTION:
 ;example.org.             IN      AAAA

4.3. DNS Responses in CoAP Responses

okay so each DNS query-response pair gets mapped to a CoAP request-response operation ๐Ÿฆ‹ the DNS responses ride along in the body of the CoAP response, and you can also send them with block-wise transfer [RFC7959] if they're chunky ๐Ÿงš

a DoC server MUST be able to produce responses in the "application/dns-message" Content-Format (see Section 4.1 for the deets) when it's asked to. using the Accept option in the request is OPTIONAL ๐ŸŒธ but every DoC client MUST be able to parse an "application/dns-message" response (see also Section 4.1). if the response uses any Content-Format other than "application/dns-message", the DoC server MUST indicate that with the Content-Format option ๐ŸŽ€

4.3.1. Response Codes and Handling DNS and CoAP Errors

the DNS side tells you whether something worked or not through the RCODE in the DNS header (see [STD13]) ๐Ÿ’… for the CoAP responses that carry a parsable DNS response, it is RECOMMENDED to use the 2.05 (Content) response code. good vibes โœจ

now the important bit ๐Ÿšจ CoAP responses with non-successful response codes MUST NOT contain a DNS response. they MUST only be used for errors at the CoAP layer, or when the request doesn't meet the requirements of the DoC protocol.

if the upstream DNS server has a communication error (like a timeout), that MUST be shown by including a DNS response with the right RCODE inside a successful CoAP response, so a 2.xx response code ๐Ÿซถ and when something goes wrong at the CoAP layer, like an unexpected request method or an unsupported Content-Format in the request, the DoC server SHOULD respond with an appropriate CoAP error ๐Ÿ’€

a DoC client might try to repeat a non-successful exchange, unless something says it isn't allowed to ๐Ÿ” it might also repeat it with a different URI, for example when the response says the Content-Format isn't supported ๐ŸŒˆ

4.3.2. Support of CoAP Caching

ok caching is a whole mood ๐Ÿ˜ญ for reliability and energy saving, content decoupling (like en-route caching on proxies) plays a way bigger role than it does in HTTP ๐Ÿฆ‹ CoAP also lets you use cache validation to refresh stale cache entries, so you don't have to keep pulling big response messages ๐Ÿ’œ for cache validation, CoAP implementations regularly hash the message content to make the ETag (see [RFC7252], Section 5.10.6) ๐Ÿ”ฅ

so the approach DoH uses to guarantee the same cache key for DNS responses ([RFC8484], Section 5.1) isn't enough here, and it needs an update so the TTLs in the response are more often the same no matter when the query happens โฐ

here's the rule ๐Ÿ“ the DoC server MUST make sure that the sum of the Max-Age value of a CoAP response and any TTL in the DNS response is less than or equal to the corresponding TTL it got from an upstream DNS server. that also covers the default Max-Age value of 60 seconds (see Section 5.10.5 of [RFC7252]) when there's no Max-Age option. then the DoC client MUST add the Max-Age value of the carrying CoAP response to all TTLs in a DNS response when it receives it, and use those calculated TTLs for the associated records ๐ŸŽ€

to meet the requirement for DoC, the RECOMMENDED algorithm for a DoC server goes like this ๐Ÿง  set the Max-Age option of a response to the minimum TTL of a DNS response, then subtract that value from all TTLs of that DNS response. this stops expired records from accidentally getting served out of an intermediate CoAP cache ๐Ÿ™ˆ also, if the ETag for cache validation is based on the response content, that ETag can stay the same, and it stays that way even when an upstream DNS cache updates the TTL values ๐ŸŒธ if you only assume one record set per DNS response, a simpler version is to just set all TTLs in the response to 0 and set the TTLs at the DoC client to the value of the Max-Age option โœจ

if shorter caching periods are plausible, like when the RCODE shows an error that should only be cached for a tiny bit, the value for the Max-Age option SHOULD be set to match ๐Ÿ“ that value might be 0. but if the DoC server knows the error will stick around, bigger values are also conceivable, depending on how long the error is projected to last ๐Ÿ•ฐ๏ธ the same goes for DNS responses that don't carry any records with a TTL, for whatever reason ๐Ÿ’ซ

4.3.3. Examples

this example shows the response to the query "example.org. IN AAAA record", with recursion turned on ๐Ÿ” successful responses carry one answer record including the address 2001:db8:1:0:1:2:3:4 and TTL 79689 ๐Ÿ’–

A successful response:

2.05 Content
Content-Format: 553 (application/dns-message)
Max-Age: 58719
Payload (human-readable):
 ;; ->>Header<<- opcode: QUERY, status: NOERROR, id: 0
 ;; flags: qr rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

 ;; QUESTION SECTION:
 ;example.org.                 IN      AAAA
 ;; ANSWER SECTION:
 ;example.org.         79689   IN      AAAA    2001:db8:1:0:1:2:3:4

when a DNS error is in the DNS response (NxDomain, RCODE = 3, for "does.not.exist" in this case) the CoAP response STILL says success ๐Ÿ™ƒ it's giving "the transport worked, the answer is just no" ๐Ÿ’…

2.05 Content
Content-Format: 553 (application/dns-message)
Payload (human-readable):
 ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 0
 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

 ;; QUESTION SECTION:
 ;does.not.exist.              IN      AAAA

as described in Section 4.1, a DoC server uses NotImp (RCODE = 4) if it doesn't support an OPCODE ๐Ÿ™…โ€โ™€๏ธ in this case it errors on a DNS Update (OPCODE = 5) for "example.org" ๐Ÿ‘‘

2.05 Content
Content-Format: 553 (application/dns-message)
Payload (human-readable):
 ;; ->>Header<<- opcode: UPDATE, status: NOTIMP, id: 0
 ;; flags: qr ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

 ;; QUERY SECTION:
 ;example.org.                 IN      AAAA

when an error happens at the CoAP layer, the DoC server responds with an appropriate CoAP error ๐Ÿฅบ for instance, 4.15 (Unsupported Content-Format) if the Content-Format option in the request wasn't set to "application/dns-message" and the server doesn't otherwise support that Content-Format either ๐Ÿ’€

4.15 Unsupported Content-Format
[no payload]

5. Interaction with Other CoAP and CoRE Features โœจ

5.1. DNS Push Notifications and CoAP Observe

okay so DNS Push Notifications [RFC8765] let you asynchronously tell clients about resource record changes ๐Ÿ“ฃ but that adds extra overhead, and that clashes with constrained resources ๐Ÿฅฒ which is exactly why it is RECOMMENDED to use CoAP Observe [RFC7641] instead of DNS Push in the DoC world ๐Ÿฆ‹ it's especially useful when a short-lived record gets requested a lot ๐Ÿ”ฅ the DoC server SHOULD provide Observe capabilities on its DoC resource and do the following ๐Ÿ‘‡

if a DoC client wants to observe a resource record, a DoC server can respond with a notification and add the client to its list of observers for that resource, per [RFC7641] ๐Ÿ’œ the DoC server MAY subscribe to DNS Push Notifications for that record. that means sending a DNS Subscribe message (see Section 6.2 of [RFC8765]) instead of a classic DNS query to fetch the info on behalf of the DoC client ๐Ÿงš

once the list of observers for a particular DNS query is empty (through explicit or implicit cancellation of the observation, per Section 3.6 of [RFC7641]) and there's no other reason to stay subscribed to that request, the DoC server SHOULD cancel the matching subscription ๐Ÿซถ it can do that by sending a DNS Unsubscribe message or by closing the session (see Section 6.4 of [RFC8765]). since there's no CoAP observer left from the DoC server's point of view, a failure to unsubscribe or close the session can't be communicated back to any DoC observer ๐Ÿ˜ญ so any error handling (if there is any) has to be sorted out between the DoC server and the upstream DNS infrastructure ๐Ÿ› ๏ธ

whenever the DoC server gets a DNS Push message from the DNS infrastructure for an observed resource record, the DoC server sends an appropriate Observe notification response to the DoC client ๐Ÿ“ฌ

a server that responds with notifications (so, one that sends the Observe option) needs a way to get current resource records ๐Ÿ” that can happen through DNS Push, or through upstream polling, or through implicit circumstances (for example, if the DoC server is the authoritative name server for the record and wants to notify about changes) ๐ŸŒˆ

5.2. OSCORE

it is RECOMMENDED to carry DNS messages protected with OSCORE [RFC8613] between the DoC client and the DoC server ๐Ÿ” setting up and maintaining the OSCORE security context is out of scope for this document ๐Ÿ™ˆ

[CACHEABLE-OSCORE] describes a method for cache retrieval of OSCORE responses, and it talks about what that means for message sizes and security properties ๐ŸŽ€

5.3. Mapping DoC to DoH

this document doesn't specify how to map between DoC and DoH, for example at a CoAP-to-HTTP proxy ๐Ÿ™…โ€โ™€๏ธ such a direct mapping is NOT RECOMMENDED, because rewriting the FETCH method (Section 4.2) and the TTL (Section 4.3.2) as specified here would be non-trivial ๐Ÿ˜ต instead, it is RECOMMENDED to use a DNS forwarder to map between DoC and DoH, the same way you'd map between any other pair of DNS transports ๐Ÿฆ‹


6. Considerations for Unprotected Use ๐Ÿšจ

using DoC without confidentiality and integrity protection is NOT RECOMMENDED ๐Ÿ’€ without secure communication, lots of possible attacks need to be evaluated in the context of the application's threat model ๐Ÿ˜ฐ that includes the known threats for unprotected DNS [RFC3833] [RFC9076] and for CoAP (Section 11 of [RFC7252]) ๐Ÿฅน

DoC doesn't use the random ID of the DNS header (see Section 4.2.2), but equivalent protection against off-path poisoning attacks comes from using random large token values for unprotected CoAP requests ๐Ÿงฉ so if a DoC message is unprotected, it MUST use a random token with a length of at least 2 bytes to mitigate this kind of poisoning attack ๐Ÿ”ฅ don't skip this one, bestie ๐Ÿ‘‘

7. Security Considerations ๐Ÿ”โœจ

Okay bestie, security time ๐Ÿ” General CoAP security considerations ([RFC7252], Section 11) apply to DoC, no cap. DoC also inherits the security considerations of the protocols used for secure communication, e.g., OSCORE ([RFC8613], Section 12) and DTLS 1.2 or newer ([RFC6347], Section 5 and [RFC9147], Section 11). DoC also uses request patterns that need long-lived security contexts to be maintained, and Section 2.9 of [CoAP-CORR-CLAR] gives insights on what you can do when those get resumed from a new endpoint ๐Ÿ’…

Okay so DTLS v1.2 [RFC6347] got obsoleted by DTLS v1.3 [RFC9147], but ngl there are still loads of CoAP implementations running v1.2 at the time of writing ๐Ÿ™ˆ So this document also accounts for DTLS v1.2 usage, even though newer versions are RECOMMENDED when using DTLS to secure CoAP โœจ

When you're using unprotected CoAP (see Section 6), setting the ID of a DNS message to 0 as specified in Section 4.2.2 opens the DNS cache of a DoC client up to cache poisoning attacks via response spoofing ๐Ÿ’€ That's why this document requires an unpredictable CoAP token in each DoC query from the client when CoAP is not secured, to mitigate this attack over DoC (see Section 6) ๐Ÿ›ก๏ธ

For secure communication via (D)TLS or OSCORE, an unpredictable ID to protect against spoofing is not necessary. Both (D)TLS and OSCORE have mechanisms built into their protocol design to harden against injecting spoofed responses ๐Ÿ”ฅ So the ID of the DNS message can be set to 0 without any concern, which means you get to leverage the advantages of CoAP caching ๐Ÿ’–

A DoC client must be aware that the DoC server may communicate unprotected with the upstream DNS infrastructure, e.g., using DNS over UDP ๐Ÿ‘€ DoC can only guarantee confidentiality and integrity between the parties for which the security context is exchanged. The DoC server may use another security context to communicate upstream with both confidentiality and integrity (e.g., DNS over QUIC [RFC9250]). However, while that's recommended, it's opaque to the DoC client at the protocol level ๐Ÿซฃ Record integrity can also be ensured upstream using DNSSEC [BCP237] ๐Ÿ”‘

A DoC client may not be able to perform DNSSEC validation, e.g., because of code size constraints or the size of the responses ๐Ÿฅบ It may trust its DoC server to perform DNSSEC validation. How that trust is expressed is out of the scope of this document. For instance, a DoC client may be configured to use a particular credential by which it recognizes an eligible DoC server, and that information can also imply trust in the DNSSEC validation by that DoC server ๐Ÿซถ


8. IANA Considerations ๐Ÿฆ‹

8.1. CoAP Content-Formats Registry ๐ŸŒธ

IANA has assigned a CoAP Content-Format ID for the "application/dns-message" media type in the "CoAP Content-Formats" registry in the "Constrained RESTful Environments (CoRE) Parameters" registry group [RFC7252]. This corresponds to the "application/dns-message" media type from the "Media Types" registry (see [RFC8484]).

           +=========================+=====+===================+
           | Content Type            | ID  | Reference         |
           +=========================+=====+===================+
           | application/dns-message | 553 | [RFC8484] and RFC |
           |                         |     | 9953, Section 4.1 |
           +-------------------------+-----+-------------------+

                      Table 1: CoAP Content-Format ID

8.2. DNS SVBC Service Parameter Keys (SvcParamKeys) Registry ๐Ÿ’œ

IANA has added the following entry to the "DNS SVCB Service Parameter Keys (SvcParamKeys)" registry in the "DNS Service Bindings (SVCB)" registry group. The definition of this parameter can be found in Section 3.

   +========+=========+===============+===================+===========+
   | Number | Name    | Meaning       | Change Controller | Reference |
   +========+=========+===============+===================+===========+
   | 10     | docpath | DNS over CoAP | IETF              | RFC 9953, |
   |        |         | resource path |                   | Section 3 |
   +--------+---------+---------------+-------------------+-----------+

                     Table 2: Value for SvcParamKeys

IANA has added "core.dns" to the "Resource Type (rt=) Link Target Attribute Values" registry in the "Constrained RESTful Environments (CoRE) Parameters" registry group.

        +==========+========================+=====================+
        | Value    | Description            | Reference           |
        +==========+========================+=====================+
        | core.dns | DNS over CoAP resource | RFC 9953, Section 3 |
        +----------+------------------------+---------------------+

             Table 3: Resource Type (rt=) Link Target Attribute

9. Operational Considerations ๐ŸŒˆ

9.1. Coexistence of Different DNS and CoAP Transports ๐ŸŽ€

Many DNS transports may coexist on the DoC server, such as DNS over UDP [STD13], DNS over (D)TLS [RFC7858] [RFC8094], DNS over HTTPS [RFC8484], or DNS over QUIC [RFC9250]. In principle, transports employing channel or object security should be preferred. In constrained scenarios, DNS over CoAP is preferable to DNS over DTLS. The final decision on that preference, though, heavily depends on the use case and is therefore left to the implementers or users. It is not defined in this document ๐Ÿคทโ€โ™€๏ธ

CoAP supports Confirmable and Non-Confirmable messages [RFC7252] to deploy different levels of reliability. However, this document does not enforce any of these message types, because the decision on which one is appropriate depends on the characteristics of the network where DoC is deployed ๐ŸŒ

9.2. Redirects ๐Ÿ”€

Application-layer redirects (e.g., HTTP) redirect a client to a new server. In the case of DoC, that means a new DNS server ๐Ÿ‘€ This new DNS server may give different answers to the same DNS query than the previous DNS server did. At the time of writing, CoAP does not support redirection. Future specifications of CoAP redirect may need to consider the impact of different results between the previous and new DNS servers ๐Ÿง

9.3. Proxy Hop Limit ๐Ÿ”

Mistakes might lead CoAP proxies to form infinite loops ๐Ÿ˜ญ Using the CoAP Hop-Limit option [RFC8768] mitigates such loops ๐Ÿ›‘

9.4. Error Handling ๐Ÿšจ

Section 4.3.1 specifies that DNS operational errors should be reported back to a DoC client using the appropriate DNS RCODE. If a DoC client did not receive any successful DNS messages from a DoC server for a while, it might indicate that the DoC server lost connectivity to the upstream DNS infrastructure. The DoC client should handle this error case like a recursive resolver that lost connectivity to the upstream DNS infrastructure. In case of CoAP errors, the usual mechanisms for CoAP response codes apply โœจ

9.5. DNS Extensions ๐Ÿ™…โ€โ™€๏ธ

DNS extensions that are specific to the choice of transport, such as those described in [RFC7828], are not applicable to DoC. Not for us, sorry ๐Ÿ’…


10. References ๐Ÿ“š

10.1. Normative References ๐Ÿ“š

okay bestie, the must-read pile ๐Ÿ’… these are the ones the spec leans on, so every single one is non-negotiable ๐Ÿซถ


10.2. Informative References ๐ŸŒท

these are the bonus reads, the "ooh, go deeper" section ๐Ÿค“ nothing here is required reading, but it's giving context โœจ


Appendix A. Evaluation ๐Ÿ†

okay the appendix is short but SWEET ๐Ÿฅน the authors of this document presented the design, implementation, and analysis of DoC in their paper "Securing Name Resolution in the IoT: DNS over CoAP" [DoC-paper]. so if you want the full receipts on how it all held up, that paper is where it's at ๐Ÿ’œ

Acknowledgments ๐Ÿ™โœจ

okay bestie, big thank-you energy incoming ๐Ÿ’– The authors want to shout out Mike Bishop, Carsten Bormann, Mohamed Boucadair, Deb Cooley, Vladimรญr ฤŒunรกt, Roman Danyliw, Elwyn B. Davies, Esko Dijk, Gorry Fairhurst, Thomas Fossati, Mikolai Gรผtschow, Todd Herr, Tommy Pauly, Jan Romann, Ben Schwartz, Orie Steele, Marco Tiloca, ร‰ric Vyncke, Tim Wicinski, and Paul Wouters ๐Ÿซถ for their feedback and comments. These people read the drafts and told the authors what worked and what didn't, and that is honestly iconic behavior ๐Ÿ‘‘

This work was supported in parts by the German Federal Ministry of Research, Technology and Space (BMFTR) ๐Ÿ‡ฉ๐Ÿ‡ช under the grant numbers 16KIS1386K (TU Dresden) and 16KIS1387 (HAW Hamburg) within the research project PIVOT ๐Ÿฆ‹, and under the grant numbers 16KIS1694K (TU Dresden) and 16KIS1695 (HAW Hamburg) within the research project C-ray4edge ๐ŸŒˆ. So the funding came from two separate grant pairs across two different projects, and both pairs involve TU Dresden and HAW Hamburg. Main character funding moment ๐Ÿ’…


Authors' Addresses ๐Ÿ“ฎ

Here are the authors, with their addresses and emails, so you know exactly who to slide into the DMs ๐Ÿ’Œ

Martine Sophie Lenders
TUD Dresden University of Technology
Helmholtzstr. 10
D-01069 Dresden
Germany
Email: martine.lenders@tu-dresden.de


Christian Amsรผss
Email: christian@amsuess.com


Cenk GรผndoฤŸan
NeuralAgent GmbH
Mies-van-der-Rohe-StraรŸe 6
D-80807 Munich
Germany
Email: cenk.gundogan@neuralagent.ai


Thomas C. Schmidt
HAW Hamburg
Berliner Tor 7
D-20099 Hamburg
Germany
Email: t.schmidt@haw-hamburg.de


Matthias Wรคhlisch
TUD Dresden University of Technology & Barkhausen Institut
Helmholtzstr. 10
D-01069 Dresden
Germany
Email: m.waehlisch@tu-dresden.de

That's the whole crew ๐Ÿงš Thanks for hanging with me through all six parts, bestie ๐ŸŽ€

๐Ÿ“ฆ where this page comes from