mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-13 12:59:21 +02:00
Fixed incorrect zone reload and sign #176
This commit is contained in:
parent
f62b19ef03
commit
ff871dd4ae
1 changed files with 62 additions and 59 deletions
|
@ -40,6 +40,8 @@ Coroutine::create(function () use ($pool, $log, $c) {
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
$timestamp = time();
|
$timestamp = time();
|
||||||
|
|
||||||
|
$tlds = [];
|
||||||
|
|
||||||
while (list($id, $tld) = $sth->fetch(PDO::FETCH_NUM)) {
|
while (list($id, $tld) = $sth->fetch(PDO::FETCH_NUM)) {
|
||||||
$tldRE = preg_quote($tld, '/');
|
$tldRE = preg_quote($tld, '/');
|
||||||
$cleanedTld = ltrim(strtolower($tld), '.');
|
$cleanedTld = ltrim(strtolower($tld), '.');
|
||||||
|
@ -157,13 +159,10 @@ Coroutine::create(function () use ($pool, $log, $c) {
|
||||||
|
|
||||||
file_put_contents("{$basePath}/{$cleanedTld}.zone", $completed_zone);
|
file_put_contents("{$basePath}/{$cleanedTld}.zone", $completed_zone);
|
||||||
|
|
||||||
if ($c['dns_server'] == 'opendnssec') {
|
$tlds[] = $cleanedTld;
|
||||||
chown("{$basePath}/{$cleanedTld}.zone", 'opendnssec');
|
|
||||||
chgrp("{$basePath}/{$cleanedTld}.zone", 'opendnssec');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($tlds as $cleanedTld) {
|
||||||
if ($c['dns_server'] == 'bind') {
|
if ($c['dns_server'] == 'bind') {
|
||||||
exec("rndc reload {$cleanedTld}.", $output, $return_var);
|
exec("rndc reload {$cleanedTld}.", $output, $return_var);
|
||||||
if ($return_var != 0) {
|
if ($return_var != 0) {
|
||||||
|
@ -190,6 +189,9 @@ Coroutine::create(function () use ($pool, $log, $c) {
|
||||||
$log->error('Failed to notify secondary servers. ' . $return_var);
|
$log->error('Failed to notify secondary servers. ' . $return_var);
|
||||||
}
|
}
|
||||||
} elseif ($c['dns_server'] == 'opendnssec') {
|
} elseif ($c['dns_server'] == 'opendnssec') {
|
||||||
|
chown("{$basePath}/{$cleanedTld}.zone", 'opendnssec');
|
||||||
|
chgrp("{$basePath}/{$cleanedTld}.zone", 'opendnssec');
|
||||||
|
|
||||||
exec("ods-signer sign {$cleanedTld}");
|
exec("ods-signer sign {$cleanedTld}");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
copy("/var/lib/opendnssec/signed/{$cleanedTld}", "/var/lib/bind/{$cleanedTld}.zone.signed");
|
copy("/var/lib/opendnssec/signed/{$cleanedTld}", "/var/lib/bind/{$cleanedTld}.zone.signed");
|
||||||
|
@ -215,6 +217,7 @@ Coroutine::create(function () use ($pool, $log, $c) {
|
||||||
$log->error('Failed to notify secondary servers. ' . $return_var);
|
$log->error('Failed to notify secondary servers. ' . $return_var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$log->info('job finished successfully.');
|
$log->info('job finished successfully.');
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue