]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Merge pull request #15780 from rgacogne/ddist20-backport-15751
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 3 Jul 2025 12:05:05 +0000 (14:05 +0200)
committerGitHub <noreply@github.com>
Thu, 3 Jul 2025 12:05:05 +0000 (14:05 +0200)
dnsdist-2.0.x: Backport to 15751 - Error on unsupported backend protocols from YAML

1  2 
pdns/dnsdistdist/dnsdist-configuration-yaml.cc

index 0f1ebd5a8530697f90a5a1d9b9a582d4b1389119,3cb801547dcb17f909109c2b045b58585c19c737..3b27cd5d4b60bcb8d7ee9217d65807e8ac6804dd
@@@ -448,8 -448,18 +448,19 @@@ static std::shared_ptr<DownstreamState
    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);
 +    boost::algorithm::to_lower(backendConfig.d_tlsParams.d_provider);
      backendConfig.d_tlsParams.d_ciphers = std::string(tlsConf.ciphers);
      backendConfig.d_tlsParams.d_ciphers13 = std::string(tlsConf.ciphers_tls_13);
      backendConfig.d_tlsParams.d_caStore = std::string(tlsConf.ca_store);