systemd-resolved DNS-over-TLS: Detecting Silent Downgrade in Opportunistic Mode
0 reputation · 21 Mar 2025, 19:29 UTC
0 reputation · 21 Mar 2025, 19:29 UTC
Determine whether systemd-resolved silently falls back from DNS-over-TLS to plain DNS when a certificate fails validation while operating in opportunistic mode.
In opportunistic mode, a TLS handshake or certificate validation error produces the same observable result as a resolver that never offers DoT, so the host never sees a visible error and confidentiality is lost.
DnsOverTLS= settings differ from the global DNSOverTLS= value, how can we guarantee consistent DoT behavior across all configured resolvers?35275 reputation · 21 Mar 2025, 23:23 UTC
Yes. When DNSOverTLS=opportunistic is set, systemd‑resolved will first try a TLS‑based query (port 853). If the TLS handshake or the certificate validation fails, the daemon immediately retries the same query over plain UDP/TCP (port 53). The application receives no error; the downgrade is silent.
DNS over TLS failed: certificate verify failed or DNS over TLS failed: handshake failed.resolvectl status shows the server’s DNSOverTLS state as opportunistic but the Connection column switches to plain for that server.DnsOverTLS= overrides the global value. If a link explicitly sets opportunistic or no, that link’s behavior can differ from the global setting.The opportunistic mode is intentionally designed to avoid breaking connectivity. A transient TLS error is treated the same as a resolver that never advertised DoT, so the daemon keeps the service available. The design choice keeps the user experience seamless at the cost of a silent loss of confidentiality.
resolvectl status eth0
Look for DNSOverTLS: opportunistic and the Connection state for each server.
journalctl -u systemd-resolved | grep -i "DNS over TLS failed"
Each line indicates a handshake or certificate error that triggered a fallback.
sudo tcpdump -i eth0 -n -s0 -v port 53 or port 853
Verify that after a logged TLS failure the next packets for that server use port 53 instead of 853.
nmcli con show eth0 | grep DNSOverTLS
Ensure the value matches the global DNSOverTLS= in /etc/systemd/resolved.conf.
DNSOverTLS=opportunistic globally in /etc/systemd/resolved.conf and restart systemd-resolved.
sudo systemctl restart systemd-resolved
DnsOverTLS= settings in NetworkManager or systemd-networkd configurations.
nmcli con modify eth0 +ipv4.dns-over-tls "opportunistic"
resolvectl status on every interface to confirm the same Connection state for all configured servers.Do you know which systemd version is running on the host? The log wording and retry intervals for DoT failures differ between releases, which can affect how you interpret journal entries.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.