From 4b6c21bb309c82ae67daf826739437254d700db8 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 4 Jun 2019 11:44:11 +0200 Subject: [PATCH 01/32] Add policies to general search and deleted help functions --- pandora_console/operation/search_main.php | 11 +- .../operation/search_policies.getdata.php | 199 ++++++++++++++++++ pandora_console/operation/search_policies.php | 65 ++++++ pandora_console/operation/search_results.php | 41 ++-- 4 files changed, 294 insertions(+), 22 deletions(-) create mode 100644 pandora_console/operation/search_policies.getdata.php create mode 100644 pandora_console/operation/search_policies.php diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index ffc9d93f74..d5ae3bff42 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -20,6 +20,7 @@ $searchGraphs = check_acl($config['id_user'], 0, 'RR'); $searchMaps = check_acl($config['id_user'], 0, 'RR'); $searchReports = check_acl($config['id_user'], 0, 'RR'); $searchUsers = check_acl($config['id_user'], 0, 'UM'); +$searchPolicies = check_acl($config['id_user'], 0, 'UM'); $searchHelps = true; echo '
'; @@ -44,8 +45,12 @@ $table->style[9] = 'font-weight: bold; text-align: center;'; $table->style[10] = 'font-weight: bold; text-align: center;'; $table->style[11] = 'font-weight: bold; text-align: center;'; $table->style[13] = 'font-weight: bold; text-align: center;'; +$table->style[14] = 'font-weight: bold; text-align: center;'; $table->style[15] = 'font-weight: bold; text-align: center;'; + + + $table->data[0][0] = html_print_image('images/agent.png', true, ['title' => __('Agents found')]); $table->data[0][1] = "".sprintf(__('%s Found'), $totalAgents).''; $table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found')]); @@ -64,8 +69,10 @@ $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' => $table->data[0][11] = "".sprintf(__('%s Found'), $totalReports).''; $table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]); $table->data[0][13] = "".sprintf(__('%s Found'), $totalMaps).''; -$table->data[0][14] = html_print_image('images/help.png', true, ['title' => __('Helps found')]); -$table->data[0][15] = "".sprintf(__('%s Found'), $totalHelps).''; +if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { + $table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]); + $table->data[0][15] = "".sprintf(__('%s Found'), $totalPolicies).''; +} html_print_table($table); diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php new file mode 100644 index 0000000000..c91e7e4279 --- /dev/null +++ b/pandora_console/operation/search_policies.getdata.php @@ -0,0 +1,199 @@ + 'id', + 'order' => 'ASC', + ]; + break; + + case 'down': + $selectpolicieIDDown = $selected; + $order = [ + 'field' => 'id', + 'order' => 'DESC', + ]; + break; + } + break; + + case 'name': + switch ($sort) { + case 'up': + $selectNameUp = $selected; + $order = [ + 'field' => 'name', + 'order' => 'ASC', + ]; + break; + + case 'down': + $selectNameDown = $selected; + $order = [ + 'field' => 'name', + 'order' => 'DESC', + ]; + break; + } + break; + + case 'description': + switch ($sort) { + case 'up': + $selectId_groupUp = $selected; + $order = [ + 'field' => 'description', + 'order' => 'ASC', + ]; + break; + + case 'down': + $selectDescriptionDown = $selected; + $order = [ + 'field' => 'description', + 'order' => 'DESC', + ]; + break; + } + break; + + case 'last_contact': + switch ($sort) { + case 'up': + $selectId_groupUp = $selected; + $order = [ + 'field' => 'last_connect', + 'order' => 'ASC', + ]; + break; + + case 'down': + $selectId_groupDown = $selected; + $order = [ + 'field' => 'last_connect', + 'order' => 'DESC', + ]; + break; + } + break; + + case 'id_group': + switch ($sort) { + case 'up': + $selectId_groupUp = $selected; + $order = [ + 'field' => 'last_connect', + 'order' => 'ASC', + ]; + break; + + case 'down': + $selectId_groupDown = $selected; + $order = [ + 'field' => 'last_connect', + 'order' => 'DESC', + ]; + break; + } + break; + + case 'status': + switch ($sort) { + case 'up': + $selectStatusUp = $selected; + $order = [ + 'field' => 'is_admin', + 'order' => 'ASC', + ]; + break; + + case 'down': + $selectStatusDown = $selected; + $order = [ + 'field' => 'is_admin', + 'order' => 'DESC', + ]; + break; + } + break; + + default: + $selectpolicieIDUp = $selected; + $selectpolicieIDDown = ''; + $selectNameUp = ''; + $selectNameDown = ''; + $selectDescriptionUp = ''; + $selectDescriptionDown = ''; + $selectId_groupUp = ''; + $selectId_groupDown = ''; + $selectStatusUp = ''; + $selectStatusDown = ''; + + $order = [ + 'field' => 'id', + 'order' => 'ASC', + ]; + break; +} + +if ($searchpolicies == 0) { + $sql = "SELECT id, name, description, id_group, status FROM tpolicies + WHERE name LIKE '%".$stringSearchSQL."%' OR + description LIKE '%".$stringSearchSQL."%' + ORDER BY ".$order['field'].' '.$order['order']; +} + + $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0); + + + $policies = db_process_sql($sql); + +if ($policies !== false) { + if ($only_count) { + unset($policies); + } + + $sql = "SELECT COUNT(id) AS count FROM tpolicies + WHERE name LIKE '%".$stringSearchSQL."%' OR + description LIKE '%".$stringSearchSQL."%'"; + + + // q$totalPolicies = db_get_value_sql($sql); + $totalPolicies = count($policies); +} else { + $totalPolicies = 0; +} diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php new file mode 100644 index 0000000000..8f339b7c1b --- /dev/null +++ b/pandora_console/operation/search_policies.php @@ -0,0 +1,65 @@ +
".__('Zero results found')."
\n"; +} else { + $table->cellpadding = 4; + $table->cellspacing = 4; + $table->width = '98%'; + $table->class = 'databox'; + + $table->align = []; + $table->align[4] = 'center'; + + $table->head = []; + $table->head[0] = __('ID').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectpolicieIDUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectpolicieIDDown]).''; + $table->head[1] = __('Name').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).''; + $table->head[2] = __('Description').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectDescriptionUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectDescriptionDown]).''; + $table->head[3] = __('Id_group').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectId_groupUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectId_groupDown]).''; + $table->head[4] = __('Status').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectstatusDown]).''; + + $table->data = []; + + foreach ($policies as $policie) { + $policieIDCell = "".$policies['id'].''; + + + array_push( + $table->data, + [ + $policie['id'], + $policie['name'], + $policie['description'], + $policie['id_group'], + $policie['status'], + + ] + ); + } + + $totalPolicies = count($policies); + echo '
'; + ui_pagination($totalPolicies); + html_print_table($table); + unset($table); + ui_pagination($totalPolicies); +} diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index d59e6908cb..cbd49ccc28 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -18,7 +18,7 @@ require_once $config['homedir'].'/include/functions_reporting.php'; enterprise_include('operation/reporting/custom_reporting.php'); $searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR'); -$searchUsers = check_acl($config['id_user'], 0, 'UM'); +$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'UM'); $searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR'); $searchMain = true; $searchHelps = true; @@ -43,6 +43,7 @@ if ($config['search_category'] == 'all') { // INI SECURITY ACL if ((!$searchAgents && !$searchUsers && !$searchMaps) || (!$searchUsers && $searchTab == 'users') + || (!$searchPolicies && $searchTab == 'policies') || (!$searchAgents && ($searchTab == 'agents' || $searchTab == 'alerts')) || (!$searchGraphs && ($searchTab == 'graphs' || $searchTab == 'maps' || $searchTab == 'reports')) ) { @@ -161,29 +162,29 @@ if ($searchModules) { $modules_tab = ''; } -if ($searchHelps) { - $helps_tab = [ - 'text' => "".html_print_image( - 'images/help_w.png', +if ($searchPolicies) { + $policies_tab = [ + 'text' => "".html_print_image( + 'images/policies.png', true, - ['title' => __('Helps')] + ['title' => __('Policies')] ).'', - 'active' => $searchTab == 'helps', + 'active' => $searchTab == 'policies', ]; } else { - $helps_tab = ''; + $policies_tab = ''; } $onheader = [ - 'main' => $main_tab, - 'agents' => $agents_tab, - 'modules' => $modules_tab, - 'alerts' => $alerts_tab, - 'users' => $users_tab, - 'graphs' => $graphs_tab, - 'reports' => $reports_tab, - 'maps' => $maps_tab, - 'helps' => $helps_tab, + 'main' => $main_tab, + 'agents' => $agents_tab, + 'modules' => $modules_tab, + 'alerts' => $alerts_tab, + 'users' => $users_tab, + 'graphs' => $graphs_tab, + 'reports' => $reports_tab, + 'maps' => $maps_tab, + 'policies' => $policies_tab, ]; ui_print_page_header( @@ -251,8 +252,8 @@ switch ($searchTab) { include_once 'search_modules.php'; break; - case 'helps': - include_once 'search_helps.getdata.php'; - include_once 'search_helps.php'; + case 'policies': + include_once 'search_policies.getdata.php'; + include_once 'search_policies.php'; break; } From c5cb76b2714e559a9acc6a60267653e8c476da5e Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 4 Jun 2019 11:52:56 +0200 Subject: [PATCH 02/32] Add policies to general search --- pandora_console/operation/search_policies.getdata.php | 1 + pandora_console/operation/search_results.php | 1 + 2 files changed, 2 insertions(+) diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index c91e7e4279..fd97335421 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -177,6 +177,7 @@ if ($searchpolicies == 0) { ORDER BY ".$order['field'].' '.$order['order']; } + $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0); diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index cbd49ccc28..e4dbe38a0c 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -255,5 +255,6 @@ switch ($searchTab) { case 'policies': include_once 'search_policies.getdata.php'; include_once 'search_policies.php'; + break; } From 22efc4ba44c2d2fe4b1a820e436d40156ea92506 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 4 Jun 2019 17:05:17 +0200 Subject: [PATCH 03/32] Resolved problem with counts on search main --- pandora_console/operation/search_graphs.getdata.php | 4 ++++ pandora_console/operation/search_main.php | 1 + pandora_console/operation/search_policies.getdata.php | 6 ++---- pandora_console/operation/search_policies.php | 2 +- pandora_console/operation/search_results.php | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pandora_console/operation/search_graphs.getdata.php b/pandora_console/operation/search_graphs.getdata.php index aefd6e2073..bd3159d72f 100644 --- a/pandora_console/operation/search_graphs.getdata.php +++ b/pandora_console/operation/search_graphs.getdata.php @@ -26,6 +26,7 @@ if ($searchGraphs) { $usergraphs_id = array_keys($usergraphs); if (empty($usergraphs_id)) { + $totalGraphs = 0; return; } @@ -37,6 +38,7 @@ if ($searchGraphs) { 'id_graph', 'name', 'description', + ]; $totalGraphs = (int) db_get_value_filter('COUNT(id_graph) AS count', 'tgraph', $filter); @@ -46,4 +48,6 @@ if ($searchGraphs) { $filter['offset'] = (int) get_parameter('offset'); $graphs = db_get_all_rows_filter('tgraph', $filter, $columns); } + + $totalGraphs = 0; } diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index d5ae3bff42..f4ba5e3f91 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -86,4 +86,5 @@ if ($searchAgents && $totalAgents > 0) { ).''; } + echo '
'; diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index fd97335421..0a28651e7a 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -13,8 +13,7 @@ // GNU General Public License for more details. global $config; - -require_once $config['homedir'].'/enterprise/include/functions_policies.php'; +enterprise_include_once('include/functions_policies.php'); $searchpolicies = check_acl($config['id'], 0, 'UM'); @@ -193,8 +192,7 @@ if ($policies !== false) { description LIKE '%".$stringSearchSQL."%'"; - // q$totalPolicies = db_get_value_sql($sql); - $totalPolicies = count($policies); + $totalPolicies = db_get_value_sql($sql); } else { $totalPolicies = 0; } diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php index 8f339b7c1b..c048e12c7c 100644 --- a/pandora_console/operation/search_policies.php +++ b/pandora_console/operation/search_policies.php @@ -14,7 +14,7 @@ global $config; // require_once $config['homedir'].'/include/functions_status.php'; -require_once $config['homedir'].'/enterprise/include/functions_policies.php'; +enterprise_include_once('include/functions_policies.php'); require_once $config['homedir'].'/enterprise/include/functions_groups.php'; $searchpolicies = check_acl($config['id_user'], 0, 'UM'); diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index e4dbe38a0c..11b4aedec9 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -213,6 +213,7 @@ switch ($searchTab) { include_once 'search_maps.getdata.php'; include_once 'search_modules.getdata.php'; include_once 'search_helps.getdata.php'; + include_once 'search_policies.getdata.php'; include_once 'search_main.php'; break; From 9bc83b4ffd7c2275ab53a83ae237faef499f5d5b Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 4 Jun 2019 17:08:08 +0200 Subject: [PATCH 04/32] Add new else --- pandora_console/operation/search_graphs.getdata.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/search_graphs.getdata.php b/pandora_console/operation/search_graphs.getdata.php index bd3159d72f..4dc6f3ba74 100644 --- a/pandora_console/operation/search_graphs.getdata.php +++ b/pandora_console/operation/search_graphs.getdata.php @@ -47,7 +47,7 @@ if ($searchGraphs) { $filter['limit'] = $config['block_size']; $filter['offset'] = (int) get_parameter('offset'); $graphs = db_get_all_rows_filter('tgraph', $filter, $columns); + } else { + $totalGraphs = 0; } - - $totalGraphs = 0; } From 1ee347684e5357766142b3c4b0ff34f7dcf61ad8 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Wed, 5 Jun 2019 10:17:28 +0200 Subject: [PATCH 05/32] Added condition if enterprise installed --- pandora_console/operation/search_main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index f4ba5e3f91..2da3377ff4 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -69,7 +69,7 @@ $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' => $table->data[0][11] = "".sprintf(__('%s Found'), $totalReports).''; $table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]); $table->data[0][13] = "".sprintf(__('%s Found'), $totalMaps).''; -if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { +if (enterprise_installed()) { $table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]); $table->data[0][15] = "".sprintf(__('%s Found'), $totalPolicies).''; } From 738958386a0e70e53823ca561e3457d0741dc8ed Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 11 Jun 2019 10:01:51 +0200 Subject: [PATCH 06/32] guardo cambios --- pandora_console/operation/search_main.php | 2 +- .../operation/search_policies.getdata.php | 20 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index 2da3377ff4..b236539695 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -69,7 +69,7 @@ $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' => $table->data[0][11] = "".sprintf(__('%s Found'), $totalReports).''; $table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]); $table->data[0][13] = "".sprintf(__('%s Found'), $totalMaps).''; -if (enterprise_installed()) { +if (enterprise_installed() || is_metaconsole()) { $table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]); $table->data[0][15] = "".sprintf(__('%s Found'), $totalPolicies).''; } diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index 0a28651e7a..0288c24d1b 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -177,19 +177,33 @@ if ($searchpolicies == 0) { } - $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0); + $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0); $policies = db_process_sql($sql); + $sql = "SELECT id_grupo FROM tusuario_perfil + WHERE id_usuario LIKE '%".$config['id_user']."%'"; + + $groups_for_search = db_process_sql($sql); + + +foreach ($policies as $p) { + foreach ($groups_for_search as $group) { + if ($p['id_group'] == $group['id_grupo'] || $group['id_grupo'] == 0) { + $policies_final = $p; + } + } +} + +$policies = $policies_final; if ($policies !== false) { if ($only_count) { unset($policies); } $sql = "SELECT COUNT(id) AS count FROM tpolicies - WHERE name LIKE '%".$stringSearchSQL."%' OR - description LIKE '%".$stringSearchSQL."%'"; + WHERE id = '".$policies_final['id']."'"; $totalPolicies = db_get_value_sql($sql); From 23469796f89cdee6c959eeb75addc843e8f4f826 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 11 Jun 2019 16:23:42 +0200 Subject: [PATCH 07/32] Limited result for user groups --- .../operation/search_policies.getdata.php | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index 0288c24d1b..980a71cec8 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -170,43 +170,27 @@ switch ($sortField) { } if ($searchpolicies == 0) { - $sql = "SELECT id, name, description, id_group, status FROM tpolicies - WHERE name LIKE '%".$stringSearchSQL."%' OR - description LIKE '%".$stringSearchSQL."%' - ORDER BY ".$order['field'].' '.$order['order']; + $user_groups = users_get_groups($config['id_user'], 'AR', false); + $id_user_groups = array_keys($user_groups); + $id_user_groups_str = implode(',', $id_user_groups); + + $sql = "SELECT id, name, description, id_group, status + FROM tpolicies + WHERE name LIKE '$stringSearchSQL' + AND id_group IN ($id_user_groups_str)"; } - $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0); - + $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0); $policies = db_process_sql($sql); - $sql = "SELECT id_grupo FROM tusuario_perfil - WHERE id_usuario LIKE '%".$config['id_user']."%'"; - - $groups_for_search = db_process_sql($sql); - - -foreach ($policies as $p) { - foreach ($groups_for_search as $group) { - if ($p['id_group'] == $group['id_grupo'] || $group['id_grupo'] == 0) { - $policies_final = $p; - } - } -} - -$policies = $policies_final; if ($policies !== false) { + $totalPolicies = count($policies); + if ($only_count) { unset($policies); } - - $sql = "SELECT COUNT(id) AS count FROM tpolicies - WHERE id = '".$policies_final['id']."'"; - - - $totalPolicies = db_get_value_sql($sql); } else { $totalPolicies = 0; } From 4b224d1314d9b71dae9c58e94d3a7731193b471e Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Wed, 12 Jun 2019 10:13:37 +0200 Subject: [PATCH 08/32] ad coments and delete is_metaconsole() condition --- pandora_console/operation/search_main.php | 2 +- pandora_console/operation/search_policies.getdata.php | 4 ++++ pandora_console/operation/search_policies.php | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index b236539695..2da3377ff4 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -69,7 +69,7 @@ $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' => $table->data[0][11] = "".sprintf(__('%s Found'), $totalReports).''; $table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]); $table->data[0][13] = "".sprintf(__('%s Found'), $totalMaps).''; -if (enterprise_installed() || is_metaconsole()) { +if (enterprise_installed()) { $table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]); $table->data[0][15] = "".sprintf(__('%s Found'), $totalPolicies).''; } diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index 980a71cec8..aec8298170 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -170,6 +170,10 @@ switch ($sortField) { } if ($searchpolicies == 0) { + /* + We take the user groups to get policies that meet the requirements of the search + and which the user have permission on this groups + */ $user_groups = users_get_groups($config['id_user'], 'AR', false); $id_user_groups = array_keys($user_groups); $id_user_groups_str = implode(',', $id_user_groups); diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php index c048e12c7c..a71d76a733 100644 --- a/pandora_console/operation/search_policies.php +++ b/pandora_console/operation/search_policies.php @@ -13,7 +13,6 @@ // GNU General Public License for more details. global $config; -// require_once $config['homedir'].'/include/functions_status.php'; enterprise_include_once('include/functions_policies.php'); require_once $config['homedir'].'/enterprise/include/functions_groups.php'; From 58009b43c66dd70625ec9038835a0eb7309ac54f Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Fri, 21 Jun 2019 13:39:48 +0200 Subject: [PATCH 09/32] fix bug: custom graphs not showing properly --- pandora_console/include/functions_graph.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 72bc9b5c91..b1e70b5c1a 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2235,7 +2235,6 @@ function combined_graph_summatory_average( $data_array_pop[$key_reverse] = array_pop( $data_array_reverse[$key_reverse] ); - $count_data_array_reverse--; } } @@ -2287,6 +2286,7 @@ function combined_graph_summatory_average( } $count++; + $count_data_array_reverse--; } if ($summatory && isset($array_sum_reverse) From c7e410b16daff3720d9fab29477c952a4d3abef6 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 3 Jul 2019 11:08:17 +0200 Subject: [PATCH 10/32] Added discovery submenus to main menu - #4203 --- pandora_console/godmode/menu.php | 20 +++++++++++++++++--- pandora_console/include/functions_menu.php | 3 +++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 14caf1b9cb..09a2aff770 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -24,9 +24,23 @@ $menu_godmode['class'] = 'godmode'; if (check_acl($config['id_user'], 0, 'PM')) { $sub = []; - $sub['godmode/servers/discovery']['text'] = __('Discovery'); - $sub['godmode/servers/discovery']['id'] = 'Discovery'; - $sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery']; + $sub['godmode/servers/discovery&wiz=main']['text'] = __('Discovery Main'); + $sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery'; + + $sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list'); + $sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist'; + + $sub['godmode/servers/discovery&wiz=app']['text'] = __('Applications'); + $sub['godmode/servers/discovery&wiz=app']['id'] = 'app'; + + $sub['godmode/servers/discovery&wiz=cloud']['text'] = __('Cloud'); + $sub['godmode/servers/discovery&wiz=cloud']['id'] = 'cloud'; + + $sub['godmode/servers/discovery&wiz=ctask']['text'] = __('Console task'); + $sub['godmode/servers/discovery&wiz=ctask']['id'] = 'ctask'; + + $sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices'); + $sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd'; // Add to menu. $menu_godmode['discovery']['text'] = __('Discovery'); diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 3f8a8cd33b..98191d231f 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -52,6 +52,9 @@ function menu_print_menu(&$menu) $sec2 = (string) get_parameter('sec2'); if ($sec2 == 'operation/agentes/ver_agente') { $sec2 = 'godmode/agentes/configurar_agente'; + } else if ($sec2 == 'godmode/servers/discovery') { + $wiz = (string) get_parameter('wiz'); + $sec2 = 'godmode/servers/discovery&wiz='.$wiz; } else { $sec2 = (string) get_parameter('sec2'); } From 18d8f90f90503b8a5e672be57c4bad1a1561a139 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 3 Jul 2019 16:04:40 +0200 Subject: [PATCH 11/32] Credential store upgrade Azure --- pandora_console/godmode/groups/credential_store.php | 4 ++-- pandora_console/include/functions_credential_store.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/groups/credential_store.php b/pandora_console/godmode/groups/credential_store.php index 9a822dc986..8c9540d581 100644 --- a/pandora_console/godmode/groups/credential_store.php +++ b/pandora_console/godmode/groups/credential_store.php @@ -534,8 +534,8 @@ echo ''; $('#div-extra_1').hide(); $('#div-extra_2').hide(); } else if ($('#product :selected').val() == "AZURE") { - $('#div-username label').text(''); - $('#div-password label').text(''); + $('#div-username label').text(''); + $('#div-password label').text(''); $('#div-extra_1 label').text(''); $('#div-extra_2 label').text(''); $('#div-extra_1').show(); diff --git a/pandora_console/include/functions_credential_store.php b/pandora_console/include/functions_credential_store.php index cf09e6d67b..0293cf9721 100644 --- a/pandora_console/include/functions_credential_store.php +++ b/pandora_console/include/functions_credential_store.php @@ -292,8 +292,8 @@ function print_inputs($values=null) 'script' => 'calculate_inputs()', 'fields' => [ // 'CUSTOM' => __('Custom'), - 'AWS' => __('Aws'), - // 'AZURE' => __('Azure'), + 'AWS' => __('Aws'), + 'AZURE' => __('Azure'), // 'GOOGLE' => __('Google'), ], 'selected' => $values['product'], @@ -319,7 +319,7 @@ function print_inputs($values=null) case 'AZURE': $user_label = __('Account ID'); - $pass_label = __('Password'); + $pass_label = __('Application secret'); $extra_1_label = __('Tenant or domain name'); $extra_2_label = __('Subscription id'); break; From 07edee619a92b7178006b90ab80c9ce4a7cebdc4 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 3 Jul 2019 16:38:26 +0200 Subject: [PATCH 12/32] CS filtering and constant --- pandora_console/include/constants.php | 1 + pandora_console/include/functions_credential_store.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 69e867bb40..c5cce5d347 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -602,6 +602,7 @@ define('DISCOVERY_SCRIPT_IPAM_RECON', 3); define('DISCOVERY_SCRIPT_IPMI_RECON', 4); // Discovery task descriptions. +define('CLOUDWIZARD_AZURE_DESCRIPTION', 'Discovery.Cloud.Azure.Compute'); define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2'); define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware'); diff --git a/pandora_console/include/functions_credential_store.php b/pandora_console/include/functions_credential_store.php index 0293cf9721..20b643d0b8 100644 --- a/pandora_console/include/functions_credential_store.php +++ b/pandora_console/include/functions_credential_store.php @@ -72,6 +72,10 @@ function credentials_get_all( throw new Exception('[credential_get_all] Fields must be an array or "count".'); } + if (isset($filter['product']) && !empty($filter['product'])) { + $sql_filters[] = sprintf(' AND cs.product = "%s"', $filter['product']); + } + if (isset($filter['free_search']) && !empty($filter['free_search'])) { $sql_filters[] = vsprintf( ' AND (lower(cs.username) like lower("%%%s%%") @@ -163,7 +167,7 @@ function credentials_get_all( %s %s', join(',', $fields), - join(',', $sql_filters), + join(' ', $sql_filters), $order_by, $pagination ); From 0e3fd848f7e1e5a66ba670058c278ef4d1bcea85 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 4 Jul 2019 19:34:03 +0200 Subject: [PATCH 13/32] minor fixes and visual change in azure credentials --- pandora_console/include/constants.php | 1 + pandora_console/include/functions_credential_store.php | 4 ++-- pandora_console/operation/agentes/ver_agente.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index c5cce5d347..7e44f1c080 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -590,6 +590,7 @@ define('DISCOVERY_APP_MYSQL', 4); define('DISCOVERY_APP_ORACLE', 5); define('DISCOVERY_CLOUD_AWS_EC2', 6); define('DISCOVERY_CLOUD_AWS_RDS', 7); +define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8); // Discovery types matching definition. diff --git a/pandora_console/include/functions_credential_store.php b/pandora_console/include/functions_credential_store.php index 20b643d0b8..eaf756f7b1 100644 --- a/pandora_console/include/functions_credential_store.php +++ b/pandora_console/include/functions_credential_store.php @@ -362,7 +362,7 @@ function print_inputs($values=null) 'label' => $extra_1_label, 'name' => 'extra_1', 'input_class' => 'flex-row', - 'type' => 'password', + 'type' => 'text', 'value' => $values['extra_1'], 'return' => true, ] @@ -375,7 +375,7 @@ function print_inputs($values=null) 'label' => $extra_2_label, 'name' => 'extra_2', 'input_class' => 'flex-row', - 'type' => 'password', + 'type' => 'text', 'value' => $values['extra_2'], 'return' => true, 'display' => $extra2, diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index b9b2a2128d..b625595930 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -70,7 +70,7 @@ if (is_ajax()) { if ($id_agente > 0) { $last_contact = db_get_value_sql( sprintf( - 'SELECT intervalo - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) + 'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val" FROM `tagente` WHERE id_agente = %d ', $id_agente From bd80e013f56330d91e33cdc3cd19b4425cca8582 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 9 Jul 2019 12:02:07 +0200 Subject: [PATCH 14/32] minor fix to avoid log messages --- pandora_console/include/load_session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/load_session.php b/pandora_console/include/load_session.php index 99bae81244..8b243d808a 100644 --- a/pandora_console/include/load_session.php +++ b/pandora_console/include/load_session.php @@ -94,7 +94,7 @@ function pandora_session_write($session_id, $data) if (is_ajax()) { // Avoid session upadte while processing ajax responses - notifications. if (get_parameter('check_new_notifications', false)) { - return false; + return true; } } From 0cabc4d4dac8ac6895b18208ae5cf0177ceeb287 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 9 Jul 2019 12:02:29 +0200 Subject: [PATCH 15/32] Azure discovery task form completed --- .../wizards/DiscoveryTaskList.class.php | 112 +++++++++++------- .../include/functions_snmp_browser.php | 2 - 2 files changed, 70 insertions(+), 44 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index e018ec3d30..586f24335b 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -501,41 +501,60 @@ class DiscoveryTaskList extends Wizard $data[5] = __('Pending'); } - if ($task['id_recon_script'] == 0) { - // Internal discovery task. - switch ($task['type']) { - case DISCOVERY_CLOUD_AWS_RDS: - // Discovery Applications MySQL. - $data[6] = html_print_image( - 'images/network.png', - true, - ['title' => __('Discovery Cloud RDS')] - ).'  '; - $data[6] .= __('Discovery.Cloud.Aws.RDS'); - break; + switch ($task['type']) { + case DISCOVERY_CLOUD_AZURE_COMPUTE: + // Discovery Applications MySQL. + $data[6] = html_print_image( + 'images/plugin.png', + true, + ['title' => __('Discovery Cloud Azure Compute')] + ).'  '; + $data[6] .= __('Cloud.Azure.Compute'); + break; - case DISCOVERY_APP_MYSQL: - // Discovery Applications MySQL. - $data[6] = html_print_image( - 'images/network.png', - true, - ['title' => __('Discovery Applications MySQL')] - ).'  '; - $data[6] .= __('Discovery.App.MySQL'); - break; + case DISCOVERY_CLOUD_AWS_EC2: + // Discovery Applications MySQL. + $data[6] = html_print_image( + 'images/plugin.png', + true, + ['title' => __('Discovery Cloud AWS EC2')] + ).'  '; + $data[6] .= __('Cloud.AWS.EC2'); + break; - case DISCOVERY_APP_ORACLE: - // Discovery Applications Oracle. - $data[6] = html_print_image( - 'images/network.png', - true, - ['title' => __('Discovery Applications Oracle')] - ).'  '; - $data[6] .= __('Discovery.App.Oracle'); - break; + case DISCOVERY_CLOUD_AWS_RDS: + // Discovery Cloud RDS. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Cloud RDS')] + ).'  '; + $data[6] .= __('Discovery.Cloud.Aws.RDS'); + break; - case DISCOVERY_HOSTDEVICES: - default: + case DISCOVERY_APP_MYSQL: + // Discovery Applications MySQL. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Applications MySQL')] + ).'  '; + $data[6] .= __('Discovery.App.MySQL'); + break; + + case DISCOVERY_APP_ORACLE: + // Discovery Applications Oracle. + $data[6] = html_print_image( + 'images/network.png', + true, + ['title' => __('Discovery Applications Oracle')] + ).'  '; + $data[6] .= __('Discovery.App.Oracle'); + break; + + case DISCOVERY_HOSTDEVICES: + default: + if ($task['id_recon_script'] == 0) { // Discovery NetScan. $data[6] = html_print_image( 'images/network.png', @@ -550,15 +569,15 @@ class DiscoveryTaskList extends Wizard } else { $data[6] .= __('Discovery.NetScan'); } - break; - } - } else { - // APP recon task. - $data[6] = html_print_image( - 'images/plugin.png', - true - ).'  '; - $data[6] .= $recon_script_name; + } else { + // APP or external script recon task. + $data[6] = html_print_image( + 'images/plugin.png', + true + ).'  '; + $data[6] .= $recon_script_name; + } + break; } if ($task['status'] <= 0 || $task['status'] > 100) { @@ -699,7 +718,16 @@ class DiscoveryTaskList extends Wizard if ($script !== false) { switch ($script['type']) { case DISCOVERY_SCRIPT_CLOUD_AWS: - return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1'; + switch ($task['type']) { + case DISCOVERY_CLOUD_AWS_EC2: + return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1'; + + case DISCOVERY_CLOUD_AZURE_COMPUTE: + return 'wiz=cloud&mode=azure&ki='.$task['auth_strings'].'&sub=compute&page=0'; + + default: + return 'wiz=cloud'; + } case DISCOVERY_SCRIPT_APP_VMWARE: return 'wiz=app&mode=vmware&page=0'; diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index dded175af5..5b485d9e54 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -96,7 +96,6 @@ function snmp_browser_get_html_tree( foreach ($tree['__LEAVES__'] as $level => $sub_level) { // Id used to expand leafs. $sub_id = time().rand(0, getrandmax()); - // Display the branch. $output .= '
  • '; @@ -225,7 +224,6 @@ function snmp_browser_print_tree( $last_array, $sufix, $checked, - $return, $descriptive_ids, $previous_id ); From ab3cfd4cc97f3b2ef8f0552b5571f9b84a2a74ca Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Tue, 9 Jul 2019 14:08:06 +0200 Subject: [PATCH 16/32] new tocken user edit newslatter info --- .../godmode/users/configure_user.php | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 47788284fe..662df7ecee 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -137,6 +137,8 @@ if ($new_user && $config['admin_can_add_user']) { $user_info['not_login'] = false; $user_info['strict_acl'] = false; $user_info['session_time'] = 0; + $user_info['middlename'] = 0; + if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { $user_info['id_skin'] = ''; } @@ -218,6 +220,7 @@ if ($create_user) { } $values['not_login'] = (bool) get_parameter('not_login', false); + $values['middlename'] = get_parameter('middlename', 0); $values['strict_acl'] = (bool) get_parameter('strict_acl', false); $values['session_time'] = (int) get_parameter('session_time', 0); @@ -317,12 +320,13 @@ if ($update_user) { $values['timezone'] = (string) get_parameter('timezone'); $values['default_event_filter'] = (int) get_parameter('default_event_filter'); $values['default_custom_view'] = (int) get_parameter('default_custom_view'); - // eHorus user level conf + + // 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'); $values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass'); - + $values['middlename'] = get_parameter('middlename', 0); $dashboard = get_parameter('dashboard', ''); $visual_console = get_parameter('visual_console', ''); @@ -869,13 +873,27 @@ foreach ($event_filter_data as $filter) { $table->data[16][0] = __('Default event filter'); $table->data[16][1] = html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false); +$table->data[17][0] = __('Disabled newsletter'); +if ($user_info['middlename'] >= 0) { + $middlename = false; +} else { + $middlename = true; +} + +$table->data[17][1] = html_print_checkbox( + 'middlename', + -1, + $middlename, + true +); + if ($config['ehorus_user_level_conf']) { - $table->data[17][0] = __('eHorus user acces enabled'); - $table->data[17][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true); - $table->data[18][0] = __('eHorus user'); - $table->data[19][0] = __('eHorus password'); - $table->data[18][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true); - $table->data[19][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true); + $table->data[18][0] = __('eHorus user acces enabled'); + $table->data[18][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true); + $table->data[19][0] = __('eHorus user'); + $table->data[20][0] = __('eHorus password'); + $table->data[19][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true); + $table->data[20][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true); } From ca3b893073db33d06b250250ea6614b34e893392 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 9 Jul 2019 16:08:29 +0200 Subject: [PATCH 17/32] Discovery Cloud Azure --- .../lib/PandoraFMS/DiscoveryServer.pm | 58 ++----------------- pandora_server/lib/PandoraFMS/Tools.pm | 20 +++++++ 2 files changed, 26 insertions(+), 52 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 80fcbef8d3..8993826931 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -56,15 +56,7 @@ my $TaskSem :shared; use constant { OS_OTHER => 10, OS_ROUTER => 17, - OS_SWITCH => 18, - DISCOVERY_HOSTDEVICES => 0, - DISCOVERY_HOSTDEVICES_CUSTOM => 1, - DISCOVERY_CLOUD_AWS => 2, - DISCOVERY_APP_VMWARE => 3, - DISCOVERY_APP_MYSQL => 4, - DISCOVERY_APP_ORACLE => 5, - DISCOVERY_CLOUD_AWS_EC2 => 6, - DISCOVERY_CLOUD_AWS_RDS => 7 + OS_SWITCH => 18 }; ######################################################################################## @@ -196,49 +188,11 @@ sub data_consumer ($$) { my $main_event = pandora_event($pa_config, "[Discovery] Execution summary",$task->{'id_group'}, 0, 0, 0, 0, 'system', 0, $dbh); my %cnf_extra; - if ($task->{'type'} == DISCOVERY_CLOUD_AWS_EC2 - || $task->{'type'} == DISCOVERY_CLOUD_AWS_RDS) { - # auth_strings stores the crential identifier to be used. - my $key = pandora_get_credential($dbh, $task->{'auth_strings'}); - - if (ref($key) eq "HASH") { - $cnf_extra{'aws_access_key_id'} = $key->{'username'}; - $cnf_extra{'aws_secret_access_key'} = $key->{'password'}; - } else { - # Invalid credential. - return; - } - - $cnf_extra{'cloud_util_path'} = pandora_get_config_value($dbh, 'cloud_util_path'); - - # Pass credentials by file due Perl limitations. We cannot update ENV here. - $cnf_extra{'creds_file'} = $pa_config->{'temporal'} . '/tmp_discovery.' . md5($task->{'id_rt'} . $task->{'name'} . time()); - eval { - open(my $__file_cfg, '> '. $cnf_extra{'creds_file'}) or die($!); - print $__file_cfg $cnf_extra{'aws_access_key_id'} . "\n"; - print $__file_cfg $cnf_extra{'aws_secret_access_key'} . "\n"; - close($__file_cfg); - set_file_permissions( - $pa_config, - $cnf_extra{'creds_file'}, - "0600" - ); - }; - if ($@) { - logger( - $pa_config, - 'Cannot instantiate configuration file for task: ' . safe_output($task->{'name'}), - 5 - ); - # A server restart will override ENV definition (see run) - logger( - $pa_config, - 'Cannot execute Discovery task: ' . safe_output($task->{'name'}) . '. Please restart the server.', - 1 - ); - # Skip this task. - return; - } + + my $r = enterprise_hook('discovery_generate_extra_cnf',[$pa_config, $dbh, $task, \%cnf_extra]); + if (isset($r) && $r eq 'ERR') { + # Could not generate extra cnf, skip this task. + return; } my $recon = new PandoraFMS::Recon::Base( diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 6271698c03..4a96c5851d 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -72,6 +72,15 @@ our @EXPORT = qw( MIGRATIONSERVER METACONSOLE_LICENSE OFFLINE_LICENSE + DISCOVERY_HOSTDEVICES + DISCOVERY_HOSTDEVICES_CUSTOM + DISCOVERY_CLOUD_AWS + DISCOVERY_APP_VMWARE + DISCOVERY_APP_MYSQL + DISCOVERY_APP_ORACLE + DISCOVERY_CLOUD_AWS_EC2 + DISCOVERY_CLOUD_AWS_RDS + DISCOVERY_CLOUD_AZURE_COMPUTE $DEVNULL $OS $OS_VERSION @@ -172,6 +181,17 @@ use constant OFFLINE_LICENSE => 0x02; use constant RECOVERED_ALERT => 0; use constant FIRED_ALERT => 1; +# Discovery task types +use constant DISCOVERY_HOSTDEVICES => 0; +use constant DISCOVERY_HOSTDEVICES_CUSTOM => 1; +use constant DISCOVERY_CLOUD_AWS => 2; +use constant DISCOVERY_APP_VMWARE => 3; +use constant DISCOVERY_APP_MYSQL => 4; +use constant DISCOVERY_APP_ORACLE => 5; +use constant DISCOVERY_CLOUD_AWS_EC2 => 6; +use constant DISCOVERY_CLOUD_AWS_RDS => 7; +use constant DISCOVERY_CLOUD_AZURE_COMPUTE => 8; + # Set OS, OS version and /dev/null our $OS = $^O; our $OS_VERSION = "unknown"; From 084d1a229e866ccf72cf75d9d21b51c2122c35c0 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 9 Jul 2019 16:41:00 +0200 Subject: [PATCH 18/32] Added success and error messages when change the event owner - #4309 --- pandora_console/include/functions_events.php | 2 ++ .../include/javascript/pandora_events.js | 36 +++++++++++-------- pandora_console/include/styles/events.css | 4 +-- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 5f83669b4b..24efd1215e 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4398,6 +4398,8 @@ function events_page_general($event) $data[1] = $user_owner; } + $table_general->cellclass[3][1] = 'general_owner'; + $table_general->data[] = $data; $data = []; diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 94dadb6fbb..c459ab0443 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -475,19 +475,18 @@ function event_change_owner() { var meta = $("#hidden-meta").val(); var history = $("#hidden-history").val(); - var params = []; - params.push("page=include/ajax/events"); - params.push("change_owner=1"); - params.push("event_id=" + event_id); - params.push("new_owner=" + new_owner); - params.push("meta=" + meta); - params.push("history=" + history); - $("#button-owner_button").attr("disabled", "disabled"); $("#response_loading").show(); jQuery.ajax({ - data: params.join("&"), + data: { + page: "include/ajax/events", + change_owner: 1, + event_id: event_id, + new_owner: new_owner, + meta: meta, + history: history + }, type: "POST", url: $("#hidden-ajax_file").val(), async: true, @@ -496,12 +495,19 @@ function event_change_owner() { $("#button-owner_button").removeAttr("disabled"); $("#response_loading").hide(); - show_event_dialog( - event_id, - $("#hidden-group_rep").val(), - "responses", - data - ); + if (data == "owner_ok") { + dt_events.draw(false); + $("#notification_owner_success").show(); + console.log(new_owner); + if (new_owner == -1) { + new_owner = ""; + } + $("#extended_event_general_page table td.general_owner").text( + new_owner + ); + } else { + $("#notification_owner_error").show(); + } } }); diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index fa1aac2e66..1ed0028dc8 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -271,6 +271,7 @@ ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header margin: 0; margin-bottom: -1px; border: none; + border-bottom: 1px solid #a9a9a9; } ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header @@ -298,9 +299,6 @@ li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab { li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-active { border-bottom: 1px solid #fff; } -div.extended_event_pages.ui-tabs-panel.ui-corner-bottom.ui-widget-content { - border-top: 1px solid #a9a9a9; -} tr.group { padding: 5px; From 936a7e839f617e46b7b2964f45d7866d0150ce4d Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 9 Jul 2019 17:18:37 +0200 Subject: [PATCH 19/32] Added success and error messages when change the event owner - #4309 --- pandora_console/include/javascript/pandora_events.js | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index c459ab0443..2ca786326e 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -498,7 +498,6 @@ function event_change_owner() { if (data == "owner_ok") { dt_events.draw(false); $("#notification_owner_success").show(); - console.log(new_owner); if (new_owner == -1) { new_owner = ""; } From 8c7745768c86e893d3b665d0eb8732a2441fb02b Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 10 Jul 2019 11:05:06 +0200 Subject: [PATCH 20/32] Added success and error messages when change the event owner - #4309 --- .../include/javascript/pandora_events.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 2ca786326e..5727e200f5 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -495,14 +495,22 @@ function event_change_owner() { $("#button-owner_button").removeAttr("disabled"); $("#response_loading").hide(); + if ($("#notification_owner_success").length) { + $("#notification_owner_success").hide(); + } + + if ($("#notification_owner_error").length) { + $("#notification_owner_error").hide(); + } + if (data == "owner_ok") { dt_events.draw(false); $("#notification_owner_success").show(); if (new_owner == -1) { - new_owner = ""; + new_owner = "N/A"; } - $("#extended_event_general_page table td.general_owner").text( - new_owner + $("#extended_event_general_page table td.general_owner").html( + "" + new_owner + "" ); } else { $("#notification_owner_error").show(); From bfb78971495ef29441f491332c2e0cd9c0fdc333 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 10 Jul 2019 12:15:41 +0200 Subject: [PATCH 21/32] Added success and error messages when change the event status - #4309 --- pandora_console/include/functions_events.php | 2 + .../include/javascript/pandora_events.js | 53 ++++++++++++------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 24efd1215e..e368651a12 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4467,6 +4467,8 @@ function events_page_general($event) $data[1] = ''.__('N/A').''; } + $table_general->cellclass[7][1] = 'general_status'; + $table_general->data[] = $data; $data = []; diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 5727e200f5..c50d755fc0 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -437,19 +437,18 @@ function event_change_status(event_ids) { var meta = $("#hidden-meta").val(); var history = $("#hidden-history").val(); - var params = []; - params.push("page=include/ajax/events"); - params.push("change_status=1"); - params.push("event_ids=" + event_ids); - params.push("new_status=" + new_status); - params.push("meta=" + meta); - params.push("history=" + history); - $("#button-status_button").attr("disabled", "disabled"); $("#response_loading").show(); jQuery.ajax({ - data: params.join("&"), + data: { + page: "include/ajax/events", + change_status: 1, + event_ids: event_ids, + new_status: new_status, + meta: meta, + history: history + }, type: "POST", url: $("#hidden-ajax_file").val(), async: true, @@ -457,12 +456,25 @@ function event_change_status(event_ids) { success: function(data) { $("#button-status_button").removeAttr("disabled"); $("#response_loading").hide(); - show_event_dialog( - event_id, - $("#hidden-group_rep").val(), - "responses", - data - ); + + if ($("#notification_status_success").length) { + $("#notification_status_success").hide(); + } + + if ($("#notification_status_error").length) { + $("#notification_status_error").hide(); + } + console.log(data); + if (data == "status_ok") { + dt_events.draw(false); + $("#notification_status_success").show(); + + $("#extended_event_general_page table td.general_status").text( + new_status + ); + } else { + $("#notification_status_error").show(); + } } }); return false; @@ -507,11 +519,14 @@ function event_change_owner() { dt_events.draw(false); $("#notification_owner_success").show(); if (new_owner == -1) { - new_owner = "N/A"; + $("#extended_event_general_page table td.general_owner").html( + "N/A" + ); + } else { + $("#extended_event_general_page table td.general_owner").text( + new_owner + ); } - $("#extended_event_general_page table td.general_owner").html( - "" + new_owner + "" - ); } else { $("#notification_owner_error").show(); } From 1f8e1439634e9f06a9dae6188d36e627110aacd2 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 10 Jul 2019 13:04:06 +0200 Subject: [PATCH 22/32] Fixed bug to change the event status in modal window - #4309 --- pandora_console/include/ajax/events.php | 3 +++ pandora_console/include/javascript/pandora_events.js | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index a7d23ca015..22eb1d7836 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -1139,6 +1139,7 @@ if ($get_extended_event) { $dialog_page = get_parameter('dialog_page', 'general'); $filter = get_parameter('filter', []); + $similar_ids = get_parameter('similar_ids', $event_id); $group_rep = $filter['group_rep']; $event_rep = $event['event_rep']; $timestamp_first = $event['min_timestamp']; @@ -1146,6 +1147,8 @@ if ($get_extended_event) { $server_id = $event['server_id']; $comments = $event['comments']; + $event['similar_ids'] = $similar_ids; + if (!isset($comments)) { $comments = $event['user_comment']; } diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index c50d755fc0..0fb6c1a6ef 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -464,14 +464,10 @@ function event_change_status(event_ids) { if ($("#notification_status_error").length) { $("#notification_status_error").hide(); } - console.log(data); + if (data == "status_ok") { dt_events.draw(false); $("#notification_status_success").show(); - - $("#extended_event_general_page table td.general_status").text( - new_status - ); } else { $("#notification_status_error").show(); } From a4518819e41b825985ff682f7c2da2e4eb6d6583 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Wed, 10 Jul 2019 17:58:52 +0200 Subject: [PATCH 23/32] add link and change table --- pandora_console/operation/search_policies.php | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php index a71d76a733..6277318f66 100644 --- a/pandora_console/operation/search_policies.php +++ b/pandora_console/operation/search_policies.php @@ -30,26 +30,53 @@ if (!$policies || !$searchpolicies) { $table->align[4] = 'center'; $table->head = []; - $table->head[0] = __('ID').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectpolicieIDUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectpolicieIDDown]).''; - $table->head[1] = __('Name').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).''; - $table->head[2] = __('Description').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectDescriptionUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectDescriptionDown]).''; - $table->head[3] = __('Id_group').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectId_groupUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectId_groupDown]).''; - $table->head[4] = __('Status').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectstatusDown]).''; + // $table->head[0] = __('ID').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectpolicieIDUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectpolicieIDDown]).''; + $table->head[0] = __('Name').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).''; + $table->head[1] = __('Description').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectDescriptionUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectDescriptionDown]).''; + $table->head[2] = __('Id_group').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectId_groupUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectId_groupDown]).''; + $table->head[3] = __('Status').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectstatusDown]).''; $table->data = []; foreach ($policies as $policie) { $policieIDCell = "".$policies['id'].''; + switch ($policie['status']) { + case POLICY_UPDATED: + $status = html_print_image( + 'images/policies_ok.png', + true, + ['title' => __('Policy updated')] + ); + break; + + case POLICY_PENDING_DATABASE: + $status = html_print_image( + 'images/policies_error_db.png', + true, + ['title' => __('Pending update policy only database')] + ); + break; + + case POLICY_PENDING_ALL: + $status = html_print_image( + 'images/policies_error.png', + true, + ['title' => __('Pending update policy')] + ); + break; + } + + $url = $config['homeurl'].'/index.php?'.'sec=gmodules&'.'sec2=enterprise/godmode/policies/policies&id='.$policie['id'].''; array_push( $table->data, [ - $policie['id'], - $policie['name'], + // $policie['id'], + ''.$policie['name'].'', $policie['description'], - $policie['id_group'], - $policie['status'], + ui_print_group_icon($policie['id_group'], true), + $status, ] ); From 467ee5fb8f8760805b4ff8e122bfe49a1bc2df3d Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 11 Jul 2019 12:01:19 +0200 Subject: [PATCH 24/32] Minor errata fix --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 8993826931..e70d871042 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -190,7 +190,7 @@ sub data_consumer ($$) { my %cnf_extra; my $r = enterprise_hook('discovery_generate_extra_cnf',[$pa_config, $dbh, $task, \%cnf_extra]); - if (isset($r) && $r eq 'ERR') { + if (defined($r) && $r eq 'ERR') { # Could not generate extra cnf, skip this task. return; } From bd070b706bad475c94d758091b9785397aca37f4 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Thu, 11 Jul 2019 12:45:52 +0200 Subject: [PATCH 25/32] fixed minor error --- pandora_console/general/register.php | 32 +++++++++---------- .../include/class/ConsoleSupervisor.php | 2 +- pandora_console/include/functions_config.php | 8 +++++ pandora_console/operation/users/user_edit.php | 31 +++++++++--------- 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index e6a26bb250..b1d58aada4 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -122,7 +122,6 @@ if (is_ajax()) { exit(); } - ui_require_css_file('register'); $initial = isset($config['initial_wizard']) !== true @@ -150,26 +149,27 @@ if ($initial && users_is_admin()) { ); } -if ($registration && users_is_admin()) { - // Prepare registration wizard, not launch. leave control to flow. - registration_wiz_modal( - false, - // Launch only if not being launch from 'initial'. - !$initial, - (($show_newsletter === true) ? 'force_run_newsletter()' : null) - ); -} else { - if ($show_newsletter) { - // Show newsletter wizard for current user. - newsletter_wiz_modal( +if (!$config['disabled_newsletter']) { + if ($registration && users_is_admin()) { + // Prepare registration wizard, not launch. leave control to flow. + registration_wiz_modal( false, - // Launch only if not being call from 'registration'. - !$registration && !$initial + // Launch only if not being launch from 'initial'. + !$initial, + (($show_newsletter === true) ? 'force_run_newsletter()' : null) ); + } else { + if ($show_newsletter) { + // Show newsletter wizard for current user. + newsletter_wiz_modal( + false, + // Launch only if not being call from 'registration'. + !$registration && !$initial + ); + } } } - $newsletter = null; ?> diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index af688fb5a0..d03b360c16 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -1976,7 +1976,7 @@ class ConsoleSupervisor 'id_user', $config['id_user'] ); - if (license_free() === true + if (!$config['disabled_newsletter'] && $newsletter != 1 && $login === false ) { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 0964cf59a3..558260f7a8 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -395,6 +395,10 @@ function config_update_config() $error_update[] = __('Enable Update Manager'); } + if (!config_update_value('disabled_newsletter', get_parameter('disabled_newsletter'))) { + $error_update[] = __('Disabled newsletter'); + } + if (!config_update_value('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold'))) { $error_update[] = __('Ipam Ocuppied Manager Critical'); } @@ -1723,6 +1727,10 @@ function config_process_config() config_update_value('enable_update_manager', 1); } + if (!isset($config['disabled_newsletter'])) { + config_update_value('disabled_newsletter', 0); + } + if (!isset($config['ipam_ocuppied_critical_treshold'])) { config_update_value('ipam_ocuppied_critical_treshold', 90); } diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 9e267c5c2d..b8b42ad945 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -426,24 +426,25 @@ if (check_acl($config['id_user'], 0, 'ER')) { ).''; } +if (!$config['disabled_newsletter']) { + $newsletter = ''; + $newsletter_reminder = '

    '.__('Newsletter Reminder').':

    '; + $newsletter_reminder .= html_print_switch( + [ + 'name' => 'newsletter_reminder', + 'value' => $newsletter_reminder_value, + 'disabled' => false, + ] + ); + } -$newsletter = '

    '.__('Newsletter Subscribed').':

    '; -if ($user_info['middlename'] > 0) { - $newsletter .= ''.__('Already subscribed to %s newsletter', get_product_name()).''; -} else { - $newsletter .= ''.__('Subscribe to our newsletter').'
    '; - $newsletter_reminder = '

    '.__('Newsletter Reminder').':

    '; - $newsletter_reminder .= html_print_switch( - [ - 'name' => 'newsletter_reminder', - 'value' => $newsletter_reminder_value, - 'disabled' => false, - ] - ); + $newsletter_reminder .= '
    '; } -$newsletter_reminder .= '
    '; - $autorefresh_list_out = []; From fd24398219c0501c9b5c4f0340dbb027dd98e767 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Thu, 11 Jul 2019 14:46:41 +0200 Subject: [PATCH 26/32] Fixed several minor visual bugs - #4347 --- pandora_console/godmode/massive/massive_add_profiles.php | 4 +++- pandora_console/godmode/massive/massive_delete_profiles.php | 4 +++- pandora_console/godmode/setup/setup_visuals.php | 2 +- pandora_console/include/styles/pandora.css | 5 ++--- .../operation/agentes/pandora_networkmap.editor.php | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/massive/massive_add_profiles.php b/pandora_console/godmode/massive/massive_add_profiles.php index 6000dbe9a6..e337c09f81 100644 --- a/pandora_console/godmode/massive/massive_add_profiles.php +++ b/pandora_console/godmode/massive/massive_add_profiles.php @@ -84,7 +84,9 @@ if ($create_profiles) { ); } -html_print_table($table); +if ($table !== null) { + html_print_table($table); +} unset($table); diff --git a/pandora_console/godmode/massive/massive_delete_profiles.php b/pandora_console/godmode/massive/massive_delete_profiles.php index 068f9ee02d..776e72616d 100644 --- a/pandora_console/godmode/massive/massive_delete_profiles.php +++ b/pandora_console/godmode/massive/massive_delete_profiles.php @@ -92,7 +92,9 @@ if ($delete_profiles) { ); } -html_print_table($table); +if ($table !== null) { + html_print_table($table); +} unset($table); diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 6e73913b56..0e7e41e7d6 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1505,7 +1505,7 @@ $(document).ready (function () { .prop('checked'); display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().parent().attr('id')); }); - $(".databox.filters").css('margin-bottom','-10px'); + $(".databox.filters").css('margin-bottom','0px'); }); // Change the favicon preview when is changed diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index de13b884ff..f688186567 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -235,11 +235,12 @@ pre { font-family: courier, serif; } fieldset { - background-color: #f9faf9; + background-color: #fff; border: 1px solid #e2e2e2; padding: 0.5em; margin-bottom: 20px; position: relative; + border-radius: 5px; } fieldset legend { font-size: 1.1em; @@ -5791,7 +5792,6 @@ div#status_pie { grid-template-columns: 50px auto; } - /* * --------------------------------------------------------------------- * - IMAGES FOR STATUS. This replaces the images of /images/status_sets/default/ @@ -5834,7 +5834,6 @@ div#status_pie { * --------------------------------------------------------------------- */ - /* Table for show more info in events and config menu in modules graphs. (This class exists in events.css too) */ .table_modal_alternate { border-spacing: 0; diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 4ed526a404..f5f5b92be1 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -383,14 +383,14 @@ if ($not_found) { html_print_table($table); - echo "
    "; + echo "
    "; if ($new_networkmap) { html_print_input_hidden('save_networkmap', 1); html_print_submit_button( __('Save networkmap'), 'crt', false, - 'class="sub"' + 'class="sub next"' ); } From 219852283d50057b9cdf183ebdcab74a1e9df570 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 11 Jul 2019 14:53:00 +0200 Subject: [PATCH 27/32] Fix in snmp browser tree --- pandora_console/include/functions_snmp_browser.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 5b485d9e54..dc423481f2 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -173,7 +173,6 @@ function snmp_browser_get_html_tree( $last_array, $sufix, $checked, - $return, $descriptive_ids, $previous_id ); From 1dbf8240c4ba515fd58401f330f1c13029558aaf Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Thu, 11 Jul 2019 15:51:35 +0200 Subject: [PATCH 28/32] deelted duplicated count --- pandora_console/operation/search_policies.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php index 6277318f66..7e31db1220 100644 --- a/pandora_console/operation/search_policies.php +++ b/pandora_console/operation/search_policies.php @@ -84,7 +84,6 @@ if (!$policies || !$searchpolicies) { $totalPolicies = count($policies); echo '
    '; - ui_pagination($totalPolicies); html_print_table($table); unset($table); ui_pagination($totalPolicies); From f701bcb44ee028445858a1d3627a9f98c26bfa6c Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Thu, 11 Jul 2019 17:00:50 +0200 Subject: [PATCH 29/32] Fixed several minor visual bugs - #4347 --- .../godmode/reporting/reporting_builder.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 1e552b112a..d499fc35df 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -774,14 +774,14 @@ switch ($action) { $table->head[1] = __('Description'); $table->head[2] = __('HTML'); $table->head[3] = __('XML'); - $table->size[0] = '60%'; + $table->size[0] = '50%'; $table->size[1] = '20%'; $table->size[2] = '2%'; - $table->headstyle[2] = 'min-width: 35px;text-align: center;'; + $table->headstyle[2] = 'min-width: 35px;text-align: left;'; $table->size[3] = '2%'; - $table->headstyle[3] = 'min-width: 35px;text-align: center;'; + $table->headstyle[3] = 'min-width: 35px;text-align: left;'; $table->size[4] = '2%'; - $table->headstyle[4] = 'min-width: 35px;text-align: center;'; + $table->headstyle[4] = 'min-width: 35px;text-align: left;'; $next = 4; // Calculate dinamically the number of the column. @@ -790,15 +790,16 @@ switch ($action) { } $table->size[$next] = '2%'; - $table->style[$next] = 'text-align: center;'; + $table->style[$next] = 'text-align: left;'; - $table->headstyle[($next + 2)] = 'min-width: 100px;'; - $table->style[($next + 2)] = 'text-align: center;'; + $table->headstyle[($next + 2)] = 'min-width: 130px; text-align:right;'; + $table->style[($next + 2)] = 'text-align: right;'; // Admin options only for RM flag. if (check_acl($config['id_user'], 0, 'RM')) { $table->head[$next] = __('Private'); + $table->headstyle[$next] = 'min-width: 40px;text-align: left;'; $table->size[$next] = '2%'; if (defined('METACONSOLE')) { $table->align[$next] = ''; @@ -808,7 +809,9 @@ switch ($action) { $next++; $table->head[$next] = __('Group'); - $table->size[$next] = '15%'; + $table->headstyle[$next] = 'min-width: 40px;text-align: left;'; + $table->size[$next] = '2%'; + $table->align[$next] = 'left'; $next++; $op_column = false; @@ -826,7 +829,7 @@ switch ($action) { // $table->size = array (); $table->size[$next] = '10%'; - $table->align[$next] = 'left'; + $table->align[$next] = 'right'; } $columnview = false; From 055bafe4d7b68dfe64fd6295004d92bd9ee13c4e Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Thu, 11 Jul 2019 17:28:22 +0200 Subject: [PATCH 30/32] changed UM to AW for search policies --- pandora_console/operation/search_main.php | 2 +- pandora_console/operation/search_policies.getdata.php | 2 +- pandora_console/operation/search_policies.php | 2 +- pandora_console/operation/search_results.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index c269b6481c..718fd45be5 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -20,7 +20,7 @@ $searchGraphs = check_acl($config['id_user'], 0, 'RR'); $searchMaps = check_acl($config['id_user'], 0, 'RR'); $searchReports = check_acl($config['id_user'], 0, 'RR'); $searchUsers = check_acl($config['id_user'], 0, 'UM'); -$searchPolicies = check_acl($config['id_user'], 0, 'UM'); +$searchPolicies = check_acl($config['id_user'], 0, 'AW'); $searchHelps = true; echo '
    '; diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index aec8298170..a8c05ea071 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -16,7 +16,7 @@ global $config; enterprise_include_once('include/functions_policies.php'); -$searchpolicies = check_acl($config['id'], 0, 'UM'); +$searchpolicies = check_acl($config['id'], 0, 'AW'); $selectpolicieIDUp = ''; $selectpolicieIDDown = ''; diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php index 7e31db1220..26b3f7737d 100644 --- a/pandora_console/operation/search_policies.php +++ b/pandora_console/operation/search_policies.php @@ -16,7 +16,7 @@ global $config; enterprise_include_once('include/functions_policies.php'); require_once $config['homedir'].'/enterprise/include/functions_groups.php'; -$searchpolicies = check_acl($config['id_user'], 0, 'UM'); +$searchpolicies = check_acl($config['id_user'], 0, 'AW'); if (!$policies || !$searchpolicies) { echo "
    ".__('Zero results found')."
    \n"; diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index 11b4aedec9..803a92cdd1 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -18,7 +18,7 @@ require_once $config['homedir'].'/include/functions_reporting.php'; enterprise_include('operation/reporting/custom_reporting.php'); $searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR'); -$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'UM'); +$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AW'); $searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR'); $searchMain = true; $searchHelps = true; From fe981897792312de35a7374200285c8a4c730b15 Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 12 Jul 2019 00:01:08 +0200 Subject: [PATCH 31/32] 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 9a0b872a6e..b6ecacb2b4 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.736-190711 +Version: 7.0NG.736-190712 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 4d84020703..c7f4f3334e 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.736-190711" +pandora_version="7.0NG.736-190712" 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 8a6ac38d5f..1298d9c2f9 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.736'; -use constant AGENT_BUILD => '190711'; +use constant AGENT_BUILD => '190712'; # 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 c9f7f10dc0..5fdc516b68 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.736 -%define release 190711 +%define release 190712 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 8d1ff4fc15..891b2769f1 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.736 -%define release 190711 +%define release 190712 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 52b49cca0c..01d573fb70 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190711" +PI_BUILD="190712" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index efa43a74ee..d20217c6a0 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190711} +{190712} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 75fb3cbe98..51c386db55 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.736(Build 190711)") +#define PANDORA_VERSION ("7.0NG.736(Build 190712)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 392c639976..feb8e814e1 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.736(Build 190711))" + VALUE "ProductVersion", "(7.0NG.736(Build 190712))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 32efed3e39..901b426196 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.736-190711 +Version: 7.0NG.736-190712 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 68e0aa147f..98935e7bf9 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.736-190711" +pandora_version="7.0NG.736-190712" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index f72acc3ef6..ab7acc743d 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 = 'PC190711'; +$build_version = 'PC190712'; $pandora_version = 'v7.0NG.736'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index e0c24fd2c6..7b1d4833a6 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 230fbad5e8..388fabbd14 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.736 -%define release 190711 +%define release 190712 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 0cee7965f4..20093a9ea4 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.736 -%define release 190711 +%define release 190712 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 48ace9e334..48dd2eaa41 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190711" +PI_BUILD="190712" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index f655b5bcb0..e040b6ea7e 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.736 PS190711"; +my $version = "7.0NG.736 PS190712"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 7172389c25..172c7ee278 100644 --- 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.736 PS190711"; +my $version = "7.0NG.736 PS190712"; # save program name for logging my $progname = basename($0); From 46f55c6d65af3ccf7d06fa60bb3688584841d982 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Fri, 12 Jul 2019 08:59:26 +0200 Subject: [PATCH 32/32] Fixed several minor visual bugs - #4347 --- pandora_console/operation/agentes/pandora_networkmap.editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index f5f5b92be1..7f698d8653 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -401,7 +401,7 @@ if ($not_found) { __('Update networkmap'), 'crt', false, - 'class="sub"' + 'class="sub upd"' ); }