Internet-Draft DoC August 2021
Lenders, et al. Expires 11 February 2022 [Page]
Workgroup:
CoRE
Internet-Draft:
draft-lenders-dns-over-coaps-00
Published:
Intended Status:
Standards Track
Expires:
Authors:
M.S. Lenders
FU Berlin
C. Amsüss
C. Gündoğan
HAW Hamburg
T.C. Schmidt
HAW Hamburg
M. Wählisch
FU Berlin

DNS Queries over CoAPS (DoC)

Abstract

This document defines a protocol for sending DNS messages over the DTLS-Secured Constrained Application Protocol (CoAPS). Using the REST architecture specified in CoAP and the security features of DTLS, DNS over CoAPS provides encrypted DNS messages for constrained devices in the Internet of Things (IoT) based on common interfaces.

Discussion Venues

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.

Status of This Memo

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 11 February 2022.

Table of Contents

1. Introduction

This document defines DNS over CoAPS (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 and secured by DTLS [RFC6347] 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.

                - GET coaps://[2001::db8::1]/?dns=example.org
               /- POST/FETCH coaps://[2001::db8::1]/
              /
             CoAP request
+--------+   [DNS query]   +--------+  DNS query   +--------+
|  DoC   |---------------->|  DoC   |.............>|  DNS   |
| Client |<----------------| Server |<.............| Server |
+--------+  CoAP response  +--------+ DNS response +--------+
            [DNS response]

Figure 1: Basic DoC architecture

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

2. Terminology

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.

3. Selection of a DoC Server

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:

4. Basic Message Exchange

4.1. DNS Queries in CoAP Requests

A DoC client encodes a single DNS query in one or more CoAP request messages using either the CoAP GET, FETCH [RFC8132], or POST method. More than one CoAP request message MAY be used if the FETCH or POST method are used and block-wise transfer [RFC7959] is supported by the client. 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. To make use of the recovery mechanism of CoAP, the CoAP request SHOULD be carried in a Confirmable (CON) messages.

For a POST or FETCH request the URI Template specified in Section 3 is processed without any variables set. For a GET request the URI Template is extended with the "dns" variable set to the content of the DNS query, encoded with base64url [RFC4648].

If new Content Formats are specified in the future, the specification MUST define the variable used in the URI Template with that new format.

For POST and FETCH methods, the DNS query is included in the payloads of the CoAP request messages in the binary format as specified in [RFC1035]. The Content Format option MUST be included to indicate the message type as "application/dns-message". Due to the lack of encoding requirements, both FETCH and POST methods are generally smaller than GET requests.

A DoH server MUST implement both the GET and POST method and MAY implement the FETCH method.

Using GET enables CoAP proxies en-route to the DoC server to cache a successful response. However, as the DNS query is carried in the URI and thus in one of the URI-* options within a GET request, block-wise transfer can not be used with that method. As a cache-friendly alternative, the FETCH method can be used, which is an extension to legacy CoAP, specified in [RFC8132].

Requests of either method type SHOULD include an Accept option to indicate what type of content 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. Messages of that Content Format are DNS responses in binary format as specified in [RFC1035].

To simplify cache-key calculations at the CoAP proxies en-route, DoC clients using Content Formats that include the ID field from the DNS message, such as "application/dns-message", SHOULD use DNS ID 0 in every DNS query. The CoAP message ID takes the same function on the CoAP layer. Dedicated identification of DNS message exchanges on the wire is thus not necessary.

4.1.1. Examples

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]

4.2. DNS Responses in CoAP Responses

This document specifies responses of Content Format "application/dns-message" which encodes the DNS response in the binary format, specified in [RFC1035]. For this type of responses, the Content Format option indicating the "application/dns-message" format MUST be included. A DoC server MUST be able to parse requests of Content Format "application/dns-message".

Each DNS query-response pair is mapped to a train of one or more of CoAP request-response pairs. If supported, a DoC server MAY transfer the DNS response in more than one CoAP response using the Block2 option [RFC7959].

4.2.1. Response Codes and Handling DNS and CoAP errors

A DNS response indicates either success or failure for the DNS query. As such, it is RECOMMENDED that CoAP responses that carry any valid DNS response, use a 2.xx Success response code. GET and FETCH requests SHOULD be responded to with a 2.05 Content response. POST requests SHOULD be responded to with a 2.01 Created response.

CoAP responses with 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.

For consistency, communications errors with an upstream DNS server such as timeouts SHOULD be indicated with 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 a 4.05 Method Not Allowed, as the server might only implement legacy CoAP and does not support the FETCH method. The DoC client might also elect to repeat a non-successful exchange with a different URI Template, for instance, when the response indicates an unsupported content format.

4.2.2. Examples

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

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

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".

5. CoAP/CoRE Integration

5.1. Proxies and caching

DoC exchanges may be cached by CoAP proxies and DNS caches en-route. It is desirable that DoC exchanges follow the same paradigm as all CoAP exchanges so they do not need any special handling by a CoAP cache implementation.

Two requirements to a DoC exchange are necessary to that goal: First, the ID field of the DNS header SHOULD always be 0, when using the "application/dns-message" Content Format. This allows for both GET URIs and FETCH payload to always have the same value for the same DNS query, and thus they do not interfere with cache key generation. Second, 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.

  DoC client           DoC proxy           DNS server
       |  CoAP req [rt 1]  |                    |
       |------------------>|  DNS query [rt 1]  |
       |                   |------------------->|
       |  CoAP req [rt 2]  |                    |
       |------------------>|      DNS resp      |
       |     CoAP resp     |<-------------------|
       |<------------------|                    |
       |                   |                    |
Figure 2: CoAP retransmission (rt) is received before DNS query could have been fulfilled.

TBD:

  • Responses that are not globally valid
  • 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)

It is RECOMMENDED that 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.

5.2. OBSERVE (modifications)?

  • TBD
  • DoH has considerations on Server Push to deliver additional, potentially outstanding requests + response to the DoC client for caching
  • OBSERVE does not include the request it would have been generated from ==> cannot be cached without corresponding request having been send over the wire.
  • If use case exists: extend OBSERVE with option that contains "promised" request (see [RFC7540], section 8.2)?
  • Other caveat: clients can't cache, only proxys so value needs to be evaluated
  • Potential use case: [RFC8490] Section 4.1.2

5.3. OSCORE

  • TBD
  • With OSCORE DTLS might not be required

6. URI template configuration

7. Considerations for Unencrypted Use

8. Security Considerations

TODO Security

9. IANA Considerations

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]

10. References

10.1. Normative References

[RFC1035]
Mockapetris, P., "Domain names - implementation and specification", STD 13, RFC 1035, DOI 10.17487/RFC1035, , <https://www.rfc-editor.org/rfc/rfc1035>.
[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/rfc/rfc2119>.
[RFC4648]
Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, DOI 10.17487/RFC4648, , <https://www.rfc-editor.org/rfc/rfc4648>.
[RFC6347]
Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, , <https://www.rfc-editor.org/rfc/rfc6347>.
[RFC6570]
Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., and D. Orchard, "URI Template", RFC 6570, DOI 10.17487/RFC6570, , <https://www.rfc-editor.org/rfc/rfc6570>.
[RFC7252]
Shelby, Z., Hartke, K., and C. Bormann, "The Constrained Application Protocol (CoAP)", RFC 7252, DOI 10.17487/RFC7252, , <https://www.rfc-editor.org/rfc/rfc7252>.
[RFC7959]
Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in the Constrained Application Protocol (CoAP)", RFC 7959, DOI 10.17487/RFC7959, , <https://www.rfc-editor.org/rfc/rfc7959>.
[RFC8132]
van der Stok, P., Bormann, C., and A. Sehgal, "PATCH and FETCH Methods for the Constrained Application Protocol (CoAP)", RFC 8132, DOI 10.17487/RFC8132, , <https://www.rfc-editor.org/rfc/rfc8132>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/rfc/rfc8174>.

10.2. Informative References

[I-D.ietf-core-coral]
Hartke, K., "The Constrained RESTful Application Language (CoRAL)", Work in Progress, Internet-Draft, draft-ietf-core-coral-03, , <https://datatracker.ietf.org/doc/html/draft-ietf-core-coral-03>.
[I-D.ietf-core-href]
Bormann, C. and H. Birkholz, "Constrained Resource Identifiers", Work in Progress, Internet-Draft, draft-ietf-core-href-06, , <https://datatracker.ietf.org/doc/html/draft-ietf-core-href-06>.
[I-D.ietf-core-resource-directory]
Amsüss, C., Shelby, Z., Koster, M., Bormann, C., and P. V. D. Stok, "CoRE Resource Directory", Work in Progress, Internet-Draft, draft-ietf-core-resource-directory-28, , <https://datatracker.ietf.org/doc/html/draft-ietf-core-resource-directory-28>.
[I-D.peterson-doh-dhcp]
Peterson, T., "DNS over HTTP resolver announcement Using DHCP or Router Advertisements", Work in Progress, Internet-Draft, draft-peterson-doh-dhcp-01, , <https://datatracker.ietf.org/doc/html/draft-peterson-doh-dhcp-01>.
[RFC7228]
Bormann, C., Ersue, M., and A. Keranen, "Terminology for Constrained-Node Networks", RFC 7228, DOI 10.17487/RFC7228, , <https://www.rfc-editor.org/rfc/rfc7228>.
[RFC7540]
Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext Transfer Protocol Version 2 (HTTP/2)", RFC 7540, DOI 10.17487/RFC7540, , <https://www.rfc-editor.org/rfc/rfc7540>.
[RFC8094]
Reddy, T., Wing, D., and P. Patil, "DNS over Datagram Transport Layer Security (DTLS)", RFC 8094, DOI 10.17487/RFC8094, , <https://www.rfc-editor.org/rfc/rfc8094>.
[RFC8484]
Hoffman, P. and P. McManus, "DNS Queries over HTTPS (DoH)", RFC 8484, DOI 10.17487/RFC8484, , <https://www.rfc-editor.org/rfc/rfc8484>.
[RFC8490]
Bellis, R., Cheshire, S., Dickinson, J., Dickinson, S., Lemon, T., and T. Pusateri, "DNS Stateful Operations", RFC 8490, DOI 10.17487/RFC8490, , <https://www.rfc-editor.org/rfc/rfc8490>.

Appendix A. Change Log

TBD:

Acknowledgments

TODO acknowledge.

Authors' Addresses

Martine Sophie Lenders
Freie Universität Berlin
Christian Amsüss
Cenk Gündoğan
HAW Hamburg
Thomas C. Schmidt
HAW Hamburg
Matthias Wählisch
Freie Universität Berlin