Merge branch 'ent-6195-10482-entities-en-tabla-de-auditoria' into 'develop'

Ent 6195 10482 entities en tabla de auditoria

See merge request artica/pandorafms!3411
This commit is contained in:
Daniel Rodriguez 2020-09-23 09:38:29 +02:00
commit 12bc9e2b4e
7 changed files with 31 additions and 28 deletions

View File

@ -1115,7 +1115,7 @@ if ($update_agent) {
ui_print_success_message(__('Successfully updated')); ui_print_success_message(__('Successfully updated'));
db_pandora_audit( db_pandora_audit(
'Agent management', 'Agent management',
'Updated agent '.$alias, 'Updated agent '.io_safe_output($alias),
false, false,
false, false,
$info $info
@ -1650,7 +1650,7 @@ if ($update_module) {
db_pandora_audit( db_pandora_audit(
'Agent management', 'Agent management',
"Fail to try update module '".$name."' for agent ".$agent['alias'] "Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
); );
} else { } else {
if ($prediction_module == 3) { if ($prediction_module == 3) {
@ -1674,7 +1674,7 @@ if ($update_module) {
db_pandora_audit( db_pandora_audit(
'Agent management', 'Agent management',
"Updated module '".$name."' for agent ".$agent['alias'], "Updated module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
false, false,
false, false,
io_json_mb_encode($values) io_json_mb_encode($values)
@ -1834,7 +1834,7 @@ if ($create_module) {
$moduletype = $id_module; $moduletype = $id_module;
db_pandora_audit( db_pandora_audit(
'Agent management', 'Agent management',
"Fail to try added module '".$name."' for agent ".$agent['alias'] "Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
); );
} else { } else {
if ($prediction_module == 3) { if ($prediction_module == 3) {
@ -1859,7 +1859,7 @@ if ($create_module) {
$agent = db_get_row('tagente', 'id_agente', $id_agente); $agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit( db_pandora_audit(
'Agent management', 'Agent management',
"Added module '".$name."' for agent ".$agent['alias'], "Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
false, false,
true, true,
io_json_mb_encode($values) io_json_mb_encode($values)
@ -1894,12 +1894,12 @@ if ($enable_module) {
if ($result === NOERR) { if ($result === NOERR) {
db_pandora_audit( db_pandora_audit(
'Module management', 'Module management',
'Enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias'] 'Enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
); );
} else { } else {
db_pandora_audit( db_pandora_audit(
'Module management', 'Module management',
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias'] 'Fail to enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
); );
} }
} }
@ -1929,12 +1929,12 @@ if ($disable_module) {
if ($result === NOERR) { if ($result === NOERR) {
db_pandora_audit( db_pandora_audit(
'Module management', 'Module management',
'Disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias'] 'Disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
); );
} else { } else {
db_pandora_audit( db_pandora_audit(
'Module management', 'Module management',
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias'] 'Fail to disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
); );
} }
} }
@ -2108,7 +2108,7 @@ if ($delete_module) {
$agent = db_get_row('tagente', 'id_agente', $id_agente); $agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit( db_pandora_audit(
'Agent management', 'Agent management',
"Deleted module '".$module_data['nombre']."' for agent ".$agent['alias'] "Deleted module '".io_safe_output($module_data['nombre'])."' for agent ".io_safe_output($agent['alias'])
); );
} }
} }
@ -2163,7 +2163,7 @@ if (!empty($duplicate_module)) {
if ($enable_module) { if ($enable_module) {
$result = modules_change_disabled($enable_module, 0); $result = modules_change_disabled($enable_module, 0);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.''); $modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
$modulo_nombre = $modulo_nombre['nombre']; $modulo_nombre = io_safe_output($modulo_nombre['nombre']);
if ($result === NOERR) { if ($result === NOERR) {
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]); enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
@ -2182,7 +2182,7 @@ if ($enable_module) {
if ($disable_module) { if ($disable_module) {
$result = modules_change_disabled($disable_module, 1); $result = modules_change_disabled($disable_module, 1);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.''); $modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
$modulo_nombre = $modulo_nombre['nombre']; $modulo_nombre = io_safe_output($modulo_nombre['nombre']);
if ($result === NOERR) { if ($result === NOERR) {
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]); enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);

View File

@ -115,7 +115,7 @@ if ($agent_to_delete) {
if ($enable_agent) { if ($enable_agent) {
$result = db_process_sql_update('tagente', ['disabled' => 0], ['id_agente' => $enable_agent]); $result = db_process_sql_update('tagente', ['disabled' => 0], ['id_agente' => $enable_agent]);
$alias = agents_get_alias($enable_agent); $alias = io_safe_output(agents_get_alias($enable_agent));
if ($result) { if ($result) {
// Update the agent from the metaconsole cache. // Update the agent from the metaconsole cache.
@ -137,7 +137,7 @@ if ($enable_agent) {
if ($disable_agent) { if ($disable_agent) {
$result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]); $result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]);
$alias = agents_get_alias($disable_agent); $alias = io_safe_output(agents_get_alias($disable_agent));
if ($result) { if ($result) {
// Update the agent from the metaconsole cache. // Update the agent from the metaconsole cache.

View File

@ -208,18 +208,21 @@ if ($delete_alert) {
$agent_alias = agents_get_alias( $agent_alias = agents_get_alias(
db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module) db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module)
); );
$unsafe_alert_template_name = io_safe_output($alert_template_name);
$unsafe_module_name = io_safe_output($module_name);
$unsafe_agent_alias = io_safe_output($agent_alias);
$result = alerts_delete_alert_agent_module($id_alert_agent_module); $result = alerts_delete_alert_agent_module($id_alert_agent_module);
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
'Alert management', 'Alert management',
"Deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_alias'" "Deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
); );
} else { } else {
db_pandora_audit( db_pandora_audit(
'Alert management', 'Alert management',
"Fail to deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_alias'" "Fail to deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
); );
} }

View File

@ -179,7 +179,7 @@ if ($id_profile || $new_profile) {
$id_audit = db_pandora_audit( $id_audit = db_pandora_audit(
'User management', 'User management',
'Edit profile '.$name 'Edit profile '.io_safe_output($name)
); );
enterprise_include_once('include/functions_audit.php'); enterprise_include_once('include/functions_audit.php');

View File

@ -125,7 +125,7 @@ if (is_ajax()) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
'Deleted profile for user '.io_safe_input($id2), 'Deleted profile for user '.io_safe_output($id2),
false, false,
false, false,
'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo'] 'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo']
@ -146,7 +146,7 @@ if (is_ajax()) {
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
__('Deleted user %s', io_safe_input($id_user)) __('Deleted user %s', io_safe_output($id_user))
); );
} }
@ -168,7 +168,7 @@ if (is_ajax()) {
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
__('Deleted user %s from metaconsole', io_safe_input($id_user)) __('Deleted user %s from metaconsole', io_safe_output($id_user))
); );
} }
@ -427,7 +427,7 @@ if ($create_user) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
'Created user '.io_safe_input($id), 'Created user '.io_safe_output($id),
false, false,
false, false,
$info $info
@ -470,7 +470,7 @@ if ($create_user) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
'Added profile for user '.io_safe_input($id2), 'Added profile for user '.io_safe_output($id2),
false, false,
false, false,
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags 'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags
@ -661,7 +661,7 @@ if ($update_user) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
'Updated user '.io_safe_input($id), 'Updated user '.io_safe_output($id),
false, false,
false, false,
$info $info
@ -729,7 +729,7 @@ if ($add_profile && empty($json_profile)) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
'Added profile for user '.io_safe_input($id2), 'Added profile for user '.io_safe_output($id2),
false, false,
false, false,
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags 'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags

View File

@ -81,7 +81,7 @@ if ($delete_profile) {
} else { } else {
db_pandora_audit( db_pandora_audit(
'Profile management', 'Profile management',
'Delete profile '.$profile['name'] 'Delete profile '.io_safe_output($profile['name'])
); );
ui_print_success_message(__('Successfully deleted')); ui_print_success_message(__('Successfully deleted'));
} }
@ -196,7 +196,7 @@ if ($update_profile) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
'Update profile '.$name, 'Update profile '.io_safe_output($name),
false, false,
false, false,
$info $info
@ -247,7 +247,7 @@ if ($create_profile) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
'Created profile '.$name, 'Created profile '.io_safe_output($name),
false, false,
false, false,
$info $info

View File

@ -171,7 +171,7 @@ if (isset($_GET['user_del'])) {
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
'User management', 'User management',
__('Deleted user %s', io_safe_input($id_user)) __('Deleted user %s', io_safe_output($id_user))
); );
} }