-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
I've run into an issue where I can't change the lifetime of certificates issued by the ACME server
Although the directive mentions a lifetime option, adding one results in Caddy crashing
For example
myca.example.com {
tls internal
acme_server {
challenges dns-01
lifetime 48h
allow {
domains *.example.com
}
}
}
Without the lifetime option the ACME server works fine, but when I add the line in, Caddy crashes with the following log output
{"level":"info","ts":1741282262.4006994,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x14dc3a0]
goroutine 1 [running]:
github.com/caddyserver/caddy/v2/modules/caddypki/acmeserver.parseACMEServer({0xc00002a540, 0xc00030fef0, 0xc00030fd70, 0xc0002eda58, 0xc00002a420, {0x1, {0xc000270150, 0x1, 0x1}, {0xc00030fec0, ...}, ...}, ...})
github.com/caddyserver/caddy/v2@v2.9.1/modules/caddypki/acmeserver/caddyfile.go:82 +0x2e0
github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile.ServerType.Setup({}, {0xc000462800, 0x4, 0xc00030fe00?}, 0xc00030fd70)
github.com/caddyserver/caddy/v2@v2.9.1/caddyconfig/httpcaddyfile/httptype.go:148 +0x28be
github.com/caddyserver/caddy/v2/caddyconfig/caddyfile.Adapter.Adapt({{0x1d99e80?, 0x2a39420?}}, {0xc000472000, 0x1e5, 0x200}, 0xc000126000?)
github.com/caddyserver/caddy/v2@v2.9.1/caddyconfig/caddyfile/adapter.go:50 +0x12d
github.com/caddyserver/caddy/v2/cmd.loadConfigWithLogger(0x16a2cc0?, {0x7ffda682bf1c, 0x14}, {0x7ffda682bf3b, 0x9})
github.com/caddyserver/caddy/v2@v2.9.1/cmd/main.go:210 +0x75b
github.com/caddyserver/caddy/v2/cmd.LoadConfig({0x7ffda682bf1c, 0x14}, {0x7ffda682bf3b, 0x9})
github.com/caddyserver/caddy/v2@v2.9.1/cmd/main.go:107 +0x45
github.com/caddyserver/caddy/v2/cmd.cmdRun({0x0?})
github.com/caddyserver/caddy/v2@v2.9.1/cmd/commandfuncs.go:218 +0x58c
github.com/caddyserver/caddy/v2/cmd.init.1.func2.WrapCommandFuncForCobra.1(0xc0005b0c08, {0x18f481c?, 0x4?, 0x18f47f0?})
github.com/caddyserver/caddy/v2@v2.9.1/cmd/cobra.go:141 +0x2f
github.com/spf13/cobra.(*Command).execute(0xc0005b0c08, {0xc0002abd80, 0x4, 0x4})
github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0005b0608)
github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.8.1/command.go:1041
github.com/caddyserver/caddy/v2/cmd.Main()
github.com/caddyserver/caddy/v2@v2.9.1/cmd/main.go:75 +0x1dd
main.main()
caddy/main.go:39 +0xf
Even if I use the default 12h value it still crashes like this
I don't know if it helps, but if I enter 12 instead of 12h it does imply it recognises the lifetime option and it's looking for a unit of time to follow
Error: adapting config using caddyfile: parsing caddyfile tokens for 'acme_server': time: missing unit in duration "12"
And it makes no difference if the only option specified is the lifetime one
I'm running v2.9.1 but even 2.8.4 for instance has the same issue for me