Skip to content

Commit

Permalink
Ensure defaultGeneratedCert.main as Subject's CN
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamatte authored Sep 30, 2024
1 parent 9eb804a commit 4d6cb6a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/provider/acme/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,11 @@ func (p *Provider) resolveDefaultCertificate(ctx context.Context, domains []stri

p.resolvingDomainsMutex.Lock()

sort.Strings(domains)
domainKey := strings.Join(domains, ",")
sortedDomains := make([]string, len(domains))
copy(sortedDomains, domains)
sort.Strings(sortedDomains)

domainKey := strings.Join(sortedDomains, ",")

if _, ok := p.resolvingDomains[domainKey]; ok {
p.resolvingDomainsMutex.Unlock()
Expand Down Expand Up @@ -947,12 +950,14 @@ func (p *Provider) certExists(validDomains []string) bool {
p.certificatesMu.RLock()
defer p.certificatesMu.RUnlock()

sort.Strings(validDomains)
sortedDomains := make([]string, len(validDomains))
copy(sortedDomains, validDomains)
sort.Strings(sortedDomains)

for _, cert := range p.certificates {
domains := cert.Certificate.Domain.ToStrArray()
sort.Strings(domains)
if reflect.DeepEqual(domains, validDomains) {
if reflect.DeepEqual(domains, sortedDomains) {
return true
}
}
Expand Down

0 comments on commit 4d6cb6a

Please sign in to comment.