Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.10.0-beta.1: Caddy panics when using ECH's DNS sub-option #6885

Closed
jonaharagon opened this issue Mar 7, 2025 · 1 comment
Closed

v2.10.0-beta.1: Caddy panics when using ECH's DNS sub-option #6885

jonaharagon opened this issue Mar 7, 2025 · 1 comment
Labels
bug 🐞 Something isn't working

Comments

@jonaharagon
Copy link

This global configuration does not work despite https://caddyserver.com/docs/caddyfile/options indicating it should:

{
	ech ech.triplebit.net {
		dns cloudflare {env.CF_ECH_API_TOKEN}
	}
}
jonah@MacBook-Pro-4 caddy-build % ./caddy validate
2025/03/07 22:14:47.617 INFO    maxprocs: Leaving GOMAXPROCS=10: CPU quota undefined
2025/03/07 22:14:47.617 INFO    GOMEMLIMIT is updated   {"package": "github.com/KimMachineGun/automemlimit/memlimit", "GOMEMLIMIT": 30923764531, "previous": 9223372036854775807}
2025/03/07 22:14:47.618 INFO    using adjacent Caddyfile
2025/03/07 22:14:47.618 INFO    using config from file  {"file": "Caddyfile"}
2025/03/07 22:14:47.620 INFO    adapted config to JSON  {"adapter": "caddyfile"}
2025/03/07 22:14:47.621 INFO    maxprocs: No GOMAXPROCS change to reset
panic: reflect: call of reflect.Value.Elem on struct Value

goroutine 1 [running]:
reflect.Value.Elem({0x10634fd00?, 0x140002e77d0?, 0x1400063c3e8?})
        /opt/homebrew/Cellar/go/1.24.1/libexec/src/reflect/value.go:1265 +0x198
github.com/caddyserver/caddy/v2.Context.LoadModule({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x1400044e1c0, 0x3, 0x4}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:180 +0xc0
github.com/caddyserver/caddy/v2/modules/caddytls.ECHDNSPublisher.Provision({{0x1400064a030, 0x25, 0x30}, {0x0, 0x0}, 0x0}, {{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, ...})
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/modules/caddytls/ech.go:598 +0xd4
github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x1400044e1c0, 0x3, 0x4}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:402 +0x6b4
github.com/caddyserver/caddy/v2.Context.loadModuleMap({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x1400055ab00, 0x2, 0x2}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:328 +0x1f4
github.com/caddyserver/caddy/v2.Context.loadModulesFromSomeMap({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x1400055ab00, 0x2, 0x2}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:290 +0x108
github.com/caddyserver/caddy/v2.Context.LoadModule({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x1400055ab00, 0x2, 0x2}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:265 +0x4cc
github.com/caddyserver/caddy/v2/modules/caddytls.(*ECH).Provision(0x1400044e100, {{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x1400055ab00, 0x2, 0x2}, {0x0, 0x0, ...}, ...})
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/modules/caddytls/ech.go:85 +0x168
github.com/caddyserver/caddy/v2/modules/caddytls.(*TLS).Provision(0x1400063c140, {{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x1400055ab00, 0x2, 0x2}, {0x0, 0x0, ...}, ...})
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/modules/caddytls/tls.go:188 +0x5b0
github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x1400055ab00, 0x2, 0x2}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:402 +0x6b4
github.com/caddyserver/caddy/v2.Context.App({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x140005aa220, 0x1, 0x1}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:478 +0x148
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision(0x1400063a270, {{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x140005aa220, 0x1, 0x1}, {0x0, 0x0, ...}, ...})
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/modules/caddyhttp/app.go:169 +0xa4
github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x140005aa220, 0x1, 0x1}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:402 +0x6b4
github.com/caddyserver/caddy/v2.Context.App({{0x10649b998, 0x140005afbd0}, 0x14000690270, 0x14000204d80, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/context.go:478 +0x148
github.com/caddyserver/caddy/v2.provisionContext.func3(...)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/caddy.go:545
github.com/caddyserver/caddy/v2.provisionContext(0x140005a7758?, 0x0)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/caddy.go:550 +0x5d0
github.com/caddyserver/caddy/v2.run(0x140005c7b80?, 0x0)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/caddy.go:400 +0x40
github.com/caddyserver/caddy/v2.Validate(0x14000204d80)
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/caddy.go:714 +0x24
github.com/caddyserver/caddy/v2/cmd.cmdValidateConfig({0x0?})
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/cmd/commandfuncs.go:551 +0x11c
github.com/caddyserver/caddy/v2/cmd.init.1.func8.WrapCommandFuncForCobra.1(0x14000535208, {0x105a32a6d?, 0x4?, 0x105a32a35?})
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/cmd/cobra.go:141 +0x34
github.com/spf13/cobra.(*Command).execute(0x14000535208, {0x107414a60, 0x0, 0x0})
        /Users/jonah/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1015 +0x828
github.com/spf13/cobra.(*Command).ExecuteC(0x1400034b208)
        /Users/jonah/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x350
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/jonah/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1071
github.com/caddyserver/caddy/v2/cmd.Main()
        /Users/jonah/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.10.0-beta.1/cmd/main.go:96 +0x3d0
main.main()
        /Volumes/Git/caddy-build/main.go:15 +0x1c

This also happens when I specify the API key in the file, so the fact I'm using an environment variable is not relevant.

Just for the sake of completeness, the regular way to configure this does work fine for me:

{
	dns cloudflare {env.CF_ECH_API_TOKEN}
	ech ech.triplebit.net
}

👍

@mholt mholt added the bug 🐞 Something isn't working label Mar 7, 2025
@mholt mholt added this to the v2.10.0-beta.2 milestone Mar 7, 2025
@mholt mholt closed this as completed in d57ab21 Mar 8, 2025
@mholt
Copy link
Member

mholt commented Mar 8, 2025

D'oh! Missed one little * in a small refactor. Thank you, fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants