Commit bf98ded3 authored by dmorley's avatar dmorley

use dig vs delv as delv can not deal with ecdsa keys properly

parent ac306aa0
Pipeline #1406 passed with stage
in 3 minutes and 1 second
......@@ -304,12 +304,13 @@ foreach ($pods as $pod) {
debug('Signup Open', $signup);
$dnsserver = c('dnsserver') ?: '1.1.1.1';
$delv = new NPM\Xec\Command("delv @{$dnsserver} {$domain}");
$delv->throwExceptionOnError(false);
$dig = new NPM\Xec\Command("dig @{$dnsserver} {$domain} +dnssec");
$dig->throwExceptionOnError(false);
$ip = '';
$iplookupv4 = explode(PHP_EOL, trim($delv->execute([], null, 15)->stdout));
$dnssec = in_array('; fully validated', $iplookupv4, true) ?? false;
$iplookupv4 = explode(PHP_EOL, trim($dig->execute(['A'], null, 15)->stdout));
$flags = preg_grep('/;; flags:(.*?);/', $iplookupv4);
$dnssec = (bool) preg_grep('/ad/', $flags);
$getaonly = array_values(preg_grep('/\s+IN\s+A\s+.*/', $iplookupv4));
if ($getaonly) {
......@@ -318,11 +319,12 @@ foreach ($pods as $pod) {
}
$ip || $score -= 2;
$iplookupv6 = explode(PHP_EOL, trim($delv->execute(['AAAA'], null, 15)->stdout));
$iplookupv6 = explode(PHP_EOL, trim($dig->execute(['AAAA'], null, 15)->stdout));
$ipv6 = (bool) preg_grep('/\s+IN\s+AAAA\s+.*/', $iplookupv6);
debug('IPv4', $ip);
debug('IPv6', $ipv6);
debug('DNSSEC', $dnssec);
// todo: Temporary workaround (see https://github.com/akalongman/php-ip-tools/issues/8)
if (Ip::isValid($ip) && Ip::isRemote($ip)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment