caddy: v2.10.0-beta.2: ECH with domains that use wildcard certificates not work
With the config, I tested the ECH working status with curl and chromium, found that there may be some issue with the wildcard certificate working with ECH. Tested with 39262f86632401ae4915600b042ef5a28141d3d5
Here is part of the log, TLDR, all subdomains *.nyaw.xyz (that are using wildcard certificate) has ech status of not configured (even if the HTTPS record for * existed):
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://yidhra.nyaw.xyz
#...
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 / X25519MLKEM768 / id-ecPublicKey
* ECH: result: status is not configured, inner is NULL, outer is NULL
* ALPN: server accepted h2
* Server certificate:
* subject: CN=*.nyaw.xyz
dns.google query result (no HTTPS record with ech pubkey exist, if it has, it’s I’m in debugging)
The part of my config , matrix.nyaw.xyz placed in subroute of *.nyaw.xyz, and yidhra.nyaw.xyz is standalone. All of 3rd level domain has ECH status of not configured. And I set prefer_wildcard enabled.
{
"apps": {
"http": {
"servers": {
"srv0": {
"automatic_https": {
"prefer_wildcard": true,
"skip_certificates": []
},
"routes": [
{
"handle": [
{
"handler": "subroute",
"routes": [
{
// matrix.nyaw.xyz and all other domains here
}
]
}
],
"match": [
{
"host": ["*.nyaw.xyz"]
}
]
},
{
"handle": [
// ..
],
"match": [
{
"host": ["yidhra.nyaw.xyz"],
"path": ["/metrics"]
}
]
},
{
"handle": [
// ...
],
"match": [
{
"host": ["yidhra.nyaw.xyz"],
"path": ["/probe"]
}
]
}
],
"strict_sni_host": false
}
}
}
// ...
}
}
While I set prefer_wildcard false, after reloading, following HTTPS record newly added to cloudflare, ECH status for yidhra.nyaw.xyz turns to success. (other *.nyaw.xyz remains)
> curl -v --ech true --doh-url https://1.1.1.1/dns-query https://yidhra.nyaw.xyz
* Some HTTPS RR to process
* Host yidhra.nyaw.xyz:443 was resolved.
* IPv6: (none)
* IPv4: 8.210.47.13
* Trying 8.210.47.13:443...
* ECH: ECHConfig from DoH HTTPS RR
* ECH: imported ECHConfigList of length 69
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 / X25519MLKEM768 / id-ecPublicKey
* ECH: result: status is succeeded, inner is yidhra.nyaw.xyz, outer is nyaw.xyz
* ALPN: server accepted h2
* Server certificate:
* subject: CN=*.nyaw.xyz
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 31 (13 by maintainers)
@oluceps Thanks, I was able to reproduce that behavior, and have pushed a fix. (We’re currently establishing more proper semantics for libdns packages, and one of them is to use “@” instead of “” in record names that are returned from the libdns functions. Right now, Cloudflare returns “” even when, in the UI, they show “@”. So I’ll need to fix that upstream, but I have a temporary fix in Caddy for the moment.)
Can you try the latest commit with a clean slate? (Ensure all the reset instructions above are followed, plus any others you might need.)
@jsarenik I believe we have addressed your concern in another issue. 👍
(We can reopen this if needed, so feel free to continue discussion.)
In my experience, restarting the browser isn’t enough. DNS is very persnickety and sticky. 🙂
I normally do test exclusively with curl or with Go programs, but in this case, I haven’t; mainly because getting curl with ECH up and running on my platform was too complicated for the time I had.
Fair point, and I would like to also, since I typically strongly advise against using browsers for testing, because they do all sorts of funky magic. And given the experimental nature of the tech, it’s quite possible that clients differ significantly, or have bugs.
If I have time to get curl with ECH running, I will try it; but until then, it’s still imperative that every test starts with a clean slate in every relevant way: DNS cache, TLS session, TCP connection, restarting the server process, recompiling the server binary, etc etc. (I’ve had to be very careful about that in development as well. Yes I’m sure there are easier ways, and yes I’m stubborn. 😉)
Been a bit sidetracked with some other pressing issues, but I’m returning to this one ASAP (right after the weekend, I hope). In the meantime if you make any progress, keep me posted!
@mholt wrote:
Querying ANY is disabled on many DNS servers.
Some extra info about my testing envs:
Local PC:
Linux 6.13.5, NixOS, 25.05 (Warbler), 25.05.20250305.59e3cd3Google Chrome Version 134.0.6998.35 (Official Build) beta (64-bit)
Firefox Version 134.0.6998.35 (Official Build) beta (64-bit)
curl with https://github.com/defo-project/openssl/commit/c4f9b218a3c68971909f92913693a42d6150a11e and curl 8.12.0
Windows 11VPSs in different ISP:
Linux 6.13.5, NixOS, 25.05 (Warbler), 25.05.20250305.59e3cd3All browser had verified ech working with
tls-ech.devandnyaw.xyz. but*.nyaw.xyzwildcard ech not work.These are doh servers used when I test:
That’s because I set
prefer_wildcardfalse at present, You could try again now since I set it to true now (and clean https record then restart caddy).And, while setting
prefer_wildcard, the ech-publish log which i previous mentiond:Has no
"yidhra.nyaw.xyz"in list. (which I think maybe expected? since it uses wildcard cert)