mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-12 12:29:20 +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();
|
||||
$timestamp = time();
|
||||
|
||||
$tlds = [];
|
||||
|
||||
while (list($id, $tld) = $sth->fetch(PDO::FETCH_NUM)) {
|
||||
$tldRE = preg_quote($tld, '/');
|
||||
$cleanedTld = ltrim(strtolower($tld), '.');
|
||||
|
@ -157,13 +159,10 @@ Coroutine::create(function () use ($pool, $log, $c) {
|
|||
|
||||
file_put_contents("{$basePath}/{$cleanedTld}.zone", $completed_zone);
|
||||
|
||||
if ($c['dns_server'] == 'opendnssec') {
|
||||
chown("{$basePath}/{$cleanedTld}.zone", 'opendnssec');
|
||||
chgrp("{$basePath}/{$cleanedTld}.zone", 'opendnssec');
|
||||
}
|
||||
|
||||
$tlds[] = $cleanedTld;
|
||||
}
|
||||
|
||||
foreach ($tlds as $cleanedTld) {
|
||||
if ($c['dns_server'] == 'bind') {
|
||||
exec("rndc reload {$cleanedTld}.", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
|
@ -190,6 +189,9 @@ Coroutine::create(function () use ($pool, $log, $c) {
|
|||
$log->error('Failed to notify secondary servers. ' . $return_var);
|
||||
}
|
||||
} elseif ($c['dns_server'] == 'opendnssec') {
|
||||
chown("{$basePath}/{$cleanedTld}.zone", 'opendnssec');
|
||||
chgrp("{$basePath}/{$cleanedTld}.zone", 'opendnssec');
|
||||
|
||||
exec("ods-signer sign {$cleanedTld}");
|
||||
sleep(1);
|
||||
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->info('job finished successfully.');
|
||||
} catch (PDOException $e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue