Commit d1b62a66 authored by Florian Schaal's avatar Florian Schaal
Browse files

use prior dns-zone if the new zone fails (# 4107)

parent 98323f1b
......@@ -40,4 +40,5 @@ $wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delievered in signed format afterwards.';
$wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.';
$wb['soa_cannot_be_changed_txt'] = 'Die Zone (SOA) kann nicht verändert werden. Bitte kontaktieren Sie ihren Administrator, um die Zone zu ändern.';
$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
?>
......@@ -40,4 +40,5 @@ $wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delievered in signed format afterwards.';
$wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.';
$wb['soa_cannot_be_changed_txt'] = 'Die Zone (SOA) kann nicht verändert werden. Bitte kontaktieren Sie ihren Administrator, um die Zone zu ändern.';
$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
?>
......@@ -40,4 +40,5 @@ $wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delievered in signed format afterwards.';
$wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.';
$wb['soa_cannot_be_changed_txt'] = 'Die Zone (SOA) kann nicht verändert werden. Bitte kontaktieren Sie ihren Administrator, um die Zone zu ändern.';
$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
?>
......@@ -40,4 +40,5 @@ $wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delievered in signed format afterwards.';
$wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.';
$wb['soa_cannot_be_changed_txt'] = 'Die Zone (SOA) kann nicht verändert werden. Bitte kontaktieren Sie ihren Administrator, um die Zone zu ändern.';
$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
?>
......@@ -40,4 +40,5 @@ $wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delievered in signed format afterwards.';
$wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.';
$wb['soa_cannot_be_changed_txt'] = 'Die Zone (SOA) kann nicht verändert werden. Bitte kontaktieren Sie ihren Administrator, um die Zone zu ändern.';
$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
?>
......@@ -40,4 +40,5 @@ $wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delievered in signed format afterwards.';
$wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.';
$wb['soa_cannot_be_changed_txt'] = 'The Zone (SOA) can not be changed. Please contact your administrator to change the zone.';
$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
?>
......@@ -3,6 +3,12 @@
</div>
<p><tmpl_var name="list_desc_txt"></p>
<tmpl_if name="config_error_msg">
<div style="background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px;">
<p style="font-face:bold">{tmpl_var name='configuration_error_txt'}</p>
<div><div style="float:left;width:150px;">{tmpl_var name='config_error_tstamp'} :&nbsp;</div><div style="padding-left:150px;">{tmpl_var name='config_error_msg'}</div></div>
</div>
</tmpl_if>
<legend>DNS Zone</legend>
<tmpl_if name="is_admin">
......
......@@ -265,6 +265,7 @@ class bind_plugin {
$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'], 0, -1)));
}
$old_zonefile = @file_get_contents($filename);
file_put_contents($filename, $tpl->grab());
chown($filename, escapeshellcmd($dns_config['bind_user']));
chgrp($filename, escapeshellcmd($dns_config['bind_group']));
......@@ -275,12 +276,20 @@ class bind_plugin {
if($return_status === 0) {
$app->log("Writing BIND domain file: ".$filename, LOGLEVEL_DEBUG);
} else {
if($dns_config['disable_bind_log'] === 'y') {
$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), LOGLEVEL_DEBUG);
$loglevel = @($dns_config['disable_bind_log'] === 'y')?:'LOGLEVEL_DEBUG':'LOGLEVEL_WARN';
$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), $loglevel);
if(is_array($out) && !empty($out)){
$app->log('Reason for Bind restart failure: '.implode("\n", $out), $loglevel);
$app->dbmaster->datalogError(implode("\n", $out));
}
if ($old_zonefile != '') {
rename($filename, $filename.'.err');
file_put_contents($filename, $old_zonefile);
chown($filename, escapeshellcmd($dns_config['bind_user']));
chgrp($filename, escapeshellcmd($dns_config['bind_group']));
} else {
$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), LOGLEVEL_WARN);
rename($filename, $filename.'.err');
}
rename($filename, $filename.'.err');
}
unset($tpl);
unset($records);
......
Supports Markdown
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