From df7150fc47ebbb538a49eadd381e13fa9c8cc280 Mon Sep 17 00:00:00 2001 From: Tobia Zanarella Date: Thu, 20 May 2021 12:47:16 +0200 Subject: [PATCH] Fixed DNS-01 and HTTP-01 challenges --- src/LEFunctions.php | 2 ++ src/LEOrder.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/LEFunctions.php b/src/LEFunctions.php index 7fa172a..a66e54a 100644 --- a/src/LEFunctions.php +++ b/src/LEFunctions.php @@ -235,7 +235,9 @@ public static function checkDNSChallenge($domain, $DNSDigest) { if($answer->type === 16) { + /* Since May 19th, this check always fails because the comparison should take place without the quotes; let's keep both just to be sure */ if($answer->data === ('"' . $DNSDigest . '"')) return true; + if($answer->data === $DNSDigest) return true; } } } diff --git a/src/LEOrder.php b/src/LEOrder.php index 6a2abd2..6c6a28b 100644 --- a/src/LEOrder.php +++ b/src/LEOrder.php @@ -51,6 +51,7 @@ class LEOrder public $expires; public $identifiers; private $authorizationURLs; + /** @var LEAuthorization[] */ public $authorizations; public $finalizeURL; public $certificateURL; @@ -414,11 +415,27 @@ public function verifyPendingOrderAuthorization($identifier, $type, $localcheck } elseif($this->log >= LEClient::LOG_STATUS) LEFunctions::log('HTTP challenge for \'' . $identifier . '\' valid.', 'function verifyPendingOrderAuthorization'); } + + $i = 1; + while($auth->status == 'pending') { + if( $i > 6 ) + { + break; + } + sleep(1); $auth->updateData(); + + $i++; + } + + if($auth->status == 'pending') + { + return false; } + return true; } } @@ -447,11 +464,27 @@ public function verifyPendingOrderAuthorization($identifier, $type, $localcheck } elseif($this->log >= LEClient::LOG_STATUS) LEFunctions::log('DNS challenge for \'' . $identifier . '\' valid.', 'function verifyPendingOrderAuthorization'); } + + $i = 1; + while($auth->status == 'pending') { + if( $i > 6 ) + { + break; + } + sleep(1); $auth->updateData(); + + $i++; + } + + if($auth->status == 'pending') + { + return false; } + return true; } }