caddy: v2.10.0-beta.2: unable to publish ECH data to cloudflare HTTPS DNS record

I’m trying to configure ECH with Cloudflare as DNS provider, and using the second-level domain as ECH public name.

      tls = {
        dns = {
          name = "cloudflare";
          api_token = "{env.CF_API_TOKEN}";
          zone_token = "{env.CF_ZONE_TOKEN}";
        };
        encrypted_client_hello.configs = [
          {
            public_name = "nyaw.xyz";
          }
        ];
      };

My related caddy JSON config(in nix). And all these domains are resolved to the machine.

Experiencing the error below (formatted):

{
  "level": "error",
  "ts": 1741433454.0890296,
  "logger": "tls",
  "msg": "unable to publish ECH data to HTTPS DNS record",
  "domain": "nyaw.xyz",
  "error": "got error status: HTTP 400: [{Code:9000 Message:DNS name is invalid. ErrorChain:[]}]"
}

And it successfully published all other domains’ (3rd/4rd-level domains) ech config except 2nd level domain.

Image

FWIW I’m using wildcard certificate for all *.nyaw.xyz , and the 2nd-lvl domain is configured to request a standalone certificate. and certificates are all successfully obtained.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Could you open a separate issue for the wildcard situation? I’ll try to look into it next. Strange though, wildcards worked for me (at least at one point) when I tested them.

I’ve opened a new issue and added some extra info, hope this helps! https://github.com/caddyserver/caddy/issues/6895

@oluceps I believe I have remedied the bug for this issue, so I’ll close it now. You can confirm by trying the latest commit on master.

Thanks! I tested with 39262f86632401ae4915600b042ef5a28141d3d5, the HTTPS record for the second-level domain was successfully added, and ECH for this site works fine now, but the issue mentioned in https://github.com/caddyserver/caddy/issues/6887#issuecomment-2708830316 about wildcard cert with ECH still exists.

Does Caddy 2.10 beta 2 help here? Just asking before giving it a try.

I tried beta2 but same issue.

With the config above, I’ve tested the ECH working status with curl, and found that there may be some issue with the wildcard certificate working with ECH.

Here is part of the log, TLDR, 2nd level domain (nyaw.xyz) and all its subdomains *.nyaw.xyz (that are using wildcard certificate) has ech status of not configured (even if the HTTPS record for * existed), while the others which obtain certificate standalone is working fine:

> curl -v --ech true --doh-url https://1.1.1.1/dns-query https://matrix.nyaw.xyz

# snippet
* ECH: result: status is not configured, inner is NULL, outer is NULL
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=*.nyaw.xyz
# snippet
> curl -v --ech true --doh-url https://1.1.1.1/dns-query https://nyaw.xyz/
* 
* ECH: result: status is not configured, inner is NULL, outer is NULL
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=nyaw.xyz
> curl -v --ech true --doh-url https://1.1.1.1/dns-query https://api.atuin.nyaw.xyz

* ECH: result: status is succeeded, inner is api.atuin.nyaw.xyz, outer is nyaw.xyz
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=api.atuin.nyaw.xyz

Please let me know if there’s any additional information I can provide to assist with debugging.

Post your full logs, with debug mode enabled

Here is my full config and log, Reproduction steps below:

  1. Delete ALL former set HTTPS record in Cloudflare dashboard.

  2. Start caddy with (ech) config: https://gist.github.com/oluceps/fac343718317ef531061180c0cd96824

  3. The log, after start about 10s, HTTPS records except 2nd-level domain’s published: https://gist.github.com/oluceps/d8c0fc2eadd938ed859fe9d7fac87bf1

But I’m not sure ECH gives you any benefit when the outer and inner names are the same.

It does have benefits since it makes middlebox unable to differentiate between traffic to it and its subdomains. (even if this does not affect me)