2009-04-02 Sancho Lerena <slerena@artica.es>

* pandoradb.sql: Final DB changes proposed for closing this month the DB
	scheme. tagente-> new server_name field to assign server (old fields will
	be removed).  talert_templates has two new types (warning, critical).
	tevento has "user_comment" new field. Tserver has three new fields, 
	server_type (so some old fields will be deleted), threads and queued_modules
	this last two are for statistical options. Tusuario add language type to
	override global language.
	
	* update_manager/main.php: Minor changes for correct ACL usage. Non PM
	users could see in what revision it the system, but only that.
	
	* pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes.
	
	* general/noaccess.php: Added footer and ending div. Page was very ugly
	when showing noaccess errors, nobody see it ???.
	
	* godmode/menu.php: A LOT of ACL fixes on several options.
	
	* godmode/agentes/agent_manager.php: Fixed a crazy floating icon.
	
	* godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting
	stuff, because was not working. This also adds a lot of ACL checks. 
	
	* godmode/agentes/massive_config.php, massive*: ACL changes.
	
	* godmode/agentes/modificar_agente.php: Fixed ACL problems.
	
	* godmode/agentes/module_manager_editor.php: Fixed bad module categories for
	some types (data, plugin and prediction).
	
	* godmode/alerts/alert_list.php: Fixed ACL problem.
	
	* godmode/reporting/graph_builder.php: Added ACl restriction for 
	non-viewable agents for current user. Seems to be a problem with data
	with more than 2 sources.
	
	* godmode/reporting/map_builder.php: ACL checks improved.
	
	* godmode/reporting/reporting_builder.php: ACL checks added (was missing), 
	some code ported from 2.1, other is new. New fields shown in list.
	
	* include/functions.php: Fixed the annoying bug of "bad counters" in
	function human_time_description_raw(). Function used,format_numeric() should
	not be used never to calculate nothing, only to print formatted strings.
	
	* include/functions_db.php: Added function user_access_to_agent() to know
	if a given user has access to a given agent.
	
	* include/functioins_report.php: get_report() should let admin to watch any
	report. Fixed.
	
	* agentes/alerts_status.php: Fixed ACL problem for view alert.
	
	* operation/incidents/incident.php: Bad call for pagination() was giving
	problems to pagination call. Somebody changes pagination() interface and 
	make this broken. Please if you change any interface, be sure that is compatible
	with old code or make a post in the list about this !
		
	* godmode/users/user_edit.php: Additional ACL check to do not let anybody
	to watch non accesible users. Even for see the username or description.
	
	* reporting/pchart_graph.php:Progress bar shown text in white when > 60%.
	


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2009-04-02 19:16:59 +00:00
parent e133943f70
commit 8ea077cd91
28 changed files with 323 additions and 7269 deletions

View File

@ -1,6 +1,71 @@
2009-04-02 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: Final DB changes proposed for closing this month the DB
scheme. tagente-> new server_name field to assign server (old fields will
be removed). talert_templates has two new types (warning, critical).
tevento has "user_comment" new field. Tserver has three new fields,
server_type (so some old fields will be deleted), threads and queued_modules
this last two are for statistical options. Tusuario add language type to
override global language.
* update_manager/main.php: Minor changes for correct ACL usage. Non PM
users could see in what revision it the system, but only that.
* pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes.
* general/noaccess.php: Added footer and ending div. Page was very ugly
when showing noaccess errors, nobody see it ???.
* godmode/menu.php: A LOT of ACL fixes on several options.
* godmode/agentes/agent_manager.php: Fixed a crazy floating icon.
* godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting
stuff, because was not working. This also adds a lot of ACL checks.
* godmode/agentes/massive_config.php, massive*: ACL changes.
* godmode/agentes/modificar_agente.php: Fixed ACL problems.
* godmode/agentes/module_manager_editor.php: Fixed bad module categories for
some types (data, plugin and prediction).
* godmode/alerts/alert_list.php: Fixed ACL problem.
* godmode/reporting/graph_builder.php: Added ACl restriction for
non-viewable agents for current user. Seems to be a problem with data
with more than 2 sources.
* godmode/reporting/map_builder.php: ACL checks improved.
* godmode/reporting/reporting_builder.php: ACL checks added (was missing),
some code ported from 2.1, other is new. New fields shown in list.
* include/functions.php: Fixed the annoying bug of "bad counters" in
function human_time_description_raw(). Function used,format_numeric() should
not be used never to calculate nothing, only to print formatted strings.
* include/functions_db.php: Added function user_access_to_agent() to know
if a given user has access to a given agent.
* include/functioins_report.php: get_report() should let admin to watch any
report. Fixed.
* agentes/alerts_status.php: Fixed ACL problem for view alert.
* operation/incidents/incident.php: Bad call for pagination() was giving
problems to pagination call. Somebody changes pagination() interface and
make this broken. Please if you change any interface, be sure that is compatible
with old code or make a post in the list about this !
* godmode/users/user_edit.php: Additional ACL check to do not let anybody
to watch non accesible users. Even for see the username or description.
* reporting/pchart_graph.php:Progress bar shown text in white when > 60%.
2009-04-02 Esteban Sanchez <estebans@artica.es>
* include/functions_config.php: Fixed a bug when the theme was not
* includandora_console/godmode/agentes/massive_config.phpe/functions_config.php: Fixed a bug when the theme was not
given on update_config().
* godmode/setup/setup.php: Removed unneccesary include of

File diff suppressed because it is too large Load Diff

View File

@ -21,13 +21,6 @@ require_once ("include/config.php");
check_login ();
if (! give_acl ($config['id_user'], 0, 'PM')) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to use Open Update Manager extension");
include ("general/noaccess.php");
exit;
}
$db =& um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
$config['dbpass'], $config['dbname']);
@ -62,38 +55,41 @@ if ($update_package) {
$package = um_client_check_latest_update ($settings, $user_key);
if (is_int ($package) && $package == 1) {
echo '<h5 class="suc">'.__('Your system is up-to-date').'.</h5>';
} elseif ($package === false) {
echo '<h5 class="error">'.__('Server connection failed')."</h5>";
} elseif (is_int ($package) && $package == 0) {
echo '<h5 class="error">'.__('Server authorization rejected')."</h5>";
} else {
echo '<h5 class="suc">'.__('There\'s a new update for Pandora FMS')."</h5>";
if (give_acl ($config['id_user'], 0, 'PM')) {
$table->width = '80%';
$table->data = array ();
if (is_int ($package) && $package == 1) {
echo '<h5 class="suc">'.__('Your system is up-to-date').'.</h5>';
} elseif ($package === false) {
echo '<h5 class="error">'.__('Server connection failed')."</h5>";
} elseif (is_int ($package) && $package == 0) {
echo '<h5 class="error">'.__('Server authorization rejected')."</h5>";
} else {
echo '<h5 class="suc">'.__('There\'s a new update for Pandora FMS')."</h5>";
$table->data[0][0] = '<strong>'.__('Id').'</strong>';
$table->data[0][1] = $package->id;
$table->width = '80%';
$table->data = array ();
$table->data[1][0] = '<strong>'.__('Timestamp').'</strong>';
$table->data[1][1] = $package->timestamp;
$table->data[0][0] = '<strong>'.__('Id').'</strong>';
$table->data[0][1] = $package->id;
$table->data[2][0] = '<strong>'.__('Description').'</strong>';
$table->data[2][1] = html_entity_decode ($package->description);
$table->data[1][0] = '<strong>'.__('Timestamp').'</strong>';
$table->data[1][1] = $package->timestamp;
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post">';
echo __('Overwrite local changes');
print_checkbox ('force_update', '1', false);
echo '<p />';
print_input_hidden ('update_package', 1);
print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"');
echo '</form>';
echo '</div>';
}
$table->data[2][0] = '<strong>'.__('Description').'</strong>';
$table->data[2][1] = html_entity_decode ($package->description);
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post">';
echo __('Overwrite local changes');
print_checkbox ('force_update', '1', false);
echo '<p />';
print_input_hidden ('update_package', 1);
print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"');
echo '</form>';
echo '</div>';
}
}
echo '<h4>'.__('Your system version number is').': '.$settings->current_update.'</h4>';

View File

@ -1,10 +1,8 @@
-- Changes on 1x March 09
ALTER TABLE treport_content_sla_combined CHANGE sla_max `sla_max` double(18,2) NOT NULL default 0;
ALTER TABLE treport_content_sla_combined CHANGE sla_min `sla_min` double(18,2) NOT NULL default 0;
ALTER TABLE treport_content_sla_combined CHANGE sla_limit `sla_limit` double(18,2) NOT NULL default 0;
ALTER TABLE ttrap add `priority` tinyint(4) unsigned NOT NULL default '2';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('loginhash_pwd', '');
@ -78,7 +76,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
`field1` varchar(255) default '',
`field2` varchar(255) default '',
`field3` mediumtext NOT NULL,
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal'),
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical'),
`value` varchar(255) default '',
`matches_value` tinyint(1) default 0,
`max_value` double(18,2) default NULL,
@ -298,3 +296,15 @@ ALTER TABLE `tmensajes` CHANGE `timestamp` `timestamp` BIGINT( 20 ) UNSIGNED
-- Changes added 20 February 2009
ALTER TABLE `tevento` CHANGE `event_type` `event_type` ENUM( 'unknown', 'alert_fired', 'alert_recovered', 'alert_ceased', 'alert_manual_validation', 'recon_host_detected', 'system', 'error', 'new_agent', 'going_up_warning', 'going_up_critical', 'going_down_warning', 'going_down_normal', 'going_down_critical', 'going_up_normal' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'unknown';
-- Changes on 1th April 09
ALTER TABLE tagente ADD `server_name` varchar(255) default '';
ALTER TABLE tevento ADD `user_comment` varchar(255) NOT NULL default '';
ALTER TABLE tusuario ADD `language` varchar(10) default NULL;
ALTER TABLE tserver ADD `server_type` tinyint(3) unsigned NOT NULL default '0';
ALTER TABLE tserver ADD `queued_modules` int(5) unsigned NOT NULL default '0';
ALTER TABLE tserver ADD `threads` int(5) unsigned NOT NULL default '0';

View File

@ -26,3 +26,10 @@
<div class="msg"><?php echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance. <br><br>Please know that all attempts to access this page are recorded in security logs of Pandora System Database');?></div>
</div>
</div>
</div>
<?PHP
include "general/footer.php";
?>
<!-- Container div. ENDS HERE -->

View File

@ -79,7 +79,7 @@ if (isset ($id_agente) && $id_agente != "") {
// Remote configuration available
if (file_exists ($filename['md5'])) {
$table->data[0][1] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5.'">';
$table->data[0][1] .= print_image ("images/application_edit.png", false, array ("border" => 0, "title" => __('This agent can be remotely configured')));
$table->data[0][1] .= print_image ("images/application_edit.png", true, array ("border" => 0, "title" => __('This agent can be remotely configured')));
$table->data[0][1] .= '</a>'.print_help_tip (__('You can remotely edit this agent configuration'), true);
}

View File

@ -26,15 +26,15 @@ $id_group = get_parameter ("id_group", -1);
$update_agent = get_parameter ("update_agent", -1);
$update_group = get_parameter ("update_group", -1);
if (! give_acl ($config['id_user'], 0, "LM")) {
if (! give_acl ($config['id_user'], 0, "AW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Config Management Admin section");
"Trying to access remote config copy tool");
require ("general/noaccess.php");
return;
exit;
}
// Operations
if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group == -1) ) {
if ((isset($_GET["operacion"])) AND ($update_group == -1) ) {
// DATA COPY
// ---------
@ -52,19 +52,36 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
}
// Source
$id_origen = $_POST["origen"];
$id_origen = get_parameter ("origen");
// Security check here
if (!user_access_to_agent ($config["id_user"], $id_origen,"AR")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to forge a source agent in remote config tool");
require ("general/noaccess.php");
exit;
}
// Copy files
for ($a=0;$a <count($destino); $a++){
// For every agent in destination
//Security check here
$id_agente = $destino[$a];
$agent_name_src = get_agent_name($id_origen);
$agent_name_dst = get_agent_name($id_agente);
echo "<br><br>".__('copyage')."<b> [".$agent_name_src."] -> [".$agent_name_dst."]</b>";
// Security check here
if (!user_access_to_agent ($config["id_user"], $id_agente, "AR")){
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to forge a source agent in remote config tool");
require ("general/noaccess.php");
exit;
}
$agent_name_src = get_agent_name($id_origen, "");
$agent_name_dst = get_agent_name($id_agente, "");
echo "<br><br>".__('Making copy of configuration file for')." [<b>".$agent_name_src."</b>] ".__('to')." [<b>".$agent_name_dst."</b>]";
$source = $config["remote_config"]."/".md5($agent_name_src);
$destination = $config["remote_config"]."/".md5($agent_name_dst);
copy ( $source.".md5", $destination.".md5" );
copy ( $source.".conf", $destination.".conf" );
} // for each destination agent
@ -77,18 +94,17 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
} else {
// title
echo '<h2>'.__('Agent configuration'). ' &gt; '. __('Configuration Management').'</h2>';
echo '<h2>'.__('Agent configuration'). ' &gt; '. __('Remote configuration Management').'</h2>';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/manage_config_remote&operacion=1">';
echo "<table width='650' border='0' cellspacing='4' cellpadding='4' class='databox'>";
// Source group
echo '<tr><td class="datost"><b>'. __('Source group'). '</b><br><br>';
echo '<select name="id_group" style="width:200px">';
if ($id_group != 0)
echo "<option value=$id_group>".get_group_name ($id_group)."</option>";
list_group ($config["id_user"]);
echo '</select>';
$group_select = get_user_groups ($config['id_user']);
$grouplist = implode (',', array_keys ($group_select));
echo print_select ($group_select, 'id_group', $id_group, '', '', '', true);
echo '&nbsp;&nbsp;';
echo '<input type=submit name="update_group" class="sub upd" value="'.__('Filter').'">';
echo '<br><br>';
@ -97,41 +113,33 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
echo '<b>'. __('Source agent').'</b>';
print_help_icon ('duplicateconfig');
echo '<br><br>';
// Show combo with SOURCE agents
if ($id_group > 1)
$sql1 = "SELECT * FROM tagente WHERE id_grupo = $id_group ORDER BY nombre ";
else
$sql1 = 'SELECT * FROM tagente ORDER BY nombre';
$sql1 = "SELECT * FROM tagente WHERE id_group IN ($grouplist) ORDER BY nombre";
echo '<select name="origen" style="width:200px">';
if (($update_agent != 1) AND ($origen != -1)){
$agent_name_src = get_agent_name ($origen);
$source = $config["remote_config"]."/". md5($agent_name_src).".conf";
if (file_exists($source))
echo "<option value=".$_POST["origen"].">" . $agent_name_src . "</option>";
}
$result=mysql_query($sql1);
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
if (give_acl ($config["id_user"], $row["id_grupo"], "AR")){
if ( $origen != $row["id_agente"]){
$source = $config["remote_config"]."/". md5($row["nombre"]).".conf";
if (file_exists($source))
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
$source = $config["remote_config"]."/". md5($row["nombre"]).".conf";
if (file_exists($source)){
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
}
}
}
echo '</select>';
echo '&nbsp;&nbsp;';
echo '<input type=submit name="update_agent" class="sub upd" value="'.__('Get Info').'">';
echo '<br><br>';
// Destination agent
echo '<tr><td class="datost">';
echo '<b>'.__('To Agent(s):').'</b><br><br>';
echo "<select name=destino[] size=10 multiple=yes style='width: 250px;'>";
$sql1='SELECT * FROM tagente ORDER BY nombre';
if ($id_group > 1)
$sql1 = "SELECT * FROM tagente WHERE id_grupo = $id_group ORDER BY nombre ";
else
$sql1 = "SELECT * FROM tagente WHERE id_group IN ($grouplist) ORDER BY nombre";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
if (give_acl ($config["id_user"], $row["id_grupo"], "AW"))
@ -145,7 +153,6 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
echo '<tr><td colspan=2>';
echo '</div></td></tr>';
echo '</table>';
}
?>

View File

@ -19,7 +19,7 @@
// Load global vars
check_login ();
if (! give_acl ($config['id_user'], 0, "LM")) {
if (! give_acl ($config['id_user'], 0, "AW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Config Management Admin section");
require ("general/noaccess.php");

View File

@ -19,9 +19,9 @@
// Load global vars
check_login ();
if (! give_acl ($config['id_user'], 0, "LM")) {
if (! give_acl ($config['id_user'], 0, "AW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Config Management Admin section");
"Trying to access massive agent deletion section");
require ("general/noaccess.php");
return;
}

View File

@ -19,9 +19,9 @@
// Load global vars
check_login ();
if (! give_acl ($config['id_user'], 0, "LM")) {
if (! give_acl ($config['id_user'], 0, "AW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Config Management Admin section");
"Trying to access massive alert deletion");
require ("general/noaccess.php");
return;
}

View File

@ -19,9 +19,9 @@
// Load global vars
check_login ();
if (! give_acl ($config['id_user'], 0, "LM")) {
if (! give_acl ($config['id_user'], 0, "AW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Config Management Admin section");
"Trying to access agent massive deletion");
require ("general/noaccess.php");
return;
}

View File

@ -19,9 +19,9 @@
// Load global vars
check_login ();
if (! give_acl ($config['id_user'], 0, "LM")) {
if (! give_acl ($config['id_user'], 0, "PM")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Config Management Admin section");
"Trying to access massive module update");
require ("general/noaccess.php");
return;
}

View File

@ -19,9 +19,9 @@
// Load global vars
check_login ();
if (! give_acl ($config['id_user'], 0, "LM")) {
if (! give_acl ($config['id_user'], 0, "AW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Config Management Admin section");
"Trying to access massive operation section");
require ("general/noaccess.php");
return;
}

View File

@ -30,7 +30,7 @@ if ($ag_group == -1 )
if (($ag_group == -1) && ($group_id != 0))
$ag_group = $group_id;
if (! give_acl ($config["id_user"], $ag_group, "AW")) {
if (! give_acl ($config["id_user"], 0, "AW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access agent manager");
require ("general/noaccess.php");

View File

@ -159,7 +159,7 @@ case "dataserver":
case 1:
/* Categories is an array containing the allowed module types
(generic_data, generic_string, etc) from ttipo_modulo (field categoria) */
$categories = array (0, 1, 2, 6, 7, 8, 9, -1);
$categories = array (0, 1, 2, 6, 7, 8, -1);
require ('module_manager_editor_common.php');
require ('module_manager_editor_data.php');
break;
@ -173,14 +173,14 @@ case 2:
case "pluginserver":
$moduletype = 4;
case 4:
$categories = array (0, 1, 2, 9);
$categories = array (0, 1, 2);
require ('module_manager_editor_common.php');
require ('module_manager_editor_plugin.php');
break;
case "predictionserver":
$moduletype = 5;
case 5:
$categories = array (1, 2);
$categories = array (0,1);
require ('module_manager_editor_common.php');
require ('module_manager_editor_prediction.php');
break;

View File

@ -90,7 +90,7 @@ if (isset ($id_agente)) {
$id_agente = 0;
}
if (! give_acl ($config['id_user'], $id_group, "LM")) {
if (! give_acl ($config['id_user'], 0, "LW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");

View File

@ -20,7 +20,12 @@ require_once ('include/config.php');
check_login ();
if ((! give_acl ($config['id_user'], 0, "LM")) && (! give_acl ($config['id_user'], 0, "AW")) && (! give_acl ($config['id_user'], 0, "PM")) && (! give_acl ($config['id_user'], 0, "DM")) && (! give_acl ($config['id_user'], 0, "UM"))) {
if ((! give_acl ($config['id_user'], 0, "LM"))
&& (! give_acl ($config['id_user'], 0, "AW"))
&& (! give_acl ($config['id_user'], 0, "LW"))
&& (! give_acl ($config['id_user'], 0, "PM"))
&& (! give_acl ($config['id_user'], 0, "DM"))
&& (! give_acl ($config['id_user'], 0, "UM"))) {
return;
}
@ -42,10 +47,9 @@ if (give_acl ($config['id_user'], 0, "AW")) {
if (give_acl ($config["id_user"], 0, "PM")) {
$sub["godmode/groups/group_list"]["text"] = __('Manage groups');
$sub["godmode/agentes/planned_downtime"]["text"] = __('Scheduled downtime');
}
$sub["godmode/agentes/planned_downtime"]["text"] = __('Scheduled downtime');
$menu["gagente"]["sub"] = $sub;
}
if (give_acl ($config['id_user'], 0, "PM")) {
@ -77,7 +81,7 @@ if (give_acl ($config['id_user'], 0, "LM")) {
$sub["godmode/alerts/alert_commands"]["text"] = __('Commands');
$sub["godmode/alerts/alert_compounds"]["text"] = __('Compounds');
$sub["godmode/alerts/alert_compounds"]["text"] = __('Correlation');
$menu["galertas"]["sub"] = $sub;
}
@ -89,7 +93,7 @@ if (give_acl ($config['id_user'], 0, "UM")) {
}
// SNMP console
if (give_acl($config['id_user'], 0, "AW")) {
if (give_acl($config['id_user'], 0, "LW")) {
$menu["gsnmpconsole"]["text"] = __('Manage SNMP console');
$menu["gsnmpconsole"]["sec2"] = "godmode/snmpconsole/snmp_alert";
$menu["gsnmpconsole"]["id"] = "god-snmpc";
@ -103,7 +107,7 @@ if (give_acl($config['id_user'], 0, "AW")) {
}
// Reporting
if (give_acl ($config['id_user'], 0, "PM")) {
if (give_acl ($config['id_user'], 0, "AW")) {
$menu["greporting"]["text"] = __('Manage reports');
$menu["greporting"]["sec2"] = "godmode/reporting/reporting_builder";
$menu["greporting"]["id"] = "god-reporting";
@ -119,12 +123,14 @@ if (give_acl ($config['id_user'], 0, "PM")) {
$sub["godmode/reporting/map_builder"]["text"] = __('Map builder');
$menu["greporting"]["sub"] = $sub;
}
if (give_acl ($config['id_user'], 0, "PM")) {
// Manage profiles
$menu["gperfiles"]["text"] = __('Manage profiles');
$menu["gperfiles"]["sec2"] = "godmode/profiles/profile_list";
$menu["gperfiles"]["id"] = "god-profiles";
// Servers
$menu["gservers"]["text"] = __('Manage servers');
$menu["gservers"]["sec2"] = "godmode/servers/modificar_server";
@ -138,9 +144,13 @@ if (give_acl ($config['id_user'], 0, "PM")) {
$sub["godmode/servers/manage_export_form"]["text"] = __('Export targets');
$menu["gservers"]["sub"] = $sub;
enterprise_hook ('snmpconsole_menu');
}
if (give_acl ($config['id_user'], 0, "LW")) {
enterprise_hook ('snmpconsole_menu');
}
if (give_acl ($config['id_user'], 0, "PM")) {
// Audit
$menu["glog"]["text"] = __('System audit log');
$menu["glog"]["sec2"] = "godmode/admin_access_logs";
@ -150,7 +160,7 @@ if (give_acl ($config['id_user'], 0, "PM")) {
$menu["gsetup"]["text"] = __('Setup');
$menu["gsetup"]["sec2"] = "godmode/setup/setup";
$menu["gsetup"]["id"] = "god-setup";
$sub = array ();
$sub["godmode/setup/setup_visuals"]["text"] = __('Visual styles');
@ -181,23 +191,25 @@ if (give_acl ($config['id_user'], 0, "DM")) {
$menu["gdbman"]["sub"] = $sub;
}
if (is_array ($config['extensions'])) {
$menu["gextensions"]["text"] = __('Extensions');
$menu["gextensions"]["sec2"] = "godmode/extensions";
$menu["gextensions"]["id"] = "god-extensions";
if (give_acl ($config['id_user'], 0, "PM")) {
if (is_array ($config['extensions'])) {
$menu["gextensions"]["text"] = __('Extensions');
$menu["gextensions"]["sec2"] = "godmode/extensions";
$menu["gextensions"]["id"] = "god-extensions";
$sub = array ();
foreach ($config['extensions'] as $extension) {
$extmenu = $extension['godmode_menu'];
if ($extension['godmode_menu'] == '' || ! give_acl ($config['id_user'], 0, $extmenu['acl'])) {
continue;
}
$sub = array ();
foreach ($config['extensions'] as $extension) {
$extmenu = $extension['godmode_menu'];
if ($extension['godmode_menu'] == '' || ! give_acl ($config['id_user'], 0, $extmenu['acl'])) {
continue;
}
$sub[$extmenu["sec2"]]["text"] = $extmenu["name"];
$sub[$extmenu["sec2"]]["refr"] = 0;
}
$sub[$extmenu["sec2"]]["text"] = $extmenu["name"];
$sub[$extmenu["sec2"]]["refr"] = 0;
}
$menu["gextensions"]["sub"] = $sub;
$menu["gextensions"]["sub"] = $sub;
}
}
print_menu ($menu);

View File

@ -275,7 +275,9 @@ echo "</b>";
// Show combo with agents
echo "<td class='datos' colspan=2>";
print_select_from_sql ('SELECT id_agente, nombre FROM tagente WHERE disabled = 0 ORDER BY nombre', 'id_agent', $id_agent, '', '--', 0);
$user_groups = implode (',', array_keys (get_user_groups ($config["id_user"])));
print_select_from_sql ("SELECT id_agente, nombre FROM tagente WHERE disabled = 0 AND id_grupo IN ($user_groups) ORDER BY nombre", 'id_agent', $id_agent, '', '--', 0);
// SOURCE MODULE FORM
if (isset ($chunkdata))

View File

@ -280,18 +280,19 @@ if (! $edit_layout && ! $id_layout) {
if (!$maps) {
echo '<div class="nf">'.('No maps defined').'</div>';
} else {
foreach ($maps as $map) {
$data = array ();
foreach ($maps as $map) {
if (give_acl ($config['id_user'], $map['id_group'], "AW")){
$data = array ();
$data[0] = '<a href="index.php?sec=greporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'">'.$map['name'].'</a>';
$data[0] = '<a href="index.php?sec=greporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'">'.$map['name'].'</a>';
$data[1] = print_group_icon ($map['id_group'], true).'&nbsp;';
$data[1] .= get_group_name ($map['id_group']);
$data[2] = get_db_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
$data[3] = '<a href="index.php?sec=greporting&amp;sec2=godmode/reporting/map_builder_wizard&amp;id_layout='.$map['id'].'">'.print_image ("images/pill.png", true).'</a>';
$data[1] = print_group_icon ($map['id_group'], true).'&nbsp;';
$data[1] .= get_group_name ($map['id_group']);
$data[2] = get_db_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
$data[3] = '<a href="index.php?sec=greporting&amp;sec2=godmode/reporting/map_builder_wizard&amp;id_layout='.$map['id'].'">'.print_image ("images/pill.png", true).'</a>';
$data[4] = '<a href="index.php?sec=greporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.print_image ("images/cross.png", true).'</a>';
array_push ($table->data, $data);
$data[4] = '<a href="index.php?sec=greporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.print_image ("images/cross.png", true).'</a>';
array_push ($table->data, $data);
}
}
print_table ($table);
}

View File

@ -148,6 +148,8 @@ if ($update_report) {
$values['name'] = $report_name;
$values['description'] = $report_description;
$values['private'] = $report_private;
$values['id_group'] = $report_id_group;
$result = update_report ($id_report, $values);
print_result_message ($result,
__('Successfully updated'),
@ -178,12 +180,12 @@ if ($edit_sla_report_content) {
$sla_min = '';
$sla_limit = '';
if ($add_sla) {
$sla_max = (int) get_parameter ('sla_max');
$sla_min = (int) get_parameter ('sla_min');
$sla_limit = (int) get_parameter ('sla_limit');
$sla_max = (float) get_parameter ('sla_max');
$sla_min = (float) get_parameter ('sla_min');
$sla_limit = (float) get_parameter ('sla_limit');
$sql = sprintf ('INSERT INTO treport_content_sla_combined (id_report_content,
id_agent_module, sla_max, sla_min, sla_limit) VALUES (%d, %d, %d, %d, %d)',
id_agent_module, sla_max, sla_min, sla_limit) VALUES (%d, %d, %f, %f, %f)',
$id_report_content, $id_module, $sla_max, $sla_min, $sla_limit);
if ($id_module) {
@ -284,11 +286,15 @@ if ($edit_sla_report_content) {
echo '</div>';
echo '</form>';
} elseif ($edit_report || $id_report) {
/* Edit and creation report form */
$id_agent = get_parameter_post ("id_agent",0);
echo "<h2>".__('Reporting')." &gt; ";
echo __('Custom reporting builder')."</h2>";
echo __('Custom reporting builder');
echo " <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=".$id_report."'><img src='images/reporting.png'></A>";
echo "</h2>";
$table->id = 'table-edit-report';
$table->width = '500px';
@ -301,14 +307,11 @@ if ($edit_sla_report_content) {
$table->data[0][1] .= "&nbsp;&nbsp;<a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report' title='".__('View report')."'><img src='images/reporting.png'></a>";
$table->data[1][0] = __('Group');
if ($report_id_group) {
/* Changing the group is not allowed. */
$table->data[1][1] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.
$report_id_group.'">'.get_group_name ($report_id_group).'</a>';
} else {
$table->data[1][1] = print_select_from_sql ('SELECT id_grupo, nombre FROM tgrupo ORDER BY nombre',
'report_id_group', $report_id_group, '', '--', 0, true);
}
$group_select = get_user_groups ($config['id_user']);
$table->data[1][1] = print_select ($group_select, 'report_id_group', $report_id_group, '', '', '', true);
$table->data[1][1] .= ' <span id="icon_preview">';
if ($report_id_group) {
$table->data[1][1] .= '<img src="images/groups_small/'.get_group_icon ($report_id_group).'.png" />';
@ -382,8 +385,8 @@ if ($edit_sla_report_content) {
$table->data[3][1] = print_select ($modules, 'id_module', 0, '', '--', 0, true);
$table->data[4][0] = __('Custom graph name');
$table->data[4][1] = print_select_from_sql ('SELECT id_graph, name FROM tgraph',
'id_custom_graph', 0, '', '--', 0, true);
$table->data[4][1] = print_select_from_sql ('SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = "'.$config["id_user"].'")',
'id_custom_graph', 0, '', '--', 0, true);
$module_description = "";
$table->data[5][0] = __('Description');
@ -485,33 +488,50 @@ if ($edit_sla_report_content) {
echo __('Custom reporting')."</h2>";
$reports = get_reports (array ('order' => 'name'),
array ('name', 'id_report', 'description'));
array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'));
$table->width = '0px';
if (sizeof ($reports)) {
$table->id = 'report_list';
$table->width = '600px';
$table->width = '720px';
$table->head = array ();
$table->align = array ();
$table->align[2] = 'center';
$table->data = array ();
$table->head[0] = __('Report name');
$table->head[1] = __('Description');
$table->head[2] = __('Delete');
$table->head[2] = __('Private');
$table->head[3] = __('Group');
$table->head[4] = __('Delete');
foreach ($reports as $report) {
if (!is_user_admin ($config["id_user"])){
if ($report["private"] && $report["id_user"] != $config['id_user'])
if (!give_acl ($config["id_user"], $report["id_group"], "AW"))
continue;
if (!give_acl ($config["id_user"], $report["id_group"], "AW"))
continue;
}
$data = array ();
$data[0] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&edit_report=1&id_report='.
$report['id_report'].'">'.$report['name'].'</a>';
$data[1] = $report['description'];
$data[2] = '<form method="post" style="display:inline" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[2] .= print_input_hidden ('id_report', $report['id_report'], true);
$data[2] .= print_input_hidden ('delete_report', 1, true);
$data[2] .= print_input_image ('delete', 'images/cross.png', 1, '',
if ($report["private"] == 1)
$data[2] = __('Yes');
else
$data[2] = __('No');
$data[3] = get_group_name($report['id_group']);
$data[4] = '<form method="post" style="display:inline" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[4] .= print_input_hidden ('id_report', $report['id_report'], true);
$data[4] .= print_input_hidden ('delete_report', 1, true);
$data[4] .= print_input_image ('delete', 'images/cross.png', 1, '',
true, array ('title' => __('Delete')));
$data[2] .= '</form>';
$data[4] .= '</form>';
array_push ($table->data, $data);
}
print_table ($table);
} else {
@ -519,7 +539,7 @@ if ($edit_sla_report_content) {
}
echo '<form method="post" action="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder">';
echo '<div class="action-buttons" style="width: 600px;">';
echo '<div class="action-buttons" style="width: 720px;">';
print_input_hidden ('edit_report', 1);
print_submit_button (__('Create report'), 'create', false, 'class="sub next"');
echo "</div>";

View File

@ -425,8 +425,8 @@ function human_time_description_raw ($seconds) {
return format_numeric ($seconds, 0)." ".__('seconds');
if ($seconds < 3600) {
$minutes = format_numeric ($seconds / 60, 0);
$seconds = format_numeric ($seconds % 60, 0);
$minutes = floor($seconds / 60);
$seconds = $seconds % 60;
if ($seconds == 0)
return $minutes.' '.__('minutes');
$seconds = sprintf ("%02d", $seconds);

View File

@ -538,6 +538,7 @@ function get_agent_name ($id_agent, $case = "upper") {
}
}
/**
* Get type name for alerts (e-mail, text, internal, ...) based on type number
*
@ -2717,10 +2718,6 @@ function get_server_info ($id_server = -1) {
$server["img"] = print_image ("images/plugin.png", true, array ("title" => __('Plugin Server')));
$server["type"] = "plugin";
$id_modulo = 4;
} elseif ($server['web_server'] == 1) {
$server["img"] = print_image ("images/serverweb.png", true, array ("title" => __('WEB Server')));
$server["type"] = "web";
$id_modulo = 7;
} elseif ($server['inventory_server'] == 1) {
$server["img"] = print_image ("images/page_white_text.png", true, array ("title" => __('Inventory Server')));
$server["type"] = "inventory";
@ -3107,4 +3104,19 @@ function print_database_debug () {
print_table ($table);
}
/**
* Return access to a specific agent by a specific user
*
* @param string $id_user User id.
* @param int $id_agent Agent id.
*
* @return int Access to that agent (0 not, 1 yes)
*/
function user_access_to_agent ($id_user, $id_agent, $mode = "AR"){
$id_group = (int) get_db_value ('id_grupo', 'tagente', 'id_agente', (int) $id_agent);
return give_acl ($id_user, $id_group, $mode);
}
?>

View File

@ -35,7 +35,8 @@ function get_report ($id_report, $filter = false, $fields = false) {
if (! is_array ($filter))
$filter = array ();
$filter['id_report'] = $id_report;
$filter[] = sprintf ('private = 0 OR (private = 1 AND id_user = "%s")', $config['id_user']);
if (!is_user_admin ($config["id_user"]))
$filter[] = sprintf ('private = 0 OR (private = 1 AND id_user = "%s")', $config['id_user']);
if (is_array ($fields))
$fields[] = 'id_group';
@ -64,7 +65,8 @@ function get_reports ($filter = false, $fields = false) {
if (! is_array ($filter))
$filter = array ();
$filter[] = sprintf ('private = 0 OR (private = 1 AND id_user = "%s")', $config['id_user']);
if (!is_user_admin ($config["id_user"]))
$filter[] = sprintf ('private = 0 OR (private = 1 AND id_user = "%s")', $config['id_user']);
if (is_array ($fields)) {
$fields[] = 'id_group';
$fields[] = 'id_user';

View File

@ -75,7 +75,7 @@ if (isset ($_GET["id_agente"])) {
$alerts_combined = get_agent_alerts_compound ($id_agent, $filter);
$print_agent = false;
} else {
if (! give_acl ($config["id_user"], $id_group, "AR")) {
if (!give_acl ($config["id_user"], 0, "AR")) {
audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation","Trying to access alert view");
require ("general/noaccess.php");
return;

View File

@ -240,7 +240,7 @@ if ($count < 1) {
$url .= "&amp;texto=".$texto;
// Show pagination
pagination ($count, $url, $offset);
pagination ($count, $url, $offset, 1, false);
echo '<br />';
// Show headers

View File

@ -24,6 +24,13 @@ $id = get_parameter_get ("id", $config["id_user"]); // ID given as parameter
$user_info = get_user_info ($id);
$id = $user_info["id_user"]; //This is done in case there are problems with uppercase/lowercase (MySQL auth has that problem)
if (!give_acl ($config["id_user"], get_user_groups ($id), "UM")){
audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation","Trying to view a user without privileges");
require ("general/noaccess.php");
exit;
}
//If current user is editing himself or if the user has UM (User Management) rights on any groups the user is part of AND the authorization scheme allows for users/admins to update info
if (($config["id_user"] == $id || give_acl ($config["id_user"], get_user_groups ($id), "UM")) && $config["user_can_update_info"]) {
$view_mode = false;

View File

@ -58,6 +58,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`id_wmi_server` smallint(4) unsigned default '0',
`id_parent` int(10) unsigned default '0',
`custom_id` varchar(255) default '',
`server_name` varchar(255) default '',
PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`),
KEY `direccion` (`direccion`),
@ -125,7 +126,7 @@ CREATE TABLE `tagente_estado` (
-- 4 - Plugin server
-- 5 - Predictive server
-- 6 - WMI server
-- 7 - WEB Server (enteprise)
CREATE TABLE IF NOT EXISTS `tagente_modulo` (
`id_agente_modulo` int(10) unsigned NOT NULL auto_increment,
@ -229,7 +230,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
`field1` varchar(255) default '',
`field2` varchar(255) default '',
`field3` mediumtext NOT NULL,
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal'),
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical'),
`value` varchar(255) default '',
`matches_value` tinyint(1) default 0,
`max_value` double(18,2) default NULL,
@ -389,6 +390,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`id_agentmodule` int(10) NOT NULL default '0',
`id_alert_am` int(10) NOT NULL default '0',
`criticity` int(4) unsigned NOT NULL default '0',
`user_comment` varchar(255) NOT NULL default '',
PRIMARY KEY (`id_evento`),
KEY `indice_1` (`id_agente`,`id_evento`),
KEY `indice_2` (`utimestamp`,`id_evento`)
@ -584,6 +586,9 @@ CREATE TABLE IF NOT EXISTS `tserver` (
`prediction_server` tinyint(3) unsigned NOT NULL default '0',
`wmi_server` tinyint(3) unsigned NOT NULL default '0',
`export_server` tinyint(3) unsigned NOT NULL default '0',
`server_type` tinyint(3) unsigned NOT NULL default '0',
`queued_modules` int(5) unsigned NOT NULL default '0',
`threads` int(5) unsigned NOT NULL default '0',
PRIMARY KEY (`id_server`),
KEY `name` (`name`),
KEY `keepalive` (`keepalive`),
@ -642,6 +647,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
`email` varchar(100) default NULL,
`phone` varchar(100) default NULL,
`is_admin` tinyint(1) unsigned NOT NULL default '0',
`language` varchar(10) default NULL,
UNIQUE KEY `id_user` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -827,23 +833,5 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_agents` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- tlocal_component is a repository of local modules for
-- physical agents on Windows / Unix physical agents
CREATE TABLE IF NOT EXISTS `tlocal_component` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(80) NOT NULL,
`data` mediumtext NOT NULL,
`description` varchar(250) default NULL,
`id_os` int(10) unsigned default '0',
`os_version` varchar(100) default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tlocal_component_group` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(200) NOT NULL default '',
`parent` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -346,7 +346,6 @@ class PchartGraph extends PandoraGraphAbstract {
for ($i = 0; $i < 7; $i++) {
$this->graph->drawLine (0, $i, 6 - $i, $i, 255, 255, 255);
}
$end = $this->height - 1;
for ($i = 0; $i < 7; $i++) {
$this->graph->drawLine (0, $end - $i, 5 - $i, $end - $i, 255, 255, 255);
@ -354,11 +353,18 @@ class PchartGraph extends PandoraGraphAbstract {
}
}
if ($this->show_title) {
$this->graph->drawTextBox (0, 0, $this->width, $this->height,
$this->title, 0, 0, 0, 0, ALIGN_CENTER, false);
if ($ratio <= 60) {
if ($this->show_title) {
$this->graph->drawTextBox (0, 0, $this->width, $this->height,
$this->title, 0, 0, 0, 0, ALIGN_CENTER, false);
}
} else {
if ($this->show_title) {
$this->graph->drawTextBox (0, 0, $this->width, $this->height,
$this->title, 0, 255, 255, 255, ALIGN_CENTER, false);
}
}
if ($this->border) {
$this->graph->drawRoundedRectangle (0, 0, $this->width - 1,
$this->height - 1,