diff --git a/src/Appwrite/Network/Validator/DNS.php b/src/Appwrite/Network/Validator/DNS.php index 89d2707727..32d26cceb6 100644 --- a/src/Appwrite/Network/Validator/DNS.php +++ b/src/Appwrite/Network/Validator/DNS.php @@ -2,7 +2,6 @@ namespace Appwrite\Network\Validator; -use Swoole\Coroutine\WaitGroup; use Utopia\DNS\Client; use Utopia\DNS\Message; use Utopia\DNS\Message\Question; diff --git a/src/Appwrite/Platform/Modules/Proxy/Action.php b/src/Appwrite/Platform/Modules/Proxy/Action.php index 9307f24c9d..7bae594743 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Action.php +++ b/src/Appwrite/Platform/Modules/Proxy/Action.php @@ -50,12 +50,8 @@ class Action extends PlatformAction if (!\is_null($log)) { $log->addExtra('dnsTimingCaa', \strval(\microtime(true) - $validationStart)); $log->addTag('dnsDomain', $domain->get()); - - $error = $validator->getDescription(); - $log->addExtra('dnsResponse', \is_array($error) ? \json_encode($error) : \strval($error)); } - - throw new Exception(Exception::RULE_VERIFICATION_FAILED, 'Domain verification failed because CAA records do not allow Appwrite\'s certificate issuer.'); + throw new Exception(Exception::RULE_VERIFICATION_FAILED); } } @@ -90,7 +86,7 @@ class Action extends PlatformAction $validators = []; $mainValidator = null; // Validator to use for error description - if (!is_null($targetCNAME) && $targetCNAME->isKnown() && !$targetCNAME->isTest()) { + if (!is_null($targetCNAME)) { $validator = new $dnsValidatorClass($targetCNAME->get(), Record::TYPE_CNAME); $validators[] = $validator; @@ -128,17 +124,7 @@ class Action extends PlatformAction if (!\is_null($log)) { $log->addExtra('dnsTiming', \strval(\microtime(true) - $validationStart)); $log->addTag('dnsDomain', $domain->get()); - - $errors = []; - foreach ($validators as $validator) { - if (!empty($validator->getLogs())) { - $errors[] = \is_array($validator->getLogs()) ? \json_encode($validator->getLogs()) : \strval($validator->getLogs()); - } - } - $error = \implode("\n", $errors); - $log->addExtra('dnsResponse', $error); } - throw new Exception(Exception::RULE_VERIFICATION_FAILED, $mainValidator->getDescription()); } } diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php index df02938ba2..23fcf795e1 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php @@ -5,7 +5,6 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\API; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Network\Validator\DNS; use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; @@ -15,14 +14,11 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Helpers\ID; -use Utopia\DNS\Message\Record; use Utopia\Domains\Domain; use Utopia\Logger\Log; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; -use Utopia\Validator\AnyOf; use Utopia\Validator\Domain as ValidatorDomain; -use Utopia\Validator\IP; class Create extends Action { @@ -143,28 +139,6 @@ class Create extends Action if (\str_ends_with($domain->get(), $functionsDomain) || \str_ends_with($domain->get(), $sitesDomain)) { $status = RULE_STATUS_SUCCESSFUL; } - if ($status === RULE_STATUS_VERIFICATION_FAILED) { - $validators = []; - $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { - $validators[] = new DNS($targetCNAME->get(), Record::TYPE_CNAME); - } - if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), Record::TYPE_A); - } - if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), Record::TYPE_AAAA); - } - - if (empty($validators)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'At least one of domain targets environment variable must be configured.'); - } - - $validator = new AnyOf($validators, AnyOf::TYPE_STRING); - if ($validator->isValid($domain->get())) { - $status = 'verifying'; - } - } $owner = ''; if ( diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php index 34b08e76d2..80b7e8483c 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -5,7 +5,6 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Function; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Network\Validator\DNS; use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; @@ -16,14 +15,11 @@ use Utopia\Database\Document; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\UID; -use Utopia\DNS\Message\Record; use Utopia\Domains\Domain; use Utopia\Logger\Log; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; -use Utopia\Validator\AnyOf; use Utopia\Validator\Domain as ValidatorDomain; -use Utopia\Validator\IP; use Utopia\Validator\Text; class Create extends Action @@ -158,28 +154,6 @@ class Create extends Action if (\str_ends_with($domain->get(), $functionsDomain) || \str_ends_with($domain->get(), $sitesDomain)) { $status = RULE_STATUS_SUCCESSFUL; } - if ($status === RULE_STATUS_VERIFICATION_FAILED) { - $validators = []; - $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { - $validators[] = new DNS($targetCNAME->get(), Record::TYPE_CNAME); - } - if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), Record::TYPE_A); - } - if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), Record::TYPE_AAAA); - } - - if (empty($validators)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'At least one of domain targets environment variable must be configured.'); - } - - $validator = new AnyOf($validators, AnyOf::TYPE_STRING); - if ($validator->isValid($domain->get())) { - $status = RULE_STATUS_GENERATING_CERTIFICATE; - } - } $owner = ''; if ( diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index aa216cdd91..096c0e80f8 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -5,7 +5,6 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Redirect; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Network\Validator\DNS; use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; @@ -16,14 +15,11 @@ use Utopia\Database\Document; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\UID; -use Utopia\DNS\Message\Record; use Utopia\Domains\Domain; use Utopia\Logger\Log; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; -use Utopia\Validator\AnyOf; use Utopia\Validator\Domain as ValidatorDomain; -use Utopia\Validator\IP; use Utopia\Validator\URL; use Utopia\Validator\WhiteList; @@ -165,28 +161,6 @@ class Create extends Action if (\str_ends_with($domain->get(), $functionsDomain) || \str_ends_with($domain->get(), $sitesDomain)) { $status = RULE_STATUS_SUCCESSFUL; } - if ($status === RULE_STATUS_VERIFICATION_FAILED) { - $validators = []; - $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { - $validators[] = new DNS($targetCNAME->get(), Record::TYPE_CNAME); - } - if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), Record::TYPE_A); - } - if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), Record::TYPE_AAAA); - } - - if (empty($validators)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'At least one of domain targets environment variable must be configured.'); - } - - $validator = new AnyOf($validators, AnyOf::TYPE_STRING); - if ($validator->isValid($domain->get())) { - $status = RULE_STATUS_GENERATING_CERTIFICATE; - } - } $owner = ''; if ( diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php index 59d9b0e26e..ed4ade3d5b 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -5,7 +5,6 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Site; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Network\Validator\DNS; use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; @@ -16,14 +15,11 @@ use Utopia\Database\Document; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\UID; -use Utopia\DNS\Message\Record; use Utopia\Domains\Domain; use Utopia\Logger\Log; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; -use Utopia\Validator\AnyOf; use Utopia\Validator\Domain as ValidatorDomain; -use Utopia\Validator\IP; use Utopia\Validator\Text; class Create extends Action @@ -158,28 +154,6 @@ class Create extends Action if (\str_ends_with($domain->get(), $functionsDomain) || \str_ends_with($domain->get(), $sitesDomain)) { $status = RULE_STATUS_SUCCESSFUL; } - if ($status === RULE_STATUS_VERIFICATION_FAILED) { - $validators = []; - $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); - if ($targetCNAME->isKnown() && !$targetCNAME->isTest()) { - $validators[] = new DNS($targetCNAME->get(), Record::TYPE_CNAME); - } - if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), Record::TYPE_A); - } - if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { - $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), Record::TYPE_AAAA); - } - - if (empty($validators)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'At least one of domain targets environment variable must be configured.'); - } - - $validator = new AnyOf($validators, AnyOf::TYPE_STRING); - if ($validator->isValid($domain->get())) { - $status = RULE_STATUS_GENERATING_CERTIFICATE; - } - } $owner = ''; if ( diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php index 95ecd42223..5ff54c621b 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php @@ -14,7 +14,6 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\DNS\Message\Record; use Utopia\Domains\Domain; use Utopia\Logger\Log; use Utopia\Platform\Scope\HTTP; @@ -83,8 +82,7 @@ class Update extends Action $queueForEvents->setParam('ruleId', $rule->getId()); - // Check both status (HEAD) and verification attribute (1.8.x) - if ($rule->getAttribute('status', '') !== RULE_STATUS_VERIFICATION_FAILED || $rule->getAttribute('verification') === true) { + if ($rule->getAttribute('status', '') !== RULE_STATUS_VERIFICATION_FAILED) { return $response->dynamic($rule, Response::MODEL_PROXY_RULE); }