cloudflare / odoh-client-go

Oblivious DoH client
MIT License
80 stars 19 forks source link

target provided no odoh configs #16

Open rocheston opened 3 years ago

rocheston commented 3 years ago

Why do I get this error: target provided no odoh configs

This is what I tried.

./odoh-client odohconfig-fetch --target odoh.cloudflare-dns.com --pretty

./odoh-client odoh --domain www.cloudflare.com. --dnstype AAAA --target odoh.cloudflare-dns.com --proxy odoh1.surfdomeinen.nl

-- It does not work. I get this error: target provided no odoh configs

Please help. Thanks.

rocheston commented 3 years ago

Hello, please reply brother. Thanks.

NullHypothesis commented 3 years ago

Looks like odoh.cloudflare-dns.com fails to serve the odohconfig SVCB key over DNS but the fallback mechanism (which fetches the config from https://odoh.cloudflare-dns.com/.well-known/odohconfigs) still works. Here's a patch that helps your client use the fallback mechanism:

From e939e31a2e10a14ae4e4b4432bad34aa244e0e2e Mon Sep 17 00:00:00 2001
From: Philipp Winter <phw@brave.com>
Date: Mon, 19 Apr 2021 16:21:52 -0700
Subject: [PATCH] Use fallback mechanism if ODoH config is empty.

---
 commands/fetch.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/fetch.go b/commands/fetch.go
index 85a052d..f52e8ef 100644
--- a/commands/fetch.go
+++ b/commands/fetch.go
@@ -72,7 +72,7 @@ func fetchTargetConfigs(targetName string) (odoh.ObliviousDoHConfigs, error) {
    u := buildOdohConfigURL(targetName)
    hostname := dns.Fqdn(u.Hostname())
    odohConfigs, err := fetchTargetConfigsFromDNS(hostname)
-   if err == nil {
+   if err == nil && len(odohConfigs.Configs) > 0 {
        return odohConfigs, err
    }

-- 
2.27.0