Internet-Draft | DoC | August 2021 |
Lenders, et al. | Expires 13 February 2022 | [Page] |
This document defines a protocol for sending DNS messages over the Constrained Application Protocol (CoAP). These CoAP messages are protected by DTLS-Secured CoAP (CoAPS) or Object Security for Constrained RESTful Environments (OSCORE) to provide encrypted DNS message exchange for constrained devices in the Internet of Things (IoT).¶
This note is to be removed before publishing as an RFC.¶
Discussion of this document takes place on TODO¶
Source for this draft and an issue tracker can be found at https://github.com/anr-bmbf-pivot/draft-dns-over-coaps.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 13 February 2022.¶
Copyright (c) 2021 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, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
This document defines DNS over CoAP (DoC), a protocol to send DNS [RFC1035] queries and get DNS responses over the Constrained Application Protocol (CoAP) [RFC7252]. Each DNS query-response pair is mapped into a CoAP message exchange. Each CoAP message is secured by DTLS [RFC6347] or Object Security for Constrained RESTful Environments (OSCORE) [RFC7252] to ensure message integrity and confidentiality.¶
The application use case of DoC is inspired by DNS over HTTPS [RFC8484] (DoH). DoC, however, aims for the deployment in the constrained Internet of Things (IoT), which usually conflicts with the requirements introduced by HTTPS.¶
To prevent TCP and HTTPS resource requirements, constrained IoT devices could use DNS over DTLS [RFC8094]. In contrast to DNS over DTLS, DoC utilizes CoAP features to mitigate drawbacks of datagram-based communication. These features include: block-wise transfer, which solves the Path MTU problem of DNS over DTLS (see [RFC8094], section 5); CoAP proxies, which provide an additional level of caching; re-use of data structures for application traffic and DNS information, which saves memory on constrained devices.¶
The most important components of DoC can be seen in Figure 1: A DoC client tries to resolve DNS information by sending DNS queries carried within CoAP requests to a DoC server. That DoC server may or may not resolve that DNS information itself by using other DNS transports with an upstream DNS server. The DoC server then replies to the DNS queries with DNS responses carried within CoAP responses.¶
TBD: additional feature sets of CoAP/CoRE¶
A server that provides the service specified in this document is called a "DoC server" to differentiate it from a classic "DNS server". Correspondingly, a client using this protocol to retrieve the DNS information is called a "DoC client".¶
The term "constrained nodes" is used as defined in [RFC7228].¶
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 DoC client is configured with a URI Template [RFC6570]. This allows us to reuse configuration mechanisms provided for DoH.¶
The URI Template SHOULD provide a variable "dns" so that GET requests can be used to retrieve the DNS information. If the "dns" variable is not provided in the URI Template, GET requests can not be used for DoC exchanges.¶
TBD:¶
TBD:¶
This document defines the Internet media type "application/dns-message" for the CoAP Content-Format. This media type is defined as in [RFC8484] Section 6, i.e., a single DNS message encoded in the DNS on-the-wire format [RFC1035].¶
A DoC client encodes a single DNS query in one or more CoAP request messages using either the CoAP GET [RFC7252], POST [RFC7252], or FETCH [RFC8132] methods. Requests of either method type SHOULD include an Accept option to indicate the type of content that can be parsed in the response. A client MUST be able to parse messages of Content-Format "application/dns-message" regardless of the provided Accept option.¶
To enable reliable message exchange, the CoAP request SHOULD be carried in a Confirmable (CON) message.¶
When sending a CoAP request using the POST or FETCH method, a DoC client MUST use the Content-Format "application/dns-message" in the request. The DNS query is included in the payload.¶
If the FETCH or POST method are used and block-wise transfer [RFC7959] is supported by the client, more than one CoAP request message MAY be used. If more than one CoAP request message is used to encode the DNS query, it must be chained together using the Block1 option in those CoAP requests.¶
For a POST or FETCH request the URI Template specified in Section 3 is processed without any variables set.¶
When sending a CoAP request using the GET method, the URI Template specified in Section 3 is extended by the variable "dns". A DoC client MUST use the "dns" variable in the URI-Query followed by the DNS query encoded with "base64url" (details see [RFC8484] Section 6). If new Content-Formats are specified in the future, the specification MUST define the variable used in the URI Template with that new format.¶
A DoC client must implement the GET, POST, or FETCH method. Due to the lack of "base64url" encoding requirements, both FETCH and POST methods are generally smaller than GET requests. Using the FETCH method is RECOMMENDED because this method provides caching and block-wise transfer without introducing the overhead of URI templates (see Table 1).¶
Method | Cacheable | Block-wise transferable | No URI Template variable needed |
---|---|---|---|
GET | Y | N | N |
POST | N | Y | Y |
FETCH | Y | Y | Y |
A DoC server MUST implement the GET, POST, and FETCH method. Content-Format within the payload of a CoAP response. A DoC server MUST be able to parse requests of Content-Format "application/dns-message".¶
The DoC client SHOULD set the ID field of the DNS header always to 0 to enable a CoAP cache (e.g., a CoAP proxy en-route) to respond to the same DNS queries with a cache entry. This ensures that the CoAP Cache-Key (for GET see [RFC7252] Section 5.6, for FETCH see [RFC8132] Section 2) does not change when multiple DNS queries for the same DNS data, carried in CoAP requests, are issued. Technically, using the POST method does not require the DNS ID set to 0 because the payload of a POST message is not part of the Cache-Key. For consistency reasons, however, it is RECOMMENDED to use the same constant DNS ID.¶
The following examples illustrate the usage of different CoAP messages to resolve "example.org. IN AAAA" based on the URI template "coaps://[2001:db8::1]/{?dns}". The CoAP body is encoded in "application/dns-message" Content-Format.¶
GET request:¶
GET coaps://[2001::db8::1]/ URI-Query: dns=AAABIAABAAAAAAAAB2V4YW1wbGUDb3JnAAAcAAE Accept: application/dns-message¶
POST request:¶
POST coaps://[2001::db8::1]/ Content-Format: application/dns-message Accept: application/dns-message Payload: 00 00 01 20 00 02 00 00 00 00 00 00 07 65 78 61 [binary] 6d 70 6c 65 03 6f 72 67 00 00 1c 00 01 c0 0c 00 [binary] 01 00 01 [binary]¶
FETCH request:¶
FETCH coaps://[2001::db8::1]/ Content-Format: application/dns-message Accept: application/dns-message Payload: 00 00 01 20 00 02 00 00 00 00 00 00 07 65 78 61 [binary] 6d 70 6c 65 03 6f 72 67 00 00 1c 00 01 c0 0c 00 [binary] 01 00 01 [binary]¶
Each DNS query-response pair is mapped to a train of one or more of CoAP request-response pairs. DNS responses are provided in the payload of CoAP responses. A DoC server MUST use the Content-Format "application/dns-message" (see Section 4.1).¶
If supported, a DoC server MAY transfer the DNS response in more than one CoAP responses using the Block2 option [RFC7959].¶
A DNS response indicates either success or failure in the Response code of the DNS header (see [RFC1035] Section 4.1.1). It is RECOMMENDED that CoAP responses that carry any valid DNS response use a "2.xx Success" response code. A response to a GET or FETCH request SHOULD use the "2.05 Content" code. A response to a POST request SHOULD use the "2.01 Created" code.¶
CoAP responses use non-successful response codes MUST NOT contain any payload and may only be used on errors in the CoAP layer or when a request does not fulfill the requirements of the DoC protocol.¶
Communication errors with a DNS server (e.g., timeouts) SHOULD be indicated by including a SERVFAIL DNS response in a successful CoAP response.¶
A DoC client might try to repeat a non-successful exchange unless otherwise prohibited. For instance, a FETCH request MUST NOT be repeated with a URI Template for which the DoC server already responded with "4.05 Method Not Allowed" since the server might only implement legacy CoAP and does not support the FETCH method. The DoC client might also decide to repeat a non-successful exchange with a different URI Template, for instance, when the response indicates an unsupported Content-Format.¶
It is RECOMMENDED to set the Max-Age option of a response to the minimum TTL in the Answer section of a DNS response. This prevents expired records unintentionally being served from a CoAP cache.¶
It is RECOMMENDED that DoC servers set an ETag option on large responses (TBD: more concrete guidance) that have a short Max-Age relative to the expected clients' caching time. Thus, clients that need to revalidate a response can do so using the established ETag mechanism. With responses large enough to be fragmented, it's best practice for servers to set an ETag anyway.¶
The following examples illustrate the replies to the query "example.org. IN AAAA record", recursion turned on. Successful responses carry one answer record including address 2001:db8:1::1:2:3:4 and TTL 58719.¶
A successful response to a GET or FETCH request:¶
2.05 Content Content-Format: application/dns-message Max-Age: 58719 Payload: 00 00 81 a0 00 01 00 01 00 00 00 00 07 65 78 61 [binary] 6d 70 6c 65 03 6f 72 67 00 00 1c 00 01 c0 0c 00 [binary] 1c 00 01 00 01 37 49 00 10 20 01 0d b8 00 01 00 [binary] 00 00 01 00 02 00 03 00 04 [binary]¶
A successful response to a POST request uses a different response code:¶
2.03 Created Content-Format: application/dns-message Max-Age: 58719 Payload: 00 00 81 a0 00 01 00 01 00 00 00 00 07 65 78 61 [binary] 6d 70 6c 65 03 6f 72 67 00 00 1c 00 01 c0 0c 00 [binary] 1c 00 01 00 01 37 49 00 10 20 01 0d b8 00 01 00 [binary] 00 00 01 00 02 00 03 00 04 [binary]¶
When a DNS error (SERVFAIL in this case) is noted in the DNS response, the CoAP request still indicates success:¶
2.05 Content Content-Format: application/dns-message Payload: 00 00 81 a2 00 01 00 00 00 00 00 00 07 65 78 61 [binary] 6d 70 6c 65 03 6f 72 67 00 00 1c 00 01 [binary]¶
When an error occurs on the CoAP layer, the DoC server SHOULD respond with an appropriate CoAP error, for instance "4.15 Unsupported Content-Format" if the Content-Format option in the request was not set to "application/dns-message" and the Content-Format is not otherwise supported by the server.¶
TBD:¶
General CoAP proxy problem, but what to do when DoC server is a DNS proxy, response came not yet in but retransmission by DoC client was received (see Figure 2)¶
send empty ACK (maybe move to best practices appendix)¶
TODO Security¶
IANA is requested to assign CoAP Content-Format ID for the DNS message media type in the "CoAP Content-Formats" sub-registry, within the "CoRE Parameters" registry [RFC7252], corresponding the "application/dns-message" media type from the "Media Types" registry:¶
Media-Type: application/dns-message¶
Encoding: -¶
Id: TBD¶
Reference: [TBD-this-spec]¶
TBD:¶
TODO acknowledge.¶