From 07ed6689d695f0e7e32c56cfc35a299c8076b348 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Tue, 8 Feb 2022 13:56:19 +0100 Subject: [PATCH 01/26] external alerts new filters pandora_enterprise#7933 --- pandora_console/include/functions_html.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index da12915fc8..eb678abd68 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -4827,7 +4827,13 @@ function html_print_input($data, $wrapper='div', $input_only=false) ((isset($data['size']) === true) ? $data['size'] : false), ((isset($data['modal']) === true) ? $data['modal'] : false), ((isset($data['message']) === true) ? $data['message'] : ''), - ((isset($data['select_all']) === true) ? $data['select_all'] : false) + ((isset($data['select_all']) === true) ? $data['select_all'] : false), + ((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false), + ((isset($data['required']) === true) ? $data['required'] : false), + ((isset($data['truncate_size']) === true) ? $data['truncate_size'] : false), + ((isset($data['select2_enable']) === true) ? $data['select2_enable'] : true), + ((isset($data['select2_multiple_enable']) === true) ? $data['select2_multiple_enable'] : false), + ((isset($data['select2_multiple_enable_all']) === true) ? $data['select2_multiple_enable_all'] : false) ); break; From 625438c1c3b8e1a34c51e2098b73b3b1642cf873 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Wed, 9 Feb 2022 10:51:18 +0100 Subject: [PATCH 02/26] clean file planned_downtime pandora_enterprise#5886 --- .../godmode/agentes/planned_downtime.list.php | 561 ++++++++++++------ 1 file changed, 385 insertions(+), 176 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index cdd8bae876..a40a6346b0 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -1,27 +1,53 @@ '; } @@ -63,12 +90,15 @@ ui_print_page_header( $id_downtime = (int) get_parameter('id_downtime', 0); $stop_downtime = (bool) get_parameter('stop_downtime'); -// STOP DOWNTIME -if ($stop_downtime) { +// STOP DOWNTIME. +if ($stop_downtime === true) { $downtime = db_get_row('tplanned_downtime', 'id', $id_downtime); - // Check AD permission on the downtime - if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) { + // Check AD permission on the downtime. + if (empty($downtime) === true + || ((bool) check_acl($config['id_user'], $downtime['id_group'], 'AD') === false + && (bool) check_acl($config['id_user'], $downtime['id_group'], 'AW') === false) + ) { db_pandora_audit( 'ACL Violation', 'Trying to access downtime scheduler' @@ -80,7 +110,9 @@ if ($stop_downtime) { $result = planned_downtimes_stop($downtime); if ($result === false) { - ui_print_error_message(__('An error occurred stopping the scheduled downtime')); + ui_print_error_message( + __('An error occurred stopping the scheduled downtime') + ); } else { echo $result['message']; } @@ -88,11 +120,14 @@ if ($stop_downtime) { $delete_downtime = (int) get_parameter('delete_downtime'); // DELETE WHOLE DOWNTIME! -if ($delete_downtime) { +if (empty($delete_downtime) === false) { $downtime = db_get_row('tplanned_downtime', 'id', $id_downtime); - // Check AD permission on the downtime - if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) { + // Check AD permission on the downtime. + if (empty($downtime) === true + || ((bool) check_acl($config['id_user'], $downtime['id_group'], 'AD') === false + && (bool) check_acl($config['id_user'], $downtime['id_group'], 'AW') === false) + ) { db_pandora_audit( 'ACL Violation', 'Trying to access downtime scheduler' @@ -102,10 +137,13 @@ if ($delete_downtime) { } // The downtime shouldn't be running!! - if ($downtime['executed']) { + if ((bool) $downtime['executed'] === true) { ui_print_error_message(__('This scheduled downtime is running')); } else { - $result = db_process_sql_delete('tplanned_downtime', ['id' => $id_downtime]); + $result = db_process_sql_delete( + 'tplanned_downtime', + ['id' => $id_downtime] + ); ui_print_result_message( $result, @@ -119,15 +157,25 @@ if ($delete_downtime) { $offset = (int) get_parameter('offset'); $filter_params = []; -$search_text = $filter_params['search_text'] = (string) get_parameter('search_text'); -$date_from = $filter_params['date_from'] = (string) get_parameter('date_from'); -$date_to = $filter_params['date_to'] = (string) get_parameter('date_to'); -$execution_type = $filter_params['execution_type'] = (string) get_parameter('execution_type'); -$show_archived = $filter_params['archived'] = (bool) get_parameter('archived'); -$agent_id = $filter_params['agent_id'] = (int) get_parameter('agent_id'); -$agent_name = $filter_params['agent_name'] = (string) (!empty($agent_id) ? get_parameter('agent_name') : ''); -$module_id = $filter_params['module_id'] = (int) get_parameter('module_name_hidden'); -$module_name = $filter_params['module_name'] = (string) (!empty($module_id) ? get_parameter('module_name') : ''); +$search_text = (string) get_parameter('search_text'); +$date_from = (string) get_parameter('date_from'); +$date_to = (string) get_parameter('date_to'); +$execution_type = (string) get_parameter('execution_type'); +$show_archived = (bool) get_parameter('archived'); +$agent_id = (int) get_parameter('agent_id'); +$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : ''); +$module_id = (int) get_parameter('module_name_hidden'); +$module_name = (string) ((empty($module_id) === false) ? get_parameter('module_name') : ''); + +$filter_params['search_text'] = $search_text; +$filter_params['date_from'] = $date_from; +$filter_params['date_to'] = $date_to; +$filter_params['execution_type'] = $execution_type; +$filter_params['archived'] = $show_archived; +$filter_params['agent_id'] = $agent_id; +$filter_params['agent_name'] = $agent_name; +$filter_params['module_id'] = $module_id; +$filter_params['module_name'] = $module_name; $filter_params_str = http_build_query($filter_params); @@ -141,11 +189,32 @@ $table_form->data = []; $row = []; // Search text. -$row[] = __('Search').' '.html_print_input_text('search_text', $search_text, '', 50, 250, true); +$row[] = __('Search').' '.html_print_input_text( + 'search_text', + $search_text, + '', + 50, + 250, + true +); // Dates. -$date_inputs = __('From').' '.html_print_input_text('date_from', $date_from, '', 10, 10, true); +$date_inputs = __('From').' '.html_print_input_text( + 'date_from', + $date_from, + '', + 10, + 10, + true +); $date_inputs .= '  '; -$date_inputs .= __('To').' '.html_print_input_text('date_to', $date_to, '', 10, 10, true); +$date_inputs .= __('To').' '.html_print_input_text( + 'date_to', + $date_to, + '', + 10, + 10, + true +); $row[] = $date_inputs; $table_form->data[] = $row; @@ -157,9 +226,24 @@ $execution_type_fields = [ 'once' => __('Once'), 'periodically' => __('Periodically'), ]; -$row[] = __('Execution type').' '.html_print_select($execution_type_fields, 'execution_type', $execution_type, '', __('Any'), '', true, false, false); +$row[] = __('Execution type').' '.html_print_select( + $execution_type_fields, + 'execution_type', + $execution_type, + '', + __('Any'), + '', + true, + false, + false +); // Show past downtimes. -$row[] = __('Show past downtimes').' '.html_print_checkbox('archived', 1, $show_archived, true); +$row[] = __('Show past downtimes').' '.html_print_checkbox( + 'archived', + 1, + $show_archived, + true +); $table_form->data[] = $row; @@ -178,48 +262,84 @@ $agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params); $row[] = $agent_input; // Module. -$row[] = __('Module').' '.html_print_autocomplete_modules('module_name', $module_name, false, true, '', [], true); +$row[] = __('Module').' '.html_print_autocomplete_modules( + 'module_name', + $module_name, + false, + true, + '', + [], + true +); -$row[] = html_print_submit_button(__('Search'), 'search', false, 'class="sub search"', true); +$row[] = html_print_submit_button( + __('Search'), + 'search', + false, + 'class="sub search"', + true +); $table_form->data[] = $row; // End of table filter. // Useful to know if the user has done a form filtering. $filter_performed = false; +$downtimes = []; $groups = users_get_groups(false, $access); -if (!empty($groups)) { +if (empty($groups) === false) { $where_values = '1=1'; $groups_string = implode(',', array_keys($groups)); - $where_values .= " AND id_group IN ($groups_string)"; + $where_values .= sprintf(' AND id_group IN (%s)', $groups_string); // WARNING: add $filter_performed = true; to any future filter. - if (!empty($search_text)) { + if (empty($search_text) === false) { $filter_performed = true; - - $where_values .= " AND (name LIKE '%$search_text%' OR description LIKE '%$search_text%')"; + $where_values .= sprintf( + ' AND (name LIKE "%%s%" OR description LIKE "%%s%")', + $search_text, + $search_text + ); } - if (!empty($execution_type)) { + if (empty($execution_type) === false) { $filter_performed = true; - - $where_values .= " AND type_execution = '$execution_type'"; + $where_values .= sprintf(' AND type_execution = "%s"', $execution_type); } - if (!empty($date_from)) { + if (empty($date_from) === false) { $filter_performed = true; - - $where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_from >= '".strtotime("$date_from 00:00:00")."'))"; + $where_values .= sprintf( + ' AND (type_execution = "periodically" + OR (type_execution = "once" + AND date_from >= "%s") + )', + strtotime($date_from.' 00:00:00') + ); } - if (!empty($date_to)) { + if (empty($date_to) === false) { $filter_performed = true; - - $periodically_monthly_w = "type_periodicity = 'monthly' - AND ((periodically_day_from <= '".date('d', strtotime($date_from))."' AND periodically_day_to >= '".date('d', strtotime($date_to))."') - OR (periodically_day_from > periodically_day_to - AND (periodically_day_from <= '".date('d', strtotime($date_from))."' OR periodically_day_to >= '".date('d', strtotime($date_to))."')))"; + $periodically_monthly_w = sprintf( + 'type_periodicity = "monthly" AND ( + ( + periodically_day_from <= "%s" + AND periodically_day_to >= "%s" + ) + OR ( + periodically_day_from > periodically_day_to + AND ( + periodically_day_from <= "%s" + OR periodically_day_to >= "%s" + ) + ) + )', + date('d', strtotime($date_from)), + date('d', strtotime($date_to)), + date('d', strtotime($date_from)), + date('d', strtotime($date_to)) + ); $periodically_weekly_days = []; $date_from_aux = strtotime($date_from); @@ -229,7 +349,7 @@ if (!empty($groups)) { while ($date_from_aux <= $date_end && $days_number < 7) { $weekday_actual = strtolower(date('l', $date_from_aux)); - $periodically_weekly_days[] = "$weekday_actual = 1"; + $periodically_weekly_days[] = $weekday_actual.' = 1'; $date_from_aux = ($date_from_aux + SECONDS_1DAY); $days_number++; @@ -237,36 +357,60 @@ if (!empty($groups)) { $periodically_weekly_w = "type_periodicity = 'weekly' AND (".implode(' OR ', $periodically_weekly_days).')'; - $periodically_w = "type_execution = 'periodically' AND (($periodically_monthly_w) OR ($periodically_weekly_w))"; + $periodically_w = sprintf( + 'type_execution = "periodically" AND ((%s) OR (%s))', + $periodically_monthly_w, + $periodically_weekly_w + ); - $once_w = "type_execution = 'once' AND date_to <= '".strtotime("$date_to 23:59:59")."'"; + $once_w = sprintf( + 'type_execution = "once" AND date_to <= "%s"', + strtotime($date_to.' 23:59:59') + ); - $where_values .= " AND (($periodically_w) OR ($once_w))"; + $where_values .= sprintf( + ' AND ((%s) OR (%s))', + $periodically_w, + $once_w + ); } - if (!$show_archived) { + if ($show_archived === false) { $filter_performed = true; - - $where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_to >= '".time()."'))"; + $where_values .= sprintf( + ' AND (type_execution = "periodically" + OR (type_execution = "once" + AND date_to >= "%s"))', + time() + ); } - if (!empty($agent_id)) { + if (empty($agent_id) === false) { $filter_performed = true; - - $where_values .= " AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = $agent_id)"; + $where_values .= sprintf( + ' AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = %d)', + $agent_id + ); } - if (!empty($module_id)) { + if (empty($module_id) === false) { $filter_performed = true; - - $where_values .= " AND (id IN (SELECT id_downtime - FROM tplanned_downtime_modules - WHERE id_agent_module = $module_id) - OR id IN (SELECT id_downtime - FROM tplanned_downtime_agents tpda, tagente_modulo tam - WHERE tpda.id_agent = tam.id_agente - AND tam.id_agente_modulo = $module_id - AND tpda.all_modules = 1))"; + $where_values .= sprintf( + ' AND (id IN ( + SELECT id_downtime + FROM tplanned_downtime_modules + WHERE id_agent_module = %d) + OR id IN ( + SELECT id_downtime + FROM tplanned_downtime_agents tpda, tagente_modulo tam + WHERE tpda.id_agent = tam.id_agente + AND tam.id_agente_modulo = %d + AND tpda.all_modules = 1 + ) + )', + $module_id, + $module_id + ); } // Columns of the table tplanned_downtime. @@ -296,68 +440,41 @@ if (!empty($groups)) { 'id_user', ]; - switch ($config['dbtype']) { - case 'mysql': - case 'postgresql': - $columns_str = implode(',', $columns); - $sql = "SELECT $columns_str - FROM tplanned_downtime - WHERE $where_values - ORDER BY type_execution DESC, date_from DESC - LIMIT ".$config['block_size']." - OFFSET $offset"; - break; + $columns_str = implode(',', $columns); + $sql = sprintf( + 'SELECT %s + FROM tplanned_downtime + WHERE %s + ORDER BY type_execution DESC, date_from DESC + LIMIT %d + OFFSET %d', + $columns_str, + $where_values, + $config['block_size'], + $offset + ); - case 'oracle': - // Oracle doesn't have TIME type, so we should transform the DATE value - $new_time_from = "TO_CHAR(periodically_time_from, 'HH24:MI:SS') AS periodically_time_from"; - $new_time_to = "TO_CHAR(periodically_time_to, 'HH24:MI:SS') AS periodically_time_to"; - - $time_from_key = array_search('periodically_time_from', $columns); - $time_to_key = array_search('periodically_time_to', $columns); - - if ($time_from_key !== false) { - $columns[$time_from_key] = $new_time_from; - } - - if ($time_to_key !== false) { - $columns[$time_to_key] = $new_time_to; - } - - $columns_str = implode(',', $columns); - - $set = []; - $set['limit'] = $config['block_size']; - $set['offset'] = $offset; - - $sql = "SELECT $columns_str - FROM tplanned_downtime - WHERE $where_values - ORDER BY type_execution DESC, date_from DESC"; - - $sql = oracle_recode_query($sql, $set); - break; - } - - $sql_count = "SELECT COUNT(id) AS num - FROM tplanned_downtime - WHERE $where_values"; + $sql_count = sprintf( + 'SELECT COUNT(id) AS num + FROM tplanned_downtime + WHERE %s', + $where_values + ); $downtimes = db_get_all_rows_sql($sql); $downtimes_number_res = db_get_all_rows_sql($sql_count); - $downtimes_number = $downtimes_number_res != false ? $downtimes_number_res[0]['num'] : 0; -} else { - $downtimes = []; + $downtimes_number = ($downtimes_number_res !== false) ? $downtimes_number_res[0]['num'] : 0; } +$url_list = 'index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'; +$url_editor = 'index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor'; // No downtimes cause the user has not anyone. -if (!$downtimes && !$filter_performed) { +if ($downtimes === false && $filter_performed === false) { include_once $config['homedir'].'/general/first_task/planned_downtime.php'; -} -// No downtimes cause the user performed a search. -else if (!$downtimes) { +} else if ($downtimes === false) { + // No downtimes cause the user performed a search. // Filter form. - echo "
"; + echo ''; html_print_table($table_form); echo '
'; @@ -367,22 +484,25 @@ else if (!$downtimes) { echo '
'; // Create button. - if ($write_permisson) { + if ($write_permisson === true) { echo ' '; - echo '
'; + echo ''; html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); echo '
'; } echo '
'; -} -// Has downtimes. -else { - echo "
"; +} else { + // Has downtimes. + echo ''; html_print_table($table_form); echo '
'; - ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset); + ui_pagination( + $downtimes_number, + $url_list.'&'.$filter_params_str, + $offset + ); // User groups with AR, AD or AW permission. $groupsAD = users_get_groups($config['id_user'], $access); @@ -403,7 +523,9 @@ else { $table->head['configuration'] = __('Configuration'); $table->head['running'] = __('Running'); - if ($write_permisson || $manage_permisson) { + if ($write_permisson === true + || $manage_permisson === true + ) { $table->head['stop'] = __('Stop downtime'); $table->head['copy'] = __('Copy'); $table->head['edit'] = __('Edit'); @@ -414,7 +536,9 @@ else { $table->align['group'] = 'center'; $table->align['running'] = 'center'; - if ($write_permisson || $manage_permisson) { + if ($write_permisson === true + || $manage_permisson === true + ) { $table->align['stop'] = 'center'; $table->align['edit'] = 'center'; $table->align['delete'] = 'center'; @@ -430,7 +554,7 @@ else { WHERE id_downtime = '.$downtime['id'] ); - $data['name'] = $downtime['name']." ($total)"; + $data['name'] = $downtime['name'].' ('.$total.')'; $data['description'] = $downtime['description']; $data['group'] = ui_print_group_icon($downtime['id_group'], true); @@ -451,7 +575,7 @@ else { $data['configuration'] = reporting_format_planned_downtime_dates($downtime); - if ($downtime['executed'] == 0) { + if ((int) $downtime['executed'] === 0) { $data['running'] = html_print_image( 'images/pixel_red.png', true, @@ -474,43 +598,105 @@ else { } // If user have writting permissions. - if (in_array($downtime['id_group'], $groupsAD)) { - // Stop button - if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) { - if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') - || check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') + if (in_array($downtime['id_group'], $groupsAD) === true) { + // Stop button. + if ($downtime['type_execution'] === 'once' + && (int) $downtime['executed'] === 1 + ) { + if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true + || (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true ) { - $data['stop'] = ''.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]); + $url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; + $data['stop'] = ''; + $data['stop'] .= html_print_image( + 'images/cancel.png', + true, + ['title' => __('Stop downtime')] + ); } else { - $data['stop'] = html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]); + $data['stop'] = html_print_image( + 'images/cancel.png', + true, + ['title' => __('Stop downtime')] + ); } } else { $data['stop'] = ''; } // Edit & delete buttons. - if ($downtime['executed'] == 0) { - if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') - || check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') + if ((int) $downtime['executed'] === 0) { + if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true + || (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true ) { // Copy. - $data['copy'] = ''.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).''; + $data['copy'] = ''; + $data['copy'] .= html_print_image( + 'images/copy.png', + true, + [ + 'title' => __('Copy'), + 'class' => 'invert_filter', + ] + ); + $data['copy'] .= ''; + // Edit. - $data['edit'] = ''.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).''; + $data['edit'] = ''; + $data['edit'] .= html_print_image( + 'images/config.png', + true, + [ + 'title' => __('Update'), + 'class' => 'invert_filter', + ] + ); + $data['edit'] .= ''; + // Delete. - $data['delete'] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']); + $url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; + $data['delete'] = ''; + $data['delete'] .= html_print_image( + 'images/cross.png', + true, + [ + 'title' => __('Delete'), + 'class' => 'invert_filter', + ] + ); + $data['delete'] .= ''; } else { $data['edit'] = ''; $data['delete'] = ''; } - } else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') { - if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') - || check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') + } else if ((int) $downtime['executed'] === 1 + && $downtime['type_execution'] === 'once' + ) { + if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true + || (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true ) { // Copy. - $data['copy'] = ''.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).''; + $data['copy'] = ''; + $data['copy'] .= html_print_image( + 'images/copy.png', + true, + [ + 'title' => __('Copy'), + 'class' => 'invert_filter', + ] + ); + $data['copy'] .= ''; // Edit. - $data['edit'] = ''.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).''; + $data['edit'] = ''; + $data['edit'] .= html_print_image( + 'images/config.png', + true, + [ + 'title' => __('Update'), + 'class' => 'invert_filter', + ] + ); + $data['edit'] .= ''; // Delete. $data['delete'] = __('N/A'); } else { @@ -529,7 +715,9 @@ else { $data['delete'] = ''; } - if (!empty($malformed_downtimes_exist) && isset($malformed_downtimes[$downtime['id']])) { + if (empty($malformed_downtimes_exist) === false + && isset($malformed_downtimes[$downtime['id']]) === true + ) { $next_row_num = count($table->data); $table->cellstyle[$next_row_num][0] = 'color: red'; $table->cellstyle[$next_row_num][1] = 'color: red'; @@ -542,7 +730,17 @@ else { } html_print_table($table); - ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom'); + ui_pagination( + $downtimes_number, + $url_list.'&'.$filter_params_str, + $offset, + 0, + false, + 'offset', + true, + 'pagination-bottom' + ); + echo '
'; // CSV export button. @@ -551,23 +749,31 @@ else { __('Export to CSV'), 'csv_export', false, - "location.href='godmode/agentes/planned_downtime.export_csv.php?$filter_params_str'", + 'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"', 'class="sub next"' ); echo '
'; // Create button. - if ($write_permisson) { + if ($write_permisson === true) { echo ' '; - echo '
'; - html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); + echo ''; + html_print_submit_button( + __('Create'), + 'create', + false, + 'class="sub next"' + ); echo '
'; } echo ''; } -ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/'); +ui_require_jquery_file( + 'ui.datepicker-'.get_user_language(), + 'include/javascript/i18n/' +); ?> diff --git a/pandora_console/include/styles/menu.css b/pandora_console/include/styles/menu.css index d514771eea..ebf201c761 100644 --- a/pandora_console/include/styles/menu.css +++ b/pandora_console/include/styles/menu.css @@ -389,7 +389,7 @@ ul li { .button_collapse { margin-top: auto; - height: 38px; + min-height: 38px; background-color: #505050; text-align: center; color: #fff; @@ -427,7 +427,6 @@ ul li { } .button_classic { - width: 215px; background-image: url(../../images/button_collapse_menu.png); background-repeat: no-repeat; background-position: center; @@ -440,7 +439,7 @@ ul li { } /* Menu height: 601px, 720px, 735px */ -@media screen and (max-height: 720px) { +@media screen and (max-height: 750px) { .menu li, .menu li a, .menu li div { @@ -448,7 +447,7 @@ ul li { } } -@media screen and (max-height: 735px) { +@media screen and (max-height: 750px) { .operation { padding-top: 10px; } From 2a37503f2ee21d59c2538b4ca72e5c8beb814a3c Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Thu, 10 Feb 2022 16:33:58 +0100 Subject: [PATCH 05/26] new item report agent/modules status pandora_enterprise#7653 --- .../reporting_builder.item_editor.php | 4 + .../godmode/reporting/reporting_builder.php | 2 + pandora_console/include/functions_agents.php | 75 ++++++++++ .../include/functions_reporting.php | 137 ++++++++++++++++++ .../include/functions_reporting_html.php | 123 ++++++++++++++++ pandora_console/include/functions_reports.php | 5 + pandora_console/include/functions_ui.php | 14 +- 7 files changed, 354 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index b98b651201..20476c6f7b 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -743,6 +743,7 @@ switch ($action) { break; case 'agent_module': + case 'agent_module_status': $description = $item['description']; $es = json_decode($item['external_source'], true); @@ -4744,6 +4745,7 @@ $(document).ready (function () { switch (type){ case 'agent_module': + case 'agent_module_status': case 'alert_report_actions': var agents_multiple = $('#id_agents2').val(); var modules_multiple = $('#module').val(); @@ -4878,6 +4880,7 @@ $(document).ready (function () { } switch (type){ case 'agent_module': + case 'agent_module_status': case 'alert_report_actions': var agents_multiple = $('#id_agents2').val(); var modules_multiple = $('#module').val(); @@ -6345,6 +6348,7 @@ function chooseType() { break; case 'agent_module': + case 'agent_module_status': $("#row_description").show(); $("#row_group").show(); $("#row_module_group").show(); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 9d42914034..5a4badf700 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1653,6 +1653,7 @@ switch ($action) { break; case 'agent_module': + case 'agent_module_status': $agents_to_report_text = get_parameter('id_agents2-multiple-text', ''); $modules_to_report_text = get_parameter('module-multiple-text', ''); @@ -2454,6 +2455,7 @@ switch ($action) { break; case 'agent_module': + case 'agent_module_status': $agents_to_report_text = get_parameter('id_agents2-multiple-text'); $modules_to_report_text = get_parameter('module-multiple-text', ''); diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 91bdfd2fe1..f0adb1267b 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -4167,3 +4167,78 @@ function get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups return $agents; } + + +/** + * Agent Module status and data + * + * @param integer $id_group Group + * @param array $agents Agents filter. + * @param array $modules Modules filter. + * + * @return array Result. + */ +function get_status_data_agent_modules($id_group, $agents=[], $modules=[]) +{ + $slq_filter_group = ''; + if (empty($id_group) === false) { + $slq_filter_group = sprintf( + ' AND tagente.id_group = %d', + $id_group + ); + } + + $slq_filter_agent = ''; + if (empty($agents) === false) { + $slq_filter_agent = sprintf( + ' AND tagente_modulo.id_agente IN (%s)', + implode(',', $agents) + ); + } + + $slq_filter_module = ''; + if (empty($modules) === false) { + $slq_filter_module = sprintf( + ' AND tagente_modulo.id_agente_modulo IN (%s)', + implode(',', $modules) + ); + } + + $sql = sprintf( + 'SELECT tagente_modulo.id_agente_modulo as id_agent_module, + tagente_modulo.nombre as name_module, + tagente_modulo.unit as unit_module, + tagente_modulo.id_agente as id_agent, + tagente_estado.datos as data_module, + tagente_estado.timestamp as data_time_module, + tagente_estado.estado as status_module, + tagente.alias as name_agent, + tagente.id_grupo as id_group, + tgrupo.nombre as name_group + FROM tagente_modulo + INNER JOIN tagente_estado + ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + INNER JOIN tagente + ON tagente_modulo.id_agente = tagente.id_agente + LEFT JOIN tagent_secondary_group + ON tagente.id_agente = tagent_secondary_group.id_agent + INNER JOIN tgrupo + ON tagente.id_grupo = tgrupo.id_grupo + WHERE 1=1 + %s + %s + %s + ', + $slq_filter_group, + $slq_filter_agent, + $slq_filter_module + ); + + $res = db_get_all_rows_sql($sql); + + if ($res === false) { + $res = []; + } + + return $res; +} diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 9ccd8e1ff0..231b280179 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -739,6 +739,13 @@ function reporting_make_reporting_data( ); break; + case 'agent_module_status': + $report['contents'][] = reporting_agent_module_status( + $report, + $content + ); + break; + case 'alert_report_actions': $report['contents'][] = reporting_alert_report_actions( $report, @@ -2863,6 +2870,136 @@ function reporting_agent_module($report, $content) } +/** + * Agents module status + * + * @param array $report Info Report. + * @param array $content Info content. + * + * @return array + */ +function reporting_agent_module_status($report, $content) +{ + global $config; + $return['type'] = 'agent_module_status'; + + if (empty($content['name'])) { + $content['name'] = __('Agent/Modules Status'); + } + + $return['title'] = io_safe_output($content['name']); + $return['landscape'] = $content['landscape']; + $return['pagebreak'] = $content['pagebreak']; + $group_name = groups_get_name($content['id_group'], true); + if ($content['id_module_group'] == 0) { + $module_group_name = __('All'); + } else { + $module_group_name = db_get_value( + 'name', + 'tmodule_group', + 'id_mg', + $content['id_module_group'] + ); + } + + $return['subtitle'] = $group_name.' - '.$module_group_name; + $return['description'] = io_safe_output($content['description']); + $return['date'] = reporting_get_date_text($report, $content); + $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : ''; + + $return['data'] = []; + + $external_source = json_decode( + $content['external_source'], + true + ); + + $agents = json_decode( + io_safe_output( + base64_decode($external_source['id_agents']) + ), + true + ); + + $modules = json_decode( + io_safe_output( + base64_decode($external_source['module']) + ), + true + ); + + if (is_metaconsole() === true) { + $agents_per_node = []; + $modules_per_node = []; + + if (empty($agents) === false) { + foreach ($agents as $value) { + $agent_array = explode('|', $value); + $agents_per_node[$agent_array[0]][] = $agent_array[1]; + } + } + + if (empty($modules) === false) { + foreach ($modules as $value) { + $module_array = explode('|', $value); + $modules_per_node[$module_array[0]][] = $module_array[1]; + } + } + + if (empty($agents_per_node) === false) { + foreach ($agents_per_node as $server => $agents) { + $connection = metaconsole_get_connection_by_id($server); + if (metaconsole_connect($connection) != NOERR) { + continue; + } + + $res[$connection['server_name']] = get_status_data_agent_modules( + $content['id_group'], + $agents, + $modules_per_node[$server] + ); + + metaconsole_restore_db(); + } + } else { + $metaconsole_connections = metaconsole_get_connection_names(); + // For all nodes. + if (isset($metaconsole_connections) === true + && is_array($metaconsole_connections) === true + ) { + foreach ($metaconsole_connections as $metaconsole) { + // Get server connection data. + $server_data = metaconsole_get_connection($metaconsole); + + // Establishes connection. + if (metaconsole_load_external_db($server_data) !== NOERR) { + continue; + } + + $res[$server_data['server_name']] = get_status_data_agent_modules( + $content['id_group'], + $agents, + $modules + ); + + metaconsole_restore_db(); + } + } + } + } else { + $res['node'] = get_status_data_agent_modules( + $content['id_group'], + $agents, + $modules + ); + } + + $return['data'] = $res; + + return reporting_check_structure_content($return); +} + + function reporting_exception( $report, $content, diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 92e20da72e..504fbe0791 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -377,6 +377,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) reporting_html_agent_module($table, $item); break; + case 'agent_module_status': + reporting_html_agent_module_status($table, $item); + break; + case 'alert_report_actions': reporting_html_alert_report_actions($table, $item); break; @@ -2000,6 +2004,125 @@ function reporting_html_agent_module($table, $item) } +/** + * Html report agent modules status. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param integer $pdf Pdf output. + * + * @return mixed + */ +function reporting_html_agent_module_status($table, $item, $pdf=0) +{ + global $config; + + $return_pdf = ''; + + if (empty($item['data']) === true) { + if ($pdf !== 0) { + $return_pdf .= __('No items'); + } else { + $table->colspan['group_report']['cell'] = 3; + $table->cellstyle['group_report']['cell'] = 'text-align: center;'; + $table->data['group_report']['cell'] = __('No items'); + } + } else { + $table_info = new stdClass(); + $table_info->width = '99%'; + + $table_info->align = []; + if (is_metaconsole() === true) { + $table_info->align['server'] = 'left'; + } + + $table_info->align['name_group'] = 'left'; + $table_info->align['name_agent'] = 'left'; + $table_info->align['name_module'] = 'left'; + $table_info->align['status_module'] = 'left'; + $table_info->align['data_module'] = 'left'; + $table_info->align['data_time_module'] = 'left'; + + $table_info->headstyle = []; + if (is_metaconsole() === true) { + $table_info->headstyle['server'] = 'text-align: left'; + } + + $table_info->headstyle['name_group'] = 'text-align: left'; + $table_info->headstyle['name_agent'] = 'text-align: left'; + $table_info->headstyle['name_module'] = 'text-align: left'; + $table_info->headstyle['status_module'] = 'text-align: left'; + $table_info->headstyle['data_module'] = 'text-align: left'; + $table_info->headstyle['data_time_module'] = 'text-align: left'; + + $table_info->head = []; + if (is_metaconsole() === true) { + $table_info->head['server'] = __('Server'); + } + + $table_info->head['name_group'] = __('Group'); + $table_info->head['name_agent'] = __('Agent'); + $table_info->head['name_module'] = __('Module'); + $table_info->head['status_module'] = __('Status'); + $table_info->head['data_module'] = __('Data'); + $table_info->head['data_time_module'] = __('Last time'); + + $table_info->data = []; + + foreach ($item['data'] as $server => $info) { + foreach ($info as $data) { + $row = []; + if (is_metaconsole() === true) { + $row['server'] = $server; + } + + $row['name_group'] = $data['name_group']; + $row['name_agent'] = $data['name_agent']; + $row['name_module'] = $data['name_module']; + $row['status_module'] = ui_print_module_status( + $data['status_module'], + true, + 'status_rounded_rectangles', + null, + ($pdf === 1) ? '       ' : '' + ); + + if (is_numeric($data['data_module']) === true) { + $row['data_module'] = remove_right_zeros( + number_format( + $data['data_module'], + $config['graph_precision'] + ) + ); + } else { + $row['data_module'] = (empty($data['data_module']) === true) ? '--' : $data['data_module']; + } + + $row['data_module'] .= $data['unit_module']; + $row['data_time_module'] = $data['data_time_module']; + + $table_info->data[] = $row; + } + } + + if ($pdf !== 0) { + $table_info->title = $item['title']; + $table_info->titleclass = 'title_table_pdf'; + $table_info->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table_info, true); + } else { + $table->colspan['data']['cell'] = 3; + $table->cellstyle['data']['cell'] = 'text-align: center;'; + $table->data['data']['cell'] = html_print_table($table_info, true); + } + } + + if ($pdf !== 0) { + return $return_pdf; + } +} + + /** * Function to print to HTML Exception report. * diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index f310856ad2..a6811f3ffd 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -796,6 +796,11 @@ function reports_get_report_types($template=false, $not_editor=false) } } + $types['agent_module_status'] = [ + 'optgroup' => __('Grouped'), + 'name' => __('Agents/Modules status'), + ]; + // Only pandora managers have access to the whole database. if (check_acl($config['id_user'], 0, 'PM')) { $types['sql'] = [ diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 44280b6bb3..d2fd2d2514 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2737,10 +2737,11 @@ function ui_print_status_image( /** * Returns html code to print a shape for a module. * - * @param integer $status Module status. - * @param boolean $return True or false. - * @param string $class Custom class or use defined. - * @param string $title Custom title or inherit from module status. + * @param integer $status Module status. + * @param boolean $return True or false. + * @param string $class Custom class or use defined. + * @param string $title Custom title or inherit from module status. + * @param string $div_content Content. * * @return string HTML code for shape. */ @@ -2748,7 +2749,8 @@ function ui_print_module_status( $status, $return=false, $class='status_rounded_rectangles', - $title=null + $title=null, + $div_content='' ) { $color = modules_get_color_status($status, true); if ($title === null) { @@ -2758,7 +2760,7 @@ function ui_print_module_status( $output = '
'; + $output .= $title.'" data-use_title_for_force_title="1">'.$div_content.''; if ($return === false) { echo $output; From aa2dac137310878114c5a9730df3641fdfed3710 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Fri, 11 Feb 2022 09:28:28 +0100 Subject: [PATCH 06/26] new item report agent/modules status pandora_enterprise#7653 --- .../godmode/reporting/reporting_builder.item_editor.php | 2 +- pandora_console/include/functions_agents.php | 2 +- pandora_console/include/functions_reporting_html.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 20476c6f7b..d57d930b6a 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -6348,10 +6348,10 @@ function chooseType() { break; case 'agent_module': + $("#row_module_group").show(); case 'agent_module_status': $("#row_description").show(); $("#row_group").show(); - $("#row_module_group").show(); $("#select_agent_modules").show(); $("#agents_modules_row").show(); $("#modules_row").show(); diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index f0adb1267b..0e3b82be2e 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -4183,7 +4183,7 @@ function get_status_data_agent_modules($id_group, $agents=[], $modules=[]) $slq_filter_group = ''; if (empty($id_group) === false) { $slq_filter_group = sprintf( - ' AND tagente.id_group = %d', + ' AND tagente.id_grupo = %d', $id_group ); } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 504fbe0791..833b90f606 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2060,9 +2060,9 @@ function reporting_html_agent_module_status($table, $item, $pdf=0) $table_info->head['server'] = __('Server'); } - $table_info->head['name_group'] = __('Group'); $table_info->head['name_agent'] = __('Agent'); $table_info->head['name_module'] = __('Module'); + $table_info->head['name_group'] = __('Group'); $table_info->head['status_module'] = __('Status'); $table_info->head['data_module'] = __('Data'); $table_info->head['data_time_module'] = __('Last time'); @@ -2076,9 +2076,9 @@ function reporting_html_agent_module_status($table, $item, $pdf=0) $row['server'] = $server; } - $row['name_group'] = $data['name_group']; $row['name_agent'] = $data['name_agent']; $row['name_module'] = $data['name_module']; + $row['name_group'] = $data['name_group']; $row['status_module'] = ui_print_module_status( $data['status_module'], true, From 1dbc9c72b8037e7838491f45342d8cc7ba602fbd Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 17 Feb 2022 14:12:48 +0100 Subject: [PATCH 07/26] Fix users count on index and user list --- pandora_console/godmode/users/user_list.php | 12 +++++---- .../include/functions_reporting.php | 26 ++++++++++++++++--- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 7ac3f55261..2457932339 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -545,6 +545,13 @@ if ($search) { } } +foreach ($info1 as $user_id => $user_info) { + // If user is not admin then don't display admin users. + if ($user_is_admin === false && (bool) $user_info['is_admin'] === true) { + unset($info1[$user_id]); + } +} + $info = $info1; // Prepare pagination. @@ -557,11 +564,6 @@ $rowPair = true; $iterator = 0; $cont = 0; foreach ($info as $user_id => $user_info) { - if (!$user_is_admin && $user_info['is_admin']) { - // If user is not admin then don't display admin users. - continue; - } - // User profiles. if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) { $user_profiles = db_get_all_rows_field_filter( diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 9ccd8e1ff0..7c40b92653 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -11053,11 +11053,29 @@ function reporting_get_stats_users($data) $tdata = []; $tdata[0] = html_print_image('images/user.png', true, ['title' => __('Defined users'), 'class' => 'invert_filter']); - $user_groups = users_get_strict_mode_groups($config['id_user'], false); - if (array_key_exists(0, $user_groups)) { - $users = users_get_user_users($config['id_user'], 'AR', true); + $user_is_admin = users_is_admin(); + + $users = []; + + if ($user_is_admin) { + $users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']); } else { - $users = users_get_user_users($config['id_user'], 'AR', false); + $group_um = users_get_groups_UM($config['id_user']); + // 0 is the group 'all'. + if (isset($group_um[0])) { + $users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']); + } else { + foreach ($group_um as $group => $value) { + $users = array_merge($users, users_get_users_by_group($group, $value)); + } + } + } + + foreach ($users as $user_id => $user_info) { + // If user is not admin then don't display admin users. + if ($user_is_admin === false && (bool) $user_info['is_admin'] === true) { + unset($users[$user_id]); + } } $tdata[1] = count($users); From 5458cd7a44fcb4fa85ca1d28ab89485a932e0608 Mon Sep 17 00:00:00 2001 From: Kike Date: Fri, 18 Feb 2022 10:09:18 +0100 Subject: [PATCH 08/26] Set min permissions to errorlog_file --- pandora_server/lib/PandoraFMS/Config.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 6575ec6fe4..217e133e62 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -1388,8 +1388,13 @@ sub pandora_start_log ($){ # Dump all errors to errorlog open (STDERR, ">> " . $pa_config->{'errorlog_file'}) or die " [ERROR] " . pandora_get_initial_product_name() . " can't write to Errorlog. Aborting : \n $! \n"; - my $mode = 0664; + + my $file_mode = (stat($pa_config->{'errorlog_file'}))[2] & 0777; + my $min_mode = 0664; + my $mode = $file_mode | $min_mode; + chmod $mode, $pa_config->{'errorlog_file'}; + print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $pa_config->{'servername'} . " Starting " . pandora_get_initial_product_name() . " Server. Error logging activated.\n"; } From 604633dd35a4ce12ef5473184edb454004f25201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Tue, 22 Feb 2022 12:37:01 +0100 Subject: [PATCH 09/26] Fixed issues with interfaces view and limited to show only agents with ifaces --- pandora_console/include/functions_agents.php | 9 ++++++-- .../operation/agentes/interface_view.php | 3 ++- .../operation/agentes/ver_agente.php | 23 +++++++++++++++---- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 4de4aa94b7..cde89f1b7b 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1243,6 +1243,11 @@ function agents_get_group_agents( unset($search['string']); } + if (isset($search['matchIds']) === true && is_array($search['matchIds']) === true) { + $filter[] = sprintf('id_agente IN (%s)', implode(', ', $search['matchIds'])); + unset($search['matchIds']); + } + if (isset($search['name']) === true) { $name = io_safe_input($search['name']); $filter[] = "nombre LIKE '$name'"; @@ -3223,8 +3228,8 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false) $ni_by_agents = []; foreach ($agents as $agent) { $agent_id = (isset($agent['id_agente'])) ? $agent['id_agente'] : $agent; - $agent_group_id = $agent['id_grupo']; - $agent_name = $agent['alias']; + $agent_group_id = (isset($agent['id_grupo']) === true) ? $agent['id_grupo'] : ''; + $agent_name = (isset($agent['alias']) === true) ? $agent['alias'] : ''; $agent_interfaces = []; $accepted_module_types = []; diff --git a/pandora_console/operation/agentes/interface_view.php b/pandora_console/operation/agentes/interface_view.php index 5a76a6afe3..1bba44ddc5 100644 --- a/pandora_console/operation/agentes/interface_view.php +++ b/pandora_console/operation/agentes/interface_view.php @@ -176,6 +176,7 @@ function load_agents_selector(group) { { "page" : "operation/agentes/ver_agente", "get_agents_group_json" : 1, + "get_agents_also_interfaces" : 1, "id_group" : group, "privilege" : "AW", "keys_prefix" : "_", @@ -216,6 +217,7 @@ $("#checkbox-recursion").change (function () { jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", "get_agents_group_json" : 1, + "get_agents_also_interfaces" : 1, "id_group" : $("#group_id").val(), "privilege" : "AW", "keys_prefix" : "_", @@ -226,7 +228,6 @@ $("#checkbox-recursion").change (function () { $("#module").html(''); jQuery.each (data, function (id, value) { id = id.substring(1); - option = $("") .attr ("value", value["id_agente"]) .html (value["alias"]); diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 5020d389f3..bca69043e2 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -49,6 +49,7 @@ if (is_ajax()) { $get_agent_modules_json = (bool) get_parameter('get_agent_modules_json'); $get_agent_status_tooltip = (bool) get_parameter('get_agent_status_tooltip'); $get_agents_group_json = (bool) get_parameter('get_agents_group_json'); + $get_agents_also_interfaces = (bool) get_parameter('get_agents_also_interfaces'); $get_modules_group_json = (bool) get_parameter('get_modules_group_json'); $filter_modules_group_json = (bool) get_parameter('filter_modules_group_json'); $get_modules_group_value_name_json = (bool) get_parameter('get_modules_group_value_name_json'); @@ -103,15 +104,15 @@ if (is_ajax()) { // Build filter. $filter = []; - if (!empty($id_os)) { + if (empty($id_os) === false) { $filter['id_os'] = $id_os; } - if (!empty($agent_name)) { + if (empty($agent_name) === false) { $filter['nombre'] = '%'.$agent_name.'%'; } - if (!empty($agent_alias)) { + if (empty($agent_alias) === false) { $filter['alias'] = '%'.$agent_alias.'%'; } @@ -147,6 +148,20 @@ if (is_ajax()) { } } + if ($get_agents_also_interfaces === true) { + $listAgentsWithIface = db_get_all_rows_sql("SELECT DISTINCT id_agente FROM tagente_modulo WHERE nombre LIKE '%_ifOperStatus'"); + if (empty($listAgentsWithIface) === false) { + $filter['matchIds'] = array_reduce( + $listAgentsWithIface, + function ($carry, $item) { + $carry[] = $item['id_agente']; + return $carry; + }, + [] + ); + } + } + // Perform search. $agents = agents_get_group_agents( // Id_group. @@ -171,7 +186,7 @@ if (is_ajax()) { (bool) is_metaconsole() ); - if (empty($agents)) { + if (empty($agents) === true) { $agents = []; } From 3e6a6445b1a14a7eed696be73dd6c8f740fbb295 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 22 Feb 2022 17:29:17 +0100 Subject: [PATCH 10/26] Fix error/success from send feedback dialog --- .../include/javascript/pandora_ui.js | 42 +++++++++++-------- pandora_console/include/styles/pandora.css | 1 - 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/pandora_console/include/javascript/pandora_ui.js b/pandora_console/include/javascript/pandora_ui.js index ba392f41e3..ab65b8d4cd 100644 --- a/pandora_console/include/javascript/pandora_ui.js +++ b/pandora_console/include/javascript/pandora_ui.js @@ -577,28 +577,34 @@ function confirmDialog(settings) { */ // eslint-disable-next-line no-unused-vars function generalShowMsg(data, idMsg) { - var title = "Response"; - var text = data; - var failed = false; + var title = data.title[data.error]; + var text = data.text[data.error]; + var failed = !data.error; - if (typeof data == "object") { - title = data.title || "Response"; - text = data.text || data.error || data.result; - failed = failed || data.error; - } + if (typeof data.error != "number") { + title = "Response"; + text = data; + failed = false; - if (failed) { - title = "Error"; - text = data.error; - } + if (typeof data == "object") { + title = data.title || "Response"; + text = data.text || data.error || data.result; + failed = data.failed || data.error; + } - if (idMsg == null) { - idMsg = uniqId(); - } + if (failed) { + title = "Error"; + text = data.error; + } - if ($("#" + idMsg).length === 0) { - $("body").append('
'); - $("#" + idMsg).empty(); + if (idMsg == null) { + idMsg = uniqId(); + } + + if ($("#" + idMsg).length === 0) { + $("body").append('
'); + $("#" + idMsg).empty(); + } } $("#" + idMsg).empty(); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 887d7df6c1..0b6652f5ab 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -6038,7 +6038,6 @@ form#modal_form_feedback input[type="email"] { border: none; border-radius: 0; border-bottom: 1px solid #ccc; - font-weight: lighter; padding: 0px 0px 2px 0px; box-sizing: border-box; margin-bottom: 4px; From 39a971ad5b7c6bdf24f4af99e3e1a5a2250ac799 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 24 Feb 2022 12:17:21 +0100 Subject: [PATCH 11/26] Fix permission vulnerabilities on profile massive operations --- .../godmode/massive/massive_add_profiles.php | 99 +++++++++++++------ pandora_console/include/functions_groups.php | 4 + 2 files changed, 72 insertions(+), 31 deletions(-) diff --git a/pandora_console/godmode/massive/massive_add_profiles.php b/pandora_console/godmode/massive/massive_add_profiles.php index da97d96d76..9e84c44b71 100644 --- a/pandora_console/godmode/massive/massive_add_profiles.php +++ b/pandora_console/godmode/massive/massive_add_profiles.php @@ -64,6 +64,40 @@ require_once $config['homedir'].'/include/functions_users.php'; $create_profiles = (int) get_parameter('create_profiles'); +// Get users and groups user can manage to check and for selectors. +$group_um = users_get_groups_UM($config['id_user']); + +$users_profiles = ''; +$users_order = [ + 'field' => 'id_user', + 'order' => 'ASC', +]; + +$info_users = []; +// Is admin. +if (users_is_admin()) { + $info_users = users_get_info($users_order, 'id_user'); + // has PM permission. +} else if (check_acl($config['id_user'], 0, 'PM')) { + $info_users = users_get_info($users_order, 'id_user'); + foreach ($info_users as $id_user => $value) { + if (users_is_admin($id_user)) { + unset($info_users[$value]); + } + } +} else { + $info = []; + foreach ($group_um as $group => $value) { + $info = array_merge($info, users_get_users_by_group($group, $value)); + } + + foreach ($info as $key => $value) { + if (!$value['is_admin']) { + $info_users[$key] = $value['id_user']; + } + } +} + if ($create_profiles) { $profiles_id = get_parameter('profiles_id', -1); $groups_id = get_parameter('groups_id', -1); @@ -74,8 +108,42 @@ if ($create_profiles) { $result = false; } else { foreach ($profiles_id as $profile) { + // Check profiles permissions for non admin user. + if (is_user_admin($config['user_id']) === false) { + $user_profiles = profile_get_profiles( + [ + 'pandora_management' => '<> 1', + 'db_management' => '<> 1', + ] + ); + + if (array_search((int) $profile, array_keys($user_profiles)) === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to add administrator profile whith standar user for user '.io_safe_input($user) + ); + exit; + } + } + foreach ($groups_id as $group) { + if (check_acl($config['id_user'], $group, 'UM') === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to add profile group without permission for user '.io_safe_input($user) + ); + exit; + } + foreach ($users_id as $user) { + if (array_search($user, $info_users) === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to edit user without permission for user '.io_safe_input($user) + ); + exit; + } + $profile_data = db_get_row_filter('tusuario_perfil', ['id_usuario' => $user, 'id_perfil' => $profile, 'id_grupo' => $group]); // If the profile doesnt exist, we create it if ($profile_data === false) { @@ -142,7 +210,6 @@ $table->size[2] = '33%'; $data = []; $data[0] = '
'; -$group_um = users_get_groups_UM($config['id_user']); $display_all_group = true; if (check_acl($config['id_user'], 0, 'PM')) { @@ -205,36 +272,6 @@ $data[1] = html_print_select_groups( $data[2] = ''; -$users_profiles = ''; -$users_order = [ - 'field' => 'id_user', - 'order' => 'ASC', -]; - -$info_users = []; -// Is admin. -if (users_is_admin()) { - $info_users = users_get_info($users_order, 'id_user'); - // has PM permission. -} else if (check_acl($config['id_user'], 0, 'PM')) { - $info_users = users_get_info($users_order, 'id_user'); - foreach ($info_users as $id_user => $value) { - if (users_is_admin($id_user)) { - unset($info_users[$value]); - } - } -} else { - $info = []; - foreach ($group_um as $group => $value) { - $info = array_merge($info, users_get_users_by_group($group, $value)); - } - - foreach ($info as $key => $value) { - if (!$value['is_admin']) { - $info_users[$key] = $value['id_user']; - } - } -} $data[2] .= html_print_select( $info_users, diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 9dc757d1e6..58f178b770 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -567,6 +567,10 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0) $tree = $groups; foreach ($groups as $key => $group) { + if ($group === 'None') { + continue; + } + if ($group['id_grupo'] == 0) { continue; } From b2bc884ec68eebe3855ca0bdfb717c845183a4a4 Mon Sep 17 00:00:00 2001 From: Luis Date: Thu, 24 Feb 2022 15:53:56 +0000 Subject: [PATCH 12/26] Fix minor bug --- pandora_console/include/functions_groups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 58f178b770..963ee55c8f 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -567,7 +567,7 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0) $tree = $groups; foreach ($groups as $key => $group) { - if ($group === 'None') { + if ($group === __('None')) { continue; } From 4f3c509bdeff8188763c7ffef239f4eb4a94b320 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 24 Feb 2022 17:33:13 +0100 Subject: [PATCH 13/26] Fix credential store ACL, only accces to PM or UM --- pandora_console/include/class/CredentialStore.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index f6cd726749..82ab94ee97 100644 --- a/pandora_console/include/class/CredentialStore.class.php +++ b/pandora_console/include/class/CredentialStore.class.php @@ -158,7 +158,9 @@ class CredentialStore extends Wizard // Check access. check_login(); - if (! check_acl($config['id_user'], 0, 'AR')) { + if ((bool) check_acl($config['id_user'], 0, 'PM') === false + || (bool) check_acl($config['id_user'], 0, 'UM') === false + ) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, 'Trying to access credential store' From 3ef537ceb2e3fd226917e885437c9b412725b258 Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 25 Feb 2022 10:16:12 +0100 Subject: [PATCH 14/26] Do not show servers header icon if user has no permission node --- pandora_console/general/header.php | 48 ++++++++++++++++-------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 3c82f32566..9b0333c55a 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -36,30 +36,32 @@ echo sprintf('
', $menuTypeClass); ).'
'; // ======= Servers List =============================================== - $servers_list = '
'; - $servers = []; - $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); - if ($servers['all'] != 0) { - $servers['up'] = (int) servers_check_status(); - $servers['down'] = ($servers['all'] - $servers['up']); - if ($servers['up'] == 0) { - // All Servers down or no servers at all. - $servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]); - } else if ($servers['down'] != 0) { - // Some servers down. - $servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]); - } else { - // All servers up. - $servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]); - } + if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { + $servers_list = '
'; + $servers = []; + $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); + if ($servers['all'] != 0) { + $servers['up'] = (int) servers_check_status(); + $servers['down'] = ($servers['all'] - $servers['up']); + if ($servers['up'] == 0) { + // All Servers down or no servers at all. + $servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]); + } else if ($servers['down'] != 0) { + // Some servers down. + $servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]); + } else { + // All servers up. + $servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]); + } - unset($servers); - // Since this is the header, we don't like to trickle down variables. - $servers_check_img_link = ''; - $servers_check_img_link .= $servers_check_img; - $servers_check_img_link .= ''; - }; - $servers_list .= $servers_check_img_link.'
'; + unset($servers); + // Since this is the header, we don't like to trickle down variables. + $servers_check_img_link = ''; + $servers_check_img_link .= $servers_check_img; + $servers_check_img_link .= ''; + }; + $servers_list .= $servers_check_img_link.'
'; + } From 036e2e3d6c8ae91ca32e5f37c41cb7788fedd1d9 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 3 Mar 2022 16:35:31 +0100 Subject: [PATCH 15/26] Fix users vulnerabilities --- .../godmode/users/configure_user.php | 20 + pandora_console/godmode/users/user_list.php | 962 +++++++++--------- 2 files changed, 512 insertions(+), 470 deletions(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index acce545440..1d75d091ca 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -324,6 +324,16 @@ if ($create_user) { $user_is_admin = (int) get_parameter('is_admin', 0); + if (users_is_admin() === false && $user_is_admin !== 0) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to create with administrator privileges to user by non administrator user '.$config['id_user'], + ); + + include 'general/noaccess.php'; + exit; + } + $values = []; $values['id_user'] = (string) get_parameter('id_user'); $values['fullname'] = (string) get_parameter('fullname'); @@ -538,6 +548,16 @@ if ($update_user) { $values['default_event_filter'] = (int) get_parameter('default_event_filter'); $values['default_custom_view'] = (int) get_parameter('default_custom_view'); + if (users_is_admin() === false && (bool) $values['is_admin'] !== false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to add administrator privileges to user by non administrator user '.$config['id_user'], + ); + + include 'general/noaccess.php'; + exit; + } + // eHorus user level conf. $values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false); $values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user'); diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 7ac3f55261..8e2e3ebd73 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -260,9 +260,21 @@ if (is_metaconsole() === true) { $disable_user = get_parameter('disable_user', false); -if ((bool) get_parameter('user_del', false) === true) { +$delete_user = (bool) get_parameter('user_del', false); + +if ($delete_user === true) { // Delete user. $id_user = get_parameter('delete_user', 0); + if (users_is_admin($id_user) === true && users_is_admin() === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to delete admininstrator user by non administrator user '.$config['id_user'], + ); + + include 'general/noaccess.php'; + exit; + } + // Only allow delete user if is not the actual user. if ($id_user != $config['id_user']) { $user_row = users_get_user_by_id($id_user); @@ -332,6 +344,16 @@ if ((bool) get_parameter('user_del', false) === true) { // Disable_user. $id_user = get_parameter('id', 0); + if (users_is_admin($id_user) === true && users_is_admin() === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to disable admininstrator user by non administrator user '.$config['id_user'], + ); + + include 'general/noaccess.php'; + exit; + } + if ($id_user !== 0) { $result = users_disable($id_user, $disable_user); } else { @@ -353,511 +375,511 @@ if ((bool) get_parameter('user_del', false) === true) { } } -$filter_group = (int) get_parameter('filter_group', 0); -$filter_search = get_parameter('filter_search', ''); -$search = (bool) get_parameter('search', false); + $filter_group = (int) get_parameter('filter_group', 0); + $filter_search = get_parameter('filter_search', ''); + $search = (bool) get_parameter('search', false); if (($filter_group == 0) && ($filter_search == '')) { $search = false; } -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'databox filters'; -$table->rowclass[0] = ''; -$table->data[0][0] = ''.__('Group').''; -$table->data[0][1] = html_print_select_groups( - false, - 'AR', - true, - 'filter_group', - $filter_group, - '', - '', - 0, - true -); -$table->data[0][2] = ''.__('Search').''.ui_print_help_tip(__('Search by username, fullname or email'), true); -$table->data[0][3] = html_print_input_text( - 'filter_search', - $filter_search, - __('Search by username, fullname or email'), - 30, - 90, - true -); -$table->data[0][4] = html_print_submit_button( - __('Search'), - 'search', - false, - ['class' => 'sub search'], - true -); - -$is_management_allowed = true; -if (is_metaconsole() === false && is_management_allowed() === false) { - $is_management_allowed = false; - if (is_metaconsole() === false) { - $url = ''.__('metaconsole').''; - } else { - $url = __('any node'); - } - - ui_print_warning_message( - __( - 'This node is configured with centralized mode. All users information is read only. Go to %s to manage it.', - $url - ) - ); -} - - -if (is_metaconsole() === true) { - $table->width = '96%'; - $form_filter = ""; - $form_filter .= html_print_table($table, true); - $form_filter .= ''; - ui_toggle($form_filter, __('Show Options')); -} else { - $form_filter = "
"; - $form_filter .= html_print_table($table, true); - $form_filter .= '
'; - ui_toggle( - $form_filter, - __('Users control filter'), - __('Toggle filter(s)'), - '', - !$search - ); -} - -// Urls to sort the table. -$url_up_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=up&pure='.$pure; -$url_down_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=down&pure='.$pure; -$url_up_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=up&pure='.$pure; -$url_down_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=down&pure='.$pure; -$url_up_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=up&pure='.$pure; -$url_down_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=down&pure='.$pure; - - -$table = new stdClass(); -$table->cellpadding = 0; -$table->cellspacing = 0; -$table->width = '100%'; -$table->class = 'info_table'; - -$table->head = []; -$table->data = []; -$table->align = []; -$table->size = []; -$table->valign = []; - -$table->head[0] = __('User ID').ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown); -$table->head[1] = __('Name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown); -$table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown); - -$table->head[3] = __('Admin'); -$table->head[4] = __('Profile / Group'); -$table->head[5] = __('Description'); -if ($is_management_allowed === true) { - $table->head[6] = ''.__('Op.').''; -} - -if (is_metaconsole() === false) { - $table->align[2] = ''; - $table->size[2] = '150px'; -} - -$table->align[3] = 'left'; - -if (is_metaconsole() === true) { - $table->size[6] = '110px'; -} else { - $table->size[6] = '85px'; -} - -if (is_metaconsole() === false) { - $table->valign[0] = 'top'; - $table->valign[1] = 'top'; - $table->valign[2] = 'top'; - $table->valign[3] = 'top'; - $table->valign[4] = 'top'; - $table->valign[5] = 'top'; - $table->valign[6] = 'top'; -} - -$info1 = []; - -$user_is_admin = users_is_admin(); - -if ($user_is_admin) { - $info1 = get_users($order); -} else { - $group_um = users_get_groups_UM($config['id_user']); - // 0 is the group 'all'. - if (isset($group_um[0])) { - $info1 = get_users($order); - } else { - foreach ($group_um as $group => $value) { - $info1 = array_merge($info1, users_get_users_by_group($group, $value)); - } - } -} - -// Filter the users. -if ($search) { - foreach ($info1 as $iterator => $user_info) { - $found = false; - - if (!empty($filter_search)) { - if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['fullname'])) != 0) { - $found = true; - } - - if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['id_user'])) != 0) { - $found = true; - } - - if (preg_match('/.*'.$filter_search.'.*/', $user_info['email']) != 0) { - $found = true; - } - } - - if ($filter_group != 0) { - $groups = users_get_groups( - $user_info['id_user'], - 'AR', - $user_info['is_admin'] - ); - - $id_groups = array_keys($groups); - - if (array_search($filter_group, $id_groups) !== false) { - $found = true; - } - } - - if (!$found) { - unset($info1[$iterator]); - } - } -} - -$info = $info1; - -// Prepare pagination. -ui_pagination(count($info)); - -$offset = (int) get_parameter('offset'); -$limit = (int) $config['block_size']; - -$rowPair = true; -$iterator = 0; -$cont = 0; -foreach ($info as $user_id => $user_info) { - if (!$user_is_admin && $user_info['is_admin']) { - // If user is not admin then don't display admin users. - continue; - } - - // User profiles. - if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) { - $user_profiles = db_get_all_rows_field_filter( - 'tusuario_perfil', - 'id_usuario', - $user_id - ); - } else { - $user_profiles_aux = users_get_user_profile($user_id); - $user_profiles = []; - foreach ($group_um as $key => $value) { - if (isset($user_profiles_aux[$key]) === true) { - $user_profiles[$key] = $user_profiles_aux[$key]; - unset($user_profiles_aux[$key]); - } - } - - if (empty($user_profiles_aux) === false) { - $user_info['not_delete'] = 1; - } - - if ($user_profiles == false) { - continue; - } - } - - $cont++; - - // Manual pagination due the complicated process of the ACL data. - if ($cont <= $offset && $search !== true) { - continue; - } - - if ($cont > ($limit + $offset) && $search !== true) { - break; - } - - - if ($rowPair) { - $table->rowclass[$iterator] = 'rowPair'; - } else { - $table->rowclass[$iterator] = 'rowOdd'; - } - - $rowPair = !$rowPair; - if ($user_info['disabled']) { - $table->rowclass[$iterator] .= ' disabled_row_user'; - } - - $iterator++; - - if ($is_management_allowed === true - && ($user_is_admin - || $config['id_user'] == $user_info['id_user'] - || (!$user_info['is_admin'] && (!isset($user_info['edit']) - || isset($group_um[0]) || (isset($user_info['edit']) - && $user_info['edit'])))) - ) { - $data[0] = ''.$user_id.''; - } else { - $data[0] = $user_id; - } - - $data[1] = '
    '; - $data[1] .= '
  • '.$user_info['fullname'].'
  • '; - $data[1] .= '
  • '.$user_info['phone'].'
  • '; - $data[1] .= '
  • '.$user_info['email'].'
  • '; - $data[1] .= '
'; - $data[2] = ui_print_timestamp($user_info['last_connect'], true); - - if ($user_info['is_admin']) { - $data[3] = html_print_image( - 'images/user_suit.png', + $table = new stdClass(); + $table->width = '100%'; + $table->class = 'databox filters'; + $table->rowclass[0] = ''; + $table->data[0][0] = ''.__('Group').''; + $table->data[0][1] = html_print_select_groups( + false, + 'AR', true, - [ - 'alt' => __('Admin'), - 'title' => __('Administrator'), - 'class' => 'invert_filter', - ] - ).' '; - } else { - $data[3] = ''; - } + 'filter_group', + $filter_group, + '', + '', + 0, + true + ); + $table->data[0][2] = ''.__('Search').''.ui_print_help_tip(__('Search by username, fullname or email'), true); + $table->data[0][3] = html_print_input_text( + 'filter_search', + $filter_search, + __('Search by username, fullname or email'), + 30, + 90, + true + ); + $table->data[0][4] = html_print_submit_button( + __('Search'), + 'search', + false, + ['class' => 'sub search'], + true + ); - $data[4] = ''; - if ($user_profiles !== false) { - $total_profile = 0; + $is_management_allowed = true; + if (is_metaconsole() === false && is_management_allowed() === false) { + $is_management_allowed = false; + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } else { + $url = __('any node'); + } - $data[4] .= '
'; - foreach ($user_profiles as $row) { - if ($total_profile <= 5) { - $data[4] .= "
"; - $data[4] .= profile_get_name($row['id_perfil']); - $data[4] .= ' /
'; - $data[4] .= "
"; - $data[4] .= groups_get_name($row['id_grupo'], true); - $data[4] .= '
'; + ui_print_warning_message( + __( + 'This node is configured with centralized mode. All users information is read only. Go to %s to manage it.', + $url + ) + ); + } - if ($total_profile == 0 && count($user_profiles) >= 5) { - $data[4] .= ' - '.html_print_image( - 'images/zoom.png', - true, - [ - 'title' => __('Show'), - 'class' => 'invert_filter', - ] - ).''; + + if (is_metaconsole() === true) { + $table->width = '96%'; + $form_filter = "
"; + $form_filter .= html_print_table($table, true); + $form_filter .= '
'; + ui_toggle($form_filter, __('Show Options')); + } else { + $form_filter = "
"; + $form_filter .= html_print_table($table, true); + $form_filter .= '
'; + ui_toggle( + $form_filter, + __('Users control filter'), + __('Toggle filter(s)'), + '', + !$search + ); + } + + // Urls to sort the table. + $url_up_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=up&pure='.$pure; + $url_down_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=down&pure='.$pure; + $url_up_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=up&pure='.$pure; + $url_down_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=down&pure='.$pure; + $url_up_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=up&pure='.$pure; + $url_down_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=down&pure='.$pure; + + + $table = new stdClass(); + $table->cellpadding = 0; + $table->cellspacing = 0; + $table->width = '100%'; + $table->class = 'info_table'; + + $table->head = []; + $table->data = []; + $table->align = []; + $table->size = []; + $table->valign = []; + + $table->head[0] = __('User ID').ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown); + $table->head[1] = __('Name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown); + $table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown); + + $table->head[3] = __('Admin'); + $table->head[4] = __('Profile / Group'); + $table->head[5] = __('Description'); + if ($is_management_allowed === true) { + $table->head[6] = ''.__('Op.').''; + } + + if (is_metaconsole() === false) { + $table->align[2] = ''; + $table->size[2] = '150px'; + } + + $table->align[3] = 'left'; + + if (is_metaconsole() === true) { + $table->size[6] = '110px'; + } else { + $table->size[6] = '85px'; + } + + if (is_metaconsole() === false) { + $table->valign[0] = 'top'; + $table->valign[1] = 'top'; + $table->valign[2] = 'top'; + $table->valign[3] = 'top'; + $table->valign[4] = 'top'; + $table->valign[5] = 'top'; + $table->valign[6] = 'top'; + } + + $info1 = []; + + $user_is_admin = users_is_admin(); + + if ($user_is_admin) { + $info1 = get_users($order); + } else { + $group_um = users_get_groups_UM($config['id_user']); + // 0 is the group 'all'. + if (isset($group_um[0])) { + $info1 = get_users($order); + } else { + foreach ($group_um as $group => $value) { + $info1 = array_merge($info1, users_get_users_by_group($group, $value)); + } + } + } + + // Filter the users. + if ($search) { + foreach ($info1 as $iterator => $user_info) { + $found = false; + + if (!empty($filter_search)) { + if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['fullname'])) != 0) { + $found = true; + } + + if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['id_user'])) != 0) { + $found = true; + } + + if (preg_match('/.*'.$filter_search.'.*/', $user_info['email']) != 0) { + $found = true; + } + } + + if ($filter_group != 0) { + $groups = users_get_groups( + $user_info['id_user'], + 'AR', + $user_info['is_admin'] + ); + + $id_groups = array_keys($groups); + + if (array_search($filter_group, $id_groups) !== false) { + $found = true; + } + } + + if (!$found) { + unset($info1[$iterator]); + } + } + } + + $info = $info1; + + // Prepare pagination. + ui_pagination(count($info)); + + $offset = (int) get_parameter('offset'); + $limit = (int) $config['block_size']; + + $rowPair = true; + $iterator = 0; + $cont = 0; + foreach ($info as $user_id => $user_info) { + if (!$user_is_admin && $user_info['is_admin']) { + // If user is not admin then don't display admin users. + continue; + } + + // User profiles. + if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) { + $user_profiles = db_get_all_rows_field_filter( + 'tusuario_perfil', + 'id_usuario', + $user_id + ); + } else { + $user_profiles_aux = users_get_user_profile($user_id); + $user_profiles = []; + foreach ($group_um as $key => $value) { + if (isset($user_profiles_aux[$key]) === true) { + $user_profiles[$key] = $user_profiles_aux[$key]; + unset($user_profiles_aux[$key]); + } + } + + if (empty($user_profiles_aux) === false) { + $user_info['not_delete'] = 1; + } + + if ($user_profiles == false) { + continue; + } + } + + $cont++; + + // Manual pagination due the complicated process of the ACL data. + if ($cont <= $offset && $search !== true) { + continue; + } + + if ($cont > ($limit + $offset) && $search !== true) { + break; + } + + + if ($rowPair) { + $table->rowclass[$iterator] = 'rowPair'; + } else { + $table->rowclass[$iterator] = 'rowOdd'; + } + + $rowPair = !$rowPair; + if ($user_info['disabled']) { + $table->rowclass[$iterator] .= ' disabled_row_user'; + } + + $iterator++; + + if ($is_management_allowed === true + && ($user_is_admin + || $config['id_user'] == $user_info['id_user'] + || (!$user_info['is_admin'] && (!isset($user_info['edit']) + || isset($group_um[0]) || (isset($user_info['edit']) + && $user_info['edit'])))) + ) { + $data[0] = ''.$user_id.''; + } else { + $data[0] = $user_id; + } + + $data[1] = '
    '; + $data[1] .= '
  • '.$user_info['fullname'].'
  • '; + $data[1] .= '
  • '.$user_info['phone'].'
  • '; + $data[1] .= '
  • '.$user_info['email'].'
  • '; + $data[1] .= '
'; + $data[2] = ui_print_timestamp($user_info['last_connect'], true); + + if ($user_info['is_admin']) { + $data[3] = html_print_image( + 'images/user_suit.png', + true, + [ + 'alt' => __('Admin'), + 'title' => __('Administrator'), + 'class' => 'invert_filter', + ] + ).' '; + } else { + $data[3] = ''; + } + + $data[4] = ''; + if ($user_profiles !== false) { + $total_profile = 0; + + $data[4] .= '
'; + foreach ($user_profiles as $row) { + if ($total_profile <= 5) { + $data[4] .= "
"; + $data[4] .= profile_get_name($row['id_perfil']); + $data[4] .= ' /
'; + $data[4] .= "
"; + $data[4] .= groups_get_name($row['id_grupo'], true); + $data[4] .= '
'; + + if ($total_profile == 0 && count($user_profiles) >= 5) { + $data[4] .= ' + '.html_print_image( + 'images/zoom.png', + true, + [ + 'title' => __('Show'), + 'class' => 'invert_filter', + ] + ).''; + } + + $data[4] .= '
'; + $data[4] .= '
'; + $data[4] .= '
'; + } else { + $data[4] .= "'; } else { - $data[4] .= "'; - } else { - $data[4] .= __('The user doesn\'t have any assigned profile/group'); - } + $data[6] = '
'; + $data[6] .= html_print_input_hidden( + 'id', + $user_info['id_user'], + true + ); + $data[6] .= html_print_input_hidden( + 'disable_user', + $toDoAction, + true + ); + $data[6] .= html_print_input_image( + 'submit_disable_enable', + $toDoImage, + '', + '', + true, + [ + 'data-title' => $toDoString, + 'data-use_title_for_force_title' => '1', + 'class' => 'forced_title no-padding '.$toDoClass, + ] + ); + $data[6] .= '
'; + } - $data[5] = ui_print_string_substr($user_info['comments'], 24, true); - - if ($is_management_allowed === true) { - $table->cellclass[][6] = 'action_buttons'; - $data[6] = ''; - if ($user_is_admin - || $config['id_user'] == $user_info['id_user'] - || isset($group_um[0]) - || (!$user_info['is_admin'] && (!isset($user_info['edit']) - || (isset($user_info['edit']) && $user_info['edit']))) - ) { - // Disable / Enable user. - if (isset($user_info['not_delete']) === false) { - if ($user_info['disabled'] == 0) { - $toDoString = __('Disable'); - $toDoAction = '1'; - $toDoImage = 'images/lightbulb.png'; - $toDoClass = ''; - } else { - $toDoString = __('Enable'); - $toDoAction = '0'; - $toDoImage = 'images/lightbulb_off.png'; - $toDoClass = 'filter_none'; - } - - $data[6] = '
'; - $data[6] .= html_print_input_hidden( - 'id', - $user_info['id_user'], - true - ); - $data[6] .= html_print_input_hidden( - 'disable_user', - $toDoAction, - true - ); - $data[6] .= html_print_input_image( - 'submit_disable_enable', - $toDoImage, - '', - '', - true, - [ - 'data-title' => $toDoString, - 'data-use_title_for_force_title' => '1', - 'class' => 'forced_title no-padding '.$toDoClass, - ] - ); - $data[6] .= '
'; - } - - // Edit user. - $data[6] .= '
'; - $data[6] .= html_print_input_hidden( - 'id_user', - $user_info['id_user'], - true - ); - $data[6] .= html_print_input_hidden( - 'edit_user', - '1', - true - ); - $data[6] .= html_print_input_image( - 'submit_edit_user', - 'images/config.png', - '', - 'padding:0', - true, - [ - 'data-title' => __('Edit'), - 'data-use_title_for_force_title' => '1', - 'class' => 'forced_title no-padding', - ] - ); - $data[6] .= '
'; - - if ($config['admin_can_delete_user'] - && $user_info['id_user'] != $config['id_user'] - && isset($user_info['not_delete']) === false - ) { - $data[6] .= '
'; - $data[6] .= html_print_input_hidden( - 'delete_user', - $user_info['id_user'], - true - ); - $data[6] .= html_print_input_hidden( - 'user_del', - '1', - true - ); - $data[6] .= html_print_input_image( - 'submit_delete_user', - 'images/cross.png', - '', - 'padding:0', - true, - [ - 'data-title' => __('Delete'), - 'data-use_title_for_force_title' => '1', - 'class' => 'forced_title no-padding', - ] - ); - $data[6] .= '
'; - - if (is_metaconsole() === true) { - $data[6] .= '
'; + // Edit user. + $data[6] .= ''; $data[6] .= html_print_input_hidden( - 'delete_user', + 'id_user', $user_info['id_user'], true ); $data[6] .= html_print_input_hidden( - 'user_del', + 'edit_user', '1', true ); - $data[6] .= html_print_input_hidden( - 'delete_all', - '1', - true + $data[6] .= html_print_input_image( + 'submit_edit_user', + 'images/config.png', + '', + 'padding:0', + true, + [ + 'data-title' => __('Edit'), + 'data-use_title_for_force_title' => '1', + 'class' => 'forced_title no-padding', + ] ); $data[6] .= '
'; + + if ($config['admin_can_delete_user'] + && $user_info['id_user'] != $config['id_user'] + && isset($user_info['not_delete']) === false + ) { + $data[6] .= '
'; + $data[6] .= html_print_input_hidden( + 'delete_user', + $user_info['id_user'], + true + ); + $data[6] .= html_print_input_hidden( + 'user_del', + '1', + true + ); + $data[6] .= html_print_input_image( + 'submit_delete_user', + 'images/cross.png', + '', + 'padding:0', + true, + [ + 'data-title' => __('Delete'), + 'data-use_title_for_force_title' => '1', + 'class' => 'forced_title no-padding', + ] + ); + $data[6] .= '
'; + + if (is_metaconsole() === true) { + $data[6] .= '
'; + $data[6] .= html_print_input_hidden( + 'delete_user', + $user_info['id_user'], + true + ); + $data[6] .= html_print_input_hidden( + 'user_del', + '1', + true + ); + $data[6] .= html_print_input_hidden( + 'delete_all', + '1', + true + ); + $data[6] .= '
'; + } + } else { + $data[6] .= ''; + // Delete button not in this mode. + } + } else { + $data[6] .= ''; + // Delete button not in this mode. } - } else { - $data[6] .= ''; - // Delete button not in this mode. } - } else { - $data[6] .= ''; - // Delete button not in this mode. + + array_push($table->data, $data); } - } - array_push($table->data, $data); -} + html_print_table($table); + ui_pagination(count($info), false, 0, 0, false, 'offset', true, 'pagination-bottom'); -html_print_table($table); -ui_pagination(count($info), false, 0, 0, false, 'offset', true, 'pagination-bottom'); + echo '
'; + unset($table); + if ($is_management_allowed === true) { + if ($config['admin_can_add_user'] !== false) { + echo '
'; + html_print_input_hidden('new_user', 1); + html_print_submit_button(__('Create user'), 'crt', false, 'class="sub next"'); + echo '
'; + } else { + echo ''.__("The current authentication scheme doesn't support creating users on %s", get_product_name()).''; + } + } -echo '
'; -unset($table); -if ($is_management_allowed === true) { - if ($config['admin_can_add_user'] !== false) { - echo '
'; - html_print_input_hidden('new_user', 1); - html_print_submit_button(__('Create user'), 'crt', false, 'class="sub next"'); - echo '
'; - } else { - echo ''.__("The current authentication scheme doesn't support creating users on %s", get_product_name()).''; - } -} + echo '
'; -echo '
'; + enterprise_hook('close_meta_frame'); -enterprise_hook('close_meta_frame'); - -echo ''; From 78ab628c8b3216dc7bac299f722678b5ecbd13f3 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 10 Mar 2022 08:22:45 +0100 Subject: [PATCH 24/26] Fix tactical view user count when user is in group --- pandora_console/include/functions_reporting.php | 2 +- pandora_console/include/functions_users.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 66aeec8bc8..39aa94d336 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -11199,7 +11199,7 @@ function reporting_get_stats_users($data) $users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']); } else { foreach ($group_um as $group => $value) { - $users = array_merge($users, users_get_users_by_group($group, $value)); + $users = array_merge($users, users_get_users_by_group($group, $value, false)); } } } diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index a0cac33b30..ef1e54576e 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -778,9 +778,10 @@ function users_get_groups_UM($id_user) * Obtiene una matriz con los grupos como clave y si tiene o no permiso UM sobre ese grupo(valor) * * @param string User id + * @param boolean $disabled Return also disabled users * @return array Return . */ -function users_get_users_by_group($id_group, $um=false) +function users_get_users_by_group($id_group, $um=false, $disabled=true) { $sql = sprintf( "SELECT tusuario.* FROM tusuario @@ -789,6 +790,10 @@ function users_get_users_by_group($id_group, $um=false) $id_group ); + if ($disabled === false) { + $sql .= 'WHERE tusuario.disabled = 0'; + } + $users = db_get_all_rows_sql($sql); $return = []; foreach ($users as $key => $user) { From 176a94ce9910fab7241180b0f00daa2fdb013ee3 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 10 Mar 2022 08:26:22 +0100 Subject: [PATCH 25/26] Fix tactical view user count when user is in group --- pandora_console/include/functions_users.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index ef1e54576e..f4e6e25be8 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -777,8 +777,10 @@ function users_get_groups_UM($id_user) /** * Obtiene una matriz con los grupos como clave y si tiene o no permiso UM sobre ese grupo(valor) * - * @param string User id - * @param boolean $disabled Return also disabled users + * @param string $id_group User id. + * @param boolean $um Um. + * @param boolean $disabled Reurn also disabled users. + * * @return array Return . */ function users_get_users_by_group($id_group, $um=false, $disabled=true) From 36aea89db69684b995cda63b744351515e400588 Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 11 Mar 2022 01:00:18 +0100 Subject: [PATCH 26/26] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 5791f4b2fd..ebdb8664f2 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.760-220310 +Version: 7.0NG.760-220311 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 260f407515..7baaf48a41 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.760-220310" +pandora_version="7.0NG.760-220311" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index a197ed563b..ac23026142 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.760'; -use constant AGENT_BUILD => '220310'; +use constant AGENT_BUILD => '220311'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index f96a88e2f7..38d18895f2 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.760 -%define release 220310 +%define release 220311 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 03919af653..51b0426c61 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.760 -%define release 220310 +%define release 220311 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 93050633b9..f8c0a0e18c 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.760" -PI_BUILD="220310" +PI_BUILD="220311" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index c2536c3147..79ce6b7ff3 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{220310} +{220311} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 8833f55fbf..09f3dc6556 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.760 Build 220310") +#define PANDORA_VERSION ("7.0NG.760 Build 220311") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 2b6e337e59..3c2a4fc8fd 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.760(Build 220310))" + VALUE "ProductVersion", "(7.0NG.760(Build 220311))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c4366d3fc9..11f7e1281c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.760-220310 +Version: 7.0NG.760-220311 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index d06232855b..19aefc5e48 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.760-220310" +pandora_version="7.0NG.760-220311" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 30d2b2df16..9a185a4f89 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC220310'; +$build_version = 'PC220311'; $pandora_version = 'v7.0NG.760'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 5e0c8a0755..a9bcb433e6 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index eaeb0e0a9d..4f59e95f00 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.760 -%define release 220310 +%define release 220311 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index e55e84736b..0839f38f54 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.760 -%define release 220310 +%define release 220311 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 850709bf51..dfa6363696 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.760" -PI_BUILD="220310" +PI_BUILD="220311" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 5e4299acf6..7c8f4c2558 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.760 Build 220310"; +my $version = "7.0NG.760 Build 220311"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 445c6aa563..0e699373e2 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.760 Build 220310"; +my $version = "7.0NG.760 Build 220311"; # save program name for logging my $progname = basename($0);