ansible-infra/roles/unbound/templates/unbound.conf.j2
lilly a315ef48e2
add local PTR records in z9 to pass rfc7050 validation
We configure dns64 in unbound which also automatically includes the
capability to communicate the local nat64 prefix to clients via
DNS as a mechanism.
This mostly *just works* except that a validation of the received
information is required by RFC7050 which needs requires explicit
unbound configuration. That configuration is implemented here.
2026-12-06 15:22:07 +01:00

79 lines
2.4 KiB
Django/Jinja

# ref: https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound.conf.html
# unbound.conf(5) man page
server:
module-config: "{% if unbound_enable_dns64 %}dns64 {% endif %}validator iterator"
{% if unbound_enable_dnssec -%}
# location of the trust anchor file that enables DNSSEC
# this file is generated by the `unbound-anchor` command
trust-anchor-file: "/usr/share/dns/root.key"
{% endif -%}
# num of threads
num-threads: {{ unbound_thread_count | default(ansible_facts['processor_vcpus']) }}
# more cache memory
rrset-cache-size: 60m
msg-cache-size: 30m
# prefetch to keep the cache up to date
prefetch: yes
# fetch the DNSKEYs earlier in the validation process, when a DS record is encountered
prefetch-key: yes
# Faster UDP with multithreading (only on Linux).
so-reuseport: yes
# disable special large send buffer handling and just use kernel defaults
so-sndbuf: 0
# send minimal amount of information to upstream servers to enhance privacy
qname-minimisation: yes
# specify the interface to answer queries from by ip-address.
{% for i in unbound_bind_interfaces -%}
interface: "{{ i }}"
{% endfor %}
# addresses from the IP range that are allowed to connect to the resolver
{% for i in unbound_access_control -%}
access-control: {{ i }} allow
{% endfor -%}
{% for i in unbound_private_domain -%}
private-domain: {{ i }}
{% endfor -%}
{% if unbound_enable_dns64 -%}
dns64-prefix: "{{ unbound_dns64_prefix }}"
{% endif -%}
{% for i in unbound_local_ptr -%}
local-data-ptr: "{{ i }}"
{% endfor -%}
# The number of seconds between printing statistics to the log for every thread.
statistics-interval: 0
# Extended statistics are printed, Keeping track of more statistics takes time.
extended-statistics: yes
remote-control:
control-enable: {{ "yes" if unbound_enable_unbound_control else "no" }}
control-interface: "/run/unbound.ctl" # debian appamour does not allow any other path!!!
control-use-cert: no
# configure some zones for which this resolver will act authoritatively
# https://www.dns.icann.org/services/axfr/
{% for i in [ ".", "in-addr.arpa.", "arpa.", "root-servers.net.", "ip6.arpa.", "ip6-servers.arpa.", "mcast.net." ] %}
auth-zone:
name: "{{ i }}"
primary: "lax.xfr.dns.icann.org"
primary: "iad.xfr.dns.icann.org"
fallback-enabled: yes
for-downstream: no
for-upstream: yes
{% endfor %}