|
@@ -52,7 +52,7 @@ function curlTest($address, $post = [], $tor = false) {
|
|
|
$result = curl_exec($req);
|
|
|
$status_code = curl_getinfo($req, CURLINFO_RESPONSE_CODE);
|
|
|
if ($status_code >= 400 OR $result === false) {
|
|
|
- var_dump(curl_exec($req));
|
|
|
+ var_dump($result);
|
|
|
var_dump(curl_error($req));
|
|
|
exit($address . ' test failed with status code ' . $status_code . LF);
|
|
|
}
|
|
@@ -129,7 +129,7 @@ function testNs($domain) {
|
|
|
'ns' => $ns,
|
|
|
]);
|
|
|
|
|
|
- preg_match('#\<code\>(?<token>[0-9a-z-]{16,128}\._domain-verification\.' . preg_quote(CORE_DOMAIN) . '\.)\</code\>#', curlTest('/ns/zone-add', []), $matches);
|
|
|
+ preg_match('#\<code\>(?<token>[0-9a-z-]{16,128}\._domain-verification\.' . preg_quote(CORE_DOMAIN, '#') . '\.)\</code\>#', curlTest('/ns/zone-add', []), $matches);
|
|
|
curlTest('/reg/ns', [
|
|
|
'action' => 'add',
|
|
|
'domain' => $domain,
|
|
@@ -157,7 +157,7 @@ function testNs($domain) {
|
|
|
'value' => 'letsencrypt.org',
|
|
|
]);
|
|
|
exec(CONF['dns']['kdig_path'] . ' @' . CONF['reg']['address'] . ' ' . $domain . ' CAA', $output);
|
|
|
- if (preg_match('/^' . preg_quote($domain) . '[ \t]+7200[ \t]+IN[ \t]+CAA[ \t]+0[ \t]+issue[ \t]+"letsencrypt\.org"$/Dm', implode(LF, $output)) !== 1)
|
|
|
+ if (preg_match('/^' . preg_quote($domain, '/') . '[ \t]+7200[ \t]+IN[ \t]+CAA[ \t]+0[ \t]+issue[ \t]+"letsencrypt\.org"$/Dm', implode(LF, $output)) !== 1)
|
|
|
exit('Error: /ns/caa: CAA record not set' . LF);
|
|
|
|
|
|
curlTest('/ns/edit', [
|
|
@@ -166,7 +166,7 @@ function testNs($domain) {
|
|
|
. '@ 86400 NS ' . CONF['ns']['servers'][0] . "\r\n",
|
|
|
]);
|
|
|
exec(CONF['dns']['kdig_path'] . ' @' . CONF['reg']['address'] . ' aaaa.' . $domain . ' AAAA', $output);
|
|
|
- if (preg_match('/[ \t]+' . preg_quote(CONF['ht']['ipv6_address']) . '$/Dm', implode(LF, $output)) !== 1)
|
|
|
+ if (preg_match('/[ \t]+' . preg_quote(CONF['ht']['ipv6_address'], '/') . '$/Dm', implode(LF, $output)) !== 1)
|
|
|
exit('Error: /ns/edit: AAAA record not set' . LF);
|
|
|
}
|
|
|
|
|
@@ -222,14 +222,13 @@ exit
|
|
|
]);
|
|
|
if (preg_match('#\<code\>http\://(?<onion>[0-9a-z]{56})\.onion/\</code\>#D', $html, $matches) !== 1)
|
|
|
exit('Can\'t find onion address.' . LF);
|
|
|
- sleep(5);
|
|
|
+ sleep(5); // Onion services are not immediately reachable
|
|
|
if (curlTest('http://' . $matches['onion'] . '.onion/', tor: true) !== TEST_CONTENT)
|
|
|
exit('Unexpected onion service response (' . $matches['onion'] . '.onion)' . LF);
|
|
|
curlTest('/ht/del', [
|
|
|
'site' => 'onion:' . $matches['onion'] . '.onion',
|
|
|
]);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
$domain = testReg();
|