From 5d4f14bc6acd6479872936c6c21888afb5518d9e Mon Sep 17 00:00:00 2001 From: mikepulaski Date: Mon, 9 Apr 2018 02:15:11 +0200 Subject: [PATCH] Fixed CN regression in ACMEv2. (#515) --- acmev2/client.go | 10 +++------- acmev2/messages.go | 3 ++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/acmev2/client.go b/acmev2/client.go index 40acdbc1..fc2777d0 100644 --- a/acmev2/client.go +++ b/acmev2/client.go @@ -482,6 +482,7 @@ func (c *Client) createOrderForIdentifiers(domains []string) (orderResource, err orderRes := orderResource{ URL: hdr.Get("Location"), + Domains: domains, orderMessage: response, } return orderRes, nil @@ -590,7 +591,7 @@ func (c *Client) requestCertificateForOrder(order orderResource, bundle bool, pr } // determine certificate name(s) based on the authorization resources - commonName := order.Identifiers[0].Value + commonName := order.Domains[0] var san []string for _, auth := range order.Identifiers { san = append(san, auth.Value) @@ -606,12 +607,7 @@ func (c *Client) requestCertificateForOrder(order orderResource, bundle bool, pr } func (c *Client) requestCertificateForCsr(order orderResource, bundle bool, csr []byte, privateKeyPem []byte) (CertificateResource, error) { - commonName := order.Identifiers[0].Value - - var authURLs []string - for _, auth := range order.Identifiers[1:] { - authURLs = append(authURLs, auth.Value) - } + commonName := order.Domains[0] csrString := base64.RawURLEncoding.EncodeToString(csr) var retOrder orderMessage diff --git a/acmev2/messages.go b/acmev2/messages.go index 9981851d..0b734437 100644 --- a/acmev2/messages.go +++ b/acmev2/messages.go @@ -34,7 +34,8 @@ type accountMessage struct { } type orderResource struct { - URL string `json:"url,omitempty"` + URL string `json:"url,omitempty"` + Domains []string `json:"domains,omitempty"` orderMessage `json:"body,omitempty"` }