New audit logs

This commit is contained in:
Jose Gonzalez 2022-02-01 13:39:18 +01:00
parent 3252832cc7
commit d81e6571ec
84 changed files with 850 additions and 275 deletions

View File

@ -146,7 +146,13 @@ function dbmgr_extension_main()
echo '<strong>An error has occured when querying the database.</strong><br />'; echo '<strong>An error has occured when querying the database.</strong><br />';
echo $error; echo $error;
db_pandora_audit('DB Interface Extension', 'Error in SQL', false, false, $sql); db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. Error in SQL',
false,
false,
$sql
);
return; return;
} }
@ -154,7 +160,13 @@ function dbmgr_extension_main()
if (! is_array($result)) { if (! is_array($result)) {
echo '<strong>Output: <strong>'.$result; echo '<strong>Output: <strong>'.$result;
db_pandora_audit('DB Interface Extension', 'SQL', false, false, $sql); db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. SQL',
false,
false,
$sql
);
return; return;
} }

View File

@ -591,9 +591,15 @@ if ($delete_command) {
$result = alerts_delete_alert_command($id); $result = alerts_delete_alert_command($id);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_COMMAND_MANAGEMENT, 'Delete alert command #'.$id); db_pandora_audit(
AUDIT_LOG_COMMAND_MANAGEMENT,
'Delete alert command #'.$id
);
} else { } else {
db_pandora_audit(AUDIT_LOG_COMMAND_MANAGEMENT, 'Fail try to delete alert command #'.$id); db_pandora_audit(
AUDIT_LOG_COMMAND_MANAGEMENT,
'Fail try to delete alert command #'.$id
);
} }
ui_print_result_message( ui_print_result_message(

View File

@ -255,9 +255,15 @@ if ($add_action) {
$result = alerts_add_alert_agent_module_action($id_alert_module, $id_action, $values); $result = alerts_add_alert_agent_module_action($id_alert_module, $id_action, $values);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Add action '.$id_action.' in alert '.$id_alert_module); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Add action '.$id_action.' in alert '.$id_alert_module
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail to add action '.$id_action.' in alert '.$id_alert_module); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail to add action '.$id_action.' in alert '.$id_alert_module
);
} }
$messageAction = ui_print_result_message( $messageAction = ui_print_result_message(
@ -290,9 +296,15 @@ if ($update_action) {
$result = alerts_update_alert_agent_module_action($id_module_action, $values); $result = alerts_update_alert_agent_module_action($id_module_action, $values);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Update action '.$id_action.' in alert '.$id_alert_module); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Update action '.$id_action.' in alert '.$id_alert_module
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail to updated action '.$id_action.' in alert '.$id_alert_module); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail to updated action '.$id_action.' in alert '.$id_alert_module
);
} }
$messageAction = ui_print_result_message( $messageAction = ui_print_result_message(
@ -311,9 +323,15 @@ if ($delete_action) {
$result = alerts_delete_alert_agent_module_action($id_action); $result = alerts_delete_alert_agent_module_action($id_action);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Delete action '.$id_action.' in alert '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Delete action '.$id_action.' in alert '.$id_alert
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail to delete action '.$id_action.' in alert '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail to delete action '.$id_action.' in alert '.$id_alert
);
} }
$messageAction = ui_print_result_message( $messageAction = ui_print_result_message(
@ -332,9 +350,15 @@ if ($enable_alert) {
$result = alerts_agent_module_disable($id_alert, false); $result = alerts_agent_module_disable($id_alert, false);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Enable '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Enable '.$id_alert
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail to enable '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail to enable '.$id_alert
);
} }
$messageAction = ui_print_result_message( $messageAction = ui_print_result_message(
@ -353,9 +377,15 @@ if ($disable_alert) {
$result = alerts_agent_module_disable($id_alert, true); $result = alerts_agent_module_disable($id_alert, true);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Disable '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Disable '.$id_alert
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail to disable '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail to disable '.$id_alert
);
} }
$messageAction = ui_print_result_message( $messageAction = ui_print_result_message(
@ -374,9 +404,15 @@ if ($standbyon_alert) {
$result = alerts_agent_module_standby($id_alert, true); $result = alerts_agent_module_standby($id_alert, true);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Standby '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Standby '.$id_alert
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail to standby '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail to standby '.$id_alert
);
} }
$messageAction = ui_print_result_message( $messageAction = ui_print_result_message(
@ -395,9 +431,15 @@ if ($standbyoff_alert) {
$result = alerts_agent_module_standby($id_alert, false); $result = alerts_agent_module_standby($id_alert, false);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Standbyoff '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Standbyoff '.$id_alert
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail to standbyoff '.$id_alert); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail to standbyoff '.$id_alert
);
} }
$messageAction = ui_print_result_message( $messageAction = ui_print_result_message(

View File

@ -96,7 +96,10 @@ if ($al_action !== false) {
} }
if (!$is_in_group && $al_action['id_group'] != 0) { if (!$is_in_group && $al_action['id_group'] != 0) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access unauthorized alert action configuration'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access unauthorized alert action configuration'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }

View File

@ -52,7 +52,10 @@ if ($id > 0) {
$alert = alerts_get_alert_command($id); $alert = alerts_get_alert_command($id);
if ($alert['internal'] || !check_acl_restricted_all($config['id_user'], $alert['id_group'], 'PM')) { if ($alert['internal'] || !check_acl_restricted_all($config['id_user'], $alert['id_group'], 'PM')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Alert Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Alert Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }
@ -110,9 +113,20 @@ if ($update_command) {
} }
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_COMMAND_MANAGEMENT, 'Update alert command #'.$id, false, false, $info); db_pandora_audit(
AUDIT_LOG_COMMAND_MANAGEMENT,
'Update alert command #'.$id,
false,
false,
$info
);
} else { } else {
db_pandora_audit(AUDIT_LOG_COMMAND_MANAGEMENT, 'Fail to update alert command #'.$id, false, false); db_pandora_audit(
AUDIT_LOG_COMMAND_MANAGEMENT,
'Fail to update alert command #'.$id,
false,
false
);
} }
ui_print_result_message( ui_print_result_message(

View File

@ -153,9 +153,15 @@ if ($duplicate_template) {
$id = alerts_duplicate_alert_template($source_id, $a_template['id_group']); $id = alerts_duplicate_alert_template($source_id, $a_template['id_group']);
if ($id) { if ($id) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Duplicate alert template '.$source_id.' clone to '.$id); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Duplicate alert template '.$source_id.' clone to '.$id
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail try to duplicate alert template '.$source_id); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail try to duplicate alert template '.$source_id
);
} }
ui_print_result_message( ui_print_result_message(
@ -364,9 +370,21 @@ function update_template($step)
} }
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Update alert template #'.$id, false, false, json_encode($values)); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Update alert template #'.$id,
false,
false,
json_encode($values)
);
} else { } else {
db_pandora_audit(AUDIT_LOG_ALERT_MANAGEMENT, 'Fail try to update alert template #'.$id, false, false, json_encode($values)); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Fail try to update alert template #'.$id,
false,
false,
json_encode($values)
);
} }
return $result; return $result;

View File

@ -35,7 +35,10 @@ check_login();
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) { if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Categories Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Categories Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }
@ -113,10 +116,16 @@ if (is_management_allowed() === false) {
if ($is_management_allowed === true && $delete != 0) { if ($is_management_allowed === true && $delete != 0) {
$return_delete = categories_delete_category($delete); $return_delete = categories_delete_category($delete);
if (!$return_delete) { if (!$return_delete) {
db_pandora_audit(AUDIT_LOG_CATEGORY_MANAGEMENT, 'Fail try to delete category #'.$delete); db_pandora_audit(
AUDIT_LOG_CATEGORY_MANAGEMENT,
'Fail try to delete category #'.$delete
);
ui_print_error_message(__('Error deleting category')); ui_print_error_message(__('Error deleting category'));
} else { } else {
db_pandora_audit(AUDIT_LOG_CATEGORY_MANAGEMENT, 'Delete category #'.$delete); db_pandora_audit(
AUDIT_LOG_CATEGORY_MANAGEMENT,
'Delete category #'.$delete
);
ui_print_success_message(__('Successfully deleted category')); ui_print_success_message(__('Successfully deleted category'));
} }
} }

View File

@ -19,7 +19,10 @@ enterprise_hook('open_meta_frame');
require_once $config['homedir'].'/include/functions_categories.php'; require_once $config['homedir'].'/include/functions_categories.php';
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Edit Category'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Edit Category'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
@ -85,34 +88,46 @@ if ($update_category && $id_category != 0) {
} }
if ($result === false) { if ($result === false) {
db_pandora_audit(AUDIT_LOG_CATEGORY_MANAGEMENT, "Fail try to update category #$id_category"); db_pandora_audit(
AUDIT_LOG_CATEGORY_MANAGEMENT,
'Fail try to update category #'.$id_category
);
ui_print_error_message(__('Error updating category')); ui_print_error_message(__('Error updating category'));
} else { } else {
db_pandora_audit(AUDIT_LOG_CATEGORY_MANAGEMENT, "Update category #$id_category"); db_pandora_audit(
AUDIT_LOG_CATEGORY_MANAGEMENT,
'Update category #'.$id_category
);
ui_print_success_message(__('Successfully updated category')); ui_print_success_message(__('Successfully updated category'));
} }
} }
// Create category: creates a new category // Create category: creates a new category.
if ($create_category) { if ($create_category) {
$return_create = true; $return_create = true;
$values = []; $values = [];
$values['name'] = $name_category; $values['name'] = $name_category;
// DB insert // DB insert.
$return_create = false; $return_create = false;
if ($values['name'] != '') { if ($values['name'] != '') {
$return_create = db_process_sql_insert('tcategory', $values); $return_create = db_process_sql_insert('tcategory', $values);
} }
if ($return_create === false) { if ($return_create === false) {
db_pandora_audit(AUDIT_LOG_CATEGORY_MANAGEMENT, 'Fail try to create category'); db_pandora_audit(
AUDIT_LOG_CATEGORY_MANAGEMENT,
'Fail try to create category'
);
ui_print_error_message(__('Error creating category')); ui_print_error_message(__('Error creating category'));
$action = 'new'; $action = 'new';
// If create action ends successfully then current action is update // If create action ends successfully then current action is update.
} else { } else {
db_pandora_audit(AUDIT_LOG_CATEGORY_MANAGEMENT, "Create category #$return_create"); db_pandora_audit(
AUDIT_LOG_CATEGORY_MANAGEMENT,
'Create category #'.$return_create
);
ui_print_success_message(__('Successfully created category')); ui_print_success_message(__('Successfully created category'));
$id_category = $return_create; $id_category = $return_create;
$action = 'update'; $action = 'update';
@ -120,7 +135,7 @@ if ($create_category) {
} }
// Form fields are filled here // Form fields are filled here
// Get results when update action is performed // Get results when update action is performed.
if ($action == 'update' && $id_category != 0) { if ($action == 'update' && $id_category != 0) {
$result_category = db_get_row_filter('tcategory', ['id' => $id_category]); $result_category = db_get_row_filter('tcategory', ['id' => $id_category]);
$name_category = $result_category['name']; $name_category = $result_category['name'];

View File

@ -20,7 +20,10 @@ $gis_m = check_acl($config['id_user'], 0, 'MM');
$access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW'); $access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW');
if (!$gis_w && !$gis_m) { if (!$gis_w && !$gis_m) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access map builder'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access map builder'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }
@ -33,7 +36,10 @@ $action = get_parameter('action', 'new_map');
$gis_map_group = db_get_value('group_id', 'tgis_map', 'id_tgis_map', $idMap); $gis_map_group = db_get_value('group_id', 'tgis_map', 'id_tgis_map', $idMap);
if ($idMap > 0 && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW') && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW')) { if ($idMap > 0 && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW') && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access map builder'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access map builder'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -34,7 +34,10 @@ check_login();
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Group Management2'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Group Management2'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -18,7 +18,10 @@ check_login();
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Group Management2'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Group Management2'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -47,7 +47,10 @@ if (is_metaconsole() === true) {
if (is_ajax() === true) { if (is_ajax() === true) {
if ((bool) check_acl($config['id_user'], 0, 'AR') === false) { if ((bool) check_acl($config['id_user'], 0, 'AR') === false) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Group Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Group Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -150,7 +150,13 @@ if ($add) {
'Fires_max' => $fires_max, 'Fires_max' => $fires_max,
'Actions' => implode(',', $actions), 'Actions' => implode(',', $actions),
]; ];
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Add alert action '.json_encode($id_agents), false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Add alert action '.json_encode($id_agents),
false,
false,
json_encode($info)
);
ui_print_result_message($results, __('Successfully added'), __('Could not be added')); ui_print_result_message($results, __('Successfully added'), __('Could not be added'));
} }
} else { } else {

View File

@ -146,9 +146,21 @@ function process_manage_add($id_alert_template, $id_agents, $module_names)
} }
if ($contsuccess > 0) { if ($contsuccess > 0) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Add alert', false, false, 'Alert template: '.$id_alert_template.' Modules: '.json_encode($modules_id)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Add alert',
false,
false,
'Alert template: '.$id_alert_template.' Modules: '.json_encode($modules_id)
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to add alert', false, false, 'Alert template: '.$id_alert_template.' Modules: '.json_encode($modules_id)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Fail try to add alert',
false,
false,
'Alert template: '.$id_alert_template.' Modules: '.json_encode($modules_id)
);
} }
ui_print_result_message( ui_print_result_message(

View File

@ -148,9 +148,21 @@ if ($delete) {
]; ];
if ($results) { if ($results) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Delete alert action', false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Delete alert action',
false,
false,
json_encode($info)
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to delete alert action', false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Fail try to delete alert action',
false,
false,
json_encode($info)
);
} }
ui_print_result_message( ui_print_result_message(

View File

@ -104,9 +104,21 @@ if ($delete) {
$info = '{"Agent":"'.implode(',', $id_agents).'"}'; $info = '{"Agent":"'.implode(',', $id_agents).'"}';
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Delete agent ', false, false, $info); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Delete agent ',
false,
false,
$info
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to delete agent', false, false, $info); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Fail try to delete agent',
false,
false,
$info
);
} }
} }

View File

@ -223,9 +223,21 @@ if ($delete) {
]; ];
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Delete alert ', false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Delete alert ',
false,
false,
json_encode($info)
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to delete alert', false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Fail try to delete alert',
false,
false,
json_encode($info)
);
} }
} }

View File

@ -266,11 +266,16 @@ if ($delete) {
'Agent' => implode(',', $agents_), 'Agent' => implode(',', $agents_),
'Module' => implode(',', $modules_), 'Module' => implode(',', $modules_),
]; ];
if ($result) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Delete module ', false, false, json_encode($info)); $auditMessage = ((bool) $result === true) ? 'Delete module' : 'Fail try to delete module';
} else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to delete module', false, false, json_encode($info)); db_pandora_audit(
} AUDIT_LOG_MASSIVE_MANAGEMENT,
$auditMessage,
false,
false,
json_encode($info)
);
} }
$groups = users_get_groups(); $groups = users_get_groups();

View File

@ -111,9 +111,21 @@ if ($delete_profiles) {
]; ];
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Delete profile ', false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Delete profile ',
false,
false,
json_encode($info)
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to delete profile', false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Fail try to delete profile',
false,
false,
json_encode($info)
);
} }
ui_print_result_message( ui_print_result_message(

View File

@ -189,9 +189,15 @@ if ($update_agents) {
if ($n_deleted > 0) { if ($n_deleted > 0) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Delete conf file '.$id_agent); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Delete conf file '.$id_agent
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Try to delete conf file '.$id_agent); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Try to delete conf file '.$id_agent
);
} }
@ -383,10 +389,22 @@ if ($update_agents) {
if ($result !== false) { if ($result !== false) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Update agent '.$id_agent, false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Update agent '.$id_agent,
false,
false,
json_encode($info)
);
} else { } else {
if (isset($id_agent)) { if (isset($id_agent)) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Try to update agent '.$id_agent, false, false, json_encode($info)); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Try to update agent '.$id_agent,
false,
false,
json_encode($info)
);
} }
} }

View File

@ -187,9 +187,21 @@ if ($update) {
$info = '{"Modules":"'.implode(',', $modules_).'","Agents":"'.implode(',', $agents_).'"}'; $info = '{"Modules":"'.implode(',', $modules_).'","Agents":"'.implode(',', $agents_).'"}';
if ($success > 0) { if ($success > 0) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Edit module', false, false, $info); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Edit module',
false,
false,
$info
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to edit module', false, false, $info); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Fail try to edit module',
false,
false,
$info
);
} }
} }

View File

@ -102,11 +102,15 @@ switch ($action) {
ui_print_result_message($result, __('Successfully enabled'), __('Could not be enabled')); ui_print_result_message($result, __('Successfully enabled'), __('Could not be enabled'));
$info = '{"Alert":"'.implode(',', $id_disabled_alerts).'"}'; $info = '{"Alert":"'.implode(',', $id_disabled_alerts).'"}';
if ($result) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Enable alert', false, false, $info); $auditMessage = ((bool) $result === true) ? 'Enable alert' : 'Fail try to enable alert';
} else { db_pandora_audit(
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to enable alert', false, false, $info); AUDIT_LOG_MASSIVE_MANAGEMENT,
} $auditMessage,
false,
false,
$info
);
break; break;
case 'disable_alerts': case 'disable_alerts':
@ -120,11 +124,15 @@ switch ($action) {
ui_print_result_message($result, __('Successfully disabled'), __('Could not be disabled')); ui_print_result_message($result, __('Successfully disabled'), __('Could not be disabled'));
$info = '{"Alert":"'.implode(',', $id_enabled_alerts).'"}'; $info = '{"Alert":"'.implode(',', $id_enabled_alerts).'"}';
if ($result) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Disable alert', false, false, $info); $auditMessage = ((bool) $result === true) ? 'Disable alert' : 'Fail try to disable alert';
} else { db_pandora_audit(
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to Disable alert', false, false, $info); AUDIT_LOG_MASSIVE_MANAGEMENT,
} $auditMessage,
false,
false,
$info
);
break; break;
default: default:

View File

@ -103,9 +103,21 @@ switch ($action) {
$info = '{"Alert":"'.implode(',', $id_standby_alerts).'"}'; $info = '{"Alert":"'.implode(',', $id_standby_alerts).'"}';
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Set off standby alerts', false, false, $info); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Set off standby alerts',
false,
false,
$info
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to set off standby alerts', false, false, $info); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Fail try to set off standby alerts',
false,
false,
$info
);
} }
break; break;
@ -121,9 +133,21 @@ switch ($action) {
$info = '{"Alert":"'.implode(',', $id_not_standby_alerts).'"}'; $info = '{"Alert":"'.implode(',', $id_not_standby_alerts).'"}';
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Set on standby alerts', false, false, $info); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Set on standby alerts',
false,
false,
$info
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to set on standby alerts', false, false, $info); db_pandora_audit(
AUDIT_LOG_MASSIVE_MANAGEMENT,
'Fail try to set on standby alerts',
false,
false,
$info
);
} }
break; break;

View File

@ -32,7 +32,10 @@ check_login();
if (! check_acl($config['id_user'], 0, 'AR')) { if (! check_acl($config['id_user'], 0, 'AR')) {
// Doesn't have access to this page. // Doesn't have access to this page.
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Module Library View'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Module Library View'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }

View File

@ -72,11 +72,12 @@ if ($create) {
'parent' => $parent, 'parent' => $parent,
] ]
); );
if ($result) {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Create component group #$result"); $auditMessage = ((bool) $result === true) ? sprintf('Create component group #%s', $result) : 'Fail try to create component group';
} else { db_pandora_audit(
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, 'Fail try to create component group'); AUDIT_LOG_MODULE_MANAGEMENT,
} $auditMessage
);
ui_print_result_message( ui_print_result_message(
$result, $result,
@ -101,11 +102,16 @@ if ($update) {
], ],
['id_sg' => $id] ['id_sg' => $id]
); );
if ($result) {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Update component group #$id"); $auditMessage = ((bool) $result === true) ? 'Update component group' : 'Fail try to update component group';
} else { db_pandora_audit(
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Fail try to update component group #$id"); AUDIT_LOG_MODULE_MANAGEMENT,
} sprintf(
'%s #%s',
$auditMessage,
$id
)
);
ui_print_result_message( ui_print_result_message(
$result, $result,
@ -131,11 +137,15 @@ if ($delete) {
$result = false; $result = false;
} }
if ($result) { $auditMessage = ((bool) $result === true) ? 'Delete component group' : 'Fail try to delete component group';
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Delete component group #$id"); db_pandora_audit(
} else { AUDIT_LOG_MODULE_MANAGEMENT,
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Fail try to delete component group #$id"); sprintf(
} '%s #%s',
$auditMessage,
$id
)
);
ui_print_result_message( ui_print_result_message(
$result, $result,
@ -168,17 +178,16 @@ if ($multiple_delete) {
} }
$str_ids = implode(',', $ids); $str_ids = implode(',', $ids);
if ($result) {
db_pandora_audit( $auditMessage = ((bool) $result === true) ? 'Multiple delete component group' : 'Fail try to delete multiple component group';
AUDIT_LOG_MODULE_MANAGEMENT, db_pandora_audit(
"Multiple delete component group: $str_ids" AUDIT_LOG_MODULE_MANAGEMENT,
); sprintf(
} else { '%s #%s',
db_pandora_audit( $auditMessage,
AUDIT_LOG_MODULE_MANAGEMENT, $str_ids
"Fail try to delete component group: $str_ids" )
); );
}
ui_print_result_message( ui_print_result_message(
$result, $result,

View File

@ -431,7 +431,10 @@ if ($is_management_allowed === true && $create_component) {
return; return;
} }
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, 'Create network component #'.$id); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Create network component #'.$id
);
ui_print_success_message(__('Created successfully')); ui_print_success_message(__('Created successfully'));
$id = 0; $id = 0;
} }
@ -524,7 +527,10 @@ if ($is_management_allowed === true && $update_component) {
return; return;
} }
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, 'Update network component #'.$id); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Update network component #'.$id
);
ui_print_success_message(__('Updated successfully')); ui_print_success_message(__('Updated successfully'));
$id = 0; $id = 0;
@ -535,17 +541,11 @@ if ($is_management_allowed === true && $delete_component) {
$result = network_components_delete_network_component($id); $result = network_components_delete_network_component($id);
if ($result) { $auditMessage = ((bool) $result === true) ? 'Delete network component' : 'Fail try to delete network component';
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT, AUDIT_LOG_MODULE_MANAGEMENT,
'Delete network component #'.$id sprintf('%s #%s', $auditMessage, $id)
); );
} else {
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Fail try to delete network component #'.$id
);
}
ui_print_result_message( ui_print_result_message(
$result, $result,
@ -567,17 +567,11 @@ if ($is_management_allowed === true && $multiple_delete) {
} }
$str_ids = implode(',', $ids); $str_ids = implode(',', $ids);
if ($result) { $auditMessage = ((bool) $result === true) ? 'Multiple delete network component' : 'Fail try to delete multiple network component';
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT, AUDIT_LOG_MODULE_MANAGEMENT,
'Multiple delete network component:'.$str_ids sprintf('%s :%s', $auditMessage, $str_ids)
); );
} else {
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Fail try to delete network component:'.$str_ids
);
}
ui_print_result_message( ui_print_result_message(
$result, $result,

View File

@ -19,7 +19,10 @@ include_javascript_d3();
if (!check_acl($config['id_user'], 0, 'PM') if (!check_acl($config['id_user'], 0, 'PM')
&& !check_acl($config['id_user'], 0, 'AW') && !check_acl($config['id_user'], 0, 'AW')
) { ) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Agent Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Agent Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -67,9 +67,15 @@ if ($delete_profile) {
$result = network_profiles_delete_network_profile($id); $result = network_profiles_delete_network_profile($id);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Delete module template #$id"); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Delete module template #'.$id
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Fail try to delete module template #$id"); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Fail try to delete module template #'.$id
);
} }
ui_print_result_message( ui_print_result_message(
@ -92,9 +98,15 @@ if ($multiple_delete) {
$str_ids = implode(',', $ids); $str_ids = implode(',', $ids);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Multiple delete module template: $str_ids"); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Multiple delete module template: '.$str_ids
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Fail try to delete module template: $str_ids"); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Fail try to delete module template: '.$str_ids
);
} }
ui_print_result_message( ui_print_result_message(

View File

@ -97,9 +97,15 @@ if (isset($_GET['create']) || isset($_GET['update'])) {
$result = db_process_sql_update('tnetwork_profile', $values, ['id_np' => $id_np]); $result = db_process_sql_update('tnetwork_profile', $values, ['id_np' => $id_np]);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Update module template #$id_np"); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Update module template #'.$id_np
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Fail try to update module template #$id_np"); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Fail try to update module template #'.$id_np
);
} }
ui_print_result_message( ui_print_result_message(
@ -116,9 +122,15 @@ if (isset($_GET['create']) || isset($_GET['update'])) {
$result = db_process_sql_insert('tnetwork_profile', $values); $result = db_process_sql_insert('tnetwork_profile', $values);
if ($result) { if ($result) {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, "Create module template #$result"); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Create module template #'.$result
);
} else { } else {
db_pandora_audit(AUDIT_LOG_MODULE_MANAGEMENT, 'Fail try to create module template'); db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Fail try to create module template'
);
} }
ui_print_result_message( ui_print_result_message(

View File

@ -17,12 +17,15 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access module management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access module management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }
// Header // Header.
ui_print_page_header(__('Module management').' &raquo; '.__('Defined modules'), 'images/gm_modules.png', false, '', true); ui_print_page_header(__('Module management').' &raquo; '.__('Defined modules'), 'images/gm_modules.png', false, '', true);
$update_module = (bool) get_parameter_post('update_module'); $update_module = (bool) get_parameter_post('update_module');

View File

@ -145,11 +145,11 @@ if ($add_graph === true) {
if (trim($name) != '') { if (trim($name) != '') {
$id_graph = db_process_sql_insert('tgraph', $values); $id_graph = db_process_sql_insert('tgraph', $values);
if ($id_graph !== false) { $auditMessage = ($id_graph !== false) ? sprintf('Create graph #%s', $id_graph) : 'Fail try to create graph';
db_pandora_audit(AUDIT_LOG_REPORT_MANAGEMENT, 'Create graph #'.$id_graph); db_pandora_audit(
} else { AUDIT_LOG_REPORT_MANAGEMENT,
db_pandora_audit(AUDIT_LOG_REPORT_MANAGEMENT, 'Fail try to create graph'); $auditMessage
} );
} else { } else {
$id_graph = false; $id_graph = false;
} }
@ -197,17 +197,16 @@ if ($update_graph) {
], ],
['id_graph' => $id_graph] ['id_graph' => $id_graph]
); );
if ($success !== false) {
db_pandora_audit( $auditMessage = ($success !== false) ? 'Update graph' : 'Fail try to update graph';
AUDIT_LOG_REPORT_MANAGEMENT, db_pandora_audit(
'Update graph #'.$id_graph AUDIT_LOG_REPORT_MANAGEMENT,
); sprintf(
} else { '%s #%s',
db_pandora_audit( $auditMessage,
AUDIT_LOG_REPORT_MANAGEMENT, $id_graph
'Fail try to update graph #'.$id_graph )
); );
}
} else { } else {
$success = false; $success = false;
} }

View File

@ -163,11 +163,17 @@ if ($delete_graph) {
__('Not deleted. Error deleting data') __('Not deleted. Error deleting data')
); );
db_pandora_audit(AUDIT_LOG_REPORT_MANAGEMENT, sprintf('%s #%s', $auditMessage, $id)); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $id)
);
echo $result; echo $result;
} else { } else {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to delete a graph from access graph builder'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to delete a graph from access graph builder'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }
@ -197,7 +203,10 @@ if ($multiple_delete) {
$str_ids = implode(',', $ids); $str_ids = implode(',', $ids);
db_pandora_audit(AUDIT_LOG_REPORT_MANAGEMENT, sprintf('%s: %s', $auditMessage, $str_ids)); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('%s: %s', $auditMessage, $str_ids)
);
ui_print_result_message( ui_print_result_message(
$result, $result,

View File

@ -32,7 +32,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access File manager'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access File manager'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -19,7 +19,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Visual Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Visual Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -19,7 +19,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Visual Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Visual Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -32,7 +32,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to change License settings'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to change License settings'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -16,7 +16,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Link Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Link Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }

View File

@ -17,7 +17,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -32,7 +32,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -32,7 +32,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -39,7 +39,10 @@ check_login();
if (! check_acl($config['id_user'], 0, 'PM') if (! check_acl($config['id_user'], 0, 'PM')
&& ! is_user_admin($config['id_user']) && ! is_user_admin($config['id_user'])
) { ) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -59,7 +59,10 @@ if (is_ajax()) {
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -25,7 +25,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -23,7 +23,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -23,7 +23,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -17,7 +17,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Visual Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Visual Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -270,10 +270,16 @@ if ($save_alert || $modify_alert) {
$result = db_process_sql_insert('talert_snmp', $values); $result = db_process_sql_insert('talert_snmp', $values);
if (!$result) { if (!$result) {
db_pandora_audit('SNMP management', 'Fail try to create snmp alert'); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
'Fail try to create snmp alert'
);
ui_print_error_message(__('There was a problem creating the alert')); ui_print_error_message(__('There was a problem creating the alert'));
} else { } else {
db_pandora_audit('SNMP management', "Create snmp alert #$result"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Create snmp alert #$result"
);
ui_print_success_message(__('Successfully created')); ui_print_success_message(__('Successfully created'));
} }
} else { } else {
@ -400,10 +406,16 @@ if ($save_alert || $modify_alert) {
$result = db_process_sql($sql); $result = db_process_sql($sql);
if (!$result) { if (!$result) {
db_pandora_audit('SNMP management', "Fail try to update snmp alert #$id_as"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Fail try to update snmp alert #$id_as"
);
ui_print_error_message(__('There was a problem updating the alert')); ui_print_error_message(__('There was a problem updating the alert'));
} else { } else {
db_pandora_audit('SNMP management', "Update snmp alert #$id_as"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Update snmp alert #$id_as"
);
ui_print_success_message(__('Successfully updated')); ui_print_success_message(__('Successfully updated'));
} }
} }
@ -591,14 +603,23 @@ if ($duplicate_alert) {
$result = db_process_sql_insert('talert_snmp', $values_duplicate); $result = db_process_sql_insert('talert_snmp', $values_duplicate);
if (!$result) { if (!$result) {
db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Fail try to duplicate snmp alert #$id_as"
);
ui_print_error_message(__('There was a problem duplicating the alert')); ui_print_error_message(__('There was a problem duplicating the alert'));
} else { } else {
db_pandora_audit('SNMP management', "Duplicate snmp alert #$id_as"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Duplicate snmp alert #$id_as"
);
ui_print_success_message(__('Successfully Duplicate')); ui_print_success_message(__('Successfully Duplicate'));
} }
} else { } else {
db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Fail try to duplicate snmp alert #$id_as"
);
ui_print_error_message(__('There was a problem duplicating the alert')); ui_print_error_message(__('There was a problem duplicating the alert'));
} }
} }
@ -616,10 +637,16 @@ if ($delete_alert) {
); );
if ($result === false) { if ($result === false) {
db_pandora_audit('SNMP management', "Fail try to delete snmp alert #$alert_delete"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Fail try to delete snmp alert #$alert_delete"
);
ui_print_error_message(__('There was a problem deleting the alert')); ui_print_error_message(__('There was a problem deleting the alert'));
} else { } else {
db_pandora_audit('SNMP management', "Delete snmp alert #$alert_delete"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Delete snmp alert #$alert_delete"
);
ui_print_success_message(__('Successfully deleted')); ui_print_success_message(__('Successfully deleted'));
} }
} }
@ -637,10 +664,16 @@ if ($multiple_delete) {
); );
if ($result !== false) { if ($result !== false) {
db_pandora_audit('SNMP management', "Delete snmp alert #$alert_delete"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Delete snmp alert #$alert_delete"
);
$count++; $count++;
} else { } else {
db_pandora_audit('SNMP management', "Fail try to delete snmp alert #$alert_delete"); db_pandora_audit(
AUDIT_LOG_SNMP_MANAGEMENT,
"Fail try to delete snmp alert #$alert_delete"
);
} }
} }

View File

@ -19,7 +19,10 @@ enterprise_hook('open_meta_frame');
require_once $config['homedir'].'/include/functions_tags.php'; require_once $config['homedir'].'/include/functions_tags.php';
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Edit Tag'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Edit Tag'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
@ -110,13 +113,21 @@ if ($update_tag && $id_tag != 0) {
$result = tags_update_tag($values, 'id_tag = '.$id_tag); $result = tags_update_tag($values, 'id_tag = '.$id_tag);
} }
if ($result === false) { $auditMessage = ($result === false) ? 'Fail try to update tag' : 'Update tag';
db_pandora_audit('Tag management', "Fail try to update tag #$id_tag"); db_pandora_audit(
ui_print_error_message(__('Error updating tag')); AUDIT_LOG_TAG_MANAGEMENT,
} else { sprintf(
db_pandora_audit('Tag management', "Update tag #$id_tag"); '%s #%s',
ui_print_success_message(__('Successfully updated tag')); $auditMessage,
} $id_tag
)
);
ui_print_result_message(
(bool) $result,
__('Successfully updated tag'),
__('Error updating tag')
);
} }
// Create tag: creates a new tag // Create tag: creates a new tag
@ -140,16 +151,24 @@ if ($create_tag) {
} }
if ($return_create === false) { if ($return_create === false) {
db_pandora_audit('Tag management', 'Fail try to create tag'); $auditMessage = 'Fail try to create tag';
ui_print_error_message(__('Error creating tag'));
$action = 'new'; $action = 'new';
// If create action ends successfully then current action is update // If create action ends successfully then current action is update.
} else { } else {
db_pandora_audit('Tag management', "Create tag #$return_create"); $auditMessage = sprintf('Create tag #%s', $return_create);
ui_print_success_message(__('Successfully created tag'));
$id_tag = $return_create; $id_tag = $return_create;
$action = 'update'; $action = 'update';
} }
db_pandora_audit(
AUDIT_LOG_TAG_MANAGEMENT,
$auditMessage
);
ui_print_result_message(
$action === 'update',
__('Successfully created tag'),
__('Error creating tag')
);
} }
// Form fields are filled here // Form fields are filled here

View File

@ -33,7 +33,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Tag Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Tag Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }
@ -160,13 +163,21 @@ if (is_metaconsole() === false) {
if ($delete !== 0) { if ($delete !== 0) {
$return_delete = tags_delete_tag($delete); $return_delete = tags_delete_tag($delete);
if ($return_delete === false) { $auditMessage = ($return_delete === false) ? 'Fail try to delete tag' : 'Delete tag';
db_pandora_audit('Tag management', 'Fail try to delete tag #'.$delete); db_pandora_audit(
ui_print_error_message(__('Error deleting tag')); AUDIT_LOG_TAG_MANAGEMENT,
} else { sprintf(
db_pandora_audit('Tag management', 'Delete tag #'.$delete); '%s #%s',
ui_print_success_message(__('Successfully deleted tag')); $auditMessage,
} $delete
)
);
ui_print_result_message(
(bool) $return_delete !== false,
__('Successfully deleted tag'),
__('Error deleting tag')
);
} }
$is_management_allowed = is_management_allowed(); $is_management_allowed = is_management_allowed();

View File

@ -50,7 +50,10 @@ if (function_exists('check_acl') === true
if ((bool) check_acl($config['id_user'], 0, 'PM') !== true if ((bool) check_acl($config['id_user'], 0, 'PM') !== true
&& (bool) is_user_admin($config['id_user']) !== true && (bool) is_user_admin($config['id_user']) !== true
) { ) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -17,7 +17,10 @@ check_login();
// The ajax is in // The ajax is in
// include/ajax/update_manager.ajax.php // include/ajax/update_manager.ajax.php
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -35,7 +35,10 @@ require_once __DIR__.'/../../include/functions_update_manager.php';
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -127,7 +127,7 @@ if ($is_management_allowed === true && $delete_profile === true) {
ui_print_error_message(__('There was a problem deleting the profile')); ui_print_error_message(__('There was a problem deleting the profile'));
} else { } else {
db_pandora_audit( db_pandora_audit(
'Profile management', AUDIT_LOG_USER_MANAGEMENT,
'Delete profile '.io_safe_output($profile['name']) 'Delete profile '.io_safe_output($profile['name'])
); );
ui_print_success_message(__('Successfully deleted')); ui_print_success_message(__('Successfully deleted'));

View File

@ -334,7 +334,7 @@ if ($correctLogin) {
* //TODO: Implement a new switch in config to enable / disable * //TODO: Implement a new switch in config to enable / disable
* ACL auth failure: if enabled and have lots of traffic can produce * ACL auth failure: if enabled and have lots of traffic can produce
* millions of records and a considerable OVERHEAD in the system :( * millions of records and a considerable OVERHEAD in the system :(
* db_pandora_audit("API access Failed", $no_login_msg, $user, $ipOrigin); * db_pandora_ audit("API access Failed", $no_login_msg, $user, $ipOrigin);
*/ */
sleep(15); sleep(15);

View File

@ -174,7 +174,10 @@ class AgentsAlerts extends HTML
db_process_sql_update('tagente_modulo', ['flag' => 1], $where); db_process_sql_update('tagente_modulo', ['flag' => 1], $where);
} else { } else {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to set flag for groups'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to set flag for groups'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }

View File

@ -420,8 +420,8 @@ class CalendarManager
if ($result === true) { if ($result === true) {
db_pandora_audit( db_pandora_audit(
'Special days list', AUDIT_LOG_SYSTEM,
'Upload iCalendar '.$_FILES['ical_file']['name'] 'Special Days. Upload iCalendar '.$_FILES['ical_file']['name']
); );
} }

View File

@ -787,10 +787,12 @@ define('AUDIT_LOG_FILE_COLLECTION', 'File collection');
define('AUDIT_LOG_HACK_ATTEMPT', 'HACK Attempt'); define('AUDIT_LOG_HACK_ATTEMPT', 'HACK Attempt');
define('AUDIT_LOG_ALERT_MANAGEMENT', 'Alert management'); define('AUDIT_LOG_ALERT_MANAGEMENT', 'Alert management');
define('AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT', 'Visual Console Management'); define('AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT', 'Visual Console Management');
define('AUDIT_LOG_ALERT_CORRELATION_MANAGEMENT', 'Alert correlation management');
define('AUDIT_LOG_ALERT_MANAGEsMENT', 'Alert management'); define('AUDIT_LOG_TAG_MANAGEMENT', 'Tag management');
define('AUDIT_LOG_ALERT_MANsAGEMENT', 'Alert management'); define('AUDIT_LOG_SETUP', 'Setup');
define('AUDIT_LOG_ALERT_MANsAGEMENT', 'Alert management'); define('AUDIT_LOG_SYSTEM', 'System');
define('AUDIT_LOG_ALERT_MAsNAGEMENT', 'Alert management'); define('AUDIT_LOG_SNMP_MANAGEMENT', 'SNMP management');
define('AUDIT_LOG_ALERT_MANsAGEMENT', 'Alert management'); define('AUDIT_LOG_WEB_SOCKETS', 'WebSockets engine');
define('AUDIT_LOG_ALERT_MAsNAGEMENT', 'Alert management'); define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');

View File

@ -5964,7 +5964,13 @@ function send_test_email(
$result = $mailer->send($message); $result = $mailer->send($message);
} catch (Exception $e) { } catch (Exception $e) {
error_log($e->getMessage()); error_log($e->getMessage());
db_pandora_audit('Cron jobs mail', $e->getMessage()); db_pandora_audit(
AUDIT_LOG_SYSTEM,
sprintf(
'Cron jobs mail: %s',
$e->getMessage()
)
);
} }
return $result; return $result;

View File

@ -272,7 +272,10 @@ function agents_create_agent(
agents_add_address($id_agent, $ip_address); agents_add_address($id_agent, $ip_address);
} }
db_pandora_audit(AUDIT_LOG_AGENT_MANAGEMENT, 'New agent '.$name.' created'); db_pandora_audit(
AUDIT_LOG_AGENT_MANAGEMENT,
'New agent '.$name.' created'
);
return $id_agent; return $id_agent;
} }

View File

@ -2744,7 +2744,7 @@ function alerts_ui_update_or_create_actions($update=true)
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
'Command management', AUDIT_LOG_ALERT_MANAGEMENT,
$update ? 'Update alert action #'.$id : 'Create alert action #'.$result, $update ? 'Update alert action #'.$id : 'Create alert action #'.$result,
false, false,
false, false,
@ -2752,7 +2752,7 @@ function alerts_ui_update_or_create_actions($update=true)
); );
} else { } else {
db_pandora_audit( db_pandora_audit(
'Command management', AUDIT_LOG_ALERT_MANAGEMENT,
$update ? 'Fail try to update alert action #'.$id : 'Fail try to create alert action', $update ? 'Fail try to update alert action #'.$id : 'Fail try to create alert action',
false, false,
false, false,

View File

@ -15083,7 +15083,10 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3)
$id_module = modules_create_agent_module($id_agent, $values_module['nombre'], $values_module, true); $id_module = modules_create_agent_module($id_agent, $values_module['nombre'], $values_module, true);
if ($id_module === false) { if ($id_module === false) {
db_pandora_audit('Report management', "Failed to create cluster status module in cluster $name (#$id_agent)"); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
"Failed to create cluster status module in cluster $name (#$id_agent)"
);
} }
} }
@ -15091,13 +15094,19 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3)
? sprintf('Created new cluster %s (#%s)', $name, $id_cluster) ? sprintf('Created new cluster %s (#%s)', $name, $id_cluster)
: sprintf('Failed to create cluster %s ', $name); : sprintf('Failed to create cluster %s ', $name);
db_pandora_audit(AUDIT_LOG_REPORT_MANAGEMENT, $auditMessageCluster); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
$auditMessageCluster
);
$auditMessageAgent = ((bool) $id_agent === true) $auditMessageAgent = ((bool) $id_agent === true)
? sprintf('Created new cluster agent %s (#%s)', $name, $id_agent) ? sprintf('Created new cluster agent %s (#%s)', $name, $id_agent)
: sprintf('Failed to create cluster agent %s ', $name); : sprintf('Failed to create cluster agent %s ', $name);
db_pandora_audit(AUDIT_LOG_REPORT_MANAGEMENT, $auditMessageAgent); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
$auditMessageAgent
);
if ($id_cluster !== false) { if ($id_cluster !== false) {
returnData( returnData(
@ -15222,9 +15231,15 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
); );
if ($tcluster_module !== false) { if ($tcluster_module !== false) {
db_pandora_audit('Report management', 'Module #'.$element['name'].' assigned to cluster #'.$element['id_cluster']); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
'Module #'.$element['name'].' assigned to cluster #'.$element['id_cluster']
);
} else { } else {
db_pandora_audit('Report management', 'Failed to assign AA item module to cluster '.$element['name']); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
'Failed to assign AA item module to cluster '.$element['name']
);
} }
} else if ($element['type'] == 'AP') { } else if ($element['type'] == 'AP') {
$id_agent = db_get_value_sql('SELECT id_agent FROM tcluster WHERE id = '.$element['id_cluster']); $id_agent = db_get_value_sql('SELECT id_agent FROM tcluster WHERE id = '.$element['id_cluster']);
@ -15287,9 +15302,15 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
); );
if ($tcluster_balanced_module !== false) { if ($tcluster_balanced_module !== false) {
db_pandora_audit('Report management', 'Module #'.$element['name'].' assigned to cluster #'.$element['id_cluster']); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
'Module #'.$element['name'].' assigned to cluster #'.$element['id_cluster']
);
} else { } else {
db_pandora_audit('Report management', 'The module could not be assigned to the cluster'); db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
'The module could not be assigned to the cluster'
);
} }
} }
} }
@ -16671,16 +16692,32 @@ function api_set_access_process($thrash1, $thrash2, $other, $returnType)
} }
} else { } else {
// There is no administrator user who has logged in since then to log us in. // There is no administrator user who has logged in since then to log us in.
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Logged in '.$other['data'][3].' node '.$other['data'][2],
$other['data'][0]
);
returnData('string', ['type' => 'string', 'data' => 'free']); returnData('string', ['type' => 'string', 'data' => 'free']);
} }
} else if ($other['data'][1] == 'logout') { } else if ($other['data'][1] == 'logout') {
// The administrator user wants to log out // The administrator user wants to log out
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Logout from '.$other['data'][3].' node '.$other['data'][2],
$other['data'][0]
);
} else if ($other['data'][1] == 'exclude') { } else if ($other['data'][1] == 'exclude') {
// The administrator user has ejected another administrator user who was logged in // The administrator user has ejected another administrator user who was logged in
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); db_pandora_audit(
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $audit_concurrence[0]['id_usuario']); AUDIT_LOG_USER_REGISTRATION,
'Logged in '.$other['data'][3].' node '.$other['data'][2],
$other['data'][0]
);
db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Logout from '.$other['data'][3].' node '.$other['data'][2],
$audit_concurrence[0]['id_usuario']
);
} }
// The admin user is trying to browse // The admin user is trying to browse
else if ($other['data'][1] == 'browse') { else if ($other['data'][1] == 'browse') {
@ -16700,23 +16737,39 @@ function api_set_access_process($thrash1, $thrash2, $other, $returnType)
} }
} else if ($other['data'][1] == 'cancelled') { } else if ($other['data'][1] == 'cancelled') {
// The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in. // The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in.
db_pandora_audit($other['data'][3].' cancelled access', 'Cancelled access in '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Cancelled access in '.$other['data'][3].' node '.$other['data'][2],
$other['data'][0]
);
returnData('string', ['type' => 'string', 'data' => 'cancelled']); returnData('string', ['type' => 'string', 'data' => 'cancelled']);
} }
} else { } else {
if ($other['data'][4] == 1) { if ($other['data'][4] == 1) {
// The user trying to log in is not an administrator and is not allowed no admin access // The user trying to log in is not an administrator and is not allowed no admin access
db_pandora_audit($other['data'][3].' denied access', 'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2],
$other['data'][0]
);
returnData('string', ['type' => 'string', 'data' => 'denied']); returnData('string', ['type' => 'string', 'data' => 'denied']);
} else { } else {
// The user trying to log in is not an administrator and is allowed no admin access // The user trying to log in is not an administrator and is allowed no admin access
if ($other['data'][1] == 'login') { if ($other['data'][1] == 'login') {
// The user trying to login is not admin, can enter without concurrent use filter // The user trying to login is not admin, can enter without concurrent use filter
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Logged in '.$other['data'][3].' node '.$other['data'][2],
$other['data'][0]
);
returnData('string', ['type' => 'string', 'data' => 'free']); returnData('string', ['type' => 'string', 'data' => 'free']);
} else if ($other['data'][1] == 'logout') { } else if ($other['data'][1] == 'logout') {
// The user trying to logoff is not admin // The user trying to logoff is not admin
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Logout from '.$other['data'][3].' node '.$other['data'][2],
$other['data'][0]
);
} else if ($other['data'][1] == 'browse') { } else if ($other['data'][1] == 'browse') {
// The user trying to browse in an app page is not admin, can enter without concurrent use filter // The user trying to browse in an app page is not admin, can enter without concurrent use filter
returnData('string', ['type' => 'string', 'data' => 'free']); returnData('string', ['type' => 'string', 'data' => 'free']);

View File

@ -145,7 +145,10 @@ function config_update_config()
$update_config = (bool) get_parameter('update_config'); $update_config = (bool) get_parameter('update_config');
if ($update_config) { if ($update_config) {
db_pandora_audit('Setup', 'Setup has changed'); db_pandora_audit(
AUDIT_LOG_SETUP,
'Setup has changed'
);
} else { } else {
// Do nothing. // Do nothing.
return false; return false;

View File

@ -285,7 +285,12 @@ function db_pandora_audit($accion, $descripcion, $user_id=false, $ip=true, $info
*/ */
function db_logon($id_user, $ip) function db_logon($id_user, $ip)
{ {
db_pandora_audit(AUDIT_LOG_USER_REGISTRATION, 'Logged in', $id_user, $ip); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Logged in',
$id_user,
$ip
);
// Update last registry of user to set last logon. How do we audit when the user was created then? // Update last registry of user to set last logon. How do we audit when the user was created then?
process_user_contact($id_user); process_user_contact($id_user);
@ -302,7 +307,12 @@ function db_logon($id_user, $ip)
*/ */
function db_logoff($id_user, $ip) function db_logoff($id_user, $ip)
{ {
db_pandora_audit(AUDIT_LOG_USER_REGISTRATION, 'Logged out', $id_user, $ip); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Logged out',
$id_user,
$ip
);
} }

View File

@ -1903,7 +1903,10 @@ function events_delete_event(
if (check_acl($config['id_user'], $event_group, 'EM') == 0) { if (check_acl($config['id_user'], $event_group, 'EM') == 0) {
// Check ACL. // Check ACL.
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Attempted deleting event #'.$event); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Attempted deleting event #'.$event
);
$errors++; $errors++;
} else { } else {
$ret = db_process_sql_delete($table_event, ['id_evento' => $event]); $ret = db_process_sql_delete($table_event, ['id_evento' => $event]);
@ -1911,7 +1914,10 @@ function events_delete_event(
if (!$ret) { if (!$ret) {
$errors++; $errors++;
} else { } else {
db_pandora_audit('Event deleted', 'Deleted event #'.$event); db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
'Deleted event #'.$event
);
// ACL didn't fail nor did return. // ACL didn't fail nor did return.
continue; continue;
} }
@ -1995,7 +2001,10 @@ function events_change_status(
} }
if (check_acl($config['id_user'], $event_group, 'EW') == 0) { if (check_acl($config['id_user'], $event_group, 'EW') == 0) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Attempted updating event #'.$id); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Attempted updating event #'.$id
);
unset($id_event[$k]); unset($id_event[$k]);
} }
@ -2106,7 +2115,10 @@ function events_change_owner(
} }
if (check_acl($config['id_user'], $event_group, 'EW') == 0) { if (check_acl($config['id_user'], $event_group, 'EW') == 0) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Attempted updating event #'.$id); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Attempted updating event #'.$id
);
unset($id_event[$k]); unset($id_event[$k]);
} }
} }
@ -2221,7 +2233,10 @@ function events_comment(
} }
if (check_acl($config['id_user'], $event_group, 'EW') == 0) { if (check_acl($config['id_user'], $event_group, 'EW') == 0) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Attempted updating event #'.$id); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Attempted updating event #'.$id
);
unset($id_event[$k]); unset($id_event[$k]);
} }

View File

@ -142,7 +142,10 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access File manager'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access File manager'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }
@ -257,7 +260,10 @@ function create_text_file($default_real_directory, $destination_directory)
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access File manager'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access File manager'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -289,7 +289,10 @@ function incidents_delete_incident($id_incident)
$notes = array_merge($notes, array_keys(incidents_get_notes($id_inc))); $notes = array_merge($notes, array_keys(incidents_get_notes($id_inc)));
$attachments = array_merge($attachments, array_keys(incidents_get_attach($id_inc))); $attachments = array_merge($attachments, array_keys(incidents_get_attach($id_inc)));
db_pandora_audit('Incident deleted', $config['id_user'].' deleted incident #'.$id_inc); db_pandora_audit(
AUDIT_LOG_INCIDENT_MANAGEMENT,
$config['id_user'].' deleted incident #'.$id_inc
);
} }
// Delete notes // Delete notes

View File

@ -588,7 +588,7 @@ function planned_downtimes_stop($downtime)
1 1
); );
db_pandora_audit( db_pandora_audit(
'Planned Downtime management', AUDIT_LOG_SYSTEM,
'Manual stop downtime '.$downtime['name'].' (ID '.$downtime['id'].')', 'Manual stop downtime '.$downtime['name'].' (ID '.$downtime['id'].')',
false, false,
true true

View File

@ -14486,7 +14486,10 @@ function reporting_email_template(
if (empty($destination) === false) { if (empty($destination) === false) {
send_email_attachment($destination, $body, $subject, $attachments); send_email_attachment($destination, $body, $subject, $attachments);
} else { } else {
db_pandora_audit('ERROR:', 'Cron jobs mail, empty destination email.'); db_pandora_audit(
AUDIT_LOG_SYSTEM,
'Cron jobs mail, empty destination email.'
);
} }
} }
} }

View File

@ -205,7 +205,7 @@ class Manager implements PublicLogin
} else { } else {
if (self::validatePublicHash($hash) === false) { if (self::validatePublicHash($hash) === false) {
db_pandora_audit( db_pandora_audit(
'Invalid public hash', AUDIT_LOG_HACK_ATTEMPT,
'Trying to access public dashboard' 'Trying to access public dashboard'
); );
include 'general/noaccess.php'; include 'general/noaccess.php';
@ -572,12 +572,12 @@ class Manager implements PublicLogin
// Audit. // Audit.
if ($result !== 0) { if ($result !== 0) {
\db_pandora_audit( \db_pandora_audit(
'Dashboard management', AUDIT_LOG_DASHBOARD_MANAGEMENT,
'Delete dashboard #'.$this->dashboardId 'Delete dashboard #'.$this->dashboardId
); );
} else { } else {
\db_pandora_audit( \db_pandora_audit(
'Dashboard management', AUDIT_LOG_DASHBOARD_MANAGEMENT,
'Fail try to delete dashboard #'.$this->dashboardId 'Fail try to delete dashboard #'.$this->dashboardId
); );
} }

View File

@ -295,7 +295,7 @@ class WSManager extends WebSocketServer
if (\check_login(false) === false) { if (\check_login(false) === false) {
$this->disconnect($user->socket); $this->disconnect($user->socket);
\db_pandora_audit( \db_pandora_audit(
'WebSockets engine', AUDIT_LOG_WEB_SOCKETS,
'Trying to access websockets engine without a valid session', 'Trying to access websockets engine without a valid session',
'N/A' 'N/A'
); );
@ -304,7 +304,7 @@ class WSManager extends WebSocketServer
// User exists, and session is valid. // User exists, and session is valid.
\db_pandora_audit( \db_pandora_audit(
'WebSockets engine', AUDIT_LOG_WEB_SOCKETS,
'WebSocket connection started', 'WebSocket connection started',
$user->account->idUser $user->account->idUser
); );
@ -427,7 +427,7 @@ class WSManager extends WebSocketServer
if ($user->account) { if ($user->account) {
$_SERVER['REMOTE_ADDR'] = $user->address; $_SERVER['REMOTE_ADDR'] = $user->address;
\db_pandora_audit( \db_pandora_audit(
'WebSockets engine', AUDIT_LOG_WEB_SOCKETS,
'WebSocket connection finished', 'WebSocket connection finished',
$user->account->idUser $user->account->idUser
); );

View File

@ -135,7 +135,10 @@ if ($idAgent != 0) {
} }
if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && !check_acl_one_of_groups($config['id_user'], $id_group, 'AW')) { if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && !check_acl_one_of_groups($config['id_user'], $id_group, 'AW')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access alert view'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access alert view'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }
@ -157,7 +160,10 @@ if ($idAgent != 0) {
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR'); $access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
if (!$agent_a && !$agent_w) { if (!$agent_a && !$agent_w) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access alert view'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access alert view'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -34,7 +34,10 @@ if (empty($agent_id)) {
$group_id = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id); $group_id = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id);
if ($group_id === false || (!check_acl($config['id_user'], $group_id, 'AW') && !is_user_admin($config['id_user']))) { if ($group_id === false || (!check_acl($config['id_user'], $group_id, 'AW') && !is_user_admin($config['id_user']))) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access eHorus'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access eHorus'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -40,7 +40,10 @@ enterprise_include_once('include/functions_config_agents.php');
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access agent main list view'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access agent main list view'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;

View File

@ -19,7 +19,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'MR') && ! check_acl($config['id_user'], 0, 'MW') && ! check_acl($config['id_user'], 0, 'MM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'MR') && ! check_acl($config['id_user'], 0, 'MW') && ! check_acl($config['id_user'], 0, 'MM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access GIS Agent view'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access GIS Agent view'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -66,7 +66,10 @@ if (isset($_GET['update_netgroup'])) {
); );
} }
} else { } else {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to set flag for groups'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to set flag for groups'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }

View File

@ -46,7 +46,10 @@ if (check_acl($config['id_user'], 0, 'ER') === false
&& check_acl($config['id_user'], 0, 'EW') === false && check_acl($config['id_user'], 0, 'EW') === false
&& check_acl($config['id_user'], 0, 'EM') === false && check_acl($config['id_user'], 0, 'EM') === false
) { ) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access event viewer'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access event viewer'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;

View File

@ -34,7 +34,10 @@ $confMapDefaultUrlFull = json_decode($confMapDefault['conection_data'], true);
$confMapUrlDefault = $confMapDefaultFull['url']; $confMapUrlDefault = $confMapDefaultFull['url'];
if (! check_acl($config['id_user'], $map['group_id'], 'MR') && ! check_acl($config['id_user'], $map['group_id'], 'MW') && ! check_acl($config['id_user'], $map['group_id'], 'MM')) { if (! check_acl($config['id_user'], $map['group_id'], 'MR') && ! check_acl($config['id_user'], $map['group_id'], 'MW') && ! check_acl($config['id_user'], $map['group_id'], 'MM')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access map builder'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access map builder'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -69,7 +69,10 @@ if ($delete_graph) {
echo $result; echo $result;
} else { } else {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to delete a graph from access graph builder'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to delete a graph from access graph builder'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }

View File

@ -36,7 +36,10 @@ enterprise_include_once('include/functions_reporting.php');
if (!reporting_user_can_see_report($id_report)) { if (!reporting_user_can_see_report($id_report)) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access report viewer'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access report viewer'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
} }

View File

@ -75,7 +75,11 @@ if (isset($_GET['direct']) && $_GET['direct']) {
// User not known. // User not known.
$login_failed = true; $login_failed = true;
include_once 'general/login_page.php'; include_once 'general/login_page.php';
db_pandora_audit(AUDIT_LOG_USER_REGISTRATION, 'Invalid login: '.$nick, $nick); db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Invalid login: '.$nick,
$nick
);
exit; exit;
} }
} else { } else {

View File

@ -35,7 +35,10 @@ ui_require_jquery_file('pandora.controls');
// Check login and ACLs. // Check login and ACLs.
check_login(); check_login();
if (!check_acl($config['id_user'], 0, 'AR')) { if (!check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access SNMP Console'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access SNMP Console'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
exit(); exit();
} }

View File

@ -32,7 +32,10 @@ global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access MIB uploader'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access MIB uploader'
);
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
} }

View File

@ -68,7 +68,7 @@ $config['id_user'] = get_parameter('id_user');
// Check input hash. // Check input hash.
if (User::validatePublicHash($hash) !== true) { if (User::validatePublicHash($hash) !== true) {
db_pandora_audit( db_pandora_audit(
'Invalid public visual console', AUDIT_LOG_HACK_ATTEMPT,
'Trying to access public visual console' 'Trying to access public visual console'
); );
include 'general/noaccess.php'; include 'general/noaccess.php';
@ -79,7 +79,10 @@ $refr = (int) get_parameter('refr', $config['refr']);
$layout = db_get_row('tlayout', 'id', $id_layout); $layout = db_get_row('tlayout', 'id', $id_layout);
if (! $layout) { if (! $layout) {
db_pandora_audit(AUDIT_LOG_ACL_VIOLATION, 'Trying to access visual console without id layout'); db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access visual console without id layout'
);
include $config['homedir'].'/general/noaccess.php'; include $config['homedir'].'/general/noaccess.php';
exit; exit;
} }

View File

@ -72,7 +72,7 @@ if (!isset($config['pure'])) {
// Check input hash. // Check input hash.
if (User::validatePublicHash($hash) !== true) { if (User::validatePublicHash($hash) !== true) {
db_pandora_audit( db_pandora_audit(
'Invalid public visual console', AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
'Trying to access public visual console' 'Trying to access public visual console'
); );
include 'general/noaccess.php'; include 'general/noaccess.php';