Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add downstream DNS-over-HTTPS support to Unbound - #255

#255
Merged
ralphdolmans merged 20 commits into
masterNLnetLabs/unbound:masterfrom
dohNLnetLabs/unbound:dohCopy head branch name to clipboard
Sep 18, 2020
Merged

Add downstream DNS-over-HTTPS support to Unbound#255
ralphdolmans merged 20 commits into
masterNLnetLabs/unbound:masterfrom
dohNLnetLabs/unbound:dohCopy head branch name to clipboard

Conversation

@ralphdolmans

Copy link
Copy Markdown
Contributor

In order to use the DoH feature, Unbound needs to be compiled with the nghttp2 library (./configure --with-libnghttp2) and requires an OpenSSL version that supports ALPN for the HTTP/2 support negotiation (starting from OpenSSL 1.0.2).

The DoH implementation requires an encrypted connection, and only works over HTTP/2 as query pipelining and out-of-order processing using HTTP/2 streams is needed to be able to provide performance that is on par with DNS-over-TLS.

To enable DoH in Unbound the certificate and corresponding key to use need to be configured, and Unbound needs to listen on the HTTPS port:

server:
   interface: 127.0.0.1@443
   tls-service-key "key.pem"
   tls-service-pem: "cert.pem"

The HTTPS port (default 443) can be changed using the 'https-port' configuration option.

The DoH endpoint (default /dns-query) can be changed using the 'http-endpoint' configuration option.

The maximum number of streams (default 100, as per HTTP/2 RFC) can be adjusted using the 'http-max-streams' configuration option.

In order to prevent abuse of Unbound servers running DoH, this PR adds counters to limit the total size of buffers used to store (partial) DNS queries and responses. The size of these limits can be adjusted using the 'http-query-buffer-size' and 'http-response-buffer-size' configuration options.

In order to provide a well-performing HTTP/2 service is might be good to set the TCP_NODELAY socket option. This PR will, by default, set this option for the sockets used for the HTTP/2 connection. Setting this option can be disabled using the 'http-nodelay' configuration option.

Three DoH stats are added to Unbound; 'num.query.https' keeps statistics for the number of queries that are serviced using DoH. The 'mem.http.query_buffer', and 'mem.http.response_buffer' stats keep track of the memory used for the query and response buffers used for DoH.

Comment thread Makefile.in Outdated
Comment thread services/listen_dnsport.c
Comment thread services/listen_dnsport.c Outdated
Comment thread services/listen_dnsport.c
Comment thread services/listen_dnsport.c Outdated
Comment thread services/listen_dnsport.c Outdated
Comment thread services/listen_dnsport.c
Comment thread services/listen_dnsport.c Outdated
Comment thread services/listen_dnsport.c Outdated
Comment thread services/listen_dnsport.c Outdated
Comment thread services/listen_dnsport.c Outdated
Comment thread smallapp/unbound-control.c Outdated
Comment thread testcode/dohclient.c Outdated
Comment thread testcode/dohclient.c
Comment thread testcode/dohclient.c
Comment thread testdata/doh_downstream_endpoint.tdir/doh_downstream_endpoint.test Outdated
Comment thread testdata/doh_downstream_post.tdir/doh_downstream_post.test
Comment thread util/configparser.y Outdated
Comment thread util/configparser.y
Comment thread util/netevent.c Outdated
Comment thread util/netevent.h Outdated

@wcawijngaards wcawijngaards left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice code! Review completed and approved. I am fine with merging this branch.

@Jakker

Jakker commented Sep 10, 2020 via email

Copy link
Copy Markdown
Contributor

@ralphdolmans

Copy link
Copy Markdown
Contributor Author

@Jakker , correct sizeof is the size needed to store the string literal, so including null byte. Hence the -1 in the code.

@ralphdolmans
ralphdolmans merged commit 8678868 into master Sep 18, 2020
@gthess
gthess deleted the doh branch November 30, 2021 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.