Skip to content

Commit

Permalink
Fixed hostnames binding mismatch (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
shibayan committed Jun 12, 2020
1 parent bd64915 commit 532a478
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion AppService.Acmebot/RenewCertificatesFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public async Task RenewSiteCertificates([OrchestrationTrigger] IDurableOrchestra
log.LogInformation($"Subject name: {certificate.SubjectName}");

// IDN に対して証明書を発行すると SANs に Punycode 前の DNS 名が入るので除外
var dnsNames = certificate.HostNames.Where(x => !x.Contains(" (")).ToArray();
var dnsNames = certificate.HostNames
.Where(x => !x.Contains(" (") && site.HostNames.Contains(x))
.ToArray();

// 証明書を発行し Azure にアップロード
var newCertificate = await context.CallSubOrchestratorAsync<Certificate>(nameof(SharedFunctions.IssueCertificate), (site, dnsNames));
Expand Down
2 changes: 1 addition & 1 deletion AppService.Acmebot/SharedFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public async Task<IList<Site>> GetSites([ActivityTrigger] object input)
}

return list.Where(x => x.State == "Running")
.Where(x => x.HostNameSslStates.Any(xs => !xs.Name.EndsWith(".azurewebsites.net") && !xs.Name.EndsWith(".trafficmanager.net")))
.Where(x => x.HostNames.Any(xs => !xs.EndsWith(".azurewebsites.net") && !xs.EndsWith(".trafficmanager.net")))
.ToArray();
}

Expand Down

0 comments on commit 532a478

Please sign in to comment.