From 703c96b2166b0ea43b58853b4d202f60e281815b Mon Sep 17 00:00:00 2001 From: shibayan Date: Wed, 30 Jan 2019 18:10:58 +0900 Subject: [PATCH] Fixed DNS validation error in SAN certificate --- AzureKeyVault.LetsEncrypt/SharedFunctions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AzureKeyVault.LetsEncrypt/SharedFunctions.cs b/AzureKeyVault.LetsEncrypt/SharedFunctions.cs index 5e3aa421..d92bb425 100644 --- a/AzureKeyVault.LetsEncrypt/SharedFunctions.cs +++ b/AzureKeyVault.LetsEncrypt/SharedFunctions.cs @@ -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() - .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."); }