From: Remi Gacogne Date: Mon, 30 Jun 2025 13:15:46 +0000 (+0200) Subject: dnsdist: Error on unsupported backend protocols from YAML X-Git-Tag: rec-5.3.0-alpha2~23^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F15751%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Error on unsupported backend protocols from YAML Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist-configuration-yaml.cc b/pdns/dnsdistdist/dnsdist-configuration-yaml.cc index e2010a71ab..3cb801547d 100644 --- a/pdns/dnsdistdist/dnsdist-configuration-yaml.cc +++ b/pdns/dnsdistdist/dnsdist-configuration-yaml.cc @@ -448,6 +448,17 @@ static std::shared_ptr createBackendFromConfiguration(const dns const auto& tlsConf = config.tls; auto protocol = boost::to_lower_copy(std::string(config.protocol)); if (protocol == "dot" || protocol == "doh") { +#if !defined(HAVE_DNS_OVER_TLS) + if (protocol == "dot") { + throw std::runtime_error("Backend " + std::string(config.address) + " is configured to use DNS over TLS but DoT support is not available"); + } +#endif /* HAVE_DNS_OVER_TLS */ +#if !defined(HAVE_DNS_OVER_HTTPS) + if (protocol == "doh") { + throw std::runtime_error("Backend " + std::string(config.address) + " is configured to use DNS over HTTPS but DoH support is not available"); + } +#endif /* HAVE_DNS_OVER_HTTPS */ + backendConfig.d_tlsParams.d_provider = std::string(tlsConf.provider); backendConfig.d_tlsParams.d_ciphers = std::string(tlsConf.ciphers); backendConfig.d_tlsParams.d_ciphers13 = std::string(tlsConf.ciphers_tls_13);