@marcel91200 / caddy Mirror · read-only / commits / 55c89ccf
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 02:00 UTC

caddytls: Convert AP subjects to punycode

Fixes bugs related to TLS automation

Matthew Holt committed Mar 14, 2025 at 15:44 UTC 55c89ccf2a39dcfd7286fcaed54787821ff9a1aa
1 file changed +7 -1
modules/caddytls/automation.go
+7 -1
@@ -28,6 +28,7 @@ import (
28 "github.com/mholt/acmez/v3"
29 "go.uber.org/zap"
30 "go.uber.org/zap/zapcore"
31 + "golang.org/x/net/idna"
32
33 "github.com/caddyserver/caddy/v2"
34 )
@@ -183,7 +184,12 @@ func (ap *AutomationPolicy) Provision(tlsApp *TLS) error {
184 repl := caddy.NewReplacer()
185 subjects := make([]string, len(ap.SubjectsRaw))
186 for i, sub := range ap.SubjectsRaw {
186 - subjects[i] = repl.ReplaceAll(sub, "")
187 + sub = repl.ReplaceAll(sub, "")
188 + subASCII, err := idna.ToASCII(sub)
189 + if err != nil {
190 + return fmt.Errorf("could not convert automation policy subject '%s' to punycode: %v", sub, err)
191 + }
192 + subjects[i] = subASCII
193 }
194 ap.subjects = subjects
195