|
@@ -246,7 +246,7 @@ function testNs(string $domain): void {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function testHt(string $username, string $password): void {
|
|
|
+function testHt(string $username, string $password, string $domain): void {
|
|
|
startTest('SFTP file upload');
|
|
|
define('TEST_CONTENT', 'test-' . bin2hex(random_bytes(16)));
|
|
|
|
|
@@ -333,11 +333,59 @@ exit
|
|
|
]);
|
|
|
stopTest();
|
|
|
}
|
|
|
+
|
|
|
+ {
|
|
|
+ if (preg_match('#<code>(?<proof>' . preg_quote(CONF['common']['public_domains'][0], '#') . '_domain-verification=[0-9a-z-]{16,128})</code>#', curlTest('/ht/add-dns', []), $matches) !== 1)
|
|
|
+ exit('Can\'t find proof for dedicated site creation.' . LF);
|
|
|
+
|
|
|
+ curlTest('/ns/sync', [
|
|
|
+ 'syncs[0][source]' => CONF['ht']['cname'],
|
|
|
+ 'syncs[0][destination]' => $domain,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ curlTest('/ns/txt', [
|
|
|
+ 'action' => 'add',
|
|
|
+ 'subdomain' => '_auth',
|
|
|
+ 'zone' => $domain,
|
|
|
+ 'ttl-value' => '1',
|
|
|
+ 'ttl-multiplier' => '300',
|
|
|
+ 'txt' => $matches['proof'],
|
|
|
+ ]);
|
|
|
+
|
|
|
+ curlTest('/ns/caa', [
|
|
|
+ 'action' => 'add',
|
|
|
+ 'subdomain' => '@',
|
|
|
+ 'zone' => $domain,
|
|
|
+ 'ttl-value' => '1',
|
|
|
+ 'ttl-multiplier' => '300',
|
|
|
+ 'flag' => '0',
|
|
|
+ 'tag' => 'issue',
|
|
|
+ 'value' => CONF['ht']['caa_account_uris']['testing'],
|
|
|
+ ]);
|
|
|
+
|
|
|
+ startTest('dedicated site creation');
|
|
|
+ curlTest('/ht/add-dns', [
|
|
|
+ 'domain' => $domain,
|
|
|
+ 'dir' => '_site0-',
|
|
|
+ ]);
|
|
|
+ stopTest();
|
|
|
+
|
|
|
+ startTest('dedicated site reachability');
|
|
|
+ if (curlTest('https://' . $domain . '/') !== TEST_CONTENT)
|
|
|
+ exit('Unexpected dedicated site response.' . LF);
|
|
|
+ stopTest();
|
|
|
+
|
|
|
+ startTest('dedicated site deletion');
|
|
|
+ curlTest('/ht/del', [
|
|
|
+ 'site' => 'dns:' . rtrim($domain, '.'),
|
|
|
+ ]);
|
|
|
+ stopTest();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$domain = testReg();
|
|
|
testNs($domain);
|
|
|
-testHt($username, $password);
|
|
|
+testHt($username, $password, $domain);
|
|
|
|
|
|
startTest('account deletion');
|
|
|
curlTest('/auth/unregister', [
|