Pi-hole Unbound and Cloudflare TLS

Expected Behaviour:

I use a 4B 4GB RPi with Raspbian Bullseye 64bit with Pi-hole v5.9, FTL v5.14 and Web Interface v5.11. I can't use pihole with Cloudflare unbound and tls with DoT

Actual Behaviour:

Until recently it worked fine for me, but since I had to reconfigure the whole raspberry, I can no longer get pihole to work with unbound-cloudflare tls, as my connection freezes. In particular I created the file 'pi-hole.conf' present in '/etc/unbound/unbound.conf.d' as shown below:

server:
    # If no logfile is specified, syslog is used
    #logfile: "/var/log/unbound/unbound.log"
    verbosity: 0

    interface: 127.0.0.1
    port: 5335
    do-ip4: yes
    do-udp: yes
    do-tcp: yes

    # May be set to yes if you have IPv6 connectivity
    do-ip6: no

    # You want to leave this to no unless you have *native* IPv6. With 6to4 and
    # Terredo tunnels your web browser should favor IPv4 for the same reasons
    prefer-ip6: no

    # Use this only when you downloaded the list of primary root servers!
    # If you use the default dns-root-data package, unbound will find it automatically
    #root-hints: "/var/lib/unbound/root.hints"

    # Trust glue only if it is within the server's authority
    harden-glue: yes

    # Require DNSSEC data for trust-anchored zones, if such data is absent, the zone becomes BOGUS
    harden-dnssec-stripped: yes

    # Don't use Capitalization randomization as it known to cause DNSSEC issues sometimes
    # see https://discourse.pi-hole.net/t/unbound-stubby-or-dnscrypt-proxy/9378 for further details
    use-caps-for-id: no

    # Reduce EDNS reassembly buffer size.
    # Suggested by the unbound man page to reduce fragmentation reassembly problems
    edns-buffer-size: 1472

    # Perform prefetching of close to expired message cache entries
    # This only applies to domains that have been frequently queried
    prefetch: yes

    # One thread should be sufficient, can be increased on beefy machines. In reality for most users running on small networks or on a single machine, it should be unnecessary to seek performance enhancement by increasing num-threads above 1.
    num-threads: 1

    # Ensure kernel buffer is large enough to not lose messages in traffic spikes
    so-rcvbuf: 1m

    # Ensure privacy of local IP ranges
    private-address: 192.168.0.0/16
    private-address: 169.254.0.0/16
    private-address: 172.16.0.0/12
    private-address: 10.0.0.0/8
    private-address: fd00::/8
    private-address: fe80::/10
#####################
# This section enables DoT (DNS over TLS)
#####################
#TLS cert bundle
    tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
#Connect to Cloudflare
    forward-zone:
    name: "."
    forward-tls-upstream: yes
    # Cloudflare DNS
    forward-addr: 2606:4700:4700::1111@853#cloudflare-dns.com
    forward-addr: 1.1.1.1@853#cloudflare-dns.com
    forward-addr: 2606:4700:4700::1001@853#cloudflare-dns.com
    forward-addr: 1.0.0.1@853#cloudflare-dns.com

Then I changed the dns from the pihole dashboard with 127.0.0.1 # 5335 then I restarted unbound with 'sudo service unbound restart' and pihole with 'sudo systemctl restart pihole-FTL'. Then trying to connect to '1.1.1.1/help' it is not connected in tls. If I force the IP of the dns with that of the raspberry, the internet connection no longer works. I am unable to extract the logs on pihole because, after making this request, the dashboard no longer responds ...

Debug Token:

I can't export it. If I try Pihole freezes. If I try from the terminal, it gives me back an infinity of lines.

Have you hashed out below line:

pi@ph5b:~ $ sudo nano /etc/resolvconf.conf
[..]
#unbound_conf=/etc/unbound/unbound.conf.d/resolvconf_resolvers.conf

And deleted below file:

pi@ph5b:~ $ sudo rm /etc/unbound/unbound.conf.d/resolvconf_resolvers.conf
rm: cannot remove '/etc/unbound/unbound.conf.d/resolvconf_resolvers.conf': No such file or directory

Above file configures unbound differently as you would expect creating a forward zone:

2 Likes

Thanks by removing that file and restarting, everything is working fine now.

1 Like

I suspect you also commented/hashed out that line in resolvconf.conf I mentioned before?
Or else that other file resolvconf_resolvers.conf will be recreated at boot or when network state changes:

Yes yes of course. I hadn't written it, but I also edited that file by commenting on the last line.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.