diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index dfbd00e2e4..410166e603 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,116 @@ +2010-10-27 Miguel de Dios + + * godmode/admin_access_logs.php: added hooks to enterprise code, and added + new filter with more options. + + * include/functions_db.php: erase the deprecated function "audit_db", and + added in function "pandora_audit" two new parameters $user_id, $ip for + pass this values when it are differents to the default values. Finally + replaced the depecrated "audit_db" for "pandora_audit". + + * include/functions_events.php, include/functions_filemanager.php, + include/ajax/reporting.ajax.php, + include/ajax/visual_console_builder.ajax.php, + include/ajax/alert_list.ajax.php, include/help/es/modu_group_list.php, + include/functions_incidents.php, index.php, extensions/agents_modules.php, + extensions/insert_data.php, extensions/system_info.php, + extensions/dbmanager.php, extensions/update_manager/settings.php, + extensions/pandora_logs.php, extensions/plugin_registration.php, + operation/incidents/incident.php, operation/incidents/incident_detail.php, + operation/incidents/incident_statistics.php, operation/extensions.php, + operation/visual_console/render_view.php, + operation/agentes/status_monitor.php, operation/agentes/export_csv.php, + operation/agentes/datos_agente.php, operation/agentes/alerts_status.php, + operation/agentes/estado_generalagente.php, + operation/agentes/custom_fields.php, operation/agentes/estado_agente.php, + operation/agentes/networkmap.topology.php, + operation/agentes/networkmap.groups.php, operation/agentes/sla_view.php, + operation/agentes/gis_view.php, operation/agentes/estado_monitores.php, + operation/agentes/ver_agente.php, operation/agentes/graphs.php, + operation/agentes/agent_fields.php, operation/agentes/tactical.php, + operation/agentes/group_view.php, operation/agentes/networkmap.php, + operation/servers/view_server.php,operation/servers/view_server_detail.php, + operation/snmpconsole/snmp_view.php, operation/users/user_edit.php, + operation/gis_maps/render_view.php, operation/events/event_statistics.php, + operation/events/sound_events.php, operation/events/events_validate.php, + operation/events/events_list.php, operation/events/events_marquee.php, + operation/events/events.php, operation/reporting/reporting_xml.php, + operation/reporting/reporting_viewer.php, + operation/reporting/graph_viewer.php, + mobile/operation/agents/view_agents.php, mobile/index.php, + godmode/groups/modu_group_list.php, godmode/groups/configure_group.php, + godmode/groups/configure_modu_group.php, godmode/groups/group_list.php, + godmode/extensions.php, godmode/db/db_main.php, godmode/db/db_audit.php, + godmode/db/db_sanity.php, godmode/db/db_refine.php, godmode/db/db_info.php, + godmode/db/db_event.php, godmode/db/db_purge.php, + godmode/agentes/fields_manager.php, godmode/agentes/module_manager.php, + godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php, + godmode/agentes/configure_field.php, godmode/agentes/planned_downtime.php, + godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php, + godmode/servers/manage_export.php, godmode/servers/recon_script.php, + godmode/servers/manage_export_form.php, godmode/servers/plugin.php, + godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php, + godmode/servers/manage_recontask_form.php, + godmode/alerts/alert_list.list.php, + godmode/alerts/configure_alert_compound.php, + godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, + godmode/alerts/configure_alert_template.php, + godmode/alerts/alert_templates.php, + godmode/alerts/configure_alert_action.php, + godmode/alerts/configure_alert_command.php, + godmode/alerts/alert_actions.php, godmode/alerts/alert_list.builder.php, + godmode/alerts/alert_commands.php, godmode/snmpconsole/snmp_alert.php, + godmode/snmpconsole/snmp_filters.php, godmode/setup/file_manager.php, + godmode/setup/os.list.php, godmode/setup/news.php, + godmode/setup/gis_step_2.php, godmode/setup/links.php, + godmode/setup/setup.php, godmode/setup/os.php, + godmode/setup/performance.php, godmode/setup/setup_auth.php, + godmode/setup/gis.php, godmode/setup/os.builder.php, + godmode/setup/setup_visuals.php, godmode/users/user_list.php, + godmode/users/configure_user.php, godmode/users/configure_profile.php, + godmode/gis_maps/configure_gis_map.php, godmode/gis_maps/index.php, + godmode/massive/massive_add_alerts.php, + godmode/massive/massive_copy_modules.php, + godmode/massive/massive_delete_agents.php, + godmode/massive/massive_enable_disable_alerts.php, + godmode/massive/massive_operations.php, + godmode/massive/massive_delete_profiles.php, + godmode/massive/massive_edit_agents.php, + godmode/massive/massive_delete_action_alerts.php, + godmode/massive/massive_delete_modules.php, + godmode/massive/massive_add_profiles.php, + godmode/massive/massive_delete_alerts.php, + godmode/massive/massive_edit_modules.php, + godmode/massive/massive_standby_alerts.php, + godmode/massive/massive_add_action_alerts.php, + godmode/modules/manage_network_components_form.php, + godmode/modules/manage_nc_groups_form.php, + godmode/modules/manage_network_templates.php, + godmode/modules/module_list.php, + godmode/modules/manage_network_components_form_common.php, + godmode/modules/manage_network_components_form_network.php, + godmode/modules/manage_network_templates_form.php, + godmode/modules/manage_network_components_form_wmi.php, + godmode/modules/manage_network_components.php, + godmode/modules/manage_nc_groups.php, + godmode/reporting/reporting_builder.list_items.php, + godmode/reporting/graph_builder.main.php, + godmode/reporting/visual_console_builder.wizard.php, + godmode/reporting/visual_console_builder.php, + godmode/reporting/reporting_builder.preview.php, + godmode/reporting/reporting_builder.main.php, + godmode/reporting/visual_console_builder.data.php, + godmode/reporting/map_builder_wizard.php, + godmode/reporting/visual_console_builder.elements.php, + godmode/reporting/graph_builder.php, + godmode/reporting/visual_console_builder.preview.php, + godmode/reporting/graph_builder.graph_editor.php, + godmode/reporting/reporting_builder.php, + godmode/reporting/visual_console_builder.editor.php, + godmode/reporting/reporting_builder.item_editor.php, + godmode/reporting/graphs.php, godmode/reporting/graph_builder.preview.php: + Replaced the depecrated "audit_db" for "pandora_audit". + 2010-10-26 Ramon Novoa * operation/agentes/stat_win.php: Hide baseline checkbox when not diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 7610a4646e..e8c1528535 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -21,7 +21,7 @@ function mainAgentsModules() { check_login (); // ACL Check if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent view (Grouped)"); require ("general/noaccess.php"); exit; @@ -36,7 +36,7 @@ function mainAgentsModules() { $sql = sprintf ("UPDATE tagente_modulo SET `flag` = 1 WHERE `id_agente` = ANY(SELECT id_agente FROM tagente WHERE `id_grupo` = %d)",$group); process_sql ($sql); } else { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to set flag for groups"); + pandora_audit("ACL Violation", "Trying to set flag for groups"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 8ea7219c69..8869a36756 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -51,7 +51,7 @@ function dbmgr_extension_main () { global $config; if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index 74b28a467e..7a6f225330 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -49,7 +49,7 @@ function mainInsertData() { if (! give_acl ($config['id_user'], 0, "AW") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 3d0e402615..f013f99c83 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -37,7 +37,7 @@ function pandoralogs_extension_main () { global $config; if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index b478bbb68f..871ea61d06 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -16,7 +16,7 @@ function pluginreg_extension_main () { global $config; if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/system_info.php b/pandora_console/extensions/system_info.php index 1147d71171..d40781b485 100644 --- a/pandora_console/extensions/system_info.php +++ b/pandora_console/extensions/system_info.php @@ -198,7 +198,7 @@ function mainSystemInfo() { global $config; if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/update_manager/settings.php b/pandora_console/extensions/update_manager/settings.php index 23866710aa..899ddfc932 100644 --- a/pandora_console/extensions/update_manager/settings.php +++ b/pandora_console/extensions/update_manager/settings.php @@ -17,7 +17,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, 'PM')) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to use Open Update Manager extension"); + pandora_audit("ACL Violation", "Trying to use Open Update Manager extension"); include ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index d17d6170cd..309549d912 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -22,8 +22,10 @@ if ($config['flash_charts']) { check_login (); +$enterprise_include = enterprise_include_once('godmode/admin_access_logs.php'); + if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit( "ACL Violation", "Trying to access event viewer"); require ("general/noaccess.php"); exit; @@ -33,9 +35,14 @@ print_page_header (__('Pandora audit')." » ".__('Review Logs'), "", false, $offset = get_parameter ("offset", 0); $tipo_log = get_parameter ("tipo_log", 'all'); -echo ""; +$user_filter = get_parameter('user_filter', 'all'); +$filter_text = get_parameter('filter_text', ''); +$filter_hours_old = get_parameter('filter_hours_old', 24); +$filter_ip = get_parameter('filter_ip', ''); + +echo "
"; echo '
'; -echo '
'; +echo '
'; echo ''.__('Filter').'

'; $rows = get_db_all_rows_sql ("SELECT DISTINCT(accion) FROM tsesion"); @@ -48,32 +55,64 @@ foreach ($rows as $row) { $actions[$row["accion"]] = $row["accion"]; } echo '
'; -echo __('Action').': '; -print_select ($actions, 'tipo_log', $tipo_log, 'this.form.submit();', __('All'), 'all'); -echo '
'; +$table = null; +$table->width = '100%'; +$table->data = array(); +$table->data[0][0] = __('Action'); +$table->data[0][1] = print_select ($actions, 'tipo_log', $tipo_log, '', __('All'), 'all', true); +$table->data[1][0] = __('User'); +$table->data[1][1] = print_select_from_sql('SELECT id_user, id_user AS text FROM tusuario', 'user', $user_filter, '', __('All'), 0, true); +$table->data[2][0] = __('Free text for search (*)'); +$table->data[2][1] = print_input_text('filter_text', $filter_text, __('Free text for search (*)'), 20, 40, true); +$table->data[3][0] = __('Max. hours old'); +$table->data[3][1] = print_input_text('filter_hours_old', $filter_hours_old, __('Max. hours old'), 3, 6, true); +$table->data[4][0] = __('IP'); +$table->data[4][1] = print_input_text('filter_ip', $filter_ip, __('IP'), 15, 15, true); +$table->data[5][0] = ''; +$table->data[5][1] = print_submit_button(__('Filter'), 'filter', false, 'class="sub search" style="float: right;"', true); +print_table($table); echo '
'; echo '
'; -echo '
'; +echo '
'; if ($config['flash_charts']) { echo graphic_user_activity (300, 140); -} else { +} +else { echo ''; } echo '
'; echo '
 
'; echo '
'; -$filter = ''; + + + +$filter = 'WHERE 1 = 1'; + if ($tipo_log != 'all') { - $filter = sprintf (" WHERE accion = '%s'", $tipo_log); + $filter .= sprintf (" AND accion = '%s'", $tipo_log); } -$sql = "SELECT COUNT(*) FROM tsesion ".$filter; +if ($user_filter != 'all') { + $filter .= sprintf(' AND ID_usuario = "%s"', $user_filter); +} + +$filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")'; + +if ($filter_ip != '') { + $filter .= sprintf(' AND IP_origen LIKE "%s"', $filter_ip); +} + +if ($filter_hours_old != 0) { + $filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -' . $filter_hours_old . ' HOUR)'; +} + +$sql = "SELECT COUNT(*) FROM tsesion " . $filter; $count = get_db_sql ($sql); $url = "index.php?sec=godmode&sec2=godmode/admin_access_logs&tipo_log=".$tipo_log; pagination ($count, $url); -$sql = sprintf ("SELECT * FROM tsesion%s ORDER BY fecha DESC LIMIT %d, %d", $filter, $offset, $config["block_size"]); +$sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC LIMIT %d, %d", $filter, $offset, $config["block_size"]); $result = get_db_all_rows_sql ($sql); if (empty ($result)) { @@ -87,17 +126,44 @@ $table->class = "databox"; $table->size = array (); $table->data = array (); $table->head = array (); +$table->align = array(); +$table->rowclass = array(); $table->head[0] = __('User'); $table->head[1] = __('Action'); $table->head[2] = __('Date'); $table->head[3] = __('Source IP'); $table->head[4] = __('Comments'); +if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $table->head[5] = enterprise_hook('tableHeadEnterpriseAudit', array('title1')); +} + +if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $table->head[6] = enterprise_hook('tableHeadEnterpriseAudit', array('title2')); +} $table->size[0] = 80; $table->size[2] = 130; $table->size[3] = 100; $table->size[4] = 200; +if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $table->size[5] = enterprise_hook('tableHeadEnterpriseAudit', array('size1')); +} +if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $table->size[6] = enterprise_hook('tableHeadEnterpriseAudit', array('size2')); +} + + +if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $table->align[5] = enterprise_hook('tableHeadEnterpriseAudit', array('align')); +} +if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $table->align[6] = enterprise_hook('tableHeadEnterpriseAudit', array('align2')); +} + +$table->colspan = array(); +$table->rowstyle = array(); + $rowPair = true; $iterator = 0; @@ -117,9 +183,23 @@ foreach ($result as $row) { $data[2] = $row["fecha"]; $data[3] = $row["IP_origen"]; $data[4] = $row["descripcion"]; + if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $data[5] = enterprise_hook('cell1EntepriseAudit', array($row['ID_sesion'])); + } + if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + $data[6] = enterprise_hook('cell2EntepriseAudit', array($row['ID_sesion'])); + } array_push ($table->data, $data); + + + if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + enterprise_hook('rowEnterpriseAudit', array($table, &$iterator, $row['ID_sesion'])); + } } print_table ($table); +if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { + enterprise_hook('enterpriseAuditFooter'); +} ?> diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index d22e325b9e..0b66b3d5e3 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -50,7 +50,7 @@ require_javascript_file('openlayers.pandora'); $new_agent = (bool) get_parameter ('new_agent'); if (! isset ($id_agente) && ! $new_agent) { - audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access agent manager witout an agent"); + pandora_audit("ACL Violation", "Trying to access agent manager witout an agent"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index f95a0b60a8..00e3ee0cc8 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -28,7 +28,7 @@ if ($id_agente) $group = get_agent_group ($id_agente); if (! give_acl ($config["id_user"], $group, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access agent manager"); require ("general/noaccess.php"); return; @@ -172,7 +172,7 @@ if ($create_agent) { $agent_created_ok = true; - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", + pandora_audit("Agent management", "Created agent $nombre_agente"); } else { @@ -432,7 +432,7 @@ if ($update_agent) { // if modified some agent paramenter } else { enterprise_hook ('update_agent', array ($id_agente)); print_success_message (__('Successfully updated')); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", + pandora_audit("Agent management", "Updated agent $nombre_agente"); } @@ -445,7 +445,7 @@ if ($id_agente) { //This has been done in the beginning of the page, but if an agent was created, this id might change $id_grupo = get_agent_group ($id_agente); if (give_acl ($config["id_user"], $id_grupo, "AW") != 1) { - audit_db($config["id_user"],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to admin an agent without access"); + pandora_audit("ACL Violation","Trying to admin an agent without access"); require ("general/noaccess.php"); exit; } @@ -485,7 +485,7 @@ if ($update_module || $create_module) { $id_grupo = get_agent_group ($id_agente); if (! give_acl ($config["id_user"], $id_grupo, "AW")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to create a module without admin rights"); require ("general/noaccess.php"); exit; @@ -620,7 +620,7 @@ if ($update_module) { $agent = get_db_row ('tagente', 'id_agente', $id_agente); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", + pandora_audit("Agent management", "Updated module '$name' for agent ".$agent["nombre"]); } } @@ -683,7 +683,7 @@ if ($create_module) { $edit_module = false; $agent = get_db_row ('tagente', 'id_agente', $id_agente); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", + pandora_audit("Agent management", "Added module '$name' for agent ".$agent["nombre"]); } } @@ -696,14 +696,14 @@ if ($delete_module){ // DELETE agent module ! $id_grupo = (int) dame_id_grupo ($id_agente); if (! give_acl ($config["id_user"], $id_grupo, "AW")) { - audit_db($config["id_user"],$_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to delete a module without admin rights"); require ("general/noaccess.php"); exit; } if ($id_borrar_modulo < 1) { - audit_db ($config["id_user"],$_SERVER['REMOTE_ADDR'], "HACK Attempt", + pandora_audit("HACK Attempt", "Expected variable from form is not correct"); require ("general/noaccess.php"); exit; @@ -742,7 +742,7 @@ if ($delete_module){ // DELETE agent module ! print_success_message (__('Module deleted succesfully')); $agent = get_db_row ('tagente', 'id_agente', $id_agente); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", + pandora_audit("Agent management", "Deleted module '".$module_data["nombre"]."' for agent ".$agent["nombre"]); } } diff --git a/pandora_console/godmode/agentes/configure_field.php b/pandora_console/godmode/agentes/configure_field.php index f4c28bc5fc..99c7409479 100755 --- a/pandora_console/godmode/agentes/configure_field.php +++ b/pandora_console/godmode/agentes/configure_field.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Group Management2"); + pandora_audit("ACL Violation", "Trying to access Group Management2"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/agentes/fields_manager.php b/pandora_console/godmode/agentes/fields_manager.php index 8329ad560f..ce1fe21266 100644 --- a/pandora_console/godmode/agentes/fields_manager.php +++ b/pandora_console/godmode/agentes/fields_manager.php @@ -20,7 +20,7 @@ global $config; check_login(); if (! give_acl($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Group Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/agentes/manage_config_remote.php b/pandora_console/godmode/agentes/manage_config_remote.php index 78d3761b6f..eb4ad5238d 100644 --- a/pandora_console/godmode/agentes/manage_config_remote.php +++ b/pandora_console/godmode/agentes/manage_config_remote.php @@ -24,7 +24,7 @@ $update_agent = get_parameter ("update_agent", -1); $update_group = get_parameter ("update_group", -1); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access remote config copy tool"); require ("general/noaccess.php"); exit; @@ -55,7 +55,7 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) { // Security check here if (!user_access_to_agent ($id_origen)) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to forge a source agent in remote config tool"); + pandora_audit("ACL Violation", "Trying to forge a source agent in remote config tool"); require ("general/noaccess.php"); exit; } @@ -69,7 +69,7 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) { // Security check here if (!user_access_to_agent ($id_agente)){ - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to forge a source agent in remote config tool"); + pandora_audit("ACL Violation", "Trying to forge a source agent in remote config tool"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index b64276965c..a9b3ae9c1b 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -30,7 +30,7 @@ if (($ag_group == -1) && ($group_id != 0)) $ag_group = $group_id; if (! give_acl ($config["id_user"], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access agent manager"); require ("general/noaccess.php"); exit; @@ -40,17 +40,19 @@ enterprise_include_once('include/functions_policies.php'); $search = get_parameter ("search", ""); -if (isset ($_GET["borrar_agente"])) { // if delete agent - $id_agente = get_parameter_get ("borrar_agente"); +$agent_to_delete = (int)get_parameter('borrar_agente'); + +if (!empty($agent_to_delete)) { + $id_agente = $agent_to_delete; $agent_name = get_agent_name ($id_agente); $id_grupo = dame_id_grupo ($id_agente); if (give_acl ($config["id_user"], $id_grupo, "AW")==1) { $id_agentes[0] = $id_agente; - delete_agent ($id_agentes); + delete_agent($id_agentes); } else { // NO permissions. - audit_db ($config["id_user"],$_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to delete agent \'$agent_name\'"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 646cd3c2e2..f05134733a 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -76,14 +76,14 @@ if ($multiple_delete) { $id_grupo = (int) dame_id_grupo ($id_agente); if (! give_acl ($config["id_user"], $id_grupo, "AW")) { - audit_db($config["id_user"],$_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to delete a module without admin rights"); require ("general/noaccess.php"); exit; } if ($id_agent_module_del < 1) { - audit_db ($config["id_user"],$_SERVER['REMOTE_ADDR'], "HACK Attempt", + pandora_audit("HACK Attempt", "Expected variable from form is not correct"); die ("Nice try buddy"); exit; diff --git a/pandora_console/godmode/agentes/planned_downtime.php b/pandora_console/godmode/agentes/planned_downtime.php index 86652a8e46..428f1cc4b1 100644 --- a/pandora_console/godmode/agentes/planned_downtime.php +++ b/pandora_console/godmode/agentes/planned_downtime.php @@ -19,7 +19,7 @@ global $config; check_login(); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access downtime scheduler"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index acb00006be..d4803f23f5 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -21,7 +21,7 @@ require_once ("include/functions_alerts.php"); check_login (); if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert actions"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index fbcc044c06..6039e289c2 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -22,7 +22,7 @@ require_once ("include/functions_alerts.php"); check_login (); if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; @@ -62,7 +62,7 @@ if ($update_command) { $id = (int) get_parameter ('id'); $alert = get_alert_command ($id); if ($alert['internal']) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Alert Management"); + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; } @@ -86,7 +86,7 @@ if ($delete_command) { // Internal commands cannot be deleted if (get_alert_command_internal ($id)) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/alerts/alert_compounds.php b/pandora_console/godmode/alerts/alert_compounds.php index b8bcf137dd..c6bfc1993d 100644 --- a/pandora_console/godmode/alerts/alert_compounds.php +++ b/pandora_console/godmode/alerts/alert_compounds.php @@ -16,7 +16,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 2b85c49872..332cba4356 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "LW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 960c5006e3..929f0221e0 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "LW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; @@ -28,7 +28,7 @@ if (! give_acl ($config['id_user'], 0, "LW")) { /* Check if this page is included from a agent edition */ if (! give_acl ($config['id_user'], 0, "LW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index 5165f42ca1..3b9d3dbb3d 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "LW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; @@ -81,7 +81,7 @@ if ($create_alert) { // Audit the creation only when the alert creation is correct if($id) { - audit_db ($config["id_user"],$_SERVER['REMOTE_ADDR'], "Alert management", + pandora_audit("Alert management", "Added alert '$alert_template_name' for module '$module_name' in agent '$agent_name'"); } @@ -110,7 +110,7 @@ if ($delete_alert) { $module_name = get_db_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module); $agent_name = get_agent_name (get_db_value ("id_agente", "tagente_modulo","id_agente_modulo", $id_agent_module)); - audit_db ($config["id_user"],$_SERVER['REMOTE_ADDR'], "Alert management", + pandora_audit("Alert management", "Deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_name'"); $result = delete_alert_agent_module ($id_alert_agent_module); diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index 2bfc63e6b4..a899e3023e 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -100,7 +100,7 @@ if (is_ajax ()) { } if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 968e69c5ef..b19d5ecd7b 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -21,7 +21,7 @@ require_once ('include/functions_alerts.php'); check_login (); if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php index 6d65cd738f..01e486fef7 100644 --- a/pandora_console/godmode/alerts/configure_alert_command.php +++ b/pandora_console/godmode/alerts/configure_alert_command.php @@ -20,7 +20,7 @@ require_once ("include/functions_alerts.php"); check_login (); if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/alerts/configure_alert_compound.php b/pandora_console/godmode/alerts/configure_alert_compound.php index b8d60de1cf..ec39d4df14 100644 --- a/pandora_console/godmode/alerts/configure_alert_compound.php +++ b/pandora_console/godmode/alerts/configure_alert_compound.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); return; @@ -228,7 +228,7 @@ if ($id && ! $create_compound) { $id_agent = $compound['id_agent']; $id_group = get_agent_group ($id_agent); if (! give_acl ($config['id_user'], $id_group, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 711fe5c197..5f7f55a451 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -20,7 +20,7 @@ require_once ('include/functions_alerts.php'); check_login (); if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/db/db_audit.php b/pandora_console/godmode/db/db_audit.php index e396a46f31..22190b83b9 100644 --- a/pandora_console/godmode/db/db_audit.php +++ b/pandora_console/godmode/db/db_audit.php @@ -21,7 +21,7 @@ print_page_header (__('Database maintenance').' » '.__('Database audit pur check_login (); if (! give_acl ($config['id_user'], 0, "DM")) { - audit_db ($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Database Management Audit"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/db/db_event.php b/pandora_console/godmode/db/db_event.php index 35fb6ee85a..69865289ea 100644 --- a/pandora_console/godmode/db/db_event.php +++ b/pandora_console/godmode/db/db_event.php @@ -21,7 +21,7 @@ check_login (); print_page_header (__('Database maintenance').' » '.__('Event database cleanup'), "images/god8.png", false, "", true); if (! give_acl ($config['id_user'], 0, "DM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Database Management Event"); + pandora_audit("ACL Violation", "Trying to access Database Management Event"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/db/db_info.php b/pandora_console/godmode/db/db_info.php index c7f53af328..8e7cedd544 100644 --- a/pandora_console/godmode/db/db_info.php +++ b/pandora_console/godmode/db/db_info.php @@ -27,7 +27,7 @@ print_page_header (__('Database maintenance').' » '.__('Database informati check_login (); if (! give_acl ($config['id_user'], 0, "DM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Database Management Info"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/db/db_main.php b/pandora_console/godmode/db/db_main.php index 00ae482a1e..e30aefd0d0 100644 --- a/pandora_console/godmode/db/db_main.php +++ b/pandora_console/godmode/db/db_main.php @@ -24,7 +24,7 @@ if ($config['flash_charts']) { check_login (); if (! give_acl ($config['id_user'], 0, "DM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Database Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/db/db_purge.php b/pandora_console/godmode/db/db_purge.php index 499d91914c..8309389395 100644 --- a/pandora_console/godmode/db/db_purge.php +++ b/pandora_console/godmode/db/db_purge.php @@ -25,7 +25,7 @@ if ($config['flash_charts']) { check_login (); if (! give_acl ($config['id_user'], 0, "DM")) { - audit_db($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit( "ACL Violation", "Trying to access Database Purge Section"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/db/db_refine.php b/pandora_console/godmode/db/db_refine.php index a6f186b1d3..7acaf0e2b0 100644 --- a/pandora_console/godmode/db/db_refine.php +++ b/pandora_console/godmode/db/db_refine.php @@ -21,7 +21,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "DM")) { - audit_db($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access Database Debug Admin section"); + pandora_audit("ACL Violation","Trying to access Database Debug Admin section"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/db/db_sanity.php b/pandora_console/godmode/db/db_sanity.php index 75a8059fde..409c5eddb4 100644 --- a/pandora_console/godmode/db/db_sanity.php +++ b/pandora_console/godmode/db/db_sanity.php @@ -20,7 +20,7 @@ global $config; check_login(); if (! give_acl ($config["id_user"], 0, "DM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Database cure section"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index 0c9e989e88..e86c49a666 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -17,7 +17,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access extensions list"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/gis_maps/configure_gis_map.php b/pandora_console/godmode/gis_maps/configure_gis_map.php index 522454e1fc..abe37c001e 100644 --- a/pandora_console/godmode/gis_maps/configure_gis_map.php +++ b/pandora_console/godmode/gis_maps/configure_gis_map.php @@ -79,7 +79,7 @@ function updateArrowLayers() { ".__('There was a problem loading group').""; - echo ""; - include ("general/footer.php"); - exit; - } -} - - -$table->width = '450px'; -$table->data = array (); -$table->data[0][0] = __('Name'); -$table->data[0][1] = print_input_text ('name', $name, '', 35, 100, true); - - -echo''; -echo '
'; -print_table ($table); -echo '
'; -if ($id_group) { - print_input_hidden ('update_group', 1); - print_input_hidden ('id_group', $id_group); - print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); -} else { - print_input_hidden ('create_group', 1); - print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"'); -} -echo '
'; -echo '
'; -?> - + +// Init vars +$icon = ""; +$name = ""; +$id_parent = 0; +$alerts_disabled = 0; +$custom_id = ""; + +$create_group = (bool) get_parameter ('create_group'); +$id_group = (int) get_parameter ('id_group'); + +if ($id_group) { + $group = get_db_row ('tmodule_group', 'id_mg', $id_group); + if ($group) { + $name = $group["name"]; + } else { + echo "

".__('There was a problem loading group')."

"; + echo ""; + include ("general/footer.php"); + exit; + } +} + + +$table->width = '450px'; +$table->data = array (); +$table->data[0][0] = __('Name'); +$table->data[0][1] = print_input_text ('name', $name, '', 35, 100, true); + + +echo''; +echo '
'; +print_table ($table); +echo '
'; +if ($id_group) { + print_input_hidden ('update_group', 1); + print_input_hidden ('id_group', $id_group); + print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); +} else { + print_input_hidden ('create_group', 1); + print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"'); +} +echo '
'; +echo '
'; +?> + diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 291d2e29b9..a18ec0d8ef 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -20,7 +20,7 @@ global $config; check_login(); if (! give_acl($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Group Management"); require ("general/noaccess.php"); return; @@ -48,7 +48,7 @@ if (is_ajax ()) { } if (! give_acl ($config['id_user'], $id_group, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); echo json_encode (false); return; @@ -65,7 +65,7 @@ if (is_ajax ()) { $disabled = (int) get_parameter ('disabled', 0); if (! give_acl ($config['id_user'], $id_group, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); echo json_encode (false); return; diff --git a/pandora_console/godmode/groups/modu_group_list.php b/pandora_console/godmode/groups/modu_group_list.php index a8d9ffa94c..6ba5dc7fc1 100644 --- a/pandora_console/godmode/groups/modu_group_list.php +++ b/pandora_console/godmode/groups/modu_group_list.php @@ -1,149 +1,150 @@ -".__('Group successfully created').""; - } else { - echo "

".__('There was a problem creating group')."

"; } -} - -/* Update group */ -if ($update_group) { - $id_group = (int) get_parameter ('id_group'); - $name = (string) get_parameter ('name'); - $icon = (string) get_parameter ('icon'); - $id_parent = (int) get_parameter ('id_parent'); - $alerts_enabled = (bool) get_parameter ('alerts_enabled'); - $custom_id = (string) get_parameter ('custom_id'); - - $sql = sprintf ('UPDATE tmodule_group SET name = "%s" WHERE id_mg = %d', $name,$id_group); - $result = process_sql ($sql); - if ($result !== false) { - echo "

".__('Group successfully updated')."

"; - } else { - echo "

".__('There was a problem modifying group')."

"; - } -} - -/* Delete group */ -if ($delete_group) { - $id_group = (int) get_parameter ('id_group'); - -// $sql = sprintf ('UPDATE tmodule_group set id_mg = 1 WHERE id_mg = %d', $id_group); -// $result = mysql_query ($sql); - $sql = sprintf ('DELETE FROM tmodule_group WHERE id_mg = %d', $id_group); - $result = mysql_query ($sql); - if (! $result) - echo "

".__('There was a problem deleting group')."

"; - else - echo "

".__('Group successfully deleted')."

"; -} - -$table->width = '65%'; -$table->head = array (); -$table->head[0] = __('Name'); -$table->head[1] = __('Delete'); -$table->align = array (); -$table->align[1] = 'center'; -$table->data = array (); - -//$groups = get_user_groups ($config['id_user']); - -$sql = "SELECT * - FROM tmodule_group "; -$groups = get_db_all_rows_sql ($sql, true); - - -foreach ($groups as $id_group ) { - $data = array (); - -// $group = get_db_row ('tmodule_group', 'id_mg', $id_group); - -// if (!empty ($group["icon"])) -// $data[0] = ''; -// else -// $data[0] = ' '; - $data[0] = ''.$id_group["name"].''; -// $data[2] = get_group_name ($group["parent"]); -// $data[3] = $group['disabled'] ? __('Disabled') : __('Enabled'); - $data[1] = ''; - - array_push ($table->data, $data); -} - -print_table ($table); - -echo '
'; -echo '
'; -print_submit_button (__('Create module group'), 'crt', false, 'class="sub next"'); -echo '
'; -echo '
'; - -?> + +$create_group = (bool) get_parameter ('create_group'); +$update_group = (bool) get_parameter ('update_group'); +$delete_group = (bool) get_parameter ('delete_group'); + +/* Create group */ +if ($create_group) { + $name = (string) get_parameter ('name'); + $icon = (string) get_parameter ('icon'); + $id_parent = (int) get_parameter ('id_parent'); + $alerts_disabled = (bool) get_parameter ('alerts_disabled'); + $custom_id = (string) get_parameter ('custom_id'); + + $sql = sprintf ('INSERT INTO tmodule_group (name) + VALUES ("%s")', + $name); + $result = mysql_query ($sql); + if ($result) { + echo "

".__('Group successfully created')."

"; + } else { + echo "

".__('There was a problem creating group')."

"; } +} + +/* Update group */ +if ($update_group) { + $id_group = (int) get_parameter ('id_group'); + $name = (string) get_parameter ('name'); + $icon = (string) get_parameter ('icon'); + $id_parent = (int) get_parameter ('id_parent'); + $alerts_enabled = (bool) get_parameter ('alerts_enabled'); + $custom_id = (string) get_parameter ('custom_id'); + + $sql = sprintf ('UPDATE tmodule_group SET name = "%s" WHERE id_mg = %d', $name,$id_group); + $result = process_sql ($sql); + if ($result !== false) { + echo "

".__('Group successfully updated')."

"; + } else { + echo "

".__('There was a problem modifying group')."

"; + } +} + +/* Delete group */ +if ($delete_group) { + $id_group = (int) get_parameter ('id_group'); + +// $sql = sprintf ('UPDATE tmodule_group set id_mg = 1 WHERE id_mg = %d', $id_group); +// $result = mysql_query ($sql); + $sql = sprintf ('DELETE FROM tmodule_group WHERE id_mg = %d', $id_group); + $result = mysql_query ($sql); + if (! $result) + echo "

".__('There was a problem deleting group')."

"; + else + echo "

".__('Group successfully deleted')."

"; +} + +$table->width = '65%'; +$table->head = array (); +$table->head[0] = __('Name'); +$table->head[1] = __('Delete'); +$table->align = array (); +$table->align[1] = 'center'; +$table->data = array (); + +//$groups = get_user_groups ($config['id_user']); + +$sql = "SELECT * + FROM tmodule_group "; +$groups = get_db_all_rows_sql ($sql, true); + + +foreach ($groups as $id_group ) { + $data = array (); + +// $group = get_db_row ('tmodule_group', 'id_mg', $id_group); + +// if (!empty ($group["icon"])) +// $data[0] = ''; +// else +// $data[0] = ' '; + $data[0] = ''.$id_group["name"].''; +// $data[2] = get_group_name ($group["parent"]); +// $data[3] = $group['disabled'] ? __('Disabled') : __('Enabled'); + $data[1] = ''; + + array_push ($table->data, $data); +} + +print_table ($table); + +echo '
'; +echo '
'; +print_submit_button (__('Create module group'), 'crt', false, 'class="sub next"'); +echo '
'; +echo '
'; + +?> diff --git a/pandora_console/godmode/massive/massive_add_action_alerts.php b/pandora_console/godmode/massive/massive_add_action_alerts.php index 0e58eed31f..a8008b91f2 100644 --- a/pandora_console/godmode/massive/massive_add_action_alerts.php +++ b/pandora_console/godmode/massive/massive_add_action_alerts.php @@ -17,7 +17,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive agent deletion section"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_add_alerts.php b/pandora_console/godmode/massive/massive_add_alerts.php index e5835c4b34..a88a6b9955 100644 --- a/pandora_console/godmode/massive/massive_add_alerts.php +++ b/pandora_console/godmode/massive/massive_add_alerts.php @@ -18,7 +18,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive alert deletion"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_add_profiles.php b/pandora_console/godmode/massive/massive_add_profiles.php index c2d0f42d7a..9a9ac5b52c 100644 --- a/pandora_console/godmode/massive/massive_add_profiles.php +++ b/pandora_console/godmode/massive/massive_add_profiles.php @@ -18,7 +18,7 @@ check_login (); if (! check_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive alert deletion"); require ("general/noaccess.php"); return; @@ -44,7 +44,7 @@ if($create_profiles) { $profile_data = get_db_row_filter ("tusuario_perfil", array("id_usuario" => $user, "id_perfil" => $profile, "id_grupo" => $group)); // If the profile doesnt exist, we create it if ($profile_data === false) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "User management", + pandora_audit("User management", "Added profile for user ".safe_input($user)); $return = create_user_profile ($user, $profile, $group); if($return !== false){ diff --git a/pandora_console/godmode/massive/massive_copy_modules.php b/pandora_console/godmode/massive/massive_copy_modules.php index e5d115a3c8..46a4c0a3d0 100644 --- a/pandora_console/godmode/massive/massive_copy_modules.php +++ b/pandora_console/godmode/massive/massive_copy_modules.php @@ -18,7 +18,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Config Management Admin section"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_delete_action_alerts.php b/pandora_console/godmode/massive/massive_delete_action_alerts.php index df20466acd..41eea72f24 100644 --- a/pandora_console/godmode/massive/massive_delete_action_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_action_alerts.php @@ -17,7 +17,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive agent deletion section"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_delete_agents.php b/pandora_console/godmode/massive/massive_delete_agents.php index d4889c8d5a..d1c0e1e327 100644 --- a/pandora_console/godmode/massive/massive_delete_agents.php +++ b/pandora_console/godmode/massive/massive_delete_agents.php @@ -17,7 +17,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive agent deletion section"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php index d0eb56bba2..db32bd6a06 100644 --- a/pandora_console/godmode/massive/massive_delete_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_alerts.php @@ -18,7 +18,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive alert deletion"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php index 6f888c17a1..ba5179b1e3 100644 --- a/pandora_console/godmode/massive/massive_delete_modules.php +++ b/pandora_console/godmode/massive/massive_delete_modules.php @@ -18,7 +18,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access agent massive deletion"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_delete_profiles.php b/pandora_console/godmode/massive/massive_delete_profiles.php index 16bfe19564..f1f4494e82 100644 --- a/pandora_console/godmode/massive/massive_delete_profiles.php +++ b/pandora_console/godmode/massive/massive_delete_profiles.php @@ -18,7 +18,7 @@ check_login (); if (! check_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive alert deletion"); require ("general/noaccess.php"); return; @@ -57,7 +57,7 @@ if($delete_profiles) { foreach($users_id as $id_up){ $user = (string) get_db_value_filter ('id_usuario', 'tusuario_perfil', array('id_up' => $id_up)); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "User management", + pandora_audit("User management", "Deleted profile for user ".safe_input($user)); $return = delete_user_profile ($user, $id_up); diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index e1246eeab0..bab92e2003 100644 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -17,7 +17,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive agent deletion section"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 08d3c5074b..fc4450d013 100644 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -17,7 +17,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive module update"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_enable_disable_alerts.php b/pandora_console/godmode/massive/massive_enable_disable_alerts.php index a897b4cbb5..0fc1984026 100644 --- a/pandora_console/godmode/massive/massive_enable_disable_alerts.php +++ b/pandora_console/godmode/massive/massive_enable_disable_alerts.php @@ -18,7 +18,7 @@ check_login (); if (! check_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive alert deletion"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php index 911f1c7ff6..65ee7b4d44 100644 --- a/pandora_console/godmode/massive/massive_operations.php +++ b/pandora_console/godmode/massive/massive_operations.php @@ -17,7 +17,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive operation section"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/massive/massive_standby_alerts.php b/pandora_console/godmode/massive/massive_standby_alerts.php index 33b6c525fa..7067aa3fd1 100644 --- a/pandora_console/godmode/massive/massive_standby_alerts.php +++ b/pandora_console/godmode/massive/massive_standby_alerts.php @@ -18,7 +18,7 @@ check_login (); if (! check_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access massive alert deletion"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php index b1b193fc72..afe1881147 100644 --- a/pandora_console/godmode/modules/manage_nc_groups.php +++ b/pandora_console/godmode/modules/manage_nc_groups.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access SNMP Group Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/modules/manage_nc_groups_form.php b/pandora_console/godmode/modules/manage_nc_groups_form.php index 17370b4892..6a0ed5c1d0 100644 --- a/pandora_console/godmode/modules/manage_nc_groups_form.php +++ b/pandora_console/godmode/modules/manage_nc_groups_form.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access SNMO Groups Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 24ad4cb931..fc03e8f194 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 6b3cc141e4..560d160cb6 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index b35b2c039e..7f203a6f41 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -16,7 +16,7 @@ global $config; if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/modules/manage_network_components_form_network.php b/pandora_console/godmode/modules/manage_network_components_form_network.php index f5a8411997..8fdeaea3c3 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_network.php +++ b/pandora_console/godmode/modules/manage_network_components_form_network.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/modules/manage_network_components_form_wmi.php b/pandora_console/godmode/modules/manage_network_components_form_wmi.php index e57e4c7e10..1ebc857c03 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_wmi.php +++ b/pandora_console/godmode/modules/manage_network_components_form_wmi.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/modules/manage_network_templates.php b/pandora_console/godmode/modules/manage_network_templates.php index 46a995d81a..03075e0716 100644 --- a/pandora_console/godmode/modules/manage_network_templates.php +++ b/pandora_console/godmode/modules/manage_network_templates.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Network Profile Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/modules/manage_network_templates_form.php b/pandora_console/godmode/modules/manage_network_templates_form.php index 2406cd2fd2..6d9e5ac2e5 100644 --- a/pandora_console/godmode/modules/manage_network_templates_form.php +++ b/pandora_console/godmode/modules/manage_network_templates_form.php @@ -20,7 +20,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Network Profile Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/modules/module_list.php b/pandora_console/godmode/modules/module_list.php index 7e50fb069b..c7c7e0aad2 100644 --- a/pandora_console/godmode/modules/module_list.php +++ b/pandora_console/godmode/modules/module_list.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access module management"); + pandora_audit("ACL Violation","Trying to access module management"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index ddfb3d1067..c0a81e61df 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -22,7 +22,7 @@ if ($config['flash_charts']) { check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access graph builder"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index a2e1f5ba38..4dd2cef3b0 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -51,7 +51,7 @@ if ($config['flash_charts']) { check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access graph builder"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index e0eb26ab0b..1698125822 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -51,7 +51,7 @@ if ($config['flash_charts']) { check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access graph builder"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/graph_builder.preview.php b/pandora_console/godmode/reporting/graph_builder.preview.php index df14b76a6c..7806cc46f2 100644 --- a/pandora_console/godmode/reporting/graph_builder.preview.php +++ b/pandora_console/godmode/reporting/graph_builder.preview.php @@ -51,7 +51,7 @@ if ($config['flash_charts']) { check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access graph builder"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index 935904edff..05cff95c52 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -21,7 +21,7 @@ require_once ('include/functions_custom_graphs.php'); check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Inventory Module Management"); require ("general/noaccess.php"); return; @@ -50,7 +50,7 @@ if ($delete_graph) { echo $result; } else { - audit_db ($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to delete a graph from access graph builder"); + pandora_audit("ACL Violation","Trying to delete a graph from access graph builder"); include ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/reporting/map_builder_wizard.php b/pandora_console/godmode/reporting/map_builder_wizard.php index b76c8e1166..5c92c8c2b0 100644 --- a/pandora_console/godmode/reporting/map_builder_wizard.php +++ b/pandora_console/godmode/reporting/map_builder_wizard.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access map builder wizard"); + pandora_audit("ACL Violation", "Trying to access map builder wizard"); require ("general/noaccess.php"); exit; } @@ -38,7 +38,7 @@ if (empty ($layout)) { $layout_group = $layout["id_group"]; if (! give_acl ($config['id_user'], $layout_group, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access map builder wizard (forget URL parameter)"); + pandora_audit("ACL Violation", "Trying to access map builder wizard (forget URL parameter)"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 175bff1dfa..7e4a355ca5 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -17,7 +17,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 99cff0695a..eaba75a5e6 100644 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -17,7 +17,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/reporting_builder.main.php b/pandora_console/godmode/reporting/reporting_builder.main.php index 856a160eab..2840ea518c 100644 --- a/pandora_console/godmode/reporting/reporting_builder.main.php +++ b/pandora_console/godmode/reporting/reporting_builder.main.php @@ -17,7 +17,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 08f3f53e36..5deb4deb08 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -17,7 +17,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/reporting_builder.preview.php b/pandora_console/godmode/reporting/reporting_builder.preview.php index 4f61a08af1..8665044379 100644 --- a/pandora_console/godmode/reporting/reporting_builder.preview.php +++ b/pandora_console/godmode/reporting/reporting_builder.preview.php @@ -24,7 +24,7 @@ $report = get_db_row ('treport', 'id_report', $id_report); // Check ACL on the report to see if user has access to the report. if (! give_acl ($config['id_user'], $report['id_group'], "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access graph reader"); + pandora_audit("ACL Violation","Trying to access graph reader"); include ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/reporting/visual_console_builder.data.php b/pandora_console/godmode/reporting/visual_console_builder.data.php index a6b3f56792..4fc9e13392 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.data.php +++ b/pandora_console/godmode/reporting/visual_console_builder.data.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 86f8aabfa0..8c4fc6e0de 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index 4c79c82448..9f7ce79c3d 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 1b230fb4cd..4c0503a25d 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/visual_console_builder.preview.php b/pandora_console/godmode/reporting/visual_console_builder.preview.php index 1ec8c4e69b..0f27121884 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.preview.php +++ b/pandora_console/godmode/reporting/visual_console_builder.preview.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index 30e2734f4b..d4470dcf6a 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/servers/manage_export.php b/pandora_console/godmode/servers/manage_export.php index 030cd5dda1..6bfc143f21 100644 --- a/pandora_console/godmode/servers/manage_export.php +++ b/pandora_console/godmode/servers/manage_export.php @@ -21,7 +21,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Export Server Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/servers/manage_export_form.php b/pandora_console/godmode/servers/manage_export_form.php index 26bdc8cdec..3dd19b1e30 100644 --- a/pandora_console/godmode/servers/manage_export_form.php +++ b/pandora_console/godmode/servers/manage_export_form.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/servers/manage_recontask.php b/pandora_console/godmode/servers/manage_recontask.php index 542dd6d228..d0f7b242f2 100644 --- a/pandora_console/godmode/servers/manage_recontask.php +++ b/pandora_console/godmode/servers/manage_recontask.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Recon Task Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/servers/manage_recontask_form.php b/pandora_console/godmode/servers/manage_recontask_form.php index fb0018a00b..dccbb06722 100644 --- a/pandora_console/godmode/servers/manage_recontask_form.php +++ b/pandora_console/godmode/servers/manage_recontask_form.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index 333e3c9608..6f295de6da 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -21,7 +21,7 @@ require_once ("include/functions_servers.php"); check_login(); if (! give_acl ($config["id_user"], 0, "PM")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Server Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index f7911f2ab9..6a622141f0 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -30,7 +30,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Plugin Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/servers/recon_script.php b/pandora_console/godmode/servers/recon_script.php index 7722e3e94f..4d7bbcf360 100644 --- a/pandora_console/godmode/servers/recon_script.php +++ b/pandora_console/godmode/servers/recon_script.php @@ -30,7 +30,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "LM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access recon script Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/setup/file_manager.php b/pandora_console/godmode/setup/file_manager.php index bb1642269a..261536f07a 100644 --- a/pandora_console/godmode/setup/file_manager.php +++ b/pandora_console/godmode/setup/file_manager.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access File manager"); + pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/gis.php b/pandora_console/godmode/setup/gis.php index aa497db1f1..1b91769755 100755 --- a/pandora_console/godmode/setup/gis.php +++ b/pandora_console/godmode/setup/gis.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Visual Setup Management"); + pandora_audit("ACL Violation", "Trying to access Visual Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/gis_step_2.php b/pandora_console/godmode/setup/gis_step_2.php index f1bd85ef25..d239eac222 100755 --- a/pandora_console/godmode/setup/gis_step_2.php +++ b/pandora_console/godmode/setup/gis_step_2.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Visual Setup Management"); + pandora_audit("ACL Violation", "Trying to access Visual Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php index 7950e9cf2c..2b2b9f354a 100644 --- a/pandora_console/godmode/setup/links.php +++ b/pandora_console/godmode/setup/links.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Link Management"); + pandora_audit("ACL Violation", "Trying to access Link Management"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/setup/news.php b/pandora_console/godmode/setup/news.php index 07ff905ec2..0d63724170 100644 --- a/pandora_console/godmode/setup/news.php +++ b/pandora_console/godmode/setup/news.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Link Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/setup/os.builder.php b/pandora_console/godmode/setup/os.builder.php index 8d8cb203d6..1a530bc375 100644 --- a/pandora_console/godmode/setup/os.builder.php +++ b/pandora_console/godmode/setup/os.builder.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/os.list.php b/pandora_console/godmode/setup/os.list.php index 6919a1c301..6e38897730 100644 --- a/pandora_console/godmode/setup/os.list.php +++ b/pandora_console/godmode/setup/os.list.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/os.php b/pandora_console/godmode/setup/os.php index e17f5dd74e..8fda89f08d 100644 --- a/pandora_console/godmode/setup/os.php +++ b/pandora_console/godmode/setup/os.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 0511c03fdf..68778d9be6 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 1474e9305f..d86cfb336b 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -32,7 +32,7 @@ if (is_ajax ()) { if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 29d3230f2a..acd57b5c56 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index dc402e9e75..7b7532f005 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Visual Setup Management"); + pandora_audit("ACL Violation", "Trying to access Visual Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index baec0bde70..ccf8dcffaf 100644 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -17,7 +17,7 @@ // Load global vars if (! give_acl ($config['id_user'], 0, "LW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access SNMP Alert Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/snmpconsole/snmp_filters.php b/pandora_console/godmode/snmpconsole/snmp_filters.php index b47f22cf62..8db4aaf90d 100644 --- a/pandora_console/godmode/snmpconsole/snmp_filters.php +++ b/pandora_console/godmode/snmpconsole/snmp_filters.php @@ -16,7 +16,7 @@ // Check ACL if (! give_acl ($config['id_user'], 0, "LW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access SNMP Filter Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/users/configure_profile.php b/pandora_console/godmode/users/configure_profile.php index 620d667858..e2fff4ca67 100644 --- a/pandora_console/godmode/users/configure_profile.php +++ b/pandora_console/godmode/users/configure_profile.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Profile Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 05304fc925..6e55c5cf9c 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -29,7 +29,7 @@ if ($user_info["language"] == ""){ } if (! give_acl ($config['id_user'], 0, "UM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access User Management"); require ("general/noaccess.php"); return; @@ -107,7 +107,7 @@ if ($create_user) { else { $result = create_user ($id, $password_new, $values); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "User management", + pandora_audit("User management", "Created user ".safe_input($id)); print_result_message ($result, @@ -155,7 +155,7 @@ if ($update_user) { print_error_message (__('Passwords does not match')); } } else { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "User management", + pandora_audit("User management", "Updated user ".safe_input($id)); print_result_message ($res1, __('User info successfully updated'), @@ -174,7 +174,7 @@ if ($add_profile) { $id2 = (string) get_parameter ('id'); $group2 = (int) get_parameter ('assign_group'); $profile2 = (int) get_parameter ('assign_profile'); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "User management", + pandora_audit("User management", "Added profile for user ".safe_input($id2)); $return = create_user_profile ($id2, $profile2, $group2); print_result_message ($return, @@ -186,7 +186,7 @@ if ($delete_profile) { $id2 = (string) get_parameter ('id_user'); $id_up = (int) get_parameter ('id_user_profile'); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "User management", + pandora_audit("User management", "Deleted profile for user ".safe_input($id2)); $return = delete_user_profile ($id2, $id_up); diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index ba986916b7..40f9895b6f 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "UM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access User Management"); require ("general/noaccess.php"); exit; @@ -94,7 +94,7 @@ if (isset ($_GET["user_del"])) { //delete user if($id_user != $config['id_user']){ $result = delete_user ($id_user); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "User management", + pandora_audit("User management", "Deleted user ".safe_input($id_user)); print_result_message ($result, diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php index 790144d046..e223f15ae3 100644 --- a/pandora_console/include/ajax/alert_list.ajax.php +++ b/pandora_console/include/ajax/alert_list.ajax.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "LW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; @@ -41,7 +41,7 @@ if ($get_agent_alerts_simple) { $id_group = get_agent_group ($id_agent); if (! give_acl ($config['id_user'], $id_group, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); echo json_encode (false); return; diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php index dad62d75aa..87234546dc 100644 --- a/pandora_console/include/ajax/reporting.ajax.php +++ b/pandora_console/include/ajax/reporting.ajax.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index c5ac341682..a7719d39c6 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -18,7 +18,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "IW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access report builder"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 1db38f8a2b..a70989e7eb 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -57,7 +57,7 @@ function check_login () { return 0; } } - audit_db ("N/A", getenv ("REMOTE_ADDR"), "No session", "Trying to access without a valid session"); + pandora_audit("No session", "Trying to access without a valid session", "N/A"); include ($config["homedir"]."/general/noaccess.php"); exit; } @@ -299,46 +299,38 @@ function safe_acl_group ($id_user, $id_groups, $access) { } -/** - * Adds an audit log entry (DEPRECATED!) - * - * @param string $id User id - * @param string $ip Client IP - * @param string $accion Action description - * @param string $descripcion Long action description - */ -function audit_db ($id, $ip, $accion, $descripcion){ - $accion = safe_input($accion); - $descripcion = safe_input($descripcion); - $sql = sprintf ("INSERT INTO tsesion (ID_usuario, accion, fecha, IP_origen,descripcion, utimestamp) VALUES ('%s','%s',NOW(),'%s','%s',UNIX_TIMESTAMP(NOW()))",$id,$accion,$ip,$descripcion); - process_sql ($sql); -} - - /** * Adds an audit log entry (new function in 3.0) * * @param string $accion Action description * @param string $descripcion Long action description + * @param string $id User id, by default is the user that login. + * @param string $ip The ip to make the action, by default is $_SERVER['REMOTE_ADDR'] or $config["remote_addr"] */ -function pandora_audit ($accion, $descripcion){ +function pandora_audit ($accion, $descripcion, $user_id = false, $ip = false){ global $config; - if (isset($config["remote_addr"])) { - $ip = $config["remote_addr"]; - - } - else { - if ($_SERVER['REMOTE_ADDR']) { - $ip = $_SERVER['REMOTE_ADDR']; + if ($ip !== false) { + if (isset($config["remote_addr"])) { + $ip = $config["remote_addr"]; + } else { - $ip = null; + if ($_SERVER['REMOTE_ADDR']) { + $ip = $_SERVER['REMOTE_ADDR']; + } + else { + $ip = null; + } } } - - $id = $config["id_user"]; + if ($user_id !== false) { + $id = $user_id; + } + else { + $id = $config["id_user"]; + } $accion = safe_input($accion); $descripcion = safe_input($descripcion); @@ -355,7 +347,8 @@ function pandora_audit ($accion, $descripcion){ * @param string $ip Client user IP address. */ function logon_db ($id_user, $ip) { - audit_db ($id_user, $ip, "Logon", "Logged in"); + pandora_audit("Logon", "Logged in", $id_user, $ip); + // Update last registry of user to set last logon. How do we audit when the user was created then? process_user_contact ($id_user); } @@ -367,7 +360,7 @@ function logon_db ($id_user, $ip) { * @param string $ip Client user IP address. */ function logoff_db ($id_user, $ip) { - audit_db ($id_user, $ip, "Logoff", "Logged out"); + pandora_audit("Logoff", "Logged out", $id_user, $ip); } /** @@ -1808,7 +1801,7 @@ function agent_delete_address ($id_agent, $ip_address) { process_sql ($sql); } $agent_name = get_agent_name($id_agent, ""); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", + pandora_audit("Agent management", "Deleted IP $ip_address from agent '$agent_name'"); // Need to change main address? @@ -3230,8 +3223,9 @@ function delete_agent ($id_agents, $disableACL = false) { $id_agent); $addresses = get_db_all_rows_sql ($sql); - if ($addresses === false) + if ($addresses === false) { $addresses = array (); + } foreach ($addresses as $address) { temp_sql_delete ("taddress_agent", "id_ag", $address["id_ag"]); } @@ -3297,7 +3291,7 @@ function delete_agent ($id_agents, $disableACL = false) { //And at long last, the agent temp_sql_delete ("tagente", "id_agente", $id_agent); - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", + pandora_audit( "Agent management", "Deleted agent '$agent_name'"); diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 7923953c11..7649d62fba 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -121,9 +121,10 @@ function delete_event ($id_event, $similar = true) { if (give_acl ($config["id_user"], get_event_group ($event), "IM") == 0) { //Check ACL - audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation", "Attempted deleting event #".$event); - } elseif ($ret !== false) { - audit_db ($config["id_user"], $config["remote_addr"], "Event deleted", "Deleted event #".$event); + pandora_audit("ACL Violation", "Attempted deleting event #".$event); + } + elseif ($ret !== false) { + pandora_audit("Event deleted", "Deleted event #".$event); //ACL didn't fail nor did return continue; @@ -198,7 +199,7 @@ function validate_event ($id_event, $similars = true, $comment = '', $new_status if (give_acl ($config["id_user"], get_event_group ($event), "IW") == 0) { //Check ACL - audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation", "Attempted updating event #".$event); + pandora_audit("ACL Violation", "Attempted updating event #".$event); } elseif ($ret !== false) { //ACL didn't fail nor did return continue; @@ -213,7 +214,7 @@ function validate_event ($id_event, $similars = true, $comment = '', $new_status return false; } else { foreach ($id_event as $event) { - audit_db ($config["id_user"], $config["remote_addr"], "Event validated", "Validated event #".$event); + pandora_audit("Event validated", "Validated event #".$event); } process_sql_commit (); return true; diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 00f11a1bcb..a6ff707a17 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -135,7 +135,7 @@ if ($upload_file) { check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access File manager"); + pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; } @@ -188,7 +188,7 @@ if ($create_text_file) { check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access File manager"); + pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; } @@ -239,7 +239,7 @@ if ($upload_zip) { check_login (); if (! give_acl ($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access File manager"); + pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/include/functions_incidents.php b/pandora_console/include/functions_incidents.php index 8a4334d5db..75bd8f29ee 100644 --- a/pandora_console/include/functions_incidents.php +++ b/pandora_console/include/functions_incidents.php @@ -252,7 +252,7 @@ function delete_incidents ($id_incident) { $notes = array_merge ($notes, array_keys (get_incidents_notes ($id_inc))); $attachments = array_merge ($attachments, array_keys (get_incidents_attach ($id_inc))); - audit_db ($config['id_user'], $config["remote_addr"], "Incident deleted", $config['id_user']." deleted incident #".$id_inc); + pandora_audit("Incident deleted", $config['id_user']." deleted incident #".$id_inc); } //Delete notes diff --git a/pandora_console/include/help/es/modu_group_list.php b/pandora_console/include/help/es/modu_group_list.php index 4344c04c06..a557088a15 100644 --- a/pandora_console/include/help/es/modu_group_list.php +++ b/pandora_console/include/help/es/modu_group_list.php @@ -20,7 +20,7 @@ global $config; check_login(); if (! give_acl($config['id_user'], 0, "PM")) { - audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Group Management"); require ("general/noaccess.php"); return; @@ -34,7 +34,7 @@ if (is_ajax ()) { $id_group = (int) get_parameter ('id_group'); if (! give_acl ($config['id_user'], $id_group, "AR")) { - audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Alert Management"); echo json_encode (false); return; diff --git a/pandora_console/index.php b/pandora_console/index.php index 2dfb3f4526..92b69dba7a 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -150,7 +150,7 @@ if (! isset ($config['id_user']) && isset ($_GET["loginhash"])) { } else { require_once ('general/login_page.php'); - audit_db ("system", $_SERVER['REMOTE_ADDR'], "Logon Failed (loginhash", ""); + pandora_audit("Logon Failed (loginhash", "", "system"); while (@ob_end_flush ()); exit (""); } @@ -194,7 +194,7 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { // User not known $login_failed = true; require_once ('general/login_page.php'); - audit_db ($nick, $_SERVER['REMOTE_ADDR'], "Logon Failed", "Invalid login: ".$nick); + pandora_audit("Logon Failed", "Invalid login: ".$nick, $nick); while (@ob_end_flush ()); exit (""); } diff --git a/pandora_console/mobile/index.php b/pandora_console/mobile/index.php index a8ece8dc48..098957157c 100644 --- a/pandora_console/mobile/index.php +++ b/pandora_console/mobile/index.php @@ -57,7 +57,7 @@ $user->hackinjectConfig(); menu(); if (! give_acl($system->getConfig('id_user'), 0, "AR")) { - audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -92,7 +92,7 @@ $user->hackinjectConfig(); default: case 'tactical': if (! give_acl($system->getConfig('id_user'), 0, "AR")) { - audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -103,7 +103,7 @@ $user->hackinjectConfig(); break; case 'agents': if (! give_acl($system->getConfig('id_user'), 0, "AR")) { - audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -129,7 +129,7 @@ $user->hackinjectConfig(); break; case 'servers': if (! give_acl($system->getConfig('id_user'), 0, "PM")) { - audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -140,7 +140,7 @@ $user->hackinjectConfig(); break; case 'alerts': if (! give_acl($system->getConfig('id_user'), 0, "PM")) { - audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -151,7 +151,7 @@ $user->hackinjectConfig(); break; case 'groups': if (! give_acl($system->getConfig('id_user'), 0, "PM")) { - audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; @@ -162,7 +162,7 @@ $user->hackinjectConfig(); break; case 'events': if (! give_acl($system->getConfig('id_user'), 0, "IR")) { - audit_db($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access event viewer"); require ("general/noaccess.php"); return; @@ -173,7 +173,7 @@ $user->hackinjectConfig(); break; case 'monitor': if (! give_acl($system->getConfig('id_user'), 0, "AR")) { - audit_db ($system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Data view"); require ("../general/noaccess.php"); return; diff --git a/pandora_console/mobile/operation/agents/view_agents.php b/pandora_console/mobile/operation/agents/view_agents.php index ce58941c2b..83fca08119 100644 --- a/pandora_console/mobile/operation/agents/view_agents.php +++ b/pandora_console/mobile/operation/agents/view_agents.php @@ -173,7 +173,7 @@ class ViewAgent { public function show() { $idGroup = $this->agent['id_grupo']; if (! give_acl ($this->system->getConfig('id_user'), $idGroup, "AR")) { - audit_db ($this->system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access (read) to agent ".get_agent_name($this->idAgent)); include ("../general/noaccess.php"); return; @@ -420,7 +420,7 @@ class viewGraph { function show() { $idGroup = $this->agent['id_grupo']; if (! give_acl ($this->system->getConfig('id_user'), $idGroup, "AR")) { - audit_db ($this->system->getConfig('id_user'), $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access (read) to agent ".get_agent_name($this->idAgent)); include ("../general/noaccess.php"); return; diff --git a/pandora_console/operation/agentes/agent_fields.php b/pandora_console/operation/agentes/agent_fields.php index c5cf449865..9e178da278 100755 --- a/pandora_console/operation/agentes/agent_fields.php +++ b/pandora_console/operation/agentes/agent_fields.php @@ -34,7 +34,7 @@ if ($id_agente === -1) { } if (! give_acl ($config["id_user"], $agent["id_grupo"], "AR")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent General Information"); require_once ("general/noaccess.php"); return; diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index d7d8e0b07c..fad4ae8949 100644 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -55,7 +55,7 @@ if ($idAgent != 0) { $id_group = get_group_agents ($idAgent); if (give_acl ($config["id_user"], $id_group, "AR") == 0) { - audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation","Trying to access alert view"); + pandora_audit("ACL Violation","Trying to access alert view"); require ("general/noaccess.php"); exit; } @@ -69,7 +69,7 @@ if ($idAgent != 0) { } else { if (!give_acl ($config["id_user"], 0, "AR")) { - audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation","Trying to access alert view"); + pandora_audit("ACL Violation","Trying to access alert view"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/operation/agentes/custom_fields.php b/pandora_console/operation/agentes/custom_fields.php index d0ab5634e7..5c19e19a7e 100644 --- a/pandora_console/operation/agentes/custom_fields.php +++ b/pandora_console/operation/agentes/custom_fields.php @@ -34,7 +34,7 @@ if ($id_agente === -1) { } if (! give_acl ($config["id_user"], $agent["id_grupo"], "AR")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent General Information"); require_once ("general/noaccess.php"); return; diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index 93cad25559..057014b227 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -29,7 +29,7 @@ $agentId = get_parameter("id_agente"); if (! give_acl ($config['id_user'], $group, "AR") || $module_id == 0) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Data view"); require ("general/noaccess.php"); return; diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 9a4f8f39c5..20a0e53853 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -20,7 +20,7 @@ require_once ("include/functions_reporting.php"); check_login (); if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access agent main list view"); require ("general/noaccess.php"); return; @@ -55,7 +55,7 @@ if (is_ajax ()) { $id_module = (int) get_parameter ('id_agent_module'); if (! give_acl ($config['id_user'], get_agentmodule_group ($id_module), "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access agent main list view"); echo json_encode (false); return; diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 3966d314b5..45fdab9ade 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -36,7 +36,7 @@ if ($agent === false) { } if (! give_acl ($config["id_user"], $agent["id_grupo"], "AR")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent General Information"); require_once ("general/noaccess.php"); return; diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 37893c3d39..5935be7e94 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -18,7 +18,7 @@ global $config; if (!isset ($id_agente)) { //This page is included, $id_agente should be passed to it. - audit_db ($config['id_user'], $config['remote_addr'], "HACK Attempt", + pandora_audit("HACK Attempt", "Trying to get to monitor list without id_agent passed"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/operation/agentes/export_csv.php b/pandora_console/operation/agentes/export_csv.php index 3db6fe744a..0640c96fcd 100644 --- a/pandora_console/operation/agentes/export_csv.php +++ b/pandora_console/operation/agentes/export_csv.php @@ -30,7 +30,7 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){ $id_agent = $_GET["agent"]; $agentmodule_name = get_agentmodule_name ($id_agentmodule); if (! give_acl ($config['id_user'], dame_id_grupo ($id_agent), "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Export Data"); require ("../../general/noaccess.php"); exit; diff --git a/pandora_console/operation/agentes/gis_view.php b/pandora_console/operation/agentes/gis_view.php index 5a54fc0d78..5d74511759 100644 --- a/pandora_console/operation/agentes/gis_view.php +++ b/pandora_console/operation/agentes/gis_view.php @@ -19,7 +19,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Visual Setup Management"); + pandora_audit("ACL Violation", "Trying to access Visual Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index e2b27e1165..08786ecc32 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -19,7 +19,7 @@ global $config; require_once ("include/functions_agents.php"); if (! give_acl ($config['id_user'], $id_grupo, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access (read) to agent ".get_agent_name($id_agente)); include ("general/noaccess.php"); return; diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index e59cf838ab..4e9edfccab 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -19,7 +19,7 @@ require_once ("include/functions_reporting.php"); check_login (); // ACL Check if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent view (Grouped)"); require ("general/noaccess.php"); exit; @@ -34,7 +34,7 @@ if (isset ($_GET["update_netgroup"])) { $sql = sprintf ("UPDATE tagente_modulo SET `flag` = 1 WHERE `id_agente` = ANY(SELECT id_agente FROM tagente WHERE `id_grupo` = %d)",$group); process_sql ($sql); } else { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to set flag for groups"); + pandora_audit("ACL Violation", "Trying to set flag for groups"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/operation/agentes/networkmap.groups.php b/pandora_console/operation/agentes/networkmap.groups.php index 4146512fc6..c281d82335 100644 --- a/pandora_console/operation/agentes/networkmap.groups.php +++ b/pandora_console/operation/agentes/networkmap.groups.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access node graph builder"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index c587c651ab..8c94b4bf6d 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access node graph builder"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/operation/agentes/networkmap.topology.php b/pandora_console/operation/agentes/networkmap.topology.php index a1a11e54b5..d15b23a7d9 100644 --- a/pandora_console/operation/agentes/networkmap.topology.php +++ b/pandora_console/operation/agentes/networkmap.topology.php @@ -20,7 +20,7 @@ global $config; check_login (); if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access node graph builder"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/operation/agentes/sla_view.php b/pandora_console/operation/agentes/sla_view.php index d46dce8135..a8f8134656 100644 --- a/pandora_console/operation/agentes/sla_view.php +++ b/pandora_console/operation/agentes/sla_view.php @@ -22,7 +22,7 @@ require_once ("include/functions_reporting.php"); check_login(); if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access SLA View"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 0ca8fe2d83..8373aff814 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -22,7 +22,7 @@ global $config; check_login(); if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent Management"); require ('general/noaccess.php'); return; diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index f2d86567f4..77039eff5a 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -24,7 +24,7 @@ require_once ("include/functions_reporting.php"); check_login (); if (! check_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Agent view (Grouped)"); require ("general/noaccess.php"); return; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 1a0610fb59..7d1d25f7b4 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -296,7 +296,7 @@ $agent = get_db_row ('tagente', 'id_agente', $id_agente); // get group for this id_agente $id_grupo = $agent['id_grupo']; if (! give_acl ($config['id_user'], $id_grupo, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access (read) to agent ".get_agent_name($id_agente)); include ("general/noaccess.php"); return; diff --git a/pandora_console/operation/events/event_statistics.php b/pandora_console/operation/events/event_statistics.php index ab6ae8209b..c008960c60 100644 --- a/pandora_console/operation/events/event_statistics.php +++ b/pandora_console/operation/events/event_statistics.php @@ -24,7 +24,7 @@ require_once ("include/fgraph.php"); check_login (); if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access event viewer"); + pandora_audit("ACL Violation","Trying to access event viewer"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 81114d7d75..ae3dfa6377 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -23,7 +23,7 @@ require_once ("include/functions_alerts.php"); //Alerts processing functions check_login (); if (! give_acl ($config["id_user"], 0, "IR")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access event viewer"); require ("general/noaccess.php"); return; diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 09f8601115..0052efa225 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -23,7 +23,7 @@ require_once ("include/functions_alerts.php"); //Alerts processing functions check_login (); if (! give_acl ($config["id_user"], 0, "IR")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access event viewer"); require ("general/noaccess.php"); return; diff --git a/pandora_console/operation/events/events_marquee.php b/pandora_console/operation/events/events_marquee.php index b9f545fd8b..cf3a83f820 100644 --- a/pandora_console/operation/events/events_marquee.php +++ b/pandora_console/operation/events/events_marquee.php @@ -38,7 +38,7 @@ session_write_close (); if(!isInACL($_SERVER['REMOTE_ADDR'])){ - audit_db ('', $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access marquee without ACL Access"); require ("../../general/noaccess.php"); exit; diff --git a/pandora_console/operation/events/events_validate.php b/pandora_console/operation/events/events_validate.php index 916735a961..045f109dfc 100644 --- a/pandora_console/operation/events/events_validate.php +++ b/pandora_console/operation/events/events_validate.php @@ -23,7 +23,7 @@ require_once ("include/functions_alerts.php"); //Alerts processing functions check_login (); if (! give_acl ($config["id_user"], 0, "IR")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access event viewer"); require ("general/noaccess.php"); return; diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index 38a8d990cd..8fe696336a 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -35,7 +35,7 @@ $config["id_user"] = $_SESSION["id_usuario"]; if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access event viewer"); + pandora_audit("ACL Violation","Trying to access event viewer"); require ("general/noaccess.php"); return; diff --git a/pandora_console/operation/extensions.php b/pandora_console/operation/extensions.php index e37bc6d88e..60044995bc 100644 --- a/pandora_console/operation/extensions.php +++ b/pandora_console/operation/extensions.php @@ -16,7 +16,7 @@ check_login (); if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access extensions list"); include ("general/noaccess.php"); exit; diff --git a/pandora_console/operation/gis_maps/render_view.php b/pandora_console/operation/gis_maps/render_view.php index e64d025b61..201c36103b 100644 --- a/pandora_console/operation/gis_maps/render_view.php +++ b/pandora_console/operation/gis_maps/render_view.php @@ -29,7 +29,7 @@ $map = get_db_row ('tgis_map', 'id_tgis_map', $idMap); $confMap = getMapConf($idMap); if (! check_acl ($config['id_user'], $map['group_id'], "IR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access map builder"); + pandora_audit("ACL Violation", "Trying to access map builder"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php index a2434016d3..48f62978ba 100644 --- a/pandora_console/operation/incidents/incident.php +++ b/pandora_console/operation/incidents/incident.php @@ -19,7 +19,7 @@ require_once ("include/functions_incidents.php"); check_login (); if (! give_acl ($config['id_user'], 0, "IR")) { - audit_db($config['id_user'],$config["remote_addr"], "ACL Violation","Trying to access incident viewer"); + pandora_audit("ACL Violation","Trying to access incident viewer"); require ("general/noaccess.php"); exit; } @@ -48,7 +48,7 @@ if ($action == "mass") { if (give_acl ($config['id_user'], get_incidents_group ($incident), "IM") || get_incidents_author ($incident) == $config["id_user"] || get_incidents_owner ($incident) == $config["id_user"]) { continue; } - audit_db ($config["id_user"],$config["remote_addr"],"ACL Forbidden","Mass-update or deletion of incident"); + pandora_audit("ACL Forbidden","Mass-update or deletion of incident"); require ("general/noaccess.php"); exit; } @@ -66,14 +66,15 @@ if ($action == "mass") { __('Could not reclame ownership')); } -} elseif ($action == "update") { +} +elseif ($action == "update") { $id_inc = get_parameter ("id_inc", 0); $author = get_incidents_author ($id_inc); $owner = get_incidents_owner ($id_inc); $grupo = get_incidents_group ($id_inc); if ($author != $config["id_user"] && $owner != $config["id_user"] && !give_acl ($config['id_user'], $grupo, "IM")) { // Only admins (manage incident) or owners/creators can modify incidents - audit_db ($author, $config["remote_addr"], "ACL Forbidden", "Update incident #".$id_inc); + pandora_audit("ACL Forbidden", "Update incident #".$id_inc, $author); require ("general/noaccess.php"); exit; } @@ -91,7 +92,7 @@ if ($action == "mass") { $result = process_sql ($sql); if ($result !== false) { - audit_db ($config["id_user"], $config["remote_addr"], "Incident updated","User ".$config['id_user']." updated incident #".$id_inc); + pandora_audit("Incident updated","User ".$config['id_user']." updated incident #".$id_inc); } print_result_message ($result, @@ -103,7 +104,7 @@ if ($action == "mass") { $grupo = get_parameter_post ("grupo_form", 1); if (!give_acl ($config['id_user'], $grupo, "IW")) { - audit_db ($config["id_user"], $config["remote_addr"], "ACL Forbidden", "User ".$config["id_user"]." tried to update incident"); + pandora_audit("ACL Forbidden", "User ".$config["id_user"]." tried to update incident"); require ("general/noaccess.php"); exit; } @@ -121,8 +122,9 @@ if ($action == "mass") { if ($id_inc === false) { echo '

'.__('Error creating incident').'

'; - } else { - audit_db ($config["id_user"], $config["remote_addr"], "Incident created", "User ".$config["id_user"]." created incident #".$id_inc); + } + else { + pandora_audit("Incident created", "User ".$config["id_user"]." created incident #".$id_inc); } } @@ -145,7 +147,7 @@ $grupo = (int) get_parameter ("grupo", 0); if ($grupo > 0) { $filter .= sprintf (" AND id_grupo = %d", $grupo); if (give_acl ($config['id_user'], $grupo, "IM") == 0) { - audit_db ($config["id_user"],$config["remote_addr"],"ACL Forbidden","User tried to read incidents from group without access"); + pandora_audit("ACL Forbidden","User tried to read incidents from group without access"); include ("general/noaccess.php"); exit; } diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index 3226cbac1a..cfc6f3b0cc 100644 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -23,7 +23,7 @@ check_login (); if (! give_acl ($config["id_user"], 0, "IR")) { // Doesn't have access to this page - audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation", "Trying to access incident details"); + pandora_audit("ACL Violation", "Trying to access incident details"); require ("general/noaccess.php"); exit; } @@ -170,7 +170,7 @@ elseif (isset ($_GET["insert_form"])) { $prioridad = 0; $id_grupo = 0; } else { - audit_db ($config['id_user'],$config["remote_addr"], "HACK","Trying to get to incident details in an unusual way"); + pandora_audit("HACK","Trying to get to incident details in an unusual way"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/operation/incidents/incident_statistics.php b/pandora_console/operation/incidents/incident_statistics.php index 9ad0e9006e..31dbecd088 100644 --- a/pandora_console/operation/incidents/incident_statistics.php +++ b/pandora_console/operation/incidents/incident_statistics.php @@ -21,7 +21,7 @@ require_once ("include/fgraph.php"); check_login (); if (! give_acl ($config['id_user'], 0, "IR") == 1) { - audit_db ($config['id_user'], $config["remote_addr"], "ACL Violation", "Trying to access Incident section"); + pandora_audit("ACL Violation", "Trying to access Incident section"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index 1d1a47313f..b5259cf349 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -41,7 +41,7 @@ if ($delete_graph) { echo $result; } else { - audit_db ($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to delete a graph from access graph builder"); + pandora_audit("ACL Violation","Trying to delete a graph from access graph builder"); include ("general/noaccess.php"); exit; } @@ -89,7 +89,7 @@ if ($view_graph) { $name = $graph["name"]; if (($graph["private"]==1) && ($graph["id_user"] != $id_user)){ - audit_db($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access to a custom graph not allowed"); + pandora_audit("ACL Violation","Trying to access to a custom graph not allowed"); include ("general/noaccess.php"); exit; } diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index b49a702cad..e1f82f5e51 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -21,7 +21,7 @@ check_login(); $id_report = (int) get_parameter ('id'); if (! $id_report) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "HACK Attempt", + pandora_audit("HACK Attempt", "Trying to access graph viewer withoud ID"); include ("general/noaccess.php"); return; @@ -32,7 +32,7 @@ $report = get_db_row ('treport', 'id_report', $id_report); // Check ACL on the report to see if user has access to the report. if (! give_acl ($config['id_user'], $report['id_group'], "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access graph reader"); + pandora_audit("ACL Violation","Trying to access graph reader"); include ("general/noaccess.php"); exit; } diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 9fd86fb4c1..b3be6c32dc 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -85,14 +85,16 @@ if (isset ($_GET["direct"])) { $config['id_user'] = $nick; //Remove everything that might have to do with people's passwords or logins unset ($_GET['pass'], $pass, $_POST['pass'], $_REQUEST['pass'], $login_good); - } else { + } + else { // User not known $login_failed = true; require_once ('general/login_page.php'); - audit_db ($nick, $_SERVER['REMOTE_ADDR'], "Logon Failed", "Invalid login: ".$nick); + pandora_audit("Logon Failed", "Invalid login: ".$nick, $nick); exit; } -} else { +} +else { require_once ("include/config.php"); require_once ("include/functions_reporting.php"); require_once ("include/auth/mysql.php"); @@ -103,7 +105,7 @@ check_login (); $id_report = (int) get_parameter ('id'); if (! $id_report) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "HACK Attempt", + pandora_audit("HACK Attempt", "Trying to access graph viewer without valid ID"); require ("general/noaccess.php"); exit; @@ -114,7 +116,7 @@ $report = get_db_row ('treport', 'id_report', $id_report); $report["datetime"] = get_system_time(); if (! give_acl ($config['id_user'], $report['id_group'], "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access graph reader"); + pandora_audit("ACL Violation","Trying to access graph reader"); include ("general/noaccess.php"); exit; } diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php index b09c9e4ebf..f3ddb6883a 100644 --- a/pandora_console/operation/servers/view_server.php +++ b/pandora_console/operation/servers/view_server.php @@ -22,7 +22,7 @@ require_once ("include/functions_servers.php"); check_login (); if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'], 0, "AW")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access Server view"); require ("general/noaccess.php"); return; diff --git a/pandora_console/operation/servers/view_server_detail.php b/pandora_console/operation/servers/view_server_detail.php index 3ac8a6783f..f86c064172 100644 --- a/pandora_console/operation/servers/view_server_detail.php +++ b/pandora_console/operation/servers/view_server_detail.php @@ -27,7 +27,7 @@ print_page_header (__('Pandora servers'), "images/server.png", false, "", false, if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access recon task viewer"); require ("/general/noaccess.php"); return; diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index e9da663366..f8ed4c868d 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -22,7 +22,7 @@ enterprise_include ("operation/snmpconsole/snmp_view.php"); check_login (); if (! give_acl ($config['id_user'], 0, "AR")) { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to access SNMP Console"); require ("general/noaccess.php"); exit; @@ -61,7 +61,7 @@ if (isset ($_GET["delete"])){ __('Successfully deleted'), __('Could not be deleted')); } else { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to delete SNMP event ID #".$id_trap); } } @@ -76,7 +76,7 @@ if (isset ($_GET["check"])) { __('Successfully updated'), __('Could not be updated')); } else { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to checkout SNMP Trap ID".$id_trap); } } @@ -90,7 +90,7 @@ if (isset ($_POST["deletebt"])) { process_sql ($sql); } } else { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to mass-delete SNMP Trap ID"); } } @@ -104,7 +104,7 @@ if (isset ($_POST["updatebt"])) { process_sql ($sql); } } else { - audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + pandora_audit("ACL Violation", "Trying to mass-delete SNMP Trap ID"); } } diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index eef3f4eedf..8d2c1b90f7 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -28,7 +28,7 @@ if ($user_info["language"] == ""){ $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")) AND ($id != $config["id_user"])){ - audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation","Trying to view a user without privileges"); + pandora_audit("ACL Violation","Trying to view a user without privileges"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 71173f60ce..52b3069ca2 100644 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -23,7 +23,7 @@ $id_layout = (int) get_parameter ('id'); // Get input parameter for layout id if (! $id_layout) { - audit_db ($config["id_user"],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access visual console without id layout"); + pandora_audit("ACL Violation","Trying to access visual console without id layout"); include ("general/noaccess.php"); exit; } @@ -31,7 +31,7 @@ if (! $id_layout) { $layout = get_db_row ('tlayout', 'id', $id_layout); if (! $layout) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access visual console without id layout"); + pandora_audit("ACL Violation","Trying to access visual console without id layout"); include ("general/noaccess.php"); exit; } @@ -46,7 +46,7 @@ $bheight = $layout["height"]; $pure_url = "&pure=".$config["pure"]; if (! give_acl ($config["id_user"], $id_group, "AR")) { - audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access visual console without group access"); + pandora_audit("ACL Violation", "Trying to access visual console without group access"); require ("general/noaccess.php"); exit; }