author | Alberto Bertogli
<albertito@blitiri.com.ar> 2017-12-08 14:07:42 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2017-12-08 14:07:42 UTC |
parent | f7a4fa895c4168f672706e3d531abac845f2ae65 |
test/util/generate_cert.go | +9 | -1 |
diff --git a/test/util/generate_cert.go b/test/util/generate_cert.go index 87554d6..b7e9547 100644 --- a/test/util/generate_cert.go +++ b/test/util/generate_cert.go @@ -25,6 +25,8 @@ import ( "os" "strings" "time" + + "golang.org/x/net/idna" ) var ( @@ -128,7 +130,13 @@ func main() { if ip := net.ParseIP(h); ip != nil { template.IPAddresses = append(template.IPAddresses, ip) } else { - template.DNSNames = append(template.DNSNames, h) + // We use IDNA-encoded DNS names, otherwise the TLS library won't + // load the certificates. + ih, err := idna.ToASCII(h) + if err != nil { + log.Fatalf("host %q cannot be IDNA-encoded: %v", h, err) + } + template.DNSNames = append(template.DNSNames, ih) } }