Skip to content

DNSSEC and a local resolver

Your domain needs zone signing at the DNS provider and a matching DS at the registrar. Unbound validates responses; it does not sign your public zone.

RateMyMail assesses reverse DNS separately: an unsigned, missing or invalid PTR record does not lower the general DNSSEC status. Forward confirmation of the PTR name also belongs to that separate check. Unsigned, invalid and unknown answers to authentication queries remain distinct findings. Previously saved reports retain their original assessment.

Setup

Prepare your values and Debian packages. Commands use your domain and files.

Enable DNSSEC at your provider, publish its DS unchanged at the registrar and check the chain. This recipe binds loopback port 53 and switches the system resolver to it. It requires a regular resolv.conf that is not managed by NetworkManager or systemd-resolved. For a managed symlink, configure that network manager to use the local resolver first; the block explicitly stops in that case. Check for existing listeners on 127.0.0.1:53 before proceeding.

set -euo pipefail
apt-get install -y --no-install-recommends unbound dns-root-data
test ! -L /etc/resolv.conf || { echo 'resolv.conf is managed: configure DNS in the network manager' >&2; exit 1; }
if test ! -s /var/lib/unbound/root.key; then
  install -o unbound -g unbound -m 0644 /usr/share/dns/root.key /var/lib/unbound/root.key
fi
cat > /etc/unbound/unbound.conf.d/mailserver.conf <<'EOF'
server:
  interface: 127.0.0.1
  access-control: 127.0.0.0/8 allow
  hide-identity: yes
  hide-version: yes
EOF
unbound-checkconf
systemctl enable --now unbound
systemctl restart unbound
if test ! -e /etc/resolv.conf.before-mailserver; then
  cp -p /etc/resolv.conf /etc/resolv.conf.before-mailserver
fi
printf 'nameserver 127.0.0.1\noptions edns0 trust-ad\n' > /etc/resolv.conf
systemctl reload postfix

Preserve the resolver inside the Postfix chroot

For chrooted Postfix services, the resolver file at $(postconf -h queue_directory)/etc/resolv.conf also matters. Debian startup scripts may copy it from the host file again when the service starts. A one-time edit and reload therefore do not demonstrate that the intended resolver survives a restart.

If the entire host already uses the same validating resolver, the copied chroot file must point to it as well. If only Postfix should use a dedicated resolver, preserve host/VPN resolution and use a separate Postfix file with the actual bound loopback address, for example 127.0.0.2. Unbound must listen on that address. Install the separate file through a startup hook after the distribution-specific Postfix service's copy step. On Debian this often involves the postfix@-.service instance rather than only the parent service; inspect local units and startup order first.

Restart Postfix during a planned maintenance window, then verify the chroot file, resolver reachability and a regular outgoing delivery again. Adapt the DNSSEC test below to the selected resolver address. Testing the host resolver alone does not demonstrate the resolver path used by the Postfix chroot.

Test

set -euo pipefail
unbound-checkconf
systemctl is-active unbound
dig @127.0.0.1 . DNSKEY +dnssec +comments > /root/mail-tests/root-dnssec.txt
cat /root/mail-tests/root-dnssec.txt
grep -E 'flags:.* ad[; ]' /root/mail-tests/root-dnssec.txt
grep -Fx 'nameserver 127.0.0.1' /var/spool/postfix/etc/resolv.conf

Check your public domain chain:

Public DNSSEC chain
. /root/mailserver.env
delv "$DOMAIN" SOA

Expected for the root query: a validated response with ad. For your domain, delv must report a fully validated chain. Fix SERVFAIL caused by an incorrect DS rather than disabling validation. A local container cannot publish provider or registrar settings.