DNS over TLS not working

I’ve spent several hours trying various permutations of the following config, but no matter what I do I can’t get unbound to forward a DNS request over TLS:

server:
tls-cert-bundle: “C:\Program Files\Unbound\cabundle.crt”
forward-zone:
name: “.”
forward-ssl-upstream: yes
forward-addr: 1.1.1.1@853#cloudflare-dns.com

I’m on windows 10, unbound v1.7.1. I’ve been using nslookup to test:

C:\Users\Me>nslookup - 127.0.0.1
Default Server: localhost
Address: 127.0.0.1

google.com
Server: localhost
Address: 127.0.0.1

*** localhost can’t find google.com: Server failed

Following this request in wireshark, unbound is accurately requesting DNS to the cloudflare server on tcp port 853, but is attempting to do this without negotiating a TLS connection, which cloudflare appropriately rejects.

Anyone have any ideas?

Hi Raymond,

I've spent several hours trying various permutations of the following
config, but no matter what I do I can't get unbound to forward a DNS
request over TLS:

This config looks correct. It should be connecting with TLS. Unless
you have other options in unbound.conf that negate the lines you pasted
here. Perhaps enable verbosity: 4 and logfile: "C:\unbound.log" and
log-time-ascii: yes and then you have a logfile in plain text with
details about what unbound is doing.

Best regards, Wouter

I can confirm this issue.

1.7.1 64bit does not work with DoT on Win10.

Verbosity 4 log and service config attached.

See no anomalies in log, however no resolve.

SImplified config (OpenDNS, no DNSSEC etc.) - works.

(attachments)

service.conf (2.28 KB)
unbound.zip (112 KB)

Hi Yuri,

I can confirm this issue.

1.7.1 64bit does not work with DoT on Win10.

Verbosity 4 log and service config attached.

See no anomalies in log, however no resolve.

SImplified config (OpenDNS, no DNSSEC etc.) - works.

I have made some fixes for DNS-over-TLS for unbound on windows, the are
in the patch below. I've also compiled a 64bit build for that snapshot.
Does the solve the problem?

http://open.nlnetlabs.nl/~wouter/unbound-1.7.2_20180507.zip (16Mb)
http://open.nlnetlabs.nl/~wouter/unbound-1.7.2_20180507.zip.asc (pgp sig)

The diff solves two problems. Sticky TCP flags causing TLS to use more
CPU that is probably needed, assuming openssl always reads all available
data. The other is that a combined result of data and tcp length would
not be handled correctly, also on Linux.

Index: util/netevent.c

Just checked. Unfortunately, patch does not fix issue.

Same sympthom. Timeout, then no resolve.

[http://open.nlnetlabs.nl/~wouter/unbound-1.7.2_20180507.zip](http://open.nlnetlabs.nl/%7Ewouter/unbound-1.7.2_20180507.zip) (16Mb)
[http://open.nlnetlabs.nl/~wouter/unbound-1.7.2_20180507.zip.asc](http://open.nlnetlabs.nl/%7Ewouter/unbound-1.7.2_20180507.zip.asc) (pgp sig)

Hi Yuri,

Just checked. Unfortunately, patch does not fix issue.

Same sympthom. Timeout, then no resolve.

From your previous logs, what unbound does is connect, then write. Then
it gets nothing to read. Until the timeout happens. The connection
closes, there was no data received.

Is there a firewall of some sort preventing data from leaving or
entering the system?

Best regards, Wouter

Nop,

I've disabled all firewalls with same results.

And when I've tried to open TCP socket on 1.1.1.1 port 853 with telnet -
it's opens.

Hi Yuri,

Is it possible that it is OpenSSL-related issue? Does OpenSSL library in
windows unbound statically linked?

08.05.2018 18:12, W.C.A. Wijngaards via Unbound-users пишет:

Hi Yuri,

Yes it is static linked, and you can see what it is by running unbound
from the command prompt with the -h flag.

For this release I moved from 1.0.2j to 1.1.0h, and I now also wonder if
that has made an impact somehow.

Best regards, Wouter

I'm just wondering, why *NIX version works well, but windows not with DoT.

In same conditions, in same networks. With similar configurations. With
existing connectivity to sources.

08.05.2018 18:32, W.C.A. Wijngaards via Unbound-users пишет:

Yuri via Unbound-users:

I'm just wondering, why *NIX version works well, but windows not with DoT.

wild guess: an MTU issue?

Hardly. Same settings in same networks.

08.05.2018 19:58, A. Schulze via Unbound-users пишет:

I downloaded the updated binary and tried on my system as well - unbound is still attempting to resolve without first negotiating TLS.

It correctly reaches out to 1.1.1.1:853, but it doesn't negotiate a TLS connection. Is there anything I could do to help fix this?

-Ray

Still not, Raymond.

Digging.

08.05.2018 21:45, Raymond Bannan via Unbound-users пишет:

Hi,

No idea what is going on anymore, here is two new sets of binaries.

These are made with openssl 1.0.2j. The code in unbound that does
tls-upstream:yes is basically almost the same as previous releases, and
with the same version of openssl, shouldn't that work like it did in the
previous release?

Note that the 1.0.2 openssl does not have the set verify name function
that is used to verify the tls authentication name, so it won't check that.

open.nlnetlabs.nl/~wouter/unbound-1.7.1_20180509.zip
open.nlnetlabs.nl/~wouter/unbound-1.7.2_20180509.zip

pgp sigs in .asc files.

The 1.7.1 zipfile is the 1.7.1 release with the different openssl library.

The 1.7.2 has a different windows event handling for SSL upstream, that
should result in fewer cycles used to handle the SSL connection. It
should however, not otherwise change the SSL connection calls to OpenSSL.

Best regards, Wouter

09.05.2018 11:51, W.C.A. Wijngaards via Unbound-users пишет:

Hi,

No idea what is going on anymore, here is two new sets of binaries.

These are made with openssl 1.0.2j. The code in unbound that does
tls-upstream:yes is basically almost the same as previous releases, and
with the same version of openssl, shouldn't that work like it did in the
previous release?

Note that the 1.0.2 openssl does not have the set verify name function
that is used to verify the tls authentication name, so it won't check that.

open.nlnetlabs.nl/~wouter/unbound-1.7.1_20180509.zip
open.nlnetlabs.nl/~wouter/unbound-1.7.2_20180509.zip

Same shame, Wouter.:frowning:

Both does not work with DoT.

Hi Yuri,

09.05.2018 11:51, W.C.A. Wijngaards via Unbound-users пишет:

Hi,

No idea what is going on anymore, here is two new sets of binaries.

These are made with openssl 1.0.2j. The code in unbound that does
tls-upstream:yes is basically almost the same as previous releases, and
with the same version of openssl, shouldn't that work like it did in the
previous release?

Note that the 1.0.2 openssl does not have the set verify name function
that is used to verify the tls authentication name, so it won't check that.

open.nlnetlabs.nl/~wouter/unbound-1.7.1_20180509.zip
open.nlnetlabs.nl/~wouter/unbound-1.7.2_20180509.zip

Same shame, Wouter.:frowning:

Both does not work with DoT.

I have a bugfix for windows DNS-over-TLS. There was missing
initialisation. The version with bugfixes is available here
open.nlnetlabs.nl/~wouter/unbound-1.7.2rc45.zip
and unbound_setup_1.7.2rc45.exe and .asc gpg sigs.

Best regards, Wouter

Still get tcp error:

24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] info:
0RDd mod1 rep nasa.gov. A IN
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
cache memory msg=66446 rrset=66533 infra=6220 val=66288
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
svcd callbacks end
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
event_del 0000000003F0CF50 added=1 fd=-1 tv=1527159695184 EV_TIMEOUT
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
winsock 504 got sticky EV_READEV_WRITE
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
winsock 504 pass sticky EV_READEV_WRITE
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
winsock 504 store sticky EV_READEV_WRITE
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
winsock event callback 0000000003E97210 fd=504 ; EV_READ EV_WRITE
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
bio_cb 6, before read
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
bio_cb 134, return read
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
bio_cb 3, before read
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
bio_cb 131, return read
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
bio_cb 6, before read
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
bio_cb 134, return read
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
bio_cb 1, before write
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
event_del 0000000003E97210 added=1 fd=504 tv=-1 EV_WRITE
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
close fd 504
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
outnettcp cb
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
outnettcp got tcp error -1
24.05.2018 17:01:35 C:\Program Files\Unbound\unbound.exe[18264:1] debug:
tcp error for address ip4 1.1.1.1 port 853 (len 16)

and no resolve.

24.05.2018 15:57, W.C.A. Wijngaards пишет:

(attachments)

unbound.log.zip (14.9 KB)

Hi Yuri,

Still get tcp error:

Do you have a ca-cert bundle loaded?
server:
        tls-cert-bundle: "ca-bundle.pem"

From, on Linux: /etc/pki/tls/certs/ca-bundle.crt

Best regards, Wouter