Skip to content

Commit

Permalink
Merge pull request #15 from shibayan/fix/dns-validation
Browse files Browse the repository at this point in the history
Fixed DNS validation error in SAN certificate
  • Loading branch information
shibayan authored Jan 30, 2019
2 parents 3a16c43 + 703c96b commit 4cc88b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions AzureKeyVault.LetsEncrypt/SharedFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,18 @@ public static async Task CheckIsDnsRecord([ActivityTrigger] DurableActivityConte
// 実際に ACME の TXT レコードを引いて確認する
var queryResult = await _lookupClient.QueryAsync(challenge.DnsRecordName, QueryType.TXT);

var txtRecord = queryResult.Answers
var txtRecords = queryResult.Answers
.OfType<DnsClient.Protocol.TxtRecord>()
.FirstOrDefault();
.ToArray();

// レコードが存在しなかった場合はエラー
if (txtRecord == null)
if (txtRecords.Length == 0)
{
throw new InvalidOperationException($"{challenge.DnsRecordName} did not resolve.");
}

// レコードに今回のチャレンジが含まれていない場合もエラー
if (!txtRecord.Text.Contains(challenge.DnsRecordValue))
if (!txtRecords.Any(x => x.Text.Contains(challenge.DnsRecordValue)))
{
throw new InvalidOperationException($"{challenge.DnsRecordName} value is not correct.");
}
Expand Down

0 comments on commit 4cc88b6

Please sign in to comment.