--blocking for knotc everywhere
This commit is contained in:
parent
864f868890
commit
c05c16a516
3 changed files with 15 additions and 15 deletions
20
fn/dns.php
20
fn/dns.php
|
@ -16,21 +16,21 @@ function parseZoneFile($zone_content, $types, $filter_domain = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function knotcConfExec($cmds) {
|
function knotcConfExec($cmds) {
|
||||||
exec(CONF['dns']['knotc_path'] . ' conf-begin', $output['begin'], $code['begin']);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 conf-begin', $output['begin'], $code['begin']);
|
||||||
if ($code['begin'] !== 0)
|
if ($code['begin'] !== 0)
|
||||||
output(500, 'knotcConfExec: <code>knotc</code> failed with exit code <samp>' . $code['begin'] . '</samp>: <samp>' . $output['begin'][0] . '</samp>.');
|
output(500, 'knotcConfExec: <code>knotc</code> failed with exit code <samp>' . $code['begin'] . '</samp>: <samp>' . $output['begin'][0] . '</samp>.');
|
||||||
|
|
||||||
foreach ($cmds as $cmd) {
|
foreach ($cmds as $cmd) {
|
||||||
exec(CONF['dns']['knotc_path'] . ' conf-' . $cmd, $output['op'], $code['op']);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 conf-' . $cmd, $output['op'], $code['op']);
|
||||||
if ($code['op'] !== 0) {
|
if ($code['op'] !== 0) {
|
||||||
exec(CONF['dns']['knotc_path'] . ' conf-abort');
|
exec(CONF['dns']['knotc_path'] . ' --blocking conf-abort');
|
||||||
output(500, 'knotcConfExec: <code>knotc</code> failed with exit code <samp>' . $code['op'] . '</samp>: <samp>' . $output['op'][0] . '</samp>.');
|
output(500, 'knotcConfExec: <code>knotc</code> failed with exit code <samp>' . $code['op'] . '</samp>: <samp>' . $output['op'][0] . '</samp>.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' conf-commit', $output['commit'], $code['commit']);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 conf-commit', $output['commit'], $code['commit']);
|
||||||
if ($code['commit'] !== 0) {
|
if ($code['commit'] !== 0) {
|
||||||
exec(CONF['dns']['knotc_path'] . ' conf-abort');
|
exec(CONF['dns']['knotc_path'] . ' --blocking conf-abort');
|
||||||
output(500, 'knotcConfExec: <code>knotc</code> failed with exit code <samp>' . $code['commit'] . '</samp>: <samp>' . $output['commit'][0] . '</samp>.');
|
output(500, 'knotcConfExec: <code>knotc</code> failed with exit code <samp>' . $code['commit'] . '</samp>: <samp>' . $output['commit'][0] . '</samp>.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,19 +38,19 @@ function knotcConfExec($cmds) {
|
||||||
function knotcZoneExec($zone, $cmd, $action = NULL) {
|
function knotcZoneExec($zone, $cmd, $action = NULL) {
|
||||||
$action = checkAction($action ?? $_POST['action']);
|
$action = checkAction($action ?? $_POST['action']);
|
||||||
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' zone-begin ' . $zone, $output['begin'], $code['begin']);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-begin ' . $zone, $output['begin'], $code['begin']);
|
||||||
if ($code['begin'] !== 0)
|
if ($code['begin'] !== 0)
|
||||||
output(500, 'knotcZoneExec: <code>knotc</code> failed with exit code <samp>' . $code['begin'] . '</samp>: <samp>' . $output['begin'][0] . '</samp>.');
|
output(500, 'knotcZoneExec: <code>knotc</code> failed with exit code <samp>' . $code['begin'] . '</samp>: <samp>' . $output['begin'][0] . '</samp>.');
|
||||||
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' zone-' . $action . 'set ' . $zone . ' ' . implode(' ', $cmd), $output['op'], $code['op']);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-' . $action . 'set ' . $zone . ' ' . implode(' ', $cmd), $output['op'], $code['op']);
|
||||||
if ($code['op'] !== 0) {
|
if ($code['op'] !== 0) {
|
||||||
exec(CONF['dns']['knotc_path'] . ' zone-abort ' . $zone);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-abort ' . $zone);
|
||||||
output(500, 'knotcZoneExec: <code>knotc</code> failed with exit code <samp>' . $code['op'] . '</samp>: <samp>' . $output['op'][0] . '</samp>.');
|
output(500, 'knotcZoneExec: <code>knotc</code> failed with exit code <samp>' . $code['op'] . '</samp>: <samp>' . $output['op'][0] . '</samp>.');
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' zone-commit ' . $zone, $output['commit'], $code['commit']);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-commit ' . $zone, $output['commit'], $code['commit']);
|
||||||
if ($code['commit'] !== 0) {
|
if ($code['commit'] !== 0) {
|
||||||
exec(CONF['dns']['knotc_path'] . ' zone-abort ' . $zone);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-abort ' . $zone);
|
||||||
output(500, 'knotcZoneExec: <code>knotc</code> failed with exit code <samp>' . $code['commit'] . '</samp>: <samp>' . $output['commit'][0] . '</samp>.');
|
output(500, 'knotcZoneExec: <code>knotc</code> failed with exit code <samp>' . $code['commit'] . '</samp>: <samp>' . $output['commit'][0] . '</samp>.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ function nsCheckZonePossession($zone) {
|
||||||
|
|
||||||
function nsDeleteZone($zone) {
|
function nsDeleteZone($zone) {
|
||||||
// Delete zone data
|
// Delete zone data
|
||||||
exec(CONF['dns']['knotc_path'] . ' --force zone-purge ' . $zone, result_code: $code);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 --force zone-purge ' . $zone, result_code: $code);
|
||||||
if ($code !== 0)
|
if ($code !== 0)
|
||||||
output(500, 'Failed to purge zone data.');
|
output(500, 'Failed to purge zone data.');
|
||||||
|
|
||||||
|
|
|
@ -39,22 +39,22 @@ if (isset($_POST['zone-content'])) { // Update zone
|
||||||
|
|
||||||
ratelimit();
|
ratelimit();
|
||||||
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 10 zone-freeze ' . $_POST['zone'], $output, $return_code);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-freeze ' . $_POST['zone'], $output, $return_code);
|
||||||
if ($return_code !== 0)
|
if ($return_code !== 0)
|
||||||
output(500, 'Failed to freeze zone file.', $output);
|
output(500, 'Failed to freeze zone file.', $output);
|
||||||
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 10 zone-flush ' . $_POST['zone'], $output, $return_code);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-flush ' . $_POST['zone'], $output, $return_code);
|
||||||
if ($return_code !== 0)
|
if ($return_code !== 0)
|
||||||
output(500, 'Failed to flush zone file.', $output);
|
output(500, 'Failed to flush zone file.', $output);
|
||||||
|
|
||||||
if (file_put_contents(CONF['ns']['knot_zones_path'] . '/' . $_POST['zone'] . 'zone', $new_zone_content) === false)
|
if (file_put_contents(CONF['ns']['knot_zones_path'] . '/' . $_POST['zone'] . 'zone', $new_zone_content) === false)
|
||||||
output(500, 'Failed to write zone file.');
|
output(500, 'Failed to write zone file.');
|
||||||
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 10 zone-reload ' . $_POST['zone'], $output, $return_code);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-reload ' . $_POST['zone'], $output, $return_code);
|
||||||
if ($return_code !== 0)
|
if ($return_code !== 0)
|
||||||
output(500, 'Failed to reload zone file.', $output);
|
output(500, 'Failed to reload zone file.', $output);
|
||||||
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 10 zone-thaw ' . $_POST['zone'], $output, $return_code);
|
exec(CONF['dns']['knotc_path'] . ' --blocking --timeout 3 zone-thaw ' . $_POST['zone'], $output, $return_code);
|
||||||
if ($return_code !== 0)
|
if ($return_code !== 0)
|
||||||
output(500, 'Failed to thaw zone file.', $output);
|
output(500, 'Failed to thaw zone file.', $output);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue