Commit d93e2d63 authored by Marius Burkard's avatar Marius Burkard

Merge branch 'darkalex/ispconfig3-dns-status'

parents 4e7339b7 0c811fda
...@@ -678,7 +678,7 @@ class installer_base { ...@@ -678,7 +678,7 @@ class installer_base {
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
} }
$query = "GRANT SELECT, UPDATE(`dnssec_initialized`, `dnssec_info`, `dnssec_last_signed`) ON ?? TO ?@?"; $query = "GRANT SELECT, UPDATE(`dnssec_initialized`, `dnssec_info`, `dnssec_last_signed`, `status`, `status_txt`) ON ?? TO ?@?";
if ($verbose){ if ($verbose){
echo $query ."\n"; echo $query ."\n";
} }
......
ALTER TABLE `sys_user` ADD `last_login_ip` VARCHAR(50) NULL AFTER `lost_password_reqtime`; ALTER TABLE `sys_user` ADD `last_login_ip` VARCHAR(50) NULL AFTER `lost_password_reqtime`;
ALTER TABLE `sys_user` ADD `last_login_at` BIGINT(20) NULL AFTER `last_login_ip`; ALTER TABLE `sys_user` ADD `last_login_at` BIGINT(20) NULL AFTER `last_login_ip`;
-- DNS-Status (2 lines)
ALTER TABLE `dns_soa` ADD COLUMN `status` enum('OK','ERROR','PENDING') NOT NULL DEFAULT 'OK' AFTER `active`;
ALTER TABLE `dns_soa` ADD COLUMN `status_txt` text AFTER `status`;
ALTER TABLE `sys_remoteaction` CHANGE `action_state` `action_state` ENUM('pending','processing','ok','warning','error') NOT NULL DEFAULT 'pending'; ALTER TABLE `sys_remoteaction` CHANGE `action_state` `action_state` ENUM('pending','processing','ok','warning','error') NOT NULL DEFAULT 'pending';
CREATE TABLE IF NOT EXISTS `dns_ssl_ca` ( CREATE TABLE IF NOT EXISTS `dns_ssl_ca` (
......
...@@ -607,6 +607,8 @@ CREATE TABLE `dns_soa` ( ...@@ -607,6 +607,8 @@ CREATE TABLE `dns_soa` (
`minimum` int(11) unsigned NOT NULL default '3600', `minimum` int(11) unsigned NOT NULL default '3600',
`ttl` int(11) unsigned NOT NULL default '3600', `ttl` int(11) unsigned NOT NULL default '3600',
`active` enum('N','Y') NOT NULL DEFAULT 'N', `active` enum('N','Y') NOT NULL DEFAULT 'N',
`status` enum('OK','ERROR','PENDING') NOT NULL DEFAULT 'OK',
`status_txt` text,
`xfer` varchar(255) NOT NULL DEFAULT '', `xfer` varchar(255) NOT NULL DEFAULT '',
`also_notify` varchar(255) default NULL, `also_notify` varchar(255) default NULL,
`update_acl` varchar(255) default NULL, `update_acl` varchar(255) default NULL,
......
...@@ -80,6 +80,20 @@ $form["tabs"]['dns_soa'] = array ( ...@@ -80,6 +80,20 @@ $form["tabs"]['dns_soa'] = array (
'width' => '30', 'width' => '30',
'maxlength' => '255' 'maxlength' => '255'
), ),
'status' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => 'PENDING',
'value' => 'PENDING'
),
'status_txt' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXTAREA',
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '10000'
),
'origin' => array ( 'origin' => array (
'datatype' => 'VARCHAR', 'datatype' => 'VARCHAR',
'formtype' => 'TEXT', 'formtype' => 'TEXT',
......
...@@ -61,7 +61,27 @@ $liste["item"][] = array( 'field' => "active", ...@@ -61,7 +61,27 @@ $liste["item"][] = array( 'field' => "active",
'width' => "", 'width' => "",
'value' => array('Y' => $app->lng('yes_txt'), 'N' => $app->lng('no_txt'))); 'value' => array('Y' => $app->lng('yes_txt'), 'N' => $app->lng('no_txt')));
$liste["item"][] = array( 'field' => "status",
'datatype' => "VARCHAR",
'formtype' => "SELECT",
'op' => "=",
'prefix' => "",
'suffix' => "",
'width' => "",
'value' => array('OK' => '', 'ERROR' => 'background-color:red', 'PENDING' => 'background-color:yellow'));
$liste["item"][] = array( 'field' => "status_txt",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "=",
'prefix' => "",
'suffix' => "",
'width' => "",
'value' => '');
$liste["item"][] = array( 'field' => "server_id", $liste["item"][] = array( 'field' => "server_id",
'datatype' => "VARCHAR", 'datatype' => "VARCHAR",
'formtype' => "SELECT", 'formtype' => "SELECT",
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<tbody> <tbody>
<tmpl_loop name="records"> <tmpl_loop name="records">
<tr> <tr>
<td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}">{tmpl_var name="active"}</td> <td style="{tmpl_var name="status"}"><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='status_txt'}">{tmpl_var name="active"}</td>
<td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}">{tmpl_var name="sys_groupid"}</a></td> <td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}">{tmpl_var name="sys_groupid"}</a></td>
<td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='server_id'}">{tmpl_var name="server_id"}</a></td> <td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='server_id'}">{tmpl_var name="server_id"}</a></td>
<td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='origin'}">{tmpl_var name="origin"}</a></td> <td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='origin'}">{tmpl_var name="origin"}</a></td>
......
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
</tmpl_if> </tmpl_if>
<legend>DNS Zone</legend> <legend>DNS Zone</legend>
<tmpl_if name="status_txt">
<div class="alert alert-danger clear">
<div style="white-space: pre;" class="alert-content"><tmpl_var name="status_txt"></div>
</div>
</tmpl_if>
<tmpl_if name="is_admin"> <tmpl_if name="is_admin">
<div class="form-group"> <div class="form-group">
<tmpl_if name="edit_disabled"> <tmpl_if name="edit_disabled">
...@@ -146,6 +151,7 @@ ...@@ -146,6 +151,7 @@
</tmpl_if> </tmpl_if>
<input type="hidden" name="id" value="{tmpl_var name='id'}"> <input type="hidden" name="id" value="{tmpl_var name='id'}">
<input type="hidden" name="status" value="PENDING">
<input name="serial" type="hidden" value="{tmpl_var name='serial'}"> <input name="serial" type="hidden" value="{tmpl_var name='serial'}">
<div class="clear"><div class="right"> <div class="clear"><div class="right">
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<tbody> <tbody>
<tmpl_loop name="records"> <tmpl_loop name="records">
<tr> <tr>
<td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}">{tmpl_var name="active"}</td> <td style="{tmpl_var name="status"}"><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='status_txt'}">{tmpl_var name="active"}</td>
<td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='server_id'}">{tmpl_var name="server_id"}</a></td> <td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='server_id'}">{tmpl_var name="server_id"}</a></td>
<td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='origin'}">{tmpl_var name="origin"}</a></td> <td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='origin'}">{tmpl_var name="origin"}</a></td>
<td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='ns'}">{tmpl_var name="ns"}</a></td> <td><a href="#" data-load-content="dns/dns_soa_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='ns'}">{tmpl_var name="ns"}</a></td>
......
...@@ -296,9 +296,14 @@ class bind_plugin { ...@@ -296,9 +296,14 @@ class bind_plugin {
//* Check the zonefile //* Check the zonefile
if(is_file($filename.'.err')) unlink($filename.'.err'); if(is_file($filename.'.err')) unlink($filename.'.err');
exec('named-checkzone '.escapeshellarg($zone['origin']).' '.escapeshellarg($filename), $out, $return_status); $out=array();
exec('named-checkzone '.escapeshellarg($zone['origin']).' '.escapeshellarg($filename).' 2>&1', $out, $return_status);
$statustext='';
foreach ($out as $line) $statustext .= $line."\n";
if($return_status === 0) { if($return_status === 0) {
$app->log("Writing BIND domain file: ".$filename, LOGLEVEL_DEBUG); $app->log("Writing BIND domain file: ".$filename, LOGLEVEL_DEBUG);
$app->db->query('UPDATE dns_soa SET status=\'OK\', status_txt=\'\' WHERE id='.$data['new']['id']);
$app->dbmaster->query('UPDATE dns_soa SET status=\'OK\', status_txt=\'\' WHERE id='.$data['new']['id']);
} else { } else {
$loglevel = @($dns_config['disable_bind_log'] === 'y')?'LOGLEVEL_DEBUG':'LOGLEVEL_WARN'; $loglevel = @($dns_config['disable_bind_log'] === 'y')?'LOGLEVEL_DEBUG':'LOGLEVEL_WARN';
$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), $loglevel); $app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), $loglevel);
...@@ -314,6 +319,8 @@ class bind_plugin { ...@@ -314,6 +319,8 @@ class bind_plugin {
} else { } else {
rename($filename, $filename.'.err'); rename($filename, $filename.'.err');
} }
$app->db->query('UPDATE dns_soa SET status=\'ERROR\', status_txt=\''.str_replace(array('"', '\''), '', $statustext).'\' WHERE id='.$data['new']['id']);
$app->dbmaster->query('UPDATE dns_soa SET status=\'ERROR\', status_txt=\''.str_replace(array('"', '\''), '', $statustext).'\' WHERE id='.$data['new']['id']);
} }
unset($tpl); unset($tpl);
unset($records); unset($records);
...@@ -357,8 +364,8 @@ class bind_plugin { ...@@ -357,8 +364,8 @@ class bind_plugin {
if(is_file($filename)) unlink($filename); if(is_file($filename)) unlink($filename);
if(is_file($filename.'.err')) unlink($filename.'.err'); if(is_file($filename.'.err')) unlink($filename.'.err');
if(is_file($filename.'.signed')) unlink($filename.'.signed'); if(is_file($filename.'.signed')) unlink($filename.'.signed');
} }
//* Restart bind nameserver if update_acl is not empty, otherwise reload it //* Restart bind nameserver if update_acl is not empty, otherwise reload it
if($data['new']['update_acl'] != '') { if($data['new']['update_acl'] != '') {
$app->services->restartServiceDelayed('bind', 'restart'); $app->services->restartServiceDelayed('bind', 'restart');
...@@ -610,4 +617,5 @@ class bind_plugin { ...@@ -610,4 +617,5 @@ class bind_plugin {
} // end class } // end class
?> ?>
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