sjkp / letsencrypt-azure

The easiest way to use lets encrypt certificates on Azure
111 stars 35 forks source link

Azure DNS - consecutive DNS challenges break validation #17

Open ohadschn opened 4 years ago

ohadschn commented 4 years ago

It seems that after a few DNS challenges are made, and the TXT record contains more values, exceptions like this are encountered:

Challenge record was Pq-z7SLbwD7f_SXrA-J-akjsdhaskjdh-83D4 should have been fKESI1optQ-PjI2sYX41pC0akjsdhlaksjdh70L4, retrying again in 5 seconds

Looking at the actual record, both are there. So the code might be looking at the wrong one - I'm guessing because an assumption is made on the order of returned values: https://github.com/sjkp/letsencrypt-azure/blob/7d63cab8cb64d6fdc741bad261e8d7db25f79625/src/LetsEncrypt.Azure.Core.V2/DnsLookupService.cs#L37

When yet more challenges are made, the exception becomes (probably at the fault of the DNS client): DnsClient.DnsResponseException: Unhandled exception ---> System.IndexOutOfRangeException: Cannot read that many bytes: '43'

Either way, manually deleting the TXT entry fixes the issue. Maybe you could delete it each time, rather than add values to it?