From 54e272aaa3ca61ec974fe5c330be566fc437d662 Mon Sep 17 00:00:00 2001 From: xenolf Date: Fri, 29 Jan 2016 14:10:57 +0100 Subject: [PATCH] Fix regression in Renew with SAN. re-apply 5930ea52f0311bde21a68895d72a84e3fbc1db4d Fixes #87 --- acme/client.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/acme/client.go b/acme/client.go index afb9afb3..b34c7bb8 100644 --- a/acme/client.go +++ b/acme/client.go @@ -337,7 +337,22 @@ func (c *Client) RenewCertificate(cert CertificateResource, bundle bool) (Certif } } - newCert, failures := c.ObtainCertificate([]string{cert.Domain}, bundle, privKey) + var domains []string + var failures map[string]error + // check for SAN certificate + if len(x509Cert.DNSNames) > 1 { + domains = append(domains, x509Cert.Subject.CommonName) + for _, sanDomain := range x509Cert.DNSNames { + if sanDomain == x509Cert.Subject.CommonName { + continue + } + domains = append(domains, sanDomain) + } + } else { + domains = append(domains, x509Cert.Subject.CommonName) + } + + newCert, failures := c.ObtainCertificate(domains, bundle, privKey) return newCert, failures[cert.Domain] }