mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-19 03:59:01 +01:00
caddytls: Convert AP subjects to punycode
Fixes bugs related to TLS automation
This commit is contained in:
parent
1f8dab572c
commit
55c89ccf2a
1 changed files with 7 additions and 1 deletions
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/mholt/acmez/v3"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"golang.org/x/net/idna"
|
||||
|
||||
"github.com/caddyserver/caddy/v2"
|
||||
)
|
||||
|
@ -183,7 +184,12 @@ func (ap *AutomationPolicy) Provision(tlsApp *TLS) error {
|
|||
repl := caddy.NewReplacer()
|
||||
subjects := make([]string, len(ap.SubjectsRaw))
|
||||
for i, sub := range ap.SubjectsRaw {
|
||||
subjects[i] = repl.ReplaceAll(sub, "")
|
||||
sub = repl.ReplaceAll(sub, "")
|
||||
subASCII, err := idna.ToASCII(sub)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not convert automation policy subject '%s' to punycode: %v", sub, err)
|
||||
}
|
||||
subjects[i] = subASCII
|
||||
}
|
||||
ap.subjects = subjects
|
||||
|
||||
|
|
Loading…
Reference in a new issue