From 77e465fff90a2df97d835de412711fac9c0d1bcc Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Fri, 11 Sep 2020 14:35:32 +0200 Subject: [PATCH 001/230] fixed errors in massive operations --- .../massive/massive_add_action_alerts.php | 24 +++++++++- .../godmode/massive/massive_add_alerts.php | 28 ++++++++--- .../massive/massive_delete_action_alerts.php | 23 ++++++++- .../massive/massive_delete_modules.php | 45 ++++++++++++++++-- .../godmode/massive/massive_edit_modules.php | 47 +++++++++++++++++-- 5 files changed, 150 insertions(+), 17 deletions(-) diff --git a/pandora_console/godmode/massive/massive_add_action_alerts.php b/pandora_console/godmode/massive/massive_add_action_alerts.php index 9abac11def..52fd5bed07 100755 --- a/pandora_console/godmode/massive/massive_add_action_alerts.php +++ b/pandora_console/godmode/massive/massive_add_action_alerts.php @@ -67,10 +67,30 @@ if ($add) { $modules = get_parameter('module'); $modules_id = []; if (!empty($modules)) { + $modules_id = []; + foreach ($modules as $module) { foreach ($id_agents as $id_agent) { - $module_id = modules_get_agentmodule_id($module, $id_agent); - $modules_id[] = $module_id['id_agente_modulo']; + if ($module == '0') { + // Get all modules of agent. + $agent_modules = db_get_all_rows_filter( + 'tagente_modulo', + ['id_agente' => $id_agent], + 'id_agente_modulo' + ); + + $agent_modules_id = array_map( + function ($field) { + return $field['id_agente_modulo']; + }, + $agent_modules + ); + + $modules_id = array_merge($modules_id, $agent_modules_id); + } else { + $module_id = modules_get_agentmodule_id($module, $id_agent); + $modules_id[] = $module_id['id_agente_modulo']; + } } } diff --git a/pandora_console/godmode/massive/massive_add_alerts.php b/pandora_console/godmode/massive/massive_add_alerts.php index bf52fd0459..7ed99d8277 100755 --- a/pandora_console/godmode/massive/massive_add_alerts.php +++ b/pandora_console/godmode/massive/massive_add_alerts.php @@ -106,15 +106,31 @@ function process_manage_add($id_alert_template, $id_agents, $module_names) return false; } + $modules_id = []; + foreach ($module_names as $module) { foreach ($id_agents as $id_agent) { - $module_id = modules_get_agentmodule_id($module, $id_agent); - $modules_id[] = $module_id['id_agente_modulo']; - } - } + if ($module == '0') { + // Get all modules of agent. + $agent_modules = db_get_all_rows_filter( + 'tagente_modulo', + ['id_agente' => $id_agent], + 'id_agente_modulo' + ); - if (count($module_names) == 1 && $module_names[0] == '0') { - $modules_id = agents_common_modules($id_agents, false, true); + $agent_modules_id = array_map( + function ($field) { + return $field['id_agente_modulo']; + }, + $agent_modules + ); + + $modules_id = array_merge($modules_id, $agent_modules_id); + } else { + $module_id = modules_get_agentmodule_id($module, $id_agent); + $modules_id[] = $module_id['id_agente_modulo']; + } + } } $conttotal = 0; diff --git a/pandora_console/godmode/massive/massive_delete_action_alerts.php b/pandora_console/godmode/massive/massive_delete_action_alerts.php index 832765d4de..5f658fade6 100644 --- a/pandora_console/godmode/massive/massive_delete_action_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_action_alerts.php @@ -66,10 +66,29 @@ if ($delete) { $modules = (array) get_parameter('module'); $modules_id = []; if (!empty($modules)) { + $modules_id = []; foreach ($modules as $module) { foreach ($id_agents as $id_agent) { - $module_id = modules_get_agentmodule_id($module, $id_agent); - $modules_id[] = $module_id['id_agente_modulo']; + if ($module == '0') { + // Get all modules of agent. + $agent_modules = db_get_all_rows_filter( + 'tagente_modulo', + ['id_agente' => $id_agent], + 'id_agente_modulo' + ); + + $agent_modules_id = array_map( + function ($field) { + return $field['id_agente_modulo']; + }, + $agent_modules + ); + + $modules_id = array_merge($modules_id, $agent_modules_id); + } else { + $module_id = modules_get_agentmodule_id($module, $id_agent); + $modules_id[] = $module_id['id_agente_modulo']; + } } } diff --git a/pandora_console/godmode/massive/massive_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php index 7d8d64141a..6b31331d1b 100755 --- a/pandora_console/godmode/massive/massive_delete_modules.php +++ b/pandora_console/godmode/massive/massive_delete_modules.php @@ -450,7 +450,7 @@ $table->data['form_modules_2'][1] = html_print_select( '', false, 'width:100%' -); +).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'"); $table->data['form_modules_2'][2] = __('When select modules'); $table->data['form_modules_2'][2] .= '
'; @@ -522,7 +522,8 @@ $table->data['form_agents_3'][1] = html_print_select( '', false, 'width:100%' -); +).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'"); + $table->data['form_agents_3'][2] = __('When select agents'); $table->data['form_agents_3'][2] .= '
'; $table->data['form_agents_3'][2] .= html_print_select( @@ -588,6 +589,44 @@ if ($selection_mode == 'modules') { var limit_parameters_massive = ; $(document).ready (function () { + $("#checkbox-select_all_modules").change(function() { + if( $('#checkbox-select_all_modules').prop('checked')) { + $("#module_name option").prop('selected', 'selected'); + $("#module_name").trigger('change'); + } else { + $("#module_name option").prop('selected', false); + $("#module_name").trigger('change'); + } + }); + + $("#module_name").change(function() { + var options_length = $("#module_name option").length; + var options_selected_length = $("#module_name option:selected").length; + + if (options_selected_length < options_length) { + $('#checkbox-select_all_modules').prop("checked", false); + } + }); + + $("#checkbox-select_all_agents").change(function() { + if( $('#checkbox-select_all_agents').prop('checked')) { + $("#id_agents option").prop('selected', 'selected'); + $("#id_agents").trigger('change'); + } else { + $("#id_agents option").prop('selected', false); + $("#id_agents").trigger('change'); + } + }); + + $("#id_agents").change(function() { + var options_length = $("#id_agents option").length; + var options_selected_length = $("#id_agents option:selected").length; + + if (options_selected_length < options_length) { + $('#checkbox-select_all_agents').prop("checked", false); + } + }); + $("#id_agents").change(agent_changed_by_multiple_agents); $("#module_name").change(module_changed_by_multiple_modules); @@ -680,7 +719,7 @@ $(document).ready (function () { $('#groups_select').val(-1); } - $('input[type=checkbox]').change ( + $('input[type=checkbox]').not(".static").change ( function () { if (this.id == "checkbox-force_type") { if (this.checked) { diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 9f25e16c70..3c3975778e 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -406,7 +406,8 @@ $table->data['form_modules_2'][1] = html_print_select( true, true, true -); +).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'"); + $table->data['form_modules_2'][2] = __('When select modules'); $table->data['form_modules_2'][2] .= '
'; $table->data['form_modules_2'][2] .= html_print_select( @@ -491,7 +492,7 @@ $table->data['form_agents_3'][1] = html_print_select( true, true, false -); +).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'"); $table->data['form_agents_3'][2] = __('When select agents'); $table->data['form_agents_3'][2] .= '
'; @@ -1212,7 +1213,45 @@ $(document).ready (function () { return false; } }); - + + $("#checkbox-select_all_modules").change(function() { + if( $('#checkbox-select_all_modules').prop('checked')) { + $("#module_name option").prop('selected', 'selected'); + $("#module_name").trigger('change'); + } else { + $("#module_name option").prop('selected', false); + $("#module_name").trigger('change'); + } + }); + + $("#module_name").change(function() { + var options_length = $("#module_name option").length; + var options_selected_length = $("#module_name option:selected").length; + + if (options_selected_length < options_length) { + $('#checkbox-select_all_modules').prop("checked", false); + } + }); + + $("#checkbox-select_all_agents").change(function() { + if( $('#checkbox-select_all_agents').prop('checked')) { + $("#id_agents option").prop('selected', 'selected'); + $("#id_agents").trigger('change'); + } else { + $("#id_agents option").prop('selected', false); + $("#id_agents").trigger('change'); + } + }); + + $("#id_agents").change(function() { + var options_length = $("#id_agents option").length; + var options_selected_length = $("#id_agents option:selected").length; + + if (options_selected_length < options_length) { + $('#checkbox-select_all_agents').prop("checked", false); + } + }); + $("#text-custom_ip_target").hide(); $("#id_agents").change(agent_changed_by_multiple_agents); @@ -1463,7 +1502,7 @@ $(document).ready (function () { $('#groups_select').val(-1); } - $('input[type=checkbox]').change ( + $('input[type=checkbox]').not(".static").change ( function () { if (this.id == "checkbox-force_type") { if (this.checked) { From a70fc200b7a4167b8e81828ce390fcebc64d8e1c Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Mon, 14 Sep 2020 09:27:01 +0200 Subject: [PATCH 002/230] Fixed bug in unit field --- .../agentes/module_manager_editor_common.php | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index b812e5b8b0..440c4b3d4a 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -535,20 +535,30 @@ $table_advanced->data[0][1] = html_print_input_text( ); $table_advanced->data[0][3] = __('Unit'); -// $table_advanced->data[1][4] = html_print_input_text ('unit', $unit, '', 20, 65, true, -// $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy); -// $table_advanced->colspan[1][4] = 3; -$table_advanced->data[0][4] = html_print_extended_select_for_unit( +$table_advanced->data[0][4] = html_print_input_text ( 'unit', $unit, '', - '', - '0', - false, + 20, + 65, true, + $disabledBecauseInPolicy, false, - false + '', + $classdisabledBecauseInPolicy ); +// $table_advanced->colspan[1][4] = 3; +//$table_advanced->data[0][4] = html_print_extended_select_for_unit( +// 'unit', +// $unit, +// '', +// '', +// '0', +// false, +// true, +// false, +// false +//); $table_advanced->colspan[0][4] = 3; $module_id_policy_module = 0; From fae8070e2978d58194f7139f58239c13e173765e Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Tue, 15 Sep 2020 19:57:52 +0200 Subject: [PATCH 003/230] Report macros now apply on showing report --- .../godmode/reporting/reporting_builder.php | 10 +- .../include/functions_reporting.php | 583 ++++++++++++++++-- 2 files changed, 536 insertions(+), 57 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index b88cc5d64e..499dd6a671 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1419,10 +1419,7 @@ switch ($action) { 'module_description' => $module_description, ]; - $values['name'] = reporting_label_macro( - $items_label, - $name_it - ); + $values['name'] = $name_it; $values['landscape'] = get_parameter('landscape'); $values['pagebreak'] = get_parameter('pagebreak'); @@ -2115,10 +2112,7 @@ switch ($action) { 'module_description' => $module_description, ]; - $values['name'] = reporting_label_macro( - $items_label, - $name_it - ); + $values['name'] = $name_it; $values['landscape'] = get_parameter('landscape'); $values['pagebreak'] = get_parameter('pagebreak'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index a27be4f530..3e830b2398 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1840,10 +1840,23 @@ function reporting_event_report_group( $history = true; } - $return['title'] = $content['name']; + $group_name = groups_get_name($content['id_group'], true); + + $items_label = ['agent_group' => $group_name]; + + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; - $return['subtitle'] = groups_get_name($content['id_group'], true); + $return['subtitle'] = $group_name; if (!empty($content['style']['event_filter_search'])) { $return['subtitle'] .= ' ('.$content['style']['event_filter_search'].')'; } @@ -2122,7 +2135,16 @@ function reporting_event_report_module( 'module_description' => $module_description, ]; - $return['title'] = $content['name']; + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_alias.' - '.io_safe_output($module_name); @@ -2230,18 +2252,44 @@ function reporting_inventory_changes($report, $content, $type) metaconsole_connect($server); } - $return['title'] = $content['name']; + $es = json_decode($content['external_source'], true); + + $id_agent = $es['id_agents']; + $module_name = $es['inventory_modules']; + $id_agent_module = modules_get_agentmodule_id($module_name, $id_agent); + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + + $items_label = [ + 'id_agent' => $id_agent, + 'id_agent_module' => $id_agent_module, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + ]; + + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = agents_get_alias($content['id_agent']); $return['description'] = $content['description']; $return['date'] = reporting_get_date_text($report, $content); - $es = json_decode($content['external_source'], true); - - $id_agent = $es['id_agents']; - $module_name = $es['inventory_modules']; - switch ($type) { case 'data': $inventory_changes = inventory_get_changes( @@ -2299,12 +2347,6 @@ function reporting_inventory($report, $content, $type) metaconsole_connect($server); } - $return['title'] = $content['name']; - $return['landscape'] = $content['landscape']; - $return['pagebreak'] = $content['pagebreak']; - $return['description'] = $content['description']; - $return['date'] = reporting_get_date_text($report, $content); - $es = json_decode($content['external_source'], true); $id_agent = $es['id_agents']; @@ -2313,6 +2355,35 @@ function reporting_inventory($report, $content, $type) $module_name = [0 => 0]; } + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + + $items_label = [ + 'type' => $return['type'], + 'id_agent' => $id_agent, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + ]; + + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; + $return['landscape'] = $content['landscape']; + $return['pagebreak'] = $content['pagebreak']; + $return['description'] = $content['description']; + $return['date'] = reporting_get_date_text($report, $content); + $date = $es['date']; $description = $content['description']; @@ -2942,8 +3013,21 @@ function reporting_group_report($report, $content) $connection = metaconsole_get_connection($server); } + $items_label = [ + 'agent_group' => groups_get_name($content['id_group'], true), + ]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + $return['server_name'] = $server[0]; - $return['title'] = io_safe_output($content['name']); + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = groups_get_name($content['id_group'], true); @@ -3034,6 +3118,15 @@ function reporting_event_report_agent( 'agent_alias' => $agent_alias, ]; + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + if ($config['metaconsole']) { metaconsole_restore_db(); } @@ -3047,7 +3140,7 @@ function reporting_event_report_agent( } $return['label'] = $label; - $return['title'] = io_safe_output($content['name']); + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = io_safe_output($agent_alias); @@ -3258,7 +3351,16 @@ function reporting_historical_data($report, $content) 'module_description' => $module_description, ]; - $return['title'] = $content['name']; + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_alias.' - '.$module_name; @@ -3383,7 +3485,16 @@ function reporting_database_serialized($report, $content) 'module_description' => $module_description, ]; - $return['title'] = $content['name']; + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_alias.' - '.$module_name; @@ -3537,7 +3648,37 @@ function reporting_last_value($report, $content) $content['id_agent_module'] ); - $return['title'] = $content['name']; + $id_agent_module = $content['id_agent_module']; + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + + $items_label = [ + 'type' => $return['type'], + 'id_agent' => $id_agent, + 'id_agent_module' => $id_agent_module, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + 'module_name' => $module_name, + 'module_description' => $module_description, + ]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_alias.' - '.$module_name; @@ -3592,7 +3733,18 @@ function reporting_group_configuration($report, $content) $group_name = groups_get_name($content['id_group'], true); - $return['title'] = $content['name']; + $items_label = ['agent_group' => $group_name]; + + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $group_name; @@ -3667,7 +3819,18 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic', $group_name = groups_get_name($content['id_group']); - $return['title'] = $content['name']; + $items_label = ['_agentgroup_' => $group_name]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $group_name; @@ -3886,7 +4049,18 @@ function reporting_alert_report_group($report, $content) $group_name = groups_get_name($content['id_group'], true); - $return['title'] = $content['name']; + $items_label = ['agent_group' => $group_name]; + + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $group_name; @@ -4089,7 +4263,16 @@ function reporting_alert_report_agent($report, $content) 'agent_alias' => $agent_alias, ]; - $return['title'] = $content['name']; + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_alias; @@ -4259,7 +4442,16 @@ function reporting_alert_report_module($report, $content) 'module_description' => $module_description, ]; - $return['title'] = $content['name']; + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_alias.' - '.$module_name; @@ -4520,7 +4712,16 @@ function reporting_monitor_report($report, $content) 'module_description' => $module_description, ]; - $return['title'] = $content['name']; + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_alias.' - '.$module_name; @@ -4712,11 +4913,57 @@ function reporting_prediction_date($report, $content) ); $agent_name_db = io_safe_output(modules_get_agentmodule_agent_name($content['id_agent_module'])); - $return['title'] = $content['name']; + $id_agent = agents_get_module_id( + $content['id_agent_module'] + ); + + $id_agent_module = $content['id_agent_module']; + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + $module_name = modules_get_agentmodule_name( + $id_agent_module + ); + + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + + $items_label = [ + 'type' => $return['type'], + 'id_agent' => $id_agent, + 'id_agent_module' => $id_agent_module, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + 'module_name' => $module_name, + 'module_description' => $module_description, + ]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $description = (isset($content['description'])) ? $content['description'] : ''; + if ($description != '') { + $description = reporting_label_macro( + $items_label, + $description + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_name.' - '.$module_name; - $return['description'] = $content['description']; + $return['description'] = $description; $return['date'] = reporting_get_date_text($report, $content); $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : ''; @@ -4767,7 +5014,45 @@ function reporting_projection_graph( $agent_name = io_safe_output(modules_get_agentmodule_agent_alias($content['id_agent_module'])); $agent_name_db = io_safe_output(modules_get_agentmodule_agent_name($content['id_agent_module'])); - $return['title'] = $content['name']; + $id_agent = agents_get_module_id( + $content['id_agent_module'] + ); + + $id_agent_module = $content['id_agent_module']; + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + $module_name = modules_get_agentmodule_name( + $id_agent_module + ); + + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + + $items_label = [ + 'type' => $return['type'], + 'id_agent' => $id_agent, + 'id_agent_module' => $id_agent_module, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + 'module_name' => $module_name, + 'module_description' => $module_description, + ]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['subtitle'] = $agent_name.' - '.$module_name; $return['description'] = $content['description']; $return['date'] = reporting_get_date_text($report, $content); @@ -4846,7 +5131,36 @@ function reporting_agent_configuration($report, $content) $content['name'] = __('Agent configuration'); } - $return['title'] = $content['name']; + $sql = ' + SELECT * + FROM tagente + WHERE id_agente='.$content['id_agent']; + $agent_data = db_get_row_sql($sql); + + $id_agent = $content['id_agent']; + $agent_alias = $agent_data['alias']; + $agent_group = groups_get_name($agent_data['id_grupo']); + $agent_description = $agent_data['comentarios']; + $agent_address = $agent_data['direccion']; + + $items_label = [ + 'id_agent' => $id_agent, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + ]; + + // Apply macros. + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['description'] = $content['description']; @@ -4860,20 +5174,14 @@ function reporting_agent_configuration($report, $content) metaconsole_connect($server); } - $sql = ' - SELECT * - FROM tagente - WHERE id_agente='.$content['id_agent']; - $agent_data = db_get_row_sql($sql); - $agent_configuration = []; - $agent_configuration['name'] = $agent_data['alias']; - $agent_configuration['group'] = groups_get_name($agent_data['id_grupo']); + $agent_configuration['name'] = $agent_alias; + $agent_configuration['group'] = $agent_group; $agent_configuration['group_icon'] = ui_print_group_icon($agent_data['id_grupo'], true, '', '', false); $agent_configuration['os'] = os_get_name($agent_data['id_os']); $agent_configuration['os_icon'] = ui_print_os_icon($agent_data['id_os'], true, true); - $agent_configuration['address'] = $agent_data['direccion']; - $agent_configuration['description'] = $agent_data['comentarios']; + $agent_configuration['address'] = $agent_address; + $agent_configuration['description'] = $agent_description; $agent_configuration['enabled'] = (int) !$agent_data['disabled']; $agent_configuration['group'] = $report['group']; $modules = agents_get_modules($content['id_agent']); @@ -5026,13 +5334,59 @@ function reporting_value($report, $content, $type, $pdf=false) $content['id_agent_module'] ); - $return['title'] = $content['name']; + $id_agent = agents_get_module_id( + $content['id_agent_module'] + ); + + $id_agent_module = $content['id_agent_module']; + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + $module_name = modules_get_agentmodule_name( + $id_agent_module + ); + + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + + $items_label = [ + 'type' => $return['type'], + 'id_agent' => $id_agent, + 'id_agent_module' => $id_agent_module, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + 'module_name' => $module_name, + 'module_description' => $module_description, + ]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $label = (isset($content['name'])) ? $content['name'] : ''; + if ($label != '') { + $label = reporting_label_macro( + $items_label, + $label + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_name.' - '.$module_name; $return['description'] = $content['description']; $return['date'] = reporting_get_date_text($report, $content); - $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : ''; + $return['label'] = $label; $return['agents'] = [$content['id_agent']]; $return['id_agent'] = $content['id_agent']; $return['id_agent_module'] = $content['id_agent_module']; @@ -7573,7 +7927,42 @@ function reporting_increment($report, $content) $content['name'] = __('Increment'); } - $return['title'] = $content['name']; + $id_agent = $content['id_agent']; + $id_agent_module = $content['id_agent_module']; + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + $module_name = modules_get_agentmodule_name( + $id_agent_module + ); + + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + + $items_label = [ + 'type' => $return['type'], + 'id_agent' => $id_agent, + 'id_agent_module' => $id_agent_module, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + 'module_name' => $module_name, + 'module_description' => $module_description, + ]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['description'] = $content['description']; @@ -8197,6 +8586,10 @@ function reporting_custom_graph( $content['name'] = __('Simple graph'); } + $id_agent = agents_get_module_id( + $content['id_agent_module'] + ); + $agent_description = agents_get_description($id_agent); $agent_group = agents_get_agent_group($id_agent); $agent_address = agents_get_address($id_agent); @@ -8209,13 +8602,42 @@ function reporting_custom_graph( $id_agent_module ); - $return['title'] = $content['name']; + $items_label = [ + 'type' => $return['type'], + 'id_agent' => $id_agent, + 'id_agent_module' => $id_agent_module, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + 'module_name' => $module_name, + 'module_description' => $module_description, + ]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $description = (isset($content['description'])) ? $content['description'] : ''; + if ($description != '') { + $description = reporting_label_macro( + $items_label, + $description + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $graphs[0]['name']; $return['agent_name'] = $agent_alias; $return['module_name'] = $module_name; - $return['description'] = $content['description']; + $return['description'] = $description; $return['date'] = reporting_get_date_text( $report, $content @@ -8358,6 +8780,23 @@ function reporting_simple_graph( 'module_description' => $module_description, ]; + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $description = (isset($content['description'])) ? $content['description'] : ''; + if ($description != '') { + $description = reporting_label_macro( + $items_label, + $description + ); + } + $label = (isset($content['style']['label'])) ? $content['style']['label'] : ''; if ($label != '') { $label = reporting_label_macro( @@ -8366,14 +8805,14 @@ function reporting_simple_graph( ); } - $return['title'] = io_safe_output($content['name']); + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_alias.' - '.$module_name; $return['agent_name_db'] = agents_get_name($id_agent); $return['agent_name'] = $agent_alias; $return['module_name'] = $module_name; - $return['description'] = io_safe_output($content['description']); + $return['description'] = $description; $return['date'] = reporting_get_date_text( $report, $content @@ -12858,11 +13297,57 @@ function reporting_module_histogram_graph($report, $content, $pdf=0) ) ); - $return['title'] = $content['name']; + $id_agent = agents_get_module_id( + $content['id_agent_module'] + ); + + $id_agent_module = $content['id_agent_module']; + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + $module_name = modules_get_agentmodule_name( + $id_agent_module + ); + + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + + $items_label = [ + 'type' => $return['type'], + 'id_agent' => $id_agent, + 'id_agent_module' => $id_agent_module, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + 'module_name' => $module_name, + 'module_description' => $module_description, + ]; + + // Apply macros + $title = (isset($content['name'])) ? $content['name'] : ''; + if ($title != '') { + $title = reporting_label_macro( + $items_label, + $title + ); + } + + $description = (isset($content['description'])) ? $content['description'] : ''; + if ($description != '') { + $description = reporting_label_macro( + $items_label, + $description + ); + } + + $return['title'] = $title; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; $return['subtitle'] = $agent_name.' - '.$module_name; - $return['description'] = $content['description']; + $return['description'] = $description; $return['date'] = reporting_get_date_text( $report, $content From 6a21a668bf6721d24ea5d2027c27b0b45e7afc75 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 29 Sep 2020 09:44:20 +0200 Subject: [PATCH 004/230] Added control for reveal passwords --- .../godmode/setup/setup_general.php | 7 +++++-- pandora_console/include/functions_ui.php | 20 +++++++++++++++++++ .../include/javascript/pandora_ui.js | 13 ++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 0d8ce68e8e..e4aa1181a9 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -124,7 +124,8 @@ $table->data[$i][0] = __('Phantomjs bin directory'); $table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true); $table->data[$i][0] = __('Auto login (hash) password'); -$table->data[$i++][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true); +$table->data[$i][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true); +$table->data[$i++][1] .= ui_print_reveal_password('loginhash_pwd', true); $table->data[$i][0] = __('Time source'); $sources['system'] = __('System'); @@ -162,7 +163,8 @@ if (isset($_POST['list_ACL_IPs_for_API'])) { $table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true); $table->data[$i][0] = __('API password'); -$table->data[$i++][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true); +$table->data[$i][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true); +$table->data[$i++][1] .= ui_print_reveal_password('api_password', true); $table->data[$i][0] = __('Enable GIS features'); $table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true); @@ -384,6 +386,7 @@ $table_mail_conf->data[5][1] = html_print_input_text('email_username', $config[' $table_mail_conf->data[6][0] = __('Email password'); $table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true); +$table_mail_conf->data[6][1] .= ui_print_reveal_password('email_password', true); $uniqid = uniqid(); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index ab6079fb36..2233b2fe95 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -6124,3 +6124,23 @@ function ui_print_message_dialog($title, $text, $id='', $img='', $text_button='' echo ''; echo ''; } + + +/** + * Generate a button for reveal the content of the password field. + * + * @param string $name Name of the field. + * @param boolean $return If true, return the string with the formed element. + * + * @return string + */ +function ui_print_reveal_password(string $name, bool $return=false) +{ + $output = ' '; + + if ($return === true) { + return $output; + } + + echo $output; +} diff --git a/pandora_console/include/javascript/pandora_ui.js b/pandora_console/include/javascript/pandora_ui.js index 2445473591..951db0e712 100644 --- a/pandora_console/include/javascript/pandora_ui.js +++ b/pandora_console/include/javascript/pandora_ui.js @@ -552,3 +552,16 @@ function infoMessage(data, idMsg) { }) .show(); } + +function reveal_password(name) { + var passwordElement = $("#password-" + name); + var revealElement = $("#reveal_password_" + name); + + if (passwordElement.attr("type") == "password") { + passwordElement.attr("type", "text"); + revealElement.attr("src", "images/eye_hide.png"); + } else { + passwordElement.attr("type", "password"); + revealElement.attr("src", "images/eye_show.png"); + } +} From 9d0becc0122e7029bed214d1c84bd9cb5aa7d920 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 29 Sep 2020 10:12:49 +0200 Subject: [PATCH 005/230] Added other password fields --- pandora_console/extensions/quick_shell.php | 1 + pandora_console/godmode/setup/setup_auth.php | 4 ++++ pandora_console/godmode/setup/setup_ehorus.php | 1 + pandora_console/godmode/setup/setup_integria.php | 2 ++ 4 files changed, 8 insertions(+) diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php index 27807e6029..5505caa3af 100644 --- a/pandora_console/extensions/quick_shell.php +++ b/pandora_console/extensions/quick_shell.php @@ -468,6 +468,7 @@ function quickShellSettings() 100, true ); + $hidden->data[1][1] .= ui_print_reveal_password('gotty_pass', true); html_print_table($t); diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index db436224c3..eba3b44e0d 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -189,6 +189,10 @@ if (is_ajax()) { 100, true ); + $row['control'] .= ui_print_reveal_password( + 'ldap_admin_pass', + true + ); $table->data['ldap_admin_pass'] = $row; break; diff --git a/pandora_console/godmode/setup/setup_ehorus.php b/pandora_console/godmode/setup/setup_ehorus.php index 1c3650418b..1c522593ee 100644 --- a/pandora_console/godmode/setup/setup_ehorus.php +++ b/pandora_console/godmode/setup/setup_ehorus.php @@ -82,6 +82,7 @@ $table_remote->data['ehorus_user'] = $row; $row = []; $row['name'] = __('Password'); $row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true); +$row['control'] .= ui_print_reveal_password('ehorus_pass', true); $table_remote->data['ehorus_pass'] = $row; // Directory hostname. diff --git a/pandora_console/godmode/setup/setup_integria.php b/pandora_console/godmode/setup/setup_integria.php index e172dda50b..0113c6f024 100644 --- a/pandora_console/godmode/setup/setup_integria.php +++ b/pandora_console/godmode/setup/setup_integria.php @@ -221,6 +221,7 @@ $table_remote->data['integria_user'] = $row; $row = []; $row['name'] = __('Password'); $row['control'] = html_print_input_password('integria_pass', io_output_password($config['integria_pass']), '', 30, 100, true); +$row['control'] .= ui_print_reveal_password('integria_pass', true); $table_remote->data['integria_pass'] = $row; // Integria hostname. @@ -233,6 +234,7 @@ $table_remote->data['integria_hostname'] = $row; $row = []; $row['name'] = __('API Password'); $row['control'] = html_print_input_password('integria_api_pass', io_output_password($config['integria_api_pass']), '', 30, 100, true); +$row['control'] .= ui_print_reveal_password('integria_api_pass', true); $table_remote->data['integria_api_pass'] = $row; // Request timeout. From 00b289a557f73cda6656c14aed17495a7f040800 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 29 Sep 2020 12:21:52 +0200 Subject: [PATCH 006/230] Adapt functions for work in Metaconsole --- pandora_console/include/functions_ui.php | 8 +++++++- pandora_console/include/javascript/pandora_ui.js | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 2233b2fe95..a6fe8579c0 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -6136,7 +6136,13 @@ function ui_print_message_dialog($title, $text, $id='', $img='', $text_button='' */ function ui_print_reveal_password(string $name, bool $return=false) { - $output = ' '; + if (is_metaconsole()) { + $imagePath = '../../images/'; + } else { + $imagePath = 'images/'; + } + + $output = ' '; if ($return === true) { return $output; diff --git a/pandora_console/include/javascript/pandora_ui.js b/pandora_console/include/javascript/pandora_ui.js index 951db0e712..c2b6a86e01 100644 --- a/pandora_console/include/javascript/pandora_ui.js +++ b/pandora_console/include/javascript/pandora_ui.js @@ -556,12 +556,19 @@ function infoMessage(data, idMsg) { function reveal_password(name) { var passwordElement = $("#password-" + name); var revealElement = $("#reveal_password_" + name); + var imagesPath = ""; + + if ($("#hidden-metaconsole_activated").val() == 1) { + imagesPath = "../../images/"; + } else { + imagesPath = "images/"; + } if (passwordElement.attr("type") == "password") { passwordElement.attr("type", "text"); - revealElement.attr("src", "images/eye_hide.png"); + revealElement.attr("src", imagesPath + "eye_hide.png"); } else { passwordElement.attr("type", "password"); - revealElement.attr("src", "images/eye_show.png"); + revealElement.attr("src", imagesPath + "eye_show.png"); } } From 336f6924dfb2cdbba9a6174883e45074cc255cd5 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 29 Sep 2020 12:22:29 +0200 Subject: [PATCH 007/230] Added images --- pandora_console/images/eye_hide.png | Bin 0 -> 647 bytes pandora_console/images/eye_show.png | Bin 0 -> 1365 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 pandora_console/images/eye_hide.png create mode 100644 pandora_console/images/eye_show.png diff --git a/pandora_console/images/eye_hide.png b/pandora_console/images/eye_hide.png new file mode 100644 index 0000000000000000000000000000000000000000..8bed55e59977e35c254f877c03df36aedf39412b GIT binary patch literal 647 zcmV;20(kw2P)%GWaHovko20yJC5`{2QT3`qk?YwE%)BN zKR>?jdk^^Ml}e>9x%c!hVb>|8&pVyY#o0fyXi!m2qCwB04j>IMk%cUkbmXOvMflFG-|iogFqng9>69c#0FfE6-Bv4DShFA z?Q+i7RaGUN^K}54X_|;cB4{?7OS-O~&*gFtX0W+K2e#ue@{n_0cN|9n3`V07iN#`9 z%H{Go#u$3N9snG2&Mz~@_5gq=iXuDC+&WZMbt#j{yaBK#gurAn!RqSjxKgQ@jYcD= z>w3^VKZ8w64Tr-Nfaro$ zyQ->g%z?oCVrl>))9DnJWrI>IXga3|%s z00U{hPY4Tqa`c^Vg*E^*{bD4lMuXjKLQb3cBF3CcXD}Opw)R|xPYehuj0=6D zO-ZKMFz4U#g(WA^uc{fABu7R@%pIUaOgcK|Uc$MNP3m+xc>W zA`S~lzappMR)tw{j|dRuK+k6Guv31Hwpn}*#)d33L+o&q|EFps4u&j_$1~$nQsEga z9(RWy3%lzhNO)%yyc`P)m%qpR`F?m6kAcvzv)lS(rn>Lx#@{oY6O-`x z3-H<^t7!n*YH9jTy=S%yg#Ws?=2{tTxmu}yqiHV8ts@^i?XJIgdddCkkxpad`RlIz zHHDvzu3O_xH(rAIsS~$vx|(8~athpT4?WPpVeR_MH_PsRr=51r&*?(Hyq(`zYwLQ? zefPCOa|3u-)?xxRr>;wv;L@w^Gj)YQ-Mn8vAJ;d}AIE?u&-w=_xR~!)o6*pdu`3g_ zDL*>7aj&vE#$D(<9E%q$uA{Ssv-d0F6~rT3`9p0Ctj_6brlOXrGx~X*;m%{7@1(PO zA6$3>f~kEgde6DfzHq)$ literal 0 HcmV?d00001 From 8d5e3adf6a362c1043cd3d8c68595fed6b846b3f Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 30 Sep 2020 13:09:48 +0200 Subject: [PATCH 008/230] WIP Omnishell common libraries --- pandora_agents/unix/pandora_agent | 349 +-------------- .../win32/omnishell/omnishell_client.pl | 21 + pandora_server/lib/PandoraFMS/Omnishell.pm | 400 ++++++++++++++++++ 3 files changed, 426 insertions(+), 344 deletions(-) create mode 100644 pandora_agents/win32/omnishell/omnishell_client.pl create mode 100644 pandora_server/lib/PandoraFMS/Omnishell.pm diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 35caf972ea..50195aea2a 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -33,18 +33,6 @@ use IO::Socket; use Sys::Syslog; use Time::Local; -my $YAML = 0; -# Dynamic load. Avoid unwanted behaviour. -eval { - eval 'require YAML::Tiny;1' or die('YAML::Tiny lib not found, commands feature won\'t be available'); -}; -if ($@) { - $YAML = 0; - print STDERR $@; -} else { - $YAML = 1; -} - # Agent XML data my $Xml; @@ -1488,336 +1476,6 @@ sub check_collections () { } } -################################################################################ -# Check for remote commands defined. -################################################################################ -sub prepare_commands { - if ($YAML == 0) { - log_message( - 'error', - 'Cannot use commands without YAML dependency, please install it.' - ); - return; - } - - # Force configuration file read. - my @commands = read_config('cmd_file'); - - if (empty(\@commands)) { - $Conf{'commands'} = {}; - } else { - foreach my $rcmd (@commands) { - $Conf{'commands'}->{trim($rcmd)} = {}; - } - } - - # Cleanup old commands. Not registered. - cleanup_old_commands(); - - foreach my $ref (keys %{$Conf{'commands'}}) { - my $file_content; - my $download = 0; - my $rcmd_file = $ConfDir.'/commands/'.$ref.'.rcmd'; - - # Check for local .rcmd.done files - if (-e $rcmd_file.'.done') { - # Ignore. - delete $Conf{'commands'}->{$ref}; - next; - } - - # Search for local .rcmd file - if (-e $rcmd_file) { - my $remote_md5_file = $Conf{'temporal'}.'/'.$ref.'.md5'; - - $file_content = read_file($rcmd_file); - if (recv_file($ref.'.md5', $remote_md5_file) != 0) { - # Remote file could not be retrieved, skip. - delete $Conf{'commands'}->{$ref}; - next; - } - - my $local_md5 = md5($file_content); - my $remote_md5 = md5(read_file($remote_md5_file)); - - if ($local_md5 ne $remote_md5) { - # Must be downloaded again. - $download = 1; - } - } else { - $download = 1; - } - - # Search for remote .rcmd file - if ($download == 1) { - # Download .rcmd file - if (recv_file($ref.'.rcmd') != 0) { - # Remote file could not be retrieved, skip. - delete $Conf{'commands'}->{$ref}; - next; - } else { - # Success - move($Conf{'temporal'}.'/'.$ref.'.rcmd', $rcmd_file); - } - } - - # Parse and prepare in memory skel. - eval { - $Conf{'commands'}->{$ref} = YAML::Tiny->read($rcmd_file); - }; - if ($@) { - # Failed. - log_message('error', 'Failed to decode command. ' . "\n".$@); - delete $Conf{'commands'}->{$ref}; - next; - } - - } -} - -################################################################################ -# Command report. -################################################################################ -sub report_command { - my ($ref, $err_level) = @_; - - # Retrieve content from .stdout and .stderr - my $stdout_file = $Conf{'temporal'}.'/'.$ref.'.stdout'; - my $stderr_file = $Conf{'temporal'}.'/'.$ref.'.stderr'; - - my $return; - eval { - $return = { - 'error_level' => $err_level, - 'stdout' => read_file($stdout_file), - 'stderr' => read_file($stderr_file), - }; - - $return->{'name'} = $Conf{'commands'}->{$ref}->[0]->{'name'}; - }; - if ($@) { - log_message('error', 'Failed to report command output. ' . $@); - } - - # Cleanup - unlink($stdout_file) if (-e $stdout_file); - unlink($stderr_file) if (-e $stderr_file); - - # Mark command as done. - open (my $R_FILE, '> '.$ConfDir.'/commands/'.$ref.'.rcmd.done'); - print $R_FILE $err_level; - close($R_FILE); - - - $return->{'stdout'} = '' unless defined ($return->{'stdout'}); - $return->{'stderr'} = '' unless defined ($return->{'stderr'}); - - return $return; -} - -################################################################################ -# Cleanup unreferenced rcmd and rcmd.done files. -################################################################################ -sub cleanup_old_commands { - # Cleanup old .rcmd and .rcmd.done files. - my %registered = map { $_.'.rcmd' => 1 } keys %{$Conf{'commands'}}; - if(opendir(my $dir, $ConfDir.'/commands/')) { - while (my $item = readdir($dir)) { - - # Skip other files. - next if ($item !~ /\.rcmd$/); - - # Clean .rcmd.done file if its command is not referenced in conf. - if (!defined($registered{$item})) { - if (-e $ConfDir.'/commands/'.$item) { - unlink($ConfDir.'/commands/'.$item); - } - if (-e $ConfDir.'/commands/'.$item.'.done') { - unlink($ConfDir.'/commands/'.$item.'.done'); - } - } - } - - # Close dir. - closedir($dir); - } - -} - -################################################################################ -# Executes a command using defined timeout. -################################################################################ -sub execute_command_timeout { - my ($cmd, $timeout) = @_; - - if (!defined($timeout) - || !looks_like_number($timeout) - || $timeout <= 0 - ) { - `$cmd`; - return $?>>8; - } - - my $remaining_timeout = $timeout; - - my $RET; - my $output; - - my $pid = open ($RET, "-|"); - if (!defined($pid)) { - # Failed to fork. - log_message('error', '[command] Failed to fork.'); - return undef; - } - if ($pid == 0) { - # Child. - my $ret; - eval { - local $SIG{ALRM} = sub { die "timeout\n" }; - alarm $timeout; - `$cmd`; - alarm 0; - }; - - my $result = ($?>>8); - return $result; - - # Exit child. - # Child finishes. - exit; - - } else { - # Parent waiting. - while( --$remaining_timeout > 0 ){ - if (wait == -1) { - last; - } - # Wait child up to timeout seconds. - sleep 1; - } - } - - if ($remaining_timeout > 0) { - # Retrieve output from child. - $output = do { local $/; <$RET> }; - $output = $output>>8; - } - else { - # Timeout expired. - return 124; - } - - close($RET); - - return $output; -} - -################################################################################ -# Executes a block of commands, returns error level, leaves output in -# redirection set by $std_files. E.g: -# $std_files = ' >> /tmp/stdout 2>> /tmp/stderr -################################################################################ -sub execute_command_block { - my ($commands, $std_files, $timeout, $retry) = @_; - - return 0 unless defined($commands); - - my $retries = $retry; - - $retries = 1 unless looks_like_number($retries) && $retries > 0; - - my $err_level = 0; - $std_files = '' unless defined ($std_files); - - if (ref($commands) ne "ARRAY") { - return 0 if $commands eq ''; - - do { - $err_level = execute_command_timeout( - "($commands) $std_files", - $timeout - ); - - # Do not retry if success. - last if looks_like_number($err_level) && $err_level == 0; - } while ((--$retries) > 0); - - } else { - foreach my $comm (@{$commands}) { - next unless defined($comm); - $retries = $retry; - $retries = 1 unless looks_like_number($retries) && $retries > 0; - - do { - $err_level = execute_command_timeout( - "($comm) $std_files", - $timeout - ); - - # Do not retry if success. - $retries = 0 if looks_like_number($err_level) && $err_level == 0; - - } while ((--$retries) > 0); - - # Do not continue evaluating block if failed. - last unless ($err_level == 0); - } - } - - return $err_level; -} - -################################################################################ -# Evalate given command. -################################################################################ -sub evaluate_command { - my ($ref) = @_; - - # Not found. - return unless defined $Conf{'commands'}->{$ref}; - - # Already completed. - return if (-e $ConfDir.'/commands/'.$ref.'.rcmd.done'); - - # [0] because how library works. - my $cmd = $Conf{'commands'}->{$ref}->[0]; - - my $std_files = ' >> '.$Conf{'temporal'}.'/'.$ref.'.stdout '; - $std_files .= ' 2>> '.$Conf{'temporal'}.'/'.$ref.'.stderr '; - - # Check preconditions - my $err_level; - - $err_level = execute_command_block( - $cmd->{'preconditions'}, - $std_files, - $cmd->{'timeout'} - ); - - # Precondition not satisfied. - return report_command($ref, $err_level) unless ($err_level == 0); - - # Main run. - $err_level = execute_command_block( - $cmd->{'script'}, - $std_files, - $cmd->{'timeout'} - ); - - # Script not success. - return report_command($ref, $err_level) unless ($err_level == 0); - - # Check postconditions - $err_level = execute_command_block( - $cmd->{'postconditions'}, - $std_files, - $cmd->{'timeout'} - ); - - # Return results. - return report_command($ref, $err_level); -} - ################################################################################ # Sleep function ################################################################################ @@ -3453,8 +3111,11 @@ while (1) { # Check file collections check_collections () unless ($Conf{'debug'} eq '1'); - # Check scheduled commands - prepare_commands() unless ($Conf{'debug'} eq '1'); + if ($Conf{'debug'} ne '1') { + # Check scheduled commands + my $omni = new PandoraFMS::Omnishell(\%Conf); + $omni->prepare_commands(); + } # Launch broker agents @BrokerPid = (); diff --git a/pandora_agents/win32/omnishell/omnishell_client.pl b/pandora_agents/win32/omnishell/omnishell_client.pl new file mode 100644 index 0000000000..5abfec8797 --- /dev/null +++ b/pandora_agents/win32/omnishell/omnishell_client.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl +################################################################################ +# Pandora FMS Omnishell client. +# +# (c) Fco de Borja Sánchez +# +################################################################################ +use strict; +use warnings; + +use lib '/usr/lib/perl5'; +use PandoraFMS::Tools; +use PandoraFMS::Omnishell; + +my %Conf; + +if ($Conf{'debug'} ne '1') { + # Check scheduled commands + my $omni = new PandoraFMS::Omnishell(\%Conf); + $omni->prepare_commands(); +} \ No newline at end of file diff --git a/pandora_server/lib/PandoraFMS/Omnishell.pm b/pandora_server/lib/PandoraFMS/Omnishell.pm new file mode 100644 index 0000000000..b47955470c --- /dev/null +++ b/pandora_server/lib/PandoraFMS/Omnishell.pm @@ -0,0 +1,400 @@ +package PandoraFMS::Omnishell; +################################################################################ +# Pandora FMS Omnishell common functions. +# +# (c) Fco de Borja Sánchez +# +################################################################################ +use strict; +use warnings; + +my $YAML = 0; +# Dynamic load. Avoid unwanted behaviour. +eval { + eval 'require YAML::Tiny;1' or die('YAML::Tiny lib not found, commands feature won\'t be available'); +}; +if ($@) { + $YAML = 0; +} else { + $YAML = 1; +} + +use lib '/usr/lib/perl5'; + +our @ISA = ("Exporter"); +our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); +our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); +our @EXPORT = qw(); + + +################################################################################ +# return last error. +################################################################################ +sub get_last_error { + my ($self) = @_; + + if (!is_empty($self->{'last_error'})) { + return $self->{'last_error'}; + } + + return ''; +} + + +################################################################################ +# Create new omnishell handler. +################################################################################ +sub new { + my ($class,$args) = @_; + + if (ref($args) ne 'HASH') { + return undef; + } + + my $self = { + 'last_error' => undef, + %{$args} + }; + + + $self = bless($self, $class); + + return $self; +} + + +################################################################################ +# Check for remote commands defined. +################################################################################ +sub prepare_commands { + my ($self) = @_; + + if ($YAML == 0) { + log_message( + 'error', + 'Cannot use commands without YAML dependency, please install it.' + ); + return; + } + + # Force configuration file read. + my @commands = read_config('cmd_file'); + + if (empty(\@commands)) { + $self->{'commands'} = {}; + } else { + foreach my $rcmd (@commands) { + $self->{'commands'}->{trim($rcmd)} = {}; + } + } + + # Cleanup old commands. Not registered. + cleanup_old_commands(); + + foreach my $ref (keys %{$self->{'commands'}}) { + my $file_content; + my $download = 0; + my $rcmd_file = $self->{'ConfDir'}.'/commands/'.$ref.'.rcmd'; + + # Check for local .rcmd.done files + if (-e $rcmd_file.'.done') { + # Ignore. + delete $self->{'commands'}->{$ref}; + next; + } + + # Search for local .rcmd file + if (-e $rcmd_file) { + my $remote_md5_file = $self->{'temporal'}.'/'.$ref.'.md5'; + + $file_content = read_file($rcmd_file); + if (recv_file($ref.'.md5', $remote_md5_file) != 0) { + # Remote file could not be retrieved, skip. + delete $self->{'commands'}->{$ref}; + next; + } + + my $local_md5 = md5($file_content); + my $remote_md5 = md5(read_file($remote_md5_file)); + + if ($local_md5 ne $remote_md5) { + # Must be downloaded again. + $download = 1; + } + } else { + $download = 1; + } + + # Search for remote .rcmd file + if ($download == 1) { + # Download .rcmd file + if (recv_file($ref.'.rcmd') != 0) { + # Remote file could not be retrieved, skip. + delete $self->{'commands'}->{$ref}; + next; + } else { + # Success + move($self->{'temporal'}.'/'.$ref.'.rcmd', $rcmd_file); + } + } + + # Parse and prepare in memory skel. + eval { + $self->{'commands'}->{$ref} = YAML::Tiny->read($rcmd_file); + }; + if ($@) { + # Failed. + log_message('error', 'Failed to decode command. ' . "\n".$@); + delete $self->{'commands'}->{$ref}; + next; + } + + } +} + +################################################################################ +# Command report. +################################################################################ +sub report_command { + my ($self, $ref, $err_level) = @_; + + # Retrieve content from .stdout and .stderr + my $stdout_file = $self->{'temporal'}.'/'.$ref.'.stdout'; + my $stderr_file = $self->{'temporal'}.'/'.$ref.'.stderr'; + + my $return; + eval { + $return = { + 'error_level' => $err_level, + 'stdout' => read_file($stdout_file), + 'stderr' => read_file($stderr_file), + }; + + $return->{'name'} = $self->{'commands'}->{$ref}->[0]->{'name'}; + }; + if ($@) { + log_message('error', 'Failed to report command output. ' . $@); + } + + # Cleanup + unlink($stdout_file) if (-e $stdout_file); + unlink($stderr_file) if (-e $stderr_file); + + # Mark command as done. + open (my $R_FILE, '> '.$self->{'ConfDir'}.'/commands/'.$ref.'.rcmd.done'); + print $R_FILE $err_level; + close($R_FILE); + + + $return->{'stdout'} = '' unless defined ($return->{'stdout'}); + $return->{'stderr'} = '' unless defined ($return->{'stderr'}); + + return $return; +} + +################################################################################ +# Cleanup unreferenced rcmd and rcmd.done files. +################################################################################ +sub cleanup_old_commands { + my ($self) = @_; + + # Cleanup old .rcmd and .rcmd.done files. + my %registered = map { $_.'.rcmd' => 1 } keys %{$self->{'commands'}}; + if(opendir(my $dir, $self->{'ConfDir'}.'/commands/')) { + while (my $item = readdir($dir)) { + + # Skip other files. + next if ($item !~ /\.rcmd$/); + + # Clean .rcmd.done file if its command is not referenced in conf. + if (!defined($registered{$item})) { + if (-e $self->{'ConfDir'}.'/commands/'.$item) { + unlink($self->{'ConfDir'}.'/commands/'.$item); + } + if (-e $self->{'ConfDir'}.'/commands/'.$item.'.done') { + unlink($self->{'ConfDir'}.'/commands/'.$item.'.done'); + } + } + } + + # Close dir. + closedir($dir); + } + +} + +################################################################################ +# Executes a command using defined timeout. +################################################################################ +sub execute_command_timeout { + my ($cmd, $timeout) = @_; + + if (!defined($timeout) + || !looks_like_number($timeout) + || $timeout <= 0 + ) { + `$cmd`; + return $?>>8; + } + + my $remaining_timeout = $timeout; + + my $RET; + my $output; + + my $pid = open ($RET, "-|"); + if (!defined($pid)) { + # Failed to fork. + log_message('error', '[command] Failed to fork.'); + return undef; + } + if ($pid == 0) { + # Child. + my $ret; + eval { + local $SIG{ALRM} = sub { die "timeout\n" }; + alarm $timeout; + `$cmd`; + alarm 0; + }; + + my $result = ($?>>8); + return $result; + + # Exit child. + # Child finishes. + exit; + + } else { + # Parent waiting. + while( --$remaining_timeout > 0 ){ + if (wait == -1) { + last; + } + # Wait child up to timeout seconds. + sleep 1; + } + } + + if ($remaining_timeout > 0) { + # Retrieve output from child. + $output = do { local $/; <$RET> }; + $output = $output>>8; + } + else { + # Timeout expired. + return 124; + } + + close($RET); + + return $output; +} + +################################################################################ +# Executes a block of commands, returns error level, leaves output in +# redirection set by $std_files. E.g: +# $std_files = ' >> /tmp/stdout 2>> /tmp/stderr +################################################################################ +sub execute_command_block { + my ($commands, $std_files, $timeout, $retry) = @_; + + return 0 unless defined($commands); + + my $retries = $retry; + + $retries = 1 unless looks_like_number($retries) && $retries > 0; + + my $err_level = 0; + $std_files = '' unless defined ($std_files); + + if (ref($commands) ne "ARRAY") { + return 0 if $commands eq ''; + + do { + $err_level = execute_command_timeout( + "($commands) $std_files", + $timeout + ); + + # Do not retry if success. + last if looks_like_number($err_level) && $err_level == 0; + } while ((--$retries) > 0); + + } else { + foreach my $comm (@{$commands}) { + next unless defined($comm); + $retries = $retry; + $retries = 1 unless looks_like_number($retries) && $retries > 0; + + do { + $err_level = execute_command_timeout( + "($comm) $std_files", + $timeout + ); + + # Do not retry if success. + $retries = 0 if looks_like_number($err_level) && $err_level == 0; + + } while ((--$retries) > 0); + + # Do not continue evaluating block if failed. + last unless ($err_level == 0); + } + } + + return $err_level; +} + +################################################################################ +# Evalate given command. +################################################################################ +sub evaluate_command { + my ($self, $ref) = @_; + + # Not found. + return unless defined $self->{'commands'}->{$ref}; + + # Already completed. + return if (-e $self->{'ConfDir'}.'/commands/'.$ref.'.rcmd.done'); + + # [0] because how library works. + my $cmd = $self->{'commands'}->{$ref}->[0]; + + my $std_files = ' >> '.$self->{'temporal'}.'/'.$ref.'.stdout '; + $std_files .= ' 2>> '.$self->{'temporal'}.'/'.$ref.'.stderr '; + + # Check preconditions + my $err_level; + + $err_level = execute_command_block( + $cmd->{'preconditions'}, + $std_files, + $cmd->{'timeout'} + ); + + # Precondition not satisfied. + return report_command($ref, $err_level) unless ($err_level == 0); + + # Main run. + $err_level = execute_command_block( + $cmd->{'script'}, + $std_files, + $cmd->{'timeout'} + ); + + # Script not success. + return report_command($ref, $err_level) unless ($err_level == 0); + + # Check postconditions + $err_level = execute_command_block( + $cmd->{'postconditions'}, + $std_files, + $cmd->{'timeout'} + ); + + # Return results. + return report_command($ref, $err_level); +} + +1; \ No newline at end of file From f8666adf0f0fc51d13072c8954d044ae99bcc148 Mon Sep 17 00:00:00 2001 From: marcos Date: Wed, 30 Sep 2020 14:20:57 +0200 Subject: [PATCH 009/230] F2 feature --- pandora_console/godmode/setup/setup_auth.php | 31 ++++++++++++++++++++ pandora_console/include/functions_config.php | 4 +++ 2 files changed, 35 insertions(+) diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index db436224c3..9ba6c00c4f 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -221,6 +221,20 @@ if (is_ajax()) { ); $table->data['double_auth_enabled'] = $row; + // Enable 2FA for all users. + // Set default value. + set_unless_defined($config['2FA_all_users'], false); + $row = []; + $row['name'] = __('Force 2FA for all users is enabled'); + $row['control'] .= html_print_checkbox_switch( + ' + ', + 1, + $config['2FA_all_users'], + true + ); + $table->data['2FA_all_users'] = $row; + // Session timeout. // Default session timeout. set_when_empty($config['session_timeout'], 90); @@ -313,6 +327,23 @@ echo ''; ?> + '; +} + $newsletter = null; ?> diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index acd4e99833..273fa17de5 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -329,12 +329,20 @@ echo ''; $( document ).ready(function() { //For change autocreate remote users + console.log($('input[type=checkbox][id=checkbox-double_auth_enabled]:checked').val()); + if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) { + $('#table1-2FA_all_users').show(); + } + else { + $('#table1-2FA_all_users').hide(); + } $('input[type=checkbox][name=double_auth_enabled]').change(function () { if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) { $('#table1-2FA_all_users').show(); } else { $('#table1-2FA_all_users').hide(); + $('input[type=checkbox][name=2FA_all_users][value=0]').prop('checked', false); } }).change(); }); diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index b98d35e003..daac4addeb 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -1128,6 +1128,28 @@ if ($config['ehorus_user_level_conf']) { $ehorus .= ''; } +$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $id); + +if ($config['double_auth_enabled'] && check_acl($config['id_user'], 0, 'PM')) { + $double_authentication = '

'.__('Double authentication').'

'; + if (($config['2FA_all_users'] == '' && !$double_auth_enabled) + || ($config['double_auth_enabled'] == '' && $double_auth_enabled) + || check_acl($config['id_user'], 0, 'PM') + ) { + $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); + } + + // Dialog. + $double_authentication .= ''; +} + +if ($double_auth_enabled && $config['double_auth_enabled'] && $config['2FA_all_users'] != '') { + $double_authentication .= html_print_button(__('Show information'), 'show_info', false, 'javascript:show_double_auth_info();', '', true); +} + +if (isset($double_authentication)) { + $double_authentication .= '
'; +} if ($meta) { enterprise_include_once('include/functions_metaconsole.php'); @@ -1179,7 +1201,7 @@ echo '

Extra info

'.$email.$phone.$not_login.$session_time.'
-
'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$newsletter.'
+
'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$newsletter.$double_authentication.'
'.$timezone; if (!is_metaconsole()) { @@ -1278,6 +1300,15 @@ if (!is_metaconsole()) { var json_profile = $('#hidden-json_profile'); /* '; + + var $loadingSpinner = $("/images/spinner.gif\" />"); + var $dialogContainer = $("div#dialog-double_auth-container"); + + $dialogContainer.html($loadingSpinner); +console.log(userID); + // Load the info page + var request = $.ajax({ + url: "", + type: 'POST', + dataType: 'html', + data: { + page: 'include/ajax/double_auth.ajax', + id_user: userID, + get_double_auth_data_page: 1, + FA_forced: 1, + containerID: $dialogContainer.prop('id') + }, + complete: function(xhr, textStatus) { + + }, + success: function(data, textStatus, xhr) { + // isNaN = is not a number + if (isNaN(data)) { + $dialogContainer.html(data); + } + // data is a number, convert it to integer to do the compare + else if (Number(data) === -1) { + $dialogContainer.html("
'.__('Authentication error').'
'; ?>"); + } + else { + $dialogContainer.html("
'.__('Error').'
'; ?>"); + } + }, + error: function(xhr, textStatus, errorThrown) { + $dialogContainer.html("
'.__('There was an error loading the data').'
'; ?>"); + } + }); + + $("div#dialog-double_auth") + .css('display','block') + .append($dialogContainer) + .dialog({ + resizable: true, + draggable: true, + modal: true, + title: "", + overlay: { + opacity: 0.5, + background: "black" + }, + width: 400, + height: 375, + close: function(event, ui) { + // Abort the ajax request + if (typeof request != 'undefined') + request.abort(); + // Remove the contained html + $dialogContainer.empty(); + } + }) + .show(); + +} + +function show_double_auth_activation () { + var userID = ''; + + var $loadingSpinner = $("/images/spinner.gif\" />"); + var $dialogContainer = $("div#dialog-double_auth-container"); + + $dialogContainer.html($loadingSpinner); + + // Load the info page + var request = $.ajax({ + url: "", + type: 'POST', + dataType: 'html', + data: { + page: 'include/ajax/double_auth.ajax', + id_user: userID, + FA_forced: 1, + get_double_auth_info_page: 1, + containerID: $dialogContainer.prop('id') + }, + complete: function(xhr, textStatus) { + + }, + success: function(data, textStatus, xhr) { + // isNaN = is not a number + if (isNaN(data)) { + $dialogContainer.html(data); + } + // data is a number, convert it to integer to do the compare + else if (Number(data) === -1) { + $dialogContainer.html("
'.__('Authentication error').'
'; ?>"); + } + else { + $dialogContainer.html("
'.__('Error').'
'; ?>"); + } + }, + error: function(xhr, textStatus, errorThrown) { + $dialogContainer.html("
'.__('There was an error loading the data').'
'; ?>"); + } + }); + + $("div#dialog-double_auth").dialog({ + resizable: true, + draggable: true, + modal: true, + title: "", + overlay: { + opacity: 0.5, + background: "black" + }, + width: 500, + height: 400, + close: function(event, ui) { + // Abort the ajax request + if (typeof request != 'undefined') + request.abort(); + // Remove the contained html + $dialogContainer.empty(); + + document.location.reload(); + } + }) + .show(); +} + +function show_double_auth_deactivation () { + var userID = ''; + console.log(userID); + var $loadingSpinner = $("/images/spinner.gif\" />"); + var $dialogContainer = $("div#dialog-double_auth-container"); + + var message = "

'.__('The double authentication will be deactivated'); ?>

"; + var $button = $("\" />"); + + $dialogContainer + .empty() + .append(message) + .append($button); + + var request; + + $button.click(function(e) { + e.preventDefault(); + + $dialogContainer.html($loadingSpinner); + + // Deactivate the double auth + request = $.ajax({ + url: "", + type: 'POST', + dataType: 'json', + data: { + page: 'include/ajax/double_auth.ajax', + id_user: userID, + FA_forced: 1, + deactivate_double_auth: 1 + }, + complete: function(xhr, textStatus) { + + }, + success: function(data, textStatus, xhr) { + console.log(data); + if (data === -1) { + $dialogContainer.html("
'.__('Authentication error').'
'; ?>"); + } + else if (data) { + $dialogContainer.html("
'.__('The double autentication was deactivated successfully').'
'; ?>"); + } + else { + $dialogContainer.html("
'.__('There was an error deactivating the double autentication').'
'; ?>"); + } + }, + error: function(xhr, textStatus, errorThrown) { + $dialogContainer.html("
'.__('There was an error deactivating the double autentication').'
'; ?>"); + } + }); + }); + + + $("div#dialog-double_auth").dialog({ + resizable: true, + draggable: true, + modal: true, + title: "", + overlay: { + opacity: 0.5, + background: "black" + }, + width: 300, + height: 150, + close: function(event, ui) { + // Abort the ajax request + if (typeof request != 'undefined') + request.abort(); + // Remove the contained html + $dialogContainer.empty(); + + document.location.reload(); + } + }) + .show(); +} + + /* ]]> */ diff --git a/pandora_console/include/ajax/double_auth.ajax.php b/pandora_console/include/ajax/double_auth.ajax.php index 7633a28979..2f2970ee23 100644 --- a/pandora_console/include/ajax/double_auth.ajax.php +++ b/pandora_console/include/ajax/double_auth.ajax.php @@ -17,7 +17,9 @@ check_login(); // Security check $id_user = (string) get_parameter('id_user'); -if ($id_user !== $config['id_user']) { +$FA_forced = (int) get_parameter('FA_forced'); + +if ($id_user !== $config['id_user'] && $FA_forced != 1) { db_pandora_audit( 'ACL Violation', 'Trying to access Double Authentication' diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index f4c48ec0bb..d65720b44f 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1990,6 +1990,10 @@ function config_process_config() config_update_value('welcome_state', WELCOME_STARTED); } + if (!isset($config['2Fa_auth'])) { + config_update_value('2Fa_auth', ''); + } + /* * Parse the ACL IP list for access API */ diff --git a/pandora_console/index.php b/pandora_console/index.php index af8671ded7..289a91b3f1 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -389,6 +389,7 @@ if (! isset($config['id_user'])) { } $login_button_saml = get_parameter('login_button_saml', false); + config_update_value('2Fa_auth', ''); if (isset($double_auth_success) && $double_auth_success) { // This values are true cause there are checked before complete // the 2nd auth step. @@ -709,6 +710,8 @@ if (! isset($config['id_user'])) { $redirect_url .= '&'.safe_url_extraclean($key).'='.safe_url_extraclean($value); } + $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); + header('Location: '.ui_get_full_url('index.php'.$redirect_url)); exit; // Always exit after sending location headers. diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 1e04ad89e0..b55a0952e4 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -393,11 +393,13 @@ $timezone .= html_print_timezone_select('timezone', $user_info['timezone']).''; - if ($config['double_auth_enabled']) { - $double_authentication .= html_print_checkbox_switch('double_auth', 1, 1, true); - } else { + if (($config['2FA_all_users'] == '' && !$double_auth_enabled) + || ($config['2FA_all_users'] != '' && !$double_auth_enabled) + || ($config['double_auth_enabled'] == '' && $double_auth_enabled) + || check_acl($config['id_user'], 0, 'PM') + ) { $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); } @@ -405,7 +407,7 @@ if ($config['double_auth_enabled']) { $double_authentication .= ''; } -if ($double_auth_enabled) { +if ($double_auth_enabled && $config['double_auth_enabled'] && $config['2FA_all_users'] != '') { $double_authentication .= html_print_button(__('Show information'), 'show_info', false, 'javascript:show_double_auth_info();', '', true); } @@ -883,17 +885,14 @@ $(document).ready (function () { $("#text-block_size").removeAttr('disabled'); } } - var fa_enable = $("input#checkbox-double_auth").change(function (e) { e.preventDefault(); - if(fa_enable != 1){ if (this.checked) { show_double_auth_activation(); } else { show_double_auth_deactivation(); } - } }); From 929310d0e92b360d328c8193e3bb6faa4e055bc4 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Tue, 6 Oct 2020 17:33:34 +0200 Subject: [PATCH 020/230] fixed bad module id reference --- pandora_console/include/functions_modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 81991face5..fef8c7d302 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2359,7 +2359,7 @@ function modules_get_agentmodule_data_for_humans($module) } else { $salida = ui_print_module_string_value( $module['datos'], - $module['id_agente_modulo'], + $module['id'], $module['current_interval'], $module['module_name'] ); From 2ba412cb5521e9184eb62b2afb1f4a5b3c069bce Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 7 Oct 2020 10:29:43 +0200 Subject: [PATCH 021/230] Minor fixes discovery tasklist usability --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 59a9fab84a..a3a2b15c8a 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -176,7 +176,7 @@ class DiscoveryTaskList extends HTML 'type' => 'button', 'attributes' => 'class="sub upd"', 'return' => true, - 'script' => 'location.reload();', + 'script' => 'location.href = \''.$this->url.'\';', ], ], ], @@ -402,8 +402,10 @@ class DiscoveryTaskList extends HTML $table->headstyle[$i] = 'text-align: left;'; } + // Task name. + $table->headstyle[1] .= 'min-width: 150px; width: 300px;'; // Name. - $table->headstyle[4] .= 'min-width: 100px; width: 600px;'; + $table->headstyle[4] .= 'min-width: 100px; width: 400px;'; // Status. $table->headstyle[5] .= 'min-width: 50px; width: 100px;'; // Task type. From 5ce1bd23e4558ddcda2d38a43f7ff335753695b3 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 7 Oct 2020 10:56:40 +0200 Subject: [PATCH 022/230] Discovery task instead Recon task in some places --- pandora_console/include/functions_groups.php | 2 +- pandora_console/operation/agentes/pandora_networkmap.editor.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index b6c1a5e6c9..2bc8bad8f3 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -104,7 +104,7 @@ function groups_check_used($idGroup) if ($numRows > 0) { $return['return'] = true; - $return['tables'][] = __('Recon task'); + $return['tables'][] = __('Discovery task'); } switch ($config['dbtype']) { diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index a16874705c..8699253454 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -313,7 +313,7 @@ if ($not_found) { $table->data[6][1] = html_print_input_text('scale_z', $scale_z, '', 2, 10, true).ui_print_help_tip(__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true); $table->data['source'][0] = __('Source'); - $table->data['source'][1] = html_print_radio_button('source', 'group', __('Group'), $source, true, $disabled_source).html_print_radio_button('source', 'recon_task', __('Recon task'), $source, true, $disabled_source).html_print_radio_button('source', 'ip_mask', __('CIDR IP mask'), $source, true, $disabled_source); + $table->data['source'][1] = html_print_radio_button('source', 'group', __('Group'), $source, true, $disabled_source).html_print_radio_button('source', 'recon_task', __('Discovery task'), $source, true, $disabled_source).html_print_radio_button('source', 'ip_mask', __('CIDR IP mask'), $source, true, $disabled_source); $table->data['source_data_recon_task'][0] = __('Source from recon task'); $table->data['source_data_recon_task'][0] .= ui_print_help_tip( From ac4904f1237629c260fad5ae2d909c7acc547794 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 7 Oct 2020 12:22:46 +0200 Subject: [PATCH 023/230] Avoid host latency "fake" value 0 --- pandora_server/lib/PandoraFMS/NetworkServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/NetworkServer.pm b/pandora_server/lib/PandoraFMS/NetworkServer.pm index 0bca799815..3c0446c956 100644 --- a/pandora_server/lib/PandoraFMS/NetworkServer.pm +++ b/pandora_server/lib/PandoraFMS/NetworkServer.pm @@ -498,7 +498,7 @@ sub exec_network_module ($$$$) { $module_data = pandora_ping_latency ($pa_config, $ip_target, $timeout, $retries); if (defined($module_data)) { - $module_result = 0; # Successful + $module_result = 1; # Unsuccessful } } From 5a5fb6eeeab3944b3d5390db6397c0a4c5443de4 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 7 Oct 2020 14:49:46 +0200 Subject: [PATCH 024/230] Allow define time start greater than time end in weekly planed downtimes --- pandora_console/godmode/agentes/planned_downtime.editor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index b3e7029dbd..aab9d9360d 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -354,8 +354,8 @@ if ($create_downtime || $update_downtime) { __('Not created. Error inserting data').'. '.__('The end date must be higher than the current time') ); } else if ($type_execution == 'periodically' - && (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to) - || ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to)) + && $type_periodicity == 'monthly' + && $periodically_day_from == $periodically_day_to ) { ui_print_error_message( __('Not created. Error inserting data').'. '.__('The end time must be higher than the start time') From 2e0321fc6e2a75cdfcee0ab41826a176a64cfd1f Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 7 Oct 2020 18:48:17 +0200 Subject: [PATCH 025/230] Limit server down notifications once a day --- .../include/class/ConsoleSupervisor.php | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 5caad6f9e8..62acd97a93 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -45,6 +45,13 @@ enterprise_include_once('include/functions_cron.php'); class ConsoleSupervisor { + /** + * Being executed while navigation. + * + * @var boolean + */ + private $quick; + /** * Show if console supervisor is enabled or not. * @@ -149,8 +156,6 @@ class ConsoleSupervisor */ public function runBasic() { - global $config; - /* * PHP configuration warnings: * NOTIF.PHP.SAFE_MODE @@ -213,30 +218,35 @@ class ConsoleSupervisor * Check if the Server and Console has * the same versions. */ + $this->checkConsoleServerVersions(); /* * Check if AllowOverride is None or All. * NOTIF.ALLOWOVERIDE.MESSAGE */ + $this->checkAllowOverrideEnabled(); /* * Check if AllowOverride is None or All. * NOTIF.HAMASTER.MESSAGE */ + $this->checkHaStatus(); /* * Check if the Pandora Console log * file remains in old location. */ + $this->checkPandoraConsoleLogOldLocation(); /* * Check if the audit log file * remains in old location. */ + $this->checkAuditLogOldLocation(); } @@ -462,16 +472,19 @@ class ConsoleSupervisor * Check if the Server and Console has * the same versions. */ + $this->checkConsoleServerVersions(); /* * Check if AllowOverride is None or All. */ - $this->checkAllowOverrideEnabled(); - /* - * Check if HA status. - */ + $this->checkAllowOverrideEnabled(); + + /* + * Check if HA status. + */ + if (enterprise_installed()) { $this->checkHaStatus(); } @@ -480,11 +493,13 @@ class ConsoleSupervisor * Check if the audit log file * remains in old location. */ + $this->checkAuditLogOldLocation(); /* - Check if AllowOverride is None or All. - */ + * Check if AllowOverride is None or All. + */ + $this->checkAllowOverrideEnabled(); } @@ -594,7 +609,7 @@ class ConsoleSupervisor public function notify( array $data, int $source_id=0, - int $max_age=86400 + int $max_age=SECONDS_1DAY ) { // Uses 'check failed' logic. if (is_array($data) === false) { @@ -663,8 +678,8 @@ class ConsoleSupervisor // NOTIF.SERVER.MASTER. // NOTIF.SERVER.STATUS.ID_SERVER. if (preg_match('/^NOTIF.SERVER/', $data['type']) === true) { - // Component notifications require be inmediate. - $max_age = 0; + // Send notification once a day. + $max_age = SECONDS_1DAY; } // Else ignored. @@ -943,7 +958,7 @@ class ConsoleSupervisor { global $config; - $remote_config_dir = io_safe_output($config['remote_config']); + $remote_config_dir = (string) io_safe_output($config['remote_config']); if (enterprise_installed() && isset($config['license_nms']) @@ -1183,6 +1198,8 @@ class ConsoleSupervisor */ public function checkPandoraServers() { + global $config; + $servers = db_get_all_rows_sql( 'SELECT id_server, @@ -1280,6 +1297,8 @@ class ConsoleSupervisor */ public function checkPandoraServerMasterAvailable() { + global $config; + $n_masters = db_get_value_sql( 'SELECT count(*) as n @@ -2524,7 +2543,7 @@ class ConsoleSupervisor } - /* + /** * Check if Pandora console log file remains in old location. * * @return void From 683985fbbfdd8f8ec27f1403bd71d2a2a5b6ce63 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 7 Oct 2020 19:12:54 +0200 Subject: [PATCH 026/230] fixes chrome extension credentials using POST instead GET --- extras/chrome_extension/js/background.js | 516 +++++++++--------- extras/chrome_extension/js/popup.js | 5 +- .../chrome/content/js/main.js | 475 ++++++++-------- 3 files changed, 514 insertions(+), 482 deletions(-) diff --git a/extras/chrome_extension/js/background.js b/extras/chrome_extension/js/background.js index 521ecc19eb..037c01a472 100644 --- a/extras/chrome_extension/js/background.js +++ b/extras/chrome_extension/js/background.js @@ -3,309 +3,321 @@ var isFetching = null; var storedEvents = new Array(); var notVisited = {}; -$(window).on('load', function() { - initilise(); - // Wait some ms to throw main function - var delay = setTimeout(main, 100); - resetInterval(); +$(window).on("load", function() { + initilise(); + // Wait some ms to throw main function + var delay = setTimeout(main, 100); + resetInterval(); }); function fetchEvents() { - return storedEvents; + return storedEvents; } function fetchNotVisited() { - return notVisited; + return notVisited; } function removeNotVisited(eventId) { - if (notVisited[eventId] === true) delete notVisited[eventId]; + if (notVisited[eventId] === true) delete notVisited[eventId]; } function main() { + chrome.runtime.sendMessage({ text: "FETCH_EVENTS" }); + // Do not fetch if is fetching now + if (isFetching) return; + isFetching = true; - chrome.runtime.sendMessage({text: "FETCH_EVENTS"}); - // Do not fetch if is fetching now - if (isFetching) return; - isFetching = true; + var url = + localStorage["ip_address"] + + "/include/api.php?op=get&op2=events&return_type=json"; + var feedUrl = url; + var data = new FormData(); - var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=json&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"]; + data.append("apipass", localStorage["api_pass"]); + data.append("user", localStorage["user_name"]); + data.append("pass", localStorage["pass"]); - req = new XMLHttpRequest(); - req.onload = handleResponse; - req.onerror = handleError; - req.open("GET", feedUrl, true); - req.withCredentials = true - req.send(null); + req = new XMLHttpRequest(); + req.onload = handleResponse; + req.onerror = handleError; + req.open("POST", feedUrl, true); + req.withCredentials = true; + req.send(data); } function handleError() { - chrome.runtime.sendMessage({text: "FETCH_EVENTS_URL_ERROR"}); - isFetching = false; + chrome.runtime.sendMessage({ text: "FETCH_EVENTS_URL_ERROR" }); + isFetching = false; } function handleResponse() { - var doc = req.responseText; - if (doc=="auth error") { - chrome.runtime.sendMessage({text: "FETCH_EVENTS_URL_ERROR"}); - } else { - var n = doc.search("404 Not Found"); - if (n>0) { - chrome.runtime.sendMessage({text: "FETCH_EVENTS_DATA_ERROR"}); - } else { - getEvents(doc); - chrome.runtime.sendMessage({text: "FETCH_EVENTS_SUCCESS"}); - } - } - isFetching = false; + var doc = req.responseText; + if (doc == "auth error") { + chrome.runtime.sendMessage({ text: "FETCH_EVENTS_URL_ERROR" }); + } else { + var n = doc.search("404 Not Found"); + if (n > 0) { + chrome.runtime.sendMessage({ text: "FETCH_EVENTS_DATA_ERROR" }); + } else { + getEvents(doc); + chrome.runtime.sendMessage({ text: "FETCH_EVENTS_SUCCESS" }); + } + } + isFetching = false; } -function getEvents(reply){ - var fetchedEvents = parseReplyEvents(reply); +function getEvents(reply) { + var fetchedEvents = parseReplyEvents(reply); - // If there is no events requested, mark all as visited - if (storedEvents.length == 0) { - notVisited = {}; - storedEvents = fetchedEvents; - return; - } + // If there is no events requested, mark all as visited + if (typeof storedEvents != "undefined" && storedEvents.length == 0) { + notVisited = {}; + storedEvents = fetchedEvents; + return; + } - // Discriminate the new events - newEvents=fetchNewEvents(fetchedEvents,storedEvents); - var newNotVisited = {}; - var notVisitedCount = 0; - - // Check if popup is displayed to make some actions - var views = chrome.extension.getViews({ type: "popup" }); - for(var k=0;k0){ + prefManager.setBoolPref("data_check", true); + req = new XMLHttpRequest(); + req.onload = PandoraChrome.fn.handleResponse; + req.onerror = PandoraChrome.fn.handleError; + req.open("POST", feedUrl, true); + req.send(data); + }, - prefManager.setCharPref("data",null); - prefManager.setBoolPref("data_check", false); - if(timer) { - clearTimeout(timer); - } - timer =setTimeout(PandoraChrome.fn.main , 1000); - } - - else{ - prefManager.setBoolPref("data_check", true); + handleError: function() { + //alert("error"); + prefManager.setCharPref("data", null); + prefManager.setBoolPref("data_check", false); + if (timer) { + clearTimeout(timer); + } + timer = setTimeout(PandoraChrome.fn.main, 1000); + }, - prefManager.setCharPref("data",doc); - PandoraChrome.fn.getEvents(doc); - } - } - }, + handleResponse: function() { + var doc = req.responseText; + if (doc == "auth error") { + prefManager.setCharPref("data", null); + prefManager.setBoolPref("data_check", false); + if (timer) { + clearTimeout(timer); + } + timer = setTimeout(PandoraChrome.fn.main, 1000); + } else { + var n = doc.search("404 Not Found"); + if (n > 0) { + prefManager.setCharPref("data", null); + prefManager.setBoolPref("data_check", false); + if (timer) { + clearTimeout(timer); + } + timer = setTimeout(PandoraChrome.fn.main, 1000); + } else { + prefManager.setBoolPref("data_check", true); - getEvents: function (reply){ - if(reply.length>100){ - all_event_array=reply.split("\n"); - allEvents=PandoraChrome.fn.divideArray(all_event_array); - if(oldEvents.length==0){ - oldEvents=allEvents; - } + prefManager.setCharPref("data", doc); + PandoraChrome.fn.getEvents(doc); + } + } + }, - - newEvents=PandoraChrome.fn.fetchNewEvents(allEvents,oldEvents); - if(newEvents.length!=0){ - for(var k=0;k0){ - PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events")); - } - else{ - PandoraChrome.fn.hideBadge(); - } - - - - if(timer) { - clearTimeout(timer); - } - timer =setTimeout(PandoraChrome.fn.main , prefManager.getIntPref("refresh")*1000 ); - } - }, - - showNotification: function(eventId){ - //alert("notify"+eventId); - if(prefManager.getBoolPref("sound_alert")){ - if(newEvents[eventId][19]=="Critical"){ - Sounds.playSound(prefManager.getIntPref("critical")); - } - if(newEvents[eventId][19]=="Informational"){ - Sounds.playSound(prefManager.getIntPref("informational")); - } - if(newEvents[eventId][19]=="Maintenance"){ - Sounds.playSound(prefManager.getIntPref("maintenance")); - } - if(newEvents[eventId][19]=="Normal"){ - Sounds.playSound(prefManager.getIntPref("normal")); - } - if(newEvents[eventId][19]=="Warning"){ - Sounds.playSound(prefManager.getIntPref("warning")); - } - - } - - var newEve = document.getElementById('newEvent'); - newEve.label="Last Event : "+newEvents[eventId][6]; - var id; - if(newEvents[eventId][9]==0){ - id="."; - } - else { - id= " in the module with Id "+ newEvents[eventId][9] + "."; - } - - var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id; - newEve.tooltipText=event; - $('#newEvent').show(); - return; - }, - - - hideNotification:function(){ - //alert("Hide Notif"); - $('#newEvent').hide(); - }, - - - showBadge: function (txt) { - //alert(txt); - var updateCount = document.getElementById('temp'); - updateCount.setAttribute("style","cursor:pointer; font-size:11px; color:#123863; font-weight:bold; display:none;") ; - updateCount.label=txt; - $('#temp').show(); - }, - - hideBadge: function () { - var updateCount = document.getElementById('temp'); - //alert("hide B"); - $('#temp').hide(); - }, - - divideArray: function (e_array){ - var Events=new Array(); - for(var i=0;i' + title + '
' + event + ''; - + getEvents: function(reply) { + if (reply.length > 100) { + all_event_array = reply.split("\n"); + allEvents = PandoraChrome.fn.divideArray(all_event_array); + if (oldEvents.length == 0) { + oldEvents = allEvents; } - }; -}(); + newEvents = PandoraChrome.fn.fetchNewEvents(allEvents, oldEvents); + if (newEvents.length != 0) { + for (var k = 0; k < newEvents.length; k++) { + var temp = prefManager.getIntPref("new_events") + 1; + prefManager.setIntPref("new_events", temp); + PandoraChrome.fn.showNotification(k); + PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events")); + } + } + oldEvents = allEvents; + if (prefManager.getIntPref("new_events") > 0) { + PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events")); + } else { + PandoraChrome.fn.hideBadge(); + } + + if (timer) { + clearTimeout(timer); + } + timer = setTimeout( + PandoraChrome.fn.main, + prefManager.getIntPref("refresh") * 1000 + ); + } + }, + + showNotification: function(eventId) { + //alert("notify"+eventId); + if (prefManager.getBoolPref("sound_alert")) { + if (newEvents[eventId][19] == "Critical") { + Sounds.playSound(prefManager.getIntPref("critical")); + } + if (newEvents[eventId][19] == "Informational") { + Sounds.playSound(prefManager.getIntPref("informational")); + } + if (newEvents[eventId][19] == "Maintenance") { + Sounds.playSound(prefManager.getIntPref("maintenance")); + } + if (newEvents[eventId][19] == "Normal") { + Sounds.playSound(prefManager.getIntPref("normal")); + } + if (newEvents[eventId][19] == "Warning") { + Sounds.playSound(prefManager.getIntPref("warning")); + } + } + + var newEve = document.getElementById("newEvent"); + newEve.label = "Last Event : " + newEvents[eventId][6]; + var id; + if (newEvents[eventId][9] == 0) { + id = "."; + } else { + id = " in the module with Id " + newEvents[eventId][9] + "."; + } + + var event = + newEvents[eventId][14] + + " : " + + newEvents[eventId][17] + + ". Event occured at " + + newEvents[eventId][5] + + id; + newEve.tooltipText = event; + $("#newEvent").show(); + return; + }, + + hideNotification: function() { + //alert("Hide Notif"); + $("#newEvent").hide(); + }, + + showBadge: function(txt) { + //alert(txt); + var updateCount = document.getElementById("temp"); + updateCount.setAttribute( + "style", + "cursor:pointer; font-size:11px; color:#123863; font-weight:bold; display:none;" + ); + updateCount.label = txt; + $("#temp").show(); + }, + + hideBadge: function() { + var updateCount = document.getElementById("temp"); + //alert("hide B"); + $("#temp").hide(); + }, + + divideArray: function(e_array) { + var Events = new Array(); + for (var i = 0; i < e_array.length; i++) { + var event = e_array[i].split(";"); + Events.push(event); + } + return Events; + }, + + fetchNewEvents: function(A, B) { + var arrDiff = new Array(); + // alert(A.length); + //alert(B.length); + for (var i = 0; i < A.length; i++) { + var id = false; + for (var j = 0; j < B.length; j++) { + if (A[i][0] == B[j][0]) { + id = true; + break; + } + } + if (!id) { + arrDiff.push(A[i]); + } + } + return arrDiff; + }, + + getNotification: function(eventId) { + var title = newEvents[eventId][6]; + var id; + if (newEvents[eventId][9] == 0) { + id = "."; + } else { + id = " in the module with Id " + newEvents[eventId][9] + "."; + } + + var event = + newEvents[eventId][14] + + " : " + + newEvents[eventId][17] + + ". Event occured at " + + newEvents[eventId][5] + + id; + //var event=newEvents[eventId][14]+' '+newEvents[eventId][17]+' Event occured at:'+ newEvents[eventId][5] +'in the module with Id '+ newEvents[eventId][9]; + return ( + "" + + title + + '
' + + event + + "" + ); + } + }; +})(); /* Add Event Listener */ window.addEventListener("load", PandoraChrome.fn.Onloading(), false); From 58e34536370d2fed5af52cdc7beba25381c58bef Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 7 Oct 2020 19:40:31 +0200 Subject: [PATCH 027/230] Updated version manifest chrome extension --- extras/chrome_extension/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/chrome_extension/manifest.json b/extras/chrome_extension/manifest.json index bff5586f0c..1dcefd58ef 100644 --- a/extras/chrome_extension/manifest.json +++ b/extras/chrome_extension/manifest.json @@ -1,6 +1,6 @@ { "name": "__MSG_name__", - "version": "2.2", + "version": "2.3", "manifest_version": 2, "description": "Pandora FMS Event viewer Chrome extension", "homepage_url": "http://pandorafms.com", From 53362f64244aa0fb1e48a673a9bbdc46676b3354 Mon Sep 17 00:00:00 2001 From: marcos Date: Tue, 13 Oct 2020 15:04:33 +0200 Subject: [PATCH 028/230] update branch --- pandora_console/godmode/setup/setup_auth.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 273fa17de5..9b39734b57 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -329,13 +329,7 @@ echo ''; $( document ).ready(function() { //For change autocreate remote users - console.log($('input[type=checkbox][id=checkbox-double_auth_enabled]:checked').val()); - if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) { - $('#table1-2FA_all_users').show(); - } - else { - $('#table1-2FA_all_users').hide(); - } + $('input[type=checkbox][name=double_auth_enabled]').change(function () { if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) { $('#table1-2FA_all_users').show(); From 5a48525ff3fcbb014900adff5a3b89a9ee44d0e8 Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 15 Oct 2020 13:56:36 +0200 Subject: [PATCH 029/230] Adding dockerfiles for pandora stack centos 8 and percona --- extras/docker/centos8/base/Dockerfile | 257 ++++++++++++++ extras/docker/centos8/build_image_el8.sh | 115 ++++++ extras/docker/centos8/docker-compose.yml | 43 +++ .../docker/centos8/pandora-stack/Dockerfile | 24 ++ .../centos8/pandora-stack/sources/.gitignore | 5 + .../pandora-stack/sources/init_pandora.sh | 336 ++++++++++++++++++ extras/docker/percona/Dockerfile | 31 ++ 7 files changed, 811 insertions(+) create mode 100644 extras/docker/centos8/base/Dockerfile create mode 100755 extras/docker/centos8/build_image_el8.sh create mode 100644 extras/docker/centos8/docker-compose.yml create mode 100644 extras/docker/centos8/pandora-stack/Dockerfile create mode 100644 extras/docker/centos8/pandora-stack/sources/.gitignore create mode 100755 extras/docker/centos8/pandora-stack/sources/init_pandora.sh create mode 100644 extras/docker/percona/Dockerfile diff --git a/extras/docker/centos8/base/Dockerfile b/extras/docker/centos8/base/Dockerfile new file mode 100644 index 0000000000..08ce2c43b4 --- /dev/null +++ b/extras/docker/centos8/base/Dockerfile @@ -0,0 +1,257 @@ +#docker build -t pandorafms/pandorafms-open-base-el8 -f $HOME/code/pandorafms/extras/docker/centos8/base/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/base/ +#docker push pandorafms/pandorafms-open-base-el8 + +FROM centos:8 + +RUN dnf install -y --setopt=tsflags=nodocs \ + epel-release \ + dnf-utils \ + http://rpms.remirepo.net/enterprise/remi-release-8.rpm + +RUN dnf module reset -y php && dnf module install -y php:remi-7.3 +RUN dnf config-manager --set-enabled PowerTools + +# Install console +RUN dnf install -y --setopt=tsflags=nodocs \ + php \ + php-mcrypt \php-cli \ + php-gd \ + php-curl \ + php-session \ + php-mysqlnd \ + php-ldap \ + php-zip \ + php-zlib \ + php-fileinfo \ + php-gettext \ + php-snmp \ + php-mbstring \ + php-pecl-zip \ + php-xmlrpc \ + libxslt \ + wget \ + php-xml \ + httpd \ + mod_php \ + atk \ + avahi-libs \ + cairo \ + cups-libs \ + fribidi \ + gd \ + gdk-pixbuf2 \ + ghostscript \ + graphite2 \ + graphviz \ + gtk2 \ + harfbuzz \ + hicolor-icon-theme \ + hwdata \ + jasper-libs \ + lcms2 \ + libICE \ + libSM \ + libXaw \ + libXcomposite \ + libXcursor \ + libXdamage \ + libXext \ + libXfixes \ + libXft \ + libXi \ + libXinerama \ + libXmu \ + libXrandr \ + libXrender \ + libXt \ + libXxf86vm \ + libcroco \ + libdrm \ + libfontenc \ + libglvnd \ + libglvnd-egl \ + libglvnd-glx \ + libpciaccess \ + librsvg2 \ + libthai \ + libtool-ltdl \ + libwayland-client \ + libwayland-server \ + libxshmfence \ + mesa-libEGL \ + mesa-libGL \ + mesa-libgbm \ + mesa-libglapi \ + pango \ + pixman \ + nfdump \ + xorg-x11-fonts-75dpi \ + xorg-x11-fonts-misc \ + poppler-data \ + php-yaml; yum clean all + +RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/ +# not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts + +# Install server + +RUN dnf install -y --setopt=tsflags=nodocs \ + GeoIP \ + GeoIP-GeoLite-data \ + dwz \ + efi-srpm-macros \ + ghc-srpm-macros \ + go-srpm-macros \ + ocaml-srpm-macros \ + openblas-srpm-macros \ + perl \ + perl-Algorithm-Diff \ + perl-Archive-Tar \ + perl-Archive-Zip \ + perl-Attribute-Handlers \ + perl-B-Debug \ + perl-CPAN \ + perl-CPAN-Meta \ + perl-CPAN-Meta-Requirements \ + perl-CPAN-Meta-YAML \ + perl-Compress-Bzip2 \ + perl-Config-Perl-V \ + perl-DBD-MySQL \ + perl-DBI \ + perl-DB_File \ + perl-Data-Dump \ + perl-Data-OptList \ + perl-Data-Section \ + perl-Devel-PPPort \ + perl-Devel-Peek \ + perl-Devel-SelfStubber \ + perl-Devel-Size \ + perl-Digest-HMAC \ + perl-Digest-SHA \ + perl-Encode-Locale \ + perl-Encode-devel \ + perl-Env \ + perl-ExtUtils-CBuilder \ + perl-ExtUtils-Command \ + perl-ExtUtils-Embed \ + perl-ExtUtils-Install \ + perl-ExtUtils-MM-Utils \ + perl-ExtUtils-MakeMaker \ + perl-ExtUtils-Manifest \ + perl-ExtUtils-Miniperl \ + perl-ExtUtils-ParseXS \ + perl-File-Fetch \ + perl-File-HomeDir \ + perl-File-Listing \ + perl-File-Which \ + perl-Filter \ + perl-Filter-Simple \ + perl-Geo-IP \ + perl-HTML-Parser \ + perl-HTML-Tagset \ + perl-HTML-Tree \ + perl-HTTP-Cookies \ + perl-HTTP-Date \ + perl-HTTP-Message \ + perl-HTTP-Negotiate \ + perl-IO-HTML \ + perl-IO-Socket-INET6 \ + perl-IO-Zlib \ + perl-IO-stringy \ + perl-IPC-Cmd \ + perl-IPC-SysV \ + perl-IPC-System-Simple \ + perl-JSON \ + perl-JSON-PP \ + perl-LWP-MediaTypes \ + perl-Locale-Codes \ + perl-Locale-Maketext \ + perl-Locale-Maketext-Simple \ + perl-MRO-Compat \ + perl-Math-BigInt \ + perl-Math-BigInt-FastCalc \ + perl-Math-BigRat \ + perl-Memoize \ + perl-Module-Build \ + perl-Module-CoreList \ + perl-Module-CoreList-tools \ + perl-Module-Load \ + perl-Module-Load-Conditional \ + perl-Module-Loaded \ + perl-Module-Metadata \ + perl-NTLM \ + perl-Net-HTTP \ + perl-Net-Ping \ + perl-NetAddr-IP \ + perl-Package-Generator \ + perl-Params-Check \ + perl-Params-Util \ + perl-Perl-OSType \ + perl-PerlIO-via-QuotedPrint \ + perl-Pod-Checker \ + perl-Pod-Html \ + perl-Pod-Parser \ + perl-SelfLoader \ + perl-Socket6 \ + perl-Software-License \ + perl-Sub-Exporter \ + perl-Sub-Install \ + perl-Sys-Syslog \ + perl-Test \ + perl-Test-Harness \ + perl-Test-Simple \ + perl-Text-Balanced \ + perl-Text-Diff \ + perl-Text-Glob \ + perl-Text-Template \ + perl-Thread-Queue \ + perl-Time-Piece \ + perl-TimeDate \ + perl-Try-Tiny \ + perl-Unicode-Collate \ + perl-WWW-RobotRules \ + perl-XML-NamespaceSupport \ + perl-XML-Parser \ + perl-XML-SAX \ + perl-XML-SAX-Base \ + perl-XML-Simple \ + perl-XML-Twig \ + perl-autodie \ + perl-bignum \ + perl-devel \ + perl-encoding \ + perl-experimental \ + perl-inc-latest \ + perl-libnetcfg \ + perl-libwww-perl \ + perl-local-lib \ + perl-open \ + perl-perlfaq \ + perl-srpm-macros \ + perl-utils \ + perl-version \ + python-srpm-macros \ + python3-pyparsing \ + python3-rpm-macros \ + qt5-srpm-macros \ + redhat-rpm-config \ + rust-srpm-macros \ + systemtap-sdt-devel \ + perl-TermReadKey \ + perl \ + perl-DBD-MySQL \ + perl-DBI \ + initscripts \ + net-tools \ + nmap-ncat \ + nmap \ + net-snmp-utils \ + sudo \ + http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ + http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm + + +RUN dnf install -y supervisor crontabs mysql http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs + + +EXPOSE 80 443 41121 162/udp \ No newline at end of file diff --git a/extras/docker/centos8/build_image_el8.sh b/extras/docker/centos8/build_image_el8.sh new file mode 100755 index 0000000000..dae6e55bda --- /dev/null +++ b/extras/docker/centos8/build_image_el8.sh @@ -0,0 +1,115 @@ +#!/bin/bash + +VERSION=$1 +ENT="$HOME/code/pandora_enterprise" +OPEN="$HOME/code/pandorafms" +OS="Centos" +ARCH="x86_64" +EL="el7" +EXT="demo" +TARGET_URL="http://atlantis.artica.es" +DOCKER_PATH="$OPEN/extras/docker/centos8/" +OSTACK_IMAGE="pandorafms/pandorafms-open-stack-el8" +OBASE_IMAGE="pandorafms/pandorafms-open-base-el8" +PERCONA_IMAGE="pandorafms/pandorafms-percona-base" + + +function help { + echo "To excute the builder you must declare 4 parameters: the version image, upload (push) tokens, build base (rebuild centos base image), build percona (rebuild percona base image)" + echo "" + echo "$0 [ ] [] []" + echo "Ex creates a local image from 749 packages : $0 749 0 1 1" +} + +if [ "$1" == "" ] || [ "$1" == "-h" ] ; then + help + exit +fi + +if [ "$2" == "1" ]; then + UPDATE="1" +fi + +if [ "$3" == "1" ]; then + BASEBUILD="1" +fi + +if [ "$4" == "1" ]; then + DBBUILD="1" +fi + +#Defining packages urls + +oconsoleurl=$TARGET_URL/Releases/7.0NG.$VERSION/$OS/noarch/pandorafms_console-7.0NG.$VERSION.noarch.rpm +oserverurl=$TARGET_URL/Releases/7.0NG.$VERSION/$OS/noarch/pandorafms_server-7.0NG.$VERSION.noarch.rpm + +url=$(curl -I -s $TARGET_URL/Releases/7.0NG.$VERSION/ 2> /dev/null | grep "200 OK" | wc -l) + +# log in into docker acount to acces private repo. + +# docker login -u $DOCKERUSER -p$DOCKERPASS + +Check athlantis is reachable +if [ "$url" -lt 1 ] ; then + echo "$url Athlantis unreachable ..." + exit +fi + +echo "Start" +# Removing old packages +cd $DOCKER_PATH/pandora-stack/sources +rm -rf ./pandorafms_* + +# Downloading new packages +wget $oconsoleurl +wget oserverurl + +if [ "$BASEBUILD" == 1 ] ; then + # Open Base image + echo "building Base el8 image" + cd $DOCKER_PATH/base + docker build -t $OBASE_IMAGE:$VERSION -f $DOCKER_PATH/base/Dockerfile $DOCKER_PATH/base + echo -e ">>>> \n" +fi + +if [ "$DBBUILD" == 1 ] ; then + # Percona image + echo "building Percona image" + cd $OPEN/extras/docker/percona + docker build -t $PERCONA_IMAGE:latest -f $OPEN/extras/docker/percona/Dockerfile $OPEN/extras/docker/percona + echo -e ">>>> \n" +fi + +#Open Stack image +echo "building Open el8 image" +cd $DOCKER_PATH/pandora-stack +docker build -t $OSTACK_IMAGE:$VERSION -f $DOCKER_PATH/pandora-stack/Dockerfile $DOCKER_PATH/pandora-stack +echo -e ">>>> \n" + +# Upload images + +if [ "$UPDATE" == 1 ] ; then + if [ "$BASEBUILD" == 1 ] ; then + #Open base Images + echo "Taging Open stack el8 latest image before upload" + docker tag $OBASE_IMAGE:$VERSION $OBASE_IMAGE:latest + + echo "Uploading Open $OBASE_IMAGE:$VERSION . . ." + docker push $OBASE_IMAGE:$VERSION + docker push $OBASE_IMAGE:latest + fi + + if [ "$DBBUILD" == 1 ] ; then + #Open base Images + echo "Uploading percona $PERCONA_IMAGE:latest . . ." + docker push $PERCONA_IMAGE:latest + fi + + #Open Stack Images + echo "Taging Open base latest image before upload" + docker tag $OSTACK_IMAGE:$VERSION $OBASE_IMAGE:latest + + echo "Uploading Open $OSTACK_IMAGE:$VERSION . . ." + docker push $OSTACK_IMAGE:$VERSION + docker push $OSTACK_IMAGE:latest +fi \ No newline at end of file diff --git a/extras/docker/centos8/docker-compose.yml b/extras/docker/centos8/docker-compose.yml new file mode 100644 index 0000000000..f33b6fe9ed --- /dev/null +++ b/extras/docker/centos8/docker-compose.yml @@ -0,0 +1,43 @@ +# Use root/example as user/password credentials +# este compose incluye la base de datos en otro docker y levanta aplicacion y DB juntos +version: '3.1' + +services: + + db: + image: pandorafms/pandorafms-percona-base + restart: always + #command: ["mysqld", "--innodb-buffer-pool-size=900M"] + environment: + MYSQL_ROOT_PASSWORD: pandora + MYSQL_DATABASE: pandora + MYSQL_USER: pandora + MYSQL_PASSWORD: pandora + networks: + - pandora + + pandora: + image: pandorafms/pandorafms-open-stack-el8:749 + restart: always + depends_on: + - db + environment: + MYSQL_ROOT_PASSWORD: pandora + DBHOST: db + DBNAME: pandora + DBUSER: pandora + DBPASS: pandora + DBPORT: 3306 + INSTANCE_NAME: pandora01 + PUBLICURL: "" + SLEEP: 5 + RETRIES: 10 + networks: + - pandora + ports: + - "8080:80" + - "41121:41121" + - "162:162/udp" + - "9995:9995/udp" +networks: + pandora: diff --git a/extras/docker/centos8/pandora-stack/Dockerfile b/extras/docker/centos8/pandora-stack/Dockerfile new file mode 100644 index 0000000000..3e6ad9880d --- /dev/null +++ b/extras/docker/centos8/pandora-stack/Dockerfile @@ -0,0 +1,24 @@ +#docker build -t pandorafms/pandorafms-open-stack-el8:$VERSION -f $HOME/code/pandorafms/extras/docker/centos8/pandora-stack/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/pandora-stack/ + +FROM pandorafms/pandorafms-open-base:el8 + +ENV DBNAME=pandora +ENV DBUSER=pandora +ENV DBPASS=pandora +ENV DBHOST=pandora +ENV DBPORT=3306 +ENV SLEEP=5 +ENV RETRIES=1 +ENV OPEN=1 + +ENV LC_ALL=C + +RUN rm -rf /etc/localtime ; ln -s /usr/share/zoneinfo/Europe/Madrid /etc/localtime + +COPY ./sources /opt/pandora +# Install the Pandora console +RUN dnf install -y /opt/pandora/pandorafms_console-*.rpm /opt/pandora/pandorafms_server-*.rpm ; yum clean all + +EXPOSE 80 443 41121 162/udp 9995/udp + +CMD sh /opt/pandora/init_pandora.sh \ No newline at end of file diff --git a/extras/docker/centos8/pandora-stack/sources/.gitignore b/extras/docker/centos8/pandora-stack/sources/.gitignore new file mode 100644 index 0000000000..9e870cb2e3 --- /dev/null +++ b/extras/docker/centos8/pandora-stack/sources/.gitignore @@ -0,0 +1,5 @@ +# exclude packages +demos/ +*.tar* +*.rpm +phantomjs diff --git a/extras/docker/centos8/pandora-stack/sources/init_pandora.sh b/extras/docker/centos8/pandora-stack/sources/init_pandora.sh new file mode 100755 index 0000000000..56424e6cb9 --- /dev/null +++ b/extras/docker/centos8/pandora-stack/sources/init_pandora.sh @@ -0,0 +1,336 @@ +#!/bin/bash +# +# Prepares environment and launchs Pandora FMS +# +# Global vars +# +PANDORA_CONSOLE=/var/www/html/pandora_console +PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf +PANDORA_SERVER_BIN=/usr/bin/pandora_server +PANDORA_HA_BIN=/usr/bin/pandora_ha +PANDORA_TABLES_MIN=160 +# +# Check database +# +function db_check { + # Check DB + echo -n ">> Checking dbengine connection: " + + for i in `seq $RETRIES`; do + r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A` + if [ $? -ne 0 ]; then + echo -n "retriying DB conection in $SLEEP seconds: " + sleep $SLEEP + else + break + fi + done + + r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A` + if [ $? -eq 0 ]; then + echo "OK" + echo -n ">> Checking database connection: " + r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME` + if [ $? -eq 0 ]; then + echo "OK" + return 0 + fi + echo -n ">> Cannot connect to $DBNAME, trying to create: " + r=`echo "create database $DBNAME" | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST` + if [ $? -eq 0 ]; then + echo "OK" + return 0 + fi + echo "Cannot create database $DBNAME on $DBUSER@$DBHOST:$DBPORT" + + return 1 + fi + + if [ "$DEBUG" == "1" ]; then + echo "Command: [echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME]" + echo "Output: [$r]" + + traceroute $DBHOST + nmap $DBHOST -v -v -p $DBPORT + fi + + + return 1 +} + +# Load database +# +function db_load { + # Load DB + echo -n ">> Checking database state:" + r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME -s -e 'show tables'| wc -l` + if [ "$DEBUG" == "1" ]; then + echo "Command: [mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME -s -e 'show tables'| wc -l]" + echo "Output: [$r]" + fi + + if [ "$r" -ge "$PANDORA_TABLES_MIN" ]; then + echo 'OK. Already exists, '$r' tables detected' + return 0 + fi + echo 'Empty database detected'; + + # Needs to be loaded. + echo -n "- Loading database schema: " + r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql` + if [ $? -ne 0 ]; then + echo "mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql" + echo "ERROR" + echo "$r" + return 1; + fi + echo "OK" + + echo -n "- Loading database data: " + r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql` + if [ $? -ne 0 ]; then + echo "ERROR" + echo $r + return 2; + fi + echo "OK" + + # Loaded. + return 0 +} + +# +# Prepare & start Pandora FMS Console +# +function console_prepare { + CONSOLE_PATH=/var/www/html/pandora_console + + echo ">> Preparing console" + # Delete install and license files. + mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done + rm -f $CONSOLE_PATH/enterprise/PandoraFMS_Enteprise_Licence.txt + + # Configure console. + cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F + /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +EO_CONFIG_F + + cat > /var/www/html/index.html << EOF_INDEX + +EOF_INDEX + + echo "- Fixing permissions" + chmod 600 $CONSOLE_PATH/include/config.php + chown -R apache. $CONSOLE_PATH + + # prepare php.ini + sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini + sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini + sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini + sed -i -e "s/^memory_limit.*/memory_limit = 500M/g" /etc/php.ini + + echo "- Setting Public URL: $PUBLICURL" + q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url) + [[ ! "$q" ]] && mysql -u $DBUSER -p$DBPASS $DBNAME -P$DBPORT -h$DBHOST -sNe "INSERT INTO tconfig (token,value) VALUES ('public_url',\"$PUBLICURL\");" + mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "UPDATE tconfig SET value=\"$PUBLICURL\" WHERE token=\"public_url\";" + +#touch $CONSOLE_PATH/pandora_console.log +#chown apache. $CONSOLE_PATH/pandora_console.log + +} + +function check_mr { + ## geting MR + Package + CMR=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select value from tconfig where token = 'MR'") + CPK=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select value from tconfig where token = 'current_package_enterprise'") + + DPK=$(grep pandora_version $PANDORA_CONSOLE/include/config_process.php | awk '{print $3}' | tr -d "'" | tr -d ";" | cut -d . -f 3) + DMR=$(ls $PANDORA_CONSOLE/extras/mr/ | sort -n | tail -1 | cut -d . -f 1) + + if [[ $DMR -gt $CMR ]]; then + echo ">> Fixing DB: MR: $CMR Current Package: $CPK Desired MR: $DMR" + cd $PANDORA_CONSOLE/extras/mr/ + for i in $(ls | sort -n); do + cat $i | mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST + done + cd - + + echo ">> Updating DB: MR: $CMR Current Package: $CPK Desired MR: $DMR" + + mysql -u $DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "update tconfig set value = $DMR where token = 'MR';" + mysql -u $DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "update tconfig set value = $DPK where token = 'current_package_enterprise';" + fi + + +} + +function server_prepare { + sed -i -e "s/^dbhost.*/dbhost $DBHOST/g" $PANDORA_SERVER_CONF + sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF + sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF + sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF + sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF + sed -i -e "s/^#servername.*/servername $INSTANCE_NAME/g" $PANDORA_SERVER_CONF + echo "pandora_service_cmd /etc/init.d/pandora_server" >> $PANDORA_SERVER_CONF + + # prepare snmptrapd + cat > /etc/snmp/snmptrapd.conf << EOF +authCommunity log public +disableAuthorization yes +EOF + + ## Enable WUX + if [ "$WUX_SERVER" == "1" ] && [ "$WUX_HOST" ]; then + if [ ! $WUX_PORT ]; then + WUX_PORT=4444 + fi + echo "Enabling WUX server HOST=$WUX_HOST PORT=$WUX_PORT" + sed -i -r "s/#?wuxserver.*/wuxserver 1/g" $PANDORA_SERVER_CONF + sed -i -r "s/#?wux_host.*/wux_host $WUX_HOST/g" $PANDORA_SERVER_CONF + sed -i -r "s/#?wux_port.*/wux_port $WUX_PORT/g" $PANDORA_SERVER_CONF + + fi +} + + +## +## MAIN +## + +if [ "$DBUSER" == "" ] || [ "$DBPASS" == "" ] || [ "$DBNAME" == "" ] || [ "$DBHOST" == "" ]; then + echo "Required environemntal variables DBUSER, DBPASS, DBNAME, DBHOST" + exit 1 +fi +if [ "$DBPORT" == "" ]; then + DBPORT=3306 +fi + +echo "" > /opt/pandora/crontasks || touch /opt/pandora/crontasks + + +#install pandora packages +echo "-> Istalling pandorafms" +cd /opt/pandora +useradd pandora + +if [[ $OPEN != 1 ]]; then + # install enterprise + dnf install -y /opt/pandora/pandorafms_console*.rpm + tar xvfz /opt/pandora/pandorafms_server_*tar* && cd pandora_server && ./pandora_server_installer --install ; rm -rf /opt/pandora/pandora_server + [[ -e /var/www/html/pandora_console/include/config.php ]] || yum reinstall -y /opt/pandora/pandorafms*.rpm + PANDORA_BIN="pandora_ha" + PANDORA_EXEC="/usr/bin/pandora_ha /etc/pandora/pandora_server.conf" +else + install only open + dnf install -y /opt/pandora/pandorafms_console-*.rpm /opt/pandora/pandorafms_server-*.rpm + dnf reinstall -y /opt/pandora/pandorafms_server-*.rpm + [[ -e /var/www/html/pandora_console/include/config.php ]] || dnf reinstall -y /opt/pandora/pandorafms_console-*.rpm + PANDORA_BIN="pandora_server" + PANDORA_EXEC="/usr/bin/pandora_server /etc/pandora/pandora_server.conf" +fi + + + +db_check && db_load + +# Sync to MC. +if [ "$META_DBNAME" != "" ] && [ "$META_DBHOST" != "" ]; then + if [ "$META_DBPORT" == "" ]; then + META_DBPORT=3306 + fi + register_mc +fi + +check_mr +console_prepare +server_prepare + +echo ">> Enable oracle env file cron: " +cat > /etc/pandora/pandora_server.env << 'EOF_ENV' +#!/bin/bash +VERSION=19.8 +export PATH=$PATH:$HOME/bin:/usr/lib/oracle/$VERSION/client64/bin +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib +export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64 +EOF_ENV + +echo ">> Enable discovery cron: " +#while true ; do wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done & +echo "*/5 * * * * wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks + +echo ">> Enable pandora_db cron: " +/usr/bin/perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf +#while true ; do sleep 1h && /usr/bin/pandora_db /etc/pandora/pandora_server.conf; done & +echo "0 */1 * * * /usr/bin/pandora_db /etc/pandora/pandora_server.conf" >> /opt/pandora/crontasks + +echo ">> Loading crontab tasks" +crontab -r +crontab /opt/pandora/crontasks && crontab -l + +ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -F '/' '{print "-> Go to http://"$1"/pandora_console to manage this server"}' + +# Check and launch supervisord +echo ">> Starting process: Running supervisord" +# Create supervisor.conf + +cat > /etc/supervisord.conf << EOF_CON +[unix_http_server] +file=/tmp/supervisor.sock + +[supervisord] +nodaemon=true +loglevel = debug + +[program:php-fpm] +command=/usr/sbin/php-fpm -F +riredirect_stderr=true + +[program:httpd] +command=/usr/sbin/apachectl -DFOREGROUND +riredirect_stderr=true + +[program:tentacle] +command=/etc/init.d/tentacle_serverd restart + +[program:$PANDORA_BIN] +command=$PANDORA_EXEC +riredirect_stderr=true + +[program:cron] +command=crond -n + +[group:allservices] +programs=httpd,cron,php-fpm,$PANDORA_BIN,tentacle + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///tmp/supervisor.sock + +EOF_CON + +# execute supervisor +touch /var/log/pandora/pandora_server.log ; tail -F /var/log/pandora/* & +su - -c supervisord diff --git a/extras/docker/percona/Dockerfile b/extras/docker/percona/Dockerfile new file mode 100644 index 0000000000..82b97401d6 --- /dev/null +++ b/extras/docker/percona/Dockerfile @@ -0,0 +1,31 @@ + +#docker build -t pandorafms/pandorafms-percona-base -f $HOME/code/pandorafms/extras/docker/percona/Dockerfile $HOME/code/pandorafms/extras/docker/percona + +FROM percona:5.7 + +RUN echo -e '#PandoraFMS configuration \n\ +[mysqld] \n\ +max_allowed_packet = 64M \n\ +innodb_buffer_pool_size = 500M \n\ +innodb_lock_wait_timeout = 90 \n\ +innodb_file_per_table \n\ +innodb_flush_log_at_trx_commit = 0 \n\ +innodb_flush_method = O_DIRECT \n\ +innodb_log_file_size = 64M \n\ +innodb_log_buffer_size = 16M \n\ +innodb_io_capacity = 100 \n\ +thread_cache_size = 8 \n\ +thread_stack = 256K \n\ +max_connections = 100 \n \n\ +key_buffer_size=4M \n\ +read_buffer_size=128K \n\ +read_rnd_buffer_size=128K \n\ +sort_buffer_size=128K \n\ +join_buffer_size=4M \n\n\ +query_cache_type = 1 \n\ +query_cache_size = 64M \n\ +query_cache_min_res_unit = 2k \n\ +query_cache_limit = 256K \n\n\ +sql_mode="" ' > /etc/my.cnf.d/pandora.cnf + +EXPOSE 3306 From 541c9ff1b42952b2271458b600125e8bda8e1592 Mon Sep 17 00:00:00 2001 From: Rafael Ameijeiras Date: Thu, 15 Oct 2020 18:48:29 +0200 Subject: [PATCH 030/230] Adding dockerfiles for pandora stack centos 8 and percona --- extras/docker/centos8/base/Dockerfile | 257 ++++++++++++++ extras/docker/centos8/build_image_el8.sh | 112 ++++++ extras/docker/centos8/docker-compose.yml | 43 +++ .../docker/centos8/pandora-stack/Dockerfile | 24 ++ .../centos8/pandora-stack/sources/.gitignore | 5 + .../pandora-stack/sources/init_pandora.sh | 336 ++++++++++++++++++ extras/docker/percona/Dockerfile | 31 ++ 7 files changed, 808 insertions(+) create mode 100644 extras/docker/centos8/base/Dockerfile create mode 100755 extras/docker/centos8/build_image_el8.sh create mode 100644 extras/docker/centos8/docker-compose.yml create mode 100644 extras/docker/centos8/pandora-stack/Dockerfile create mode 100644 extras/docker/centos8/pandora-stack/sources/.gitignore create mode 100755 extras/docker/centos8/pandora-stack/sources/init_pandora.sh create mode 100644 extras/docker/percona/Dockerfile diff --git a/extras/docker/centos8/base/Dockerfile b/extras/docker/centos8/base/Dockerfile new file mode 100644 index 0000000000..285f2f7ef8 --- /dev/null +++ b/extras/docker/centos8/base/Dockerfile @@ -0,0 +1,257 @@ +#docker build -t pandorafms/pandorafms-open-base-el8 -f $HOME/code/pandorafms/extras/docker/centos8/base/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/base/ +#docker push pandorafms/pandorafms-open-base-el8 + +FROM centos:8 + +RUN dnf install -y --setopt=tsflags=nodocs \ + epel-release \ + dnf-utils \ + http://rpms.remirepo.net/enterprise/remi-release-8.rpm + +RUN dnf module reset -y php && dnf module install -y php:remi-7.3 +RUN dnf config-manager --set-enabled PowerTools + +# Install console +RUN dnf install -y --setopt=tsflags=nodocs \ + php \ + php-mcrypt \php-cli \ + php-gd \ + php-curl \ + php-session \ + php-mysqlnd \ + php-ldap \ + php-zip \ + php-zlib \ + php-fileinfo \ + php-gettext \ + php-snmp \ + php-mbstring \ + php-pecl-zip \ + php-xmlrpc \ + libxslt \ + wget \ + php-xml \ + httpd \ + mod_php \ + atk \ + avahi-libs \ + cairo \ + cups-libs \ + fribidi \ + gd \ + gdk-pixbuf2 \ + ghostscript \ + graphite2 \ + graphviz \ + gtk2 \ + harfbuzz \ + hicolor-icon-theme \ + hwdata \ + jasper-libs \ + lcms2 \ + libICE \ + libSM \ + libXaw \ + libXcomposite \ + libXcursor \ + libXdamage \ + libXext \ + libXfixes \ + libXft \ + libXi \ + libXinerama \ + libXmu \ + libXrandr \ + libXrender \ + libXt \ + libXxf86vm \ + libcroco \ + libdrm \ + libfontenc \ + libglvnd \ + libglvnd-egl \ + libglvnd-glx \ + libpciaccess \ + librsvg2 \ + libthai \ + libtool-ltdl \ + libwayland-client \ + libwayland-server \ + libxshmfence \ + mesa-libEGL \ + mesa-libGL \ + mesa-libgbm \ + mesa-libglapi \ + pango \ + pixman \ + nfdump \ + xorg-x11-fonts-75dpi \ + xorg-x11-fonts-misc \ + poppler-data \ + php-yaml; yum clean all + +RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/ +# not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts + +# Install server + +RUN dnf install -y --setopt=tsflags=nodocs \ + GeoIP \ + GeoIP-GeoLite-data \ + dwz \ + efi-srpm-macros \ + ghc-srpm-macros \ + go-srpm-macros \ + ocaml-srpm-macros \ + openblas-srpm-macros \ + perl \ + perl-Algorithm-Diff \ + perl-Archive-Tar \ + perl-Archive-Zip \ + perl-Attribute-Handlers \ + perl-B-Debug \ + perl-CPAN \ + perl-CPAN-Meta \ + perl-CPAN-Meta-Requirements \ + perl-CPAN-Meta-YAML \ + perl-Compress-Bzip2 \ + perl-Config-Perl-V \ + perl-DBD-MySQL \ + perl-DBI \ + perl-DB_File \ + perl-Data-Dump \ + perl-Data-OptList \ + perl-Data-Section \ + perl-Devel-PPPort \ + perl-Devel-Peek \ + perl-Devel-SelfStubber \ + perl-Devel-Size \ + perl-Digest-HMAC \ + perl-Digest-SHA \ + perl-Encode-Locale \ + perl-Encode-devel \ + perl-Env \ + perl-ExtUtils-CBuilder \ + perl-ExtUtils-Command \ + perl-ExtUtils-Embed \ + perl-ExtUtils-Install \ + perl-ExtUtils-MM-Utils \ + perl-ExtUtils-MakeMaker \ + perl-ExtUtils-Manifest \ + perl-ExtUtils-Miniperl \ + perl-ExtUtils-ParseXS \ + perl-File-Fetch \ + perl-File-HomeDir \ + perl-File-Listing \ + perl-File-Which \ + perl-Filter \ + perl-Filter-Simple \ + perl-Geo-IP \ + perl-HTML-Parser \ + perl-HTML-Tagset \ + perl-HTML-Tree \ + perl-HTTP-Cookies \ + perl-HTTP-Date \ + perl-HTTP-Message \ + perl-HTTP-Negotiate \ + perl-IO-HTML \ + perl-IO-Socket-INET6 \ + perl-IO-Zlib \ + perl-IO-stringy \ + perl-IPC-Cmd \ + perl-IPC-SysV \ + perl-IPC-System-Simple \ + perl-JSON \ + perl-JSON-PP \ + perl-LWP-MediaTypes \ + perl-Locale-Codes \ + perl-Locale-Maketext \ + perl-Locale-Maketext-Simple \ + perl-MRO-Compat \ + perl-Math-BigInt \ + perl-Math-BigInt-FastCalc \ + perl-Math-BigRat \ + perl-Memoize \ + perl-Module-Build \ + perl-Module-CoreList \ + perl-Module-CoreList-tools \ + perl-Module-Load \ + perl-Module-Load-Conditional \ + perl-Module-Loaded \ + perl-Module-Metadata \ + perl-NTLM \ + perl-Net-HTTP \ + perl-Net-Ping \ + perl-NetAddr-IP \ + perl-Package-Generator \ + perl-Params-Check \ + perl-Params-Util \ + perl-Perl-OSType \ + perl-PerlIO-via-QuotedPrint \ + perl-Pod-Checker \ + perl-Pod-Html \ + perl-Pod-Parser \ + perl-SelfLoader \ + perl-Socket6 \ + perl-Software-License \ + perl-Sub-Exporter \ + perl-Sub-Install \ + perl-Sys-Syslog \ + perl-Test \ + perl-Test-Harness \ + perl-Test-Simple \ + perl-Text-Balanced \ + perl-Text-Diff \ + perl-Text-Glob \ + perl-Text-Template \ + perl-Thread-Queue \ + perl-Time-Piece \ + perl-TimeDate \ + perl-Try-Tiny \ + perl-Unicode-Collate \ + perl-WWW-RobotRules \ + perl-XML-NamespaceSupport \ + perl-XML-Parser \ + perl-XML-SAX \ + perl-XML-SAX-Base \ + perl-XML-Simple \ + perl-XML-Twig \ + perl-autodie \ + perl-bignum \ + perl-devel \ + perl-encoding \ + perl-experimental \ + perl-inc-latest \ + perl-libnetcfg \ + perl-libwww-perl \ + perl-local-lib \ + perl-open \ + perl-perlfaq \ + perl-srpm-macros \ + perl-utils \ + perl-version \ + python-srpm-macros \ + python3-pyparsing \ + python3-rpm-macros \ + qt5-srpm-macros \ + redhat-rpm-config \ + rust-srpm-macros \ + systemtap-sdt-devel \ + perl-TermReadKey \ + perl \ + perl-DBD-MySQL \ + perl-DBI \ + initscripts \ + net-tools \ + nmap-ncat \ + nmap \ + net-snmp-utils \ + sudo \ + http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ + http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm + + +RUN dnf install -y supervisor crontabs mysql http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs + + +EXPOSE 80 443 41121 162/udp diff --git a/extras/docker/centos8/build_image_el8.sh b/extras/docker/centos8/build_image_el8.sh new file mode 100755 index 0000000000..00c50f6ff2 --- /dev/null +++ b/extras/docker/centos8/build_image_el8.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +VERSION=$1 +ENT="$HOME/code/pandora_enterprise" +OPEN="$HOME/code/pandorafms" +OS="Centos" +ARCH="x86_64" +EL="el7" +EXT="demo" +TARGET_URL="http://atlantis.artica.es" +DOCKER_PATH="$OPEN/extras/docker/centos8/" +OSTACK_IMAGE="pandorafms/pandorafms-open-stack-el8" +OBASE_IMAGE="pandorafms/pandorafms-open-base-el8" +PERCONA_IMAGE="pandorafms/pandorafms-percona-base" + + +function help { + echo "To excute the builder you must declare 4 parameters: the version image, upload (push) tokens, build base (rebuild centos base image), build percona (rebuild percona base image)" + echo "" + echo "$0 [ ] [] []" + echo "Ex creates a local image from 749 packages : $0 749 0 1 1" +} + +if [ "$1" == "" ] || [ "$1" == "-h" ] ; then + help + exit +fi + +if [ "$2" == "1" ]; then + UPDATE="1" +fi + +if [ "$3" == "1" ]; then + BASEBUILD="1" +fi + +if [ "$4" == "1" ]; then + DBBUILD="1" +fi + +#Defining packages urls + +oconsoleurl=$TARGET_URL/Releases/7.0NG.$VERSION/$OS/noarch/pandorafms_console-7.0NG.$VERSION.noarch.rpm +oserverurl=$TARGET_URL/Releases/7.0NG.$VERSION/$OS/noarch/pandorafms_server-7.0NG.$VERSION.noarch.rpm +url=$(curl -I -s $TARGET_URL/Releases/7.0NG.$VERSION/ 2> /dev/null | grep "200 OK" | wc -l) + +# log in into docker acount to acces private repo. + +# docker login -u $DOCKERUSER -p$DOCKERPASS + +Check athlantis is reachable +if [ "$url" -lt 1 ] ; then + echo "$url Athlantis unreachable ..." + exit +fi + +echo "Start" +# Removing old packages +cd $DOCKER_PATH/pandora-stack/sources +rm -rf ./pandorafms_* + +# Downloading new packages +wget $oconsoleurl +wget $oserverurl + +if [ "$BASEBUILD" == 1 ] ; then + # Open Base image + echo "building Base el8 image" + cd $DOCKER_PATH/base + docker build -t $OBASE_IMAGE:$VERSION -f $DOCKER_PATH/base/Dockerfile $DOCKER_PATH/base + echo "Taging Open stack el8 latest image before upload" + docker tag $OBASE_IMAGE:$VERSION $OBASE_IMAGE:latest + echo -e ">>>> \n" +fi + +if [ "$DBBUILD" == 1 ] ; then + # Percona image + echo "building Percona image" + cd $OPEN/extras/docker/percona + docker build -t $PERCONA_IMAGE:latest -f $OPEN/extras/docker/percona/Dockerfile $OPEN/extras/docker/percona + echo -e ">>>> \n" +fi + +#Open Stack image +echo "building Open el8 image" +cd $DOCKER_PATH/pandora-stack +docker build -t $OSTACK_IMAGE:$VERSION -f $DOCKER_PATH/pandora-stack/Dockerfile $DOCKER_PATH/pandora-stack +echo "Taging Open base latest image before upload" +docker tag $OSTACK_IMAGE:$VERSION $OSTACK_IMAGE:latest +echo -e ">>>> \n" + +# Upload images + +if [ "$UPDATE" == 1 ] ; then + if [ "$BASEBUILD" == 1 ] ; then + #Open base Images + echo "Uploading Open $OBASE_IMAGE:$VERSION . . ." + docker push $OBASE_IMAGE:$VERSION + docker push $OBASE_IMAGE:latest + fi + + if [ "$DBBUILD" == 1 ] ; then + #Open base Images + echo "Uploading percona $PERCONA_IMAGE:latest . . ." + docker push $PERCONA_IMAGE:latest + fi + + #Open Stack Images + echo "Uploading Open $OSTACK_IMAGE:$VERSION . . ." + docker push $OSTACK_IMAGE:$VERSION + docker push $OSTACK_IMAGE:latest +fi diff --git a/extras/docker/centos8/docker-compose.yml b/extras/docker/centos8/docker-compose.yml new file mode 100644 index 0000000000..f33b6fe9ed --- /dev/null +++ b/extras/docker/centos8/docker-compose.yml @@ -0,0 +1,43 @@ +# Use root/example as user/password credentials +# este compose incluye la base de datos en otro docker y levanta aplicacion y DB juntos +version: '3.1' + +services: + + db: + image: pandorafms/pandorafms-percona-base + restart: always + #command: ["mysqld", "--innodb-buffer-pool-size=900M"] + environment: + MYSQL_ROOT_PASSWORD: pandora + MYSQL_DATABASE: pandora + MYSQL_USER: pandora + MYSQL_PASSWORD: pandora + networks: + - pandora + + pandora: + image: pandorafms/pandorafms-open-stack-el8:749 + restart: always + depends_on: + - db + environment: + MYSQL_ROOT_PASSWORD: pandora + DBHOST: db + DBNAME: pandora + DBUSER: pandora + DBPASS: pandora + DBPORT: 3306 + INSTANCE_NAME: pandora01 + PUBLICURL: "" + SLEEP: 5 + RETRIES: 10 + networks: + - pandora + ports: + - "8080:80" + - "41121:41121" + - "162:162/udp" + - "9995:9995/udp" +networks: + pandora: diff --git a/extras/docker/centos8/pandora-stack/Dockerfile b/extras/docker/centos8/pandora-stack/Dockerfile new file mode 100644 index 0000000000..59728b37d6 --- /dev/null +++ b/extras/docker/centos8/pandora-stack/Dockerfile @@ -0,0 +1,24 @@ +#docker build -t pandorafms/pandorafms-open-stack-el8:$VERSION -f $HOME/code/pandorafms/extras/docker/centos8/pandora-stack/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/pandora-stack/ + +FROM pandorafms/pandorafms-open-base-el8 + +ENV DBNAME=pandora +ENV DBUSER=pandora +ENV DBPASS=pandora +ENV DBHOST=pandora +ENV DBPORT=3306 +ENV SLEEP=5 +ENV RETRIES=1 +ENV OPEN=1 + +ENV LC_ALL=C + +RUN rm -rf /etc/localtime ; ln -s /usr/share/zoneinfo/Europe/Madrid /etc/localtime + +COPY ./sources /opt/pandora +# Install the Pandora console +RUN dnf install -y /opt/pandora/pandorafms_console-*.rpm /opt/pandora/pandorafms_server-*.rpm ; yum clean all + +EXPOSE 80 443 41121 162/udp 9995/udp + +CMD sh /opt/pandora/init_pandora.sh diff --git a/extras/docker/centos8/pandora-stack/sources/.gitignore b/extras/docker/centos8/pandora-stack/sources/.gitignore new file mode 100644 index 0000000000..9e870cb2e3 --- /dev/null +++ b/extras/docker/centos8/pandora-stack/sources/.gitignore @@ -0,0 +1,5 @@ +# exclude packages +demos/ +*.tar* +*.rpm +phantomjs diff --git a/extras/docker/centos8/pandora-stack/sources/init_pandora.sh b/extras/docker/centos8/pandora-stack/sources/init_pandora.sh new file mode 100755 index 0000000000..56424e6cb9 --- /dev/null +++ b/extras/docker/centos8/pandora-stack/sources/init_pandora.sh @@ -0,0 +1,336 @@ +#!/bin/bash +# +# Prepares environment and launchs Pandora FMS +# +# Global vars +# +PANDORA_CONSOLE=/var/www/html/pandora_console +PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf +PANDORA_SERVER_BIN=/usr/bin/pandora_server +PANDORA_HA_BIN=/usr/bin/pandora_ha +PANDORA_TABLES_MIN=160 +# +# Check database +# +function db_check { + # Check DB + echo -n ">> Checking dbengine connection: " + + for i in `seq $RETRIES`; do + r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A` + if [ $? -ne 0 ]; then + echo -n "retriying DB conection in $SLEEP seconds: " + sleep $SLEEP + else + break + fi + done + + r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A` + if [ $? -eq 0 ]; then + echo "OK" + echo -n ">> Checking database connection: " + r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME` + if [ $? -eq 0 ]; then + echo "OK" + return 0 + fi + echo -n ">> Cannot connect to $DBNAME, trying to create: " + r=`echo "create database $DBNAME" | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST` + if [ $? -eq 0 ]; then + echo "OK" + return 0 + fi + echo "Cannot create database $DBNAME on $DBUSER@$DBHOST:$DBPORT" + + return 1 + fi + + if [ "$DEBUG" == "1" ]; then + echo "Command: [echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME]" + echo "Output: [$r]" + + traceroute $DBHOST + nmap $DBHOST -v -v -p $DBPORT + fi + + + return 1 +} + +# Load database +# +function db_load { + # Load DB + echo -n ">> Checking database state:" + r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME -s -e 'show tables'| wc -l` + if [ "$DEBUG" == "1" ]; then + echo "Command: [mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME -s -e 'show tables'| wc -l]" + echo "Output: [$r]" + fi + + if [ "$r" -ge "$PANDORA_TABLES_MIN" ]; then + echo 'OK. Already exists, '$r' tables detected' + return 0 + fi + echo 'Empty database detected'; + + # Needs to be loaded. + echo -n "- Loading database schema: " + r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql` + if [ $? -ne 0 ]; then + echo "mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql" + echo "ERROR" + echo "$r" + return 1; + fi + echo "OK" + + echo -n "- Loading database data: " + r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql` + if [ $? -ne 0 ]; then + echo "ERROR" + echo $r + return 2; + fi + echo "OK" + + # Loaded. + return 0 +} + +# +# Prepare & start Pandora FMS Console +# +function console_prepare { + CONSOLE_PATH=/var/www/html/pandora_console + + echo ">> Preparing console" + # Delete install and license files. + mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done + rm -f $CONSOLE_PATH/enterprise/PandoraFMS_Enteprise_Licence.txt + + # Configure console. + cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F + /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +EO_CONFIG_F + + cat > /var/www/html/index.html << EOF_INDEX + +EOF_INDEX + + echo "- Fixing permissions" + chmod 600 $CONSOLE_PATH/include/config.php + chown -R apache. $CONSOLE_PATH + + # prepare php.ini + sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini + sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini + sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini + sed -i -e "s/^memory_limit.*/memory_limit = 500M/g" /etc/php.ini + + echo "- Setting Public URL: $PUBLICURL" + q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url) + [[ ! "$q" ]] && mysql -u $DBUSER -p$DBPASS $DBNAME -P$DBPORT -h$DBHOST -sNe "INSERT INTO tconfig (token,value) VALUES ('public_url',\"$PUBLICURL\");" + mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "UPDATE tconfig SET value=\"$PUBLICURL\" WHERE token=\"public_url\";" + +#touch $CONSOLE_PATH/pandora_console.log +#chown apache. $CONSOLE_PATH/pandora_console.log + +} + +function check_mr { + ## geting MR + Package + CMR=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select value from tconfig where token = 'MR'") + CPK=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select value from tconfig where token = 'current_package_enterprise'") + + DPK=$(grep pandora_version $PANDORA_CONSOLE/include/config_process.php | awk '{print $3}' | tr -d "'" | tr -d ";" | cut -d . -f 3) + DMR=$(ls $PANDORA_CONSOLE/extras/mr/ | sort -n | tail -1 | cut -d . -f 1) + + if [[ $DMR -gt $CMR ]]; then + echo ">> Fixing DB: MR: $CMR Current Package: $CPK Desired MR: $DMR" + cd $PANDORA_CONSOLE/extras/mr/ + for i in $(ls | sort -n); do + cat $i | mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST + done + cd - + + echo ">> Updating DB: MR: $CMR Current Package: $CPK Desired MR: $DMR" + + mysql -u $DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "update tconfig set value = $DMR where token = 'MR';" + mysql -u $DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "update tconfig set value = $DPK where token = 'current_package_enterprise';" + fi + + +} + +function server_prepare { + sed -i -e "s/^dbhost.*/dbhost $DBHOST/g" $PANDORA_SERVER_CONF + sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF + sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF + sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF + sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF + sed -i -e "s/^#servername.*/servername $INSTANCE_NAME/g" $PANDORA_SERVER_CONF + echo "pandora_service_cmd /etc/init.d/pandora_server" >> $PANDORA_SERVER_CONF + + # prepare snmptrapd + cat > /etc/snmp/snmptrapd.conf << EOF +authCommunity log public +disableAuthorization yes +EOF + + ## Enable WUX + if [ "$WUX_SERVER" == "1" ] && [ "$WUX_HOST" ]; then + if [ ! $WUX_PORT ]; then + WUX_PORT=4444 + fi + echo "Enabling WUX server HOST=$WUX_HOST PORT=$WUX_PORT" + sed -i -r "s/#?wuxserver.*/wuxserver 1/g" $PANDORA_SERVER_CONF + sed -i -r "s/#?wux_host.*/wux_host $WUX_HOST/g" $PANDORA_SERVER_CONF + sed -i -r "s/#?wux_port.*/wux_port $WUX_PORT/g" $PANDORA_SERVER_CONF + + fi +} + + +## +## MAIN +## + +if [ "$DBUSER" == "" ] || [ "$DBPASS" == "" ] || [ "$DBNAME" == "" ] || [ "$DBHOST" == "" ]; then + echo "Required environemntal variables DBUSER, DBPASS, DBNAME, DBHOST" + exit 1 +fi +if [ "$DBPORT" == "" ]; then + DBPORT=3306 +fi + +echo "" > /opt/pandora/crontasks || touch /opt/pandora/crontasks + + +#install pandora packages +echo "-> Istalling pandorafms" +cd /opt/pandora +useradd pandora + +if [[ $OPEN != 1 ]]; then + # install enterprise + dnf install -y /opt/pandora/pandorafms_console*.rpm + tar xvfz /opt/pandora/pandorafms_server_*tar* && cd pandora_server && ./pandora_server_installer --install ; rm -rf /opt/pandora/pandora_server + [[ -e /var/www/html/pandora_console/include/config.php ]] || yum reinstall -y /opt/pandora/pandorafms*.rpm + PANDORA_BIN="pandora_ha" + PANDORA_EXEC="/usr/bin/pandora_ha /etc/pandora/pandora_server.conf" +else + install only open + dnf install -y /opt/pandora/pandorafms_console-*.rpm /opt/pandora/pandorafms_server-*.rpm + dnf reinstall -y /opt/pandora/pandorafms_server-*.rpm + [[ -e /var/www/html/pandora_console/include/config.php ]] || dnf reinstall -y /opt/pandora/pandorafms_console-*.rpm + PANDORA_BIN="pandora_server" + PANDORA_EXEC="/usr/bin/pandora_server /etc/pandora/pandora_server.conf" +fi + + + +db_check && db_load + +# Sync to MC. +if [ "$META_DBNAME" != "" ] && [ "$META_DBHOST" != "" ]; then + if [ "$META_DBPORT" == "" ]; then + META_DBPORT=3306 + fi + register_mc +fi + +check_mr +console_prepare +server_prepare + +echo ">> Enable oracle env file cron: " +cat > /etc/pandora/pandora_server.env << 'EOF_ENV' +#!/bin/bash +VERSION=19.8 +export PATH=$PATH:$HOME/bin:/usr/lib/oracle/$VERSION/client64/bin +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib +export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64 +EOF_ENV + +echo ">> Enable discovery cron: " +#while true ; do wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done & +echo "*/5 * * * * wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks + +echo ">> Enable pandora_db cron: " +/usr/bin/perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf +#while true ; do sleep 1h && /usr/bin/pandora_db /etc/pandora/pandora_server.conf; done & +echo "0 */1 * * * /usr/bin/pandora_db /etc/pandora/pandora_server.conf" >> /opt/pandora/crontasks + +echo ">> Loading crontab tasks" +crontab -r +crontab /opt/pandora/crontasks && crontab -l + +ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -F '/' '{print "-> Go to http://"$1"/pandora_console to manage this server"}' + +# Check and launch supervisord +echo ">> Starting process: Running supervisord" +# Create supervisor.conf + +cat > /etc/supervisord.conf << EOF_CON +[unix_http_server] +file=/tmp/supervisor.sock + +[supervisord] +nodaemon=true +loglevel = debug + +[program:php-fpm] +command=/usr/sbin/php-fpm -F +riredirect_stderr=true + +[program:httpd] +command=/usr/sbin/apachectl -DFOREGROUND +riredirect_stderr=true + +[program:tentacle] +command=/etc/init.d/tentacle_serverd restart + +[program:$PANDORA_BIN] +command=$PANDORA_EXEC +riredirect_stderr=true + +[program:cron] +command=crond -n + +[group:allservices] +programs=httpd,cron,php-fpm,$PANDORA_BIN,tentacle + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///tmp/supervisor.sock + +EOF_CON + +# execute supervisor +touch /var/log/pandora/pandora_server.log ; tail -F /var/log/pandora/* & +su - -c supervisord diff --git a/extras/docker/percona/Dockerfile b/extras/docker/percona/Dockerfile new file mode 100644 index 0000000000..82b97401d6 --- /dev/null +++ b/extras/docker/percona/Dockerfile @@ -0,0 +1,31 @@ + +#docker build -t pandorafms/pandorafms-percona-base -f $HOME/code/pandorafms/extras/docker/percona/Dockerfile $HOME/code/pandorafms/extras/docker/percona + +FROM percona:5.7 + +RUN echo -e '#PandoraFMS configuration \n\ +[mysqld] \n\ +max_allowed_packet = 64M \n\ +innodb_buffer_pool_size = 500M \n\ +innodb_lock_wait_timeout = 90 \n\ +innodb_file_per_table \n\ +innodb_flush_log_at_trx_commit = 0 \n\ +innodb_flush_method = O_DIRECT \n\ +innodb_log_file_size = 64M \n\ +innodb_log_buffer_size = 16M \n\ +innodb_io_capacity = 100 \n\ +thread_cache_size = 8 \n\ +thread_stack = 256K \n\ +max_connections = 100 \n \n\ +key_buffer_size=4M \n\ +read_buffer_size=128K \n\ +read_rnd_buffer_size=128K \n\ +sort_buffer_size=128K \n\ +join_buffer_size=4M \n\n\ +query_cache_type = 1 \n\ +query_cache_size = 64M \n\ +query_cache_min_res_unit = 2k \n\ +query_cache_limit = 256K \n\n\ +sql_mode="" ' > /etc/my.cnf.d/pandora.cnf + +EXPOSE 3306 From dc41879a2cd06f0fee9e771b7b88c24bbf2b470b Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 16 Oct 2020 01:00:21 +0200 Subject: [PATCH 031/230] 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 | 4 ++-- 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, 26 insertions(+), 26 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 727847ab44..860fa53e6f 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750 +Version: 7.0NG.750-201016 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 62105af82f..14d82208b5 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.750" +pandora_version="7.0NG.750-201016" 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 2734a367c0..11b8499ec9 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201015'; +use constant AGENT_BUILD => '201016'; # 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 817e89d6eb..bee938a225 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.750 -%define release 1 +%define release 201016 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 01265b910d..7ec2298e2f 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.750 -%define release 1 +%define release 201016 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 f6cfadb186..e32d5c48bf 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201015" +PI_BUILD="201016" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index cf61454766..c006f2f73f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201015} +{201016} ViewReadme {Yes} @@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives {No} Windows,Executable -{<%AppName%>-Setup<%Ext%>} +{<%AppName%>-<%Version%>-Setup<%Ext%>} Windows,FileDescription {<%AppName%> <%Version%> Setup} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 8f185cd0dc..e3c555f2bc 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.750(Build 201015)") +#define PANDORA_VERSION ("7.0NG.750(Build 201016)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a1ec2dc7bb..5cd7660184 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.750(Build 201015))" + VALUE "ProductVersion", "(7.0NG.750(Build 201016))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 1f12c293fb..85d56dfe7e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750 +Version: 7.0NG.750-201016 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 1f28341bb7..0557d70138 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.750" +pandora_version="7.0NG.750-201016" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b722c6a24a..ca993495be 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 = 'PC201015'; +$build_version = 'PC201016'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 79bc6b7fdf..f3e23b3dd1 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 d5b0c58850..3548c5523b 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.750 -%define release 1 +%define release 201016 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 7e60a5bdd8..c6aa3914f3 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.750 -%define release 1 +%define release 201016 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 3e1ec89b9b..d181358815 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201015" +PI_BUILD="201016" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 5322721ec8..66d2728c8b 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.750 PS201015"; +my $version = "7.0NG.750 PS201016"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index f71a779d5d..926266ada5 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.750 PS201015"; +my $version = "7.0NG.750 PS201016"; # save program name for logging my $progname = basename($0); From 75cab7136baa97646d17d917e255585bc827dad7 Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 16 Oct 2020 10:20:07 +0200 Subject: [PATCH 032/230] Adding Readme files --- extras/docker/centos8/README.MD | 145 ++++++++++++++++++++++++++++++++ extras/docker/percona/README.MD | 50 +++++++++++ 2 files changed, 195 insertions(+) create mode 100644 extras/docker/centos8/README.MD create mode 100644 extras/docker/percona/README.MD diff --git a/extras/docker/centos8/README.MD b/extras/docker/centos8/README.MD new file mode 100644 index 0000000000..0c5dc9a2a1 --- /dev/null +++ b/extras/docker/centos8/README.MD @@ -0,0 +1,145 @@ +![Image of Pandora FMS](https://pandorafms.org/wp-content/uploads/2016/06/logo_pandora_community.png) + + +Pandora FMS is a __monitoring solution__ that provides unparalleled flexibility for IT to address both immediate and unforeseen operational issues, including infrastructure and IT processes. + +It uniquely enables business and IT to adapt to changing needs through a flexible and rapid approach to IT and business deployment. + +For community support you can visit our forums at [forums.pandorafms.org](http://forums.pandorafms.org). Check out our community website at [pandorafms.org](http://pandorafms.org), and if you need sales information or/and professional support, visit [pandorafms.com](http://pandorafms.com). + +# Pandora FMS full stack based on Centos 8 + +## Try it + +You can try it on a cloud env for 4 hours using play with docker just click in the icon bellow, wait for the pulling image and the containers will be up and running automatically + +If you want to open the console just click on the port 8080 on the upside and will be redirected to the pandora consola. + +[![Try in PWD](https://raw.githubusercontent.com/play-with-docker/stacks/master/assets/images/button.png)](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/rafaelameijeiras/PandoraFMS/master/pandorafms_community/docker-compose-official.yml) + + +https://www.youtube.com/watch?v=Hw2P6hHQpeI + +Note: could take a couple of minutes for the console to be ready so if you click in the 8080 port and nothing and have a blank page wait a little and reload the page + +## Usage +``` +docker run --name Pandora_new %container_name% --rm \ +-p %local_httpd_port%:80 \ +-p %local_tentacle_port%:41121 \ +-e DBHOST=%Mysql_Server_IP% \ +-e DBNAME=%database_name% \ +-e DBUSER=%Mysql_user% \ +-e DBPASS=%Mysql_pass% \ +-e DBPORT=%Mysql_port% \ +-e INSTANCE_NAME=%server name% \ +-ti pandorafms-open-stack-el8 +``` +Example: +``` +docker run --name Pandora_new --rm \ +-p 8081:80 \ +-p 41125:41121 \ +-e DBHOST=192.168.80.45 \ +-e DBNAME=pandora_demos_1 \ +-e DBUSER=pandora \ +-e DBPASS=pandora \ +-e DBPORT=3306 \ +-e INSTANCE_NAME=pandora201 \ +-ti pandorafms-open-stack-el8 +``` + +### Integrated database for PandoraFMS container +There is a preconfigured database image in this repo to connect the Pandora environment so you can up the database and then point the pandora container to the database. + +Example: +``` +docker run --name Pandora_DB \ +-p 3306:3306 \ +-e MYSQL_ROOT_PASSWORD=pandora \ +-e MYSQL_DATABASE=pandora \ +-e MYSQL_USER=pandora \ +-e MYSQL_PASSWORD=pandora \ +-d pandorafms/pandorafms-percona-base +``` + +This creates a Percona mysql docker and a database called Pandora with grants to the pandora user (optional) and the credentials for root user. + +In this example we expose the 3306 for database connection. + +Using this configuration (getting the container ip from DB container ip) you can execute the next container Pandora pointing to it: + +``` +docker run --name Pandora_new --rm \ +-p 8081:80 \ +-p 41125:41121 \ +-e DBHOST= \ +-e DBNAME=pandora \ +-e DBUSER=pandora \ +-e DBPASS=pandora \ +-e DBPORT=3306 \ +-e INSTANCE_NAME=pandora_inst \ +-ti pandorafms/pandorafms-open-stack-el8 +``` + +### Docker Compose Stack + +if you want to run an easy to deploy stack you may use the docker-compose.yml file + +``` +version: '3.1' +services: + db: + image: pandorafms/pandorafms-percona-base + restart: always + #command: ["mysqld", "--innodb-buffer-pool-size=900M"] + environment: + MYSQL_ROOT_PASSWORD: pandora + MYSQL_DATABASE: pandora + MYSQL_USER: pandora + MYSQL_PASSWORD: pandora + networks: + - pandora + + pandora: + image: pandorafms/pandorafms-open-stack-el8:latest + restart: always + depends_on: + - db + environment: + MYSQL_ROOT_PASSWORD: pandora + DBHOST: db + DBNAME: pandora + DBUSER: pandora + DBPASS: pandora + DBPORT: 3306 + INSTANCE_NAME: pandora01 + PUBLICURL: "" + SLEEP: 5 + RETRIES: 10 + networks: + - pandora + ports: + - "8080:80" + - "41121:41121" + - "162:162/udp" + - "9995:9995/udp" +networks: + pandora: +``` +just by running: `docker-compose -f up` + +## Important Parameters: + +* __INSTANCE_NAME__: Pandora Server name +* __DBHOST__: DB host IP to MySQL engine +* __DBNAME__: The name of the database. If your user have enough permissions to create databases, the container will create it in case automatically if didn't exist +* __DBUSER__: The user to connect MySQL engine. +* __DBPASS__: User password to connect MySQL engine. +* __DBPORT__: The port to connect MySQL engine. by default 33306 +* __PUBLICURL__: Define a public URL. Useful when Pandora is used behind a reverse proxy +* __SLEEP__: Time to wait between retries +* __RETRIES__: How many times Pandora will try to connect to MySQL engine before fail. + +Note1: the SLEEP and RETRIES variables will be used to wait for database container to fully start, if you are in a slower system maybe you will need to increase these variables values, in this example will wait 5 seconds for the database container to be up and retries 3 times. + diff --git a/extras/docker/percona/README.MD b/extras/docker/percona/README.MD new file mode 100644 index 0000000000..036cf7e0f9 --- /dev/null +++ b/extras/docker/percona/README.MD @@ -0,0 +1,50 @@ +![Image of Pandora FMS](https://pandorafms.org/wp-content/uploads/2016/06/logo_pandora_community.png) + +# Pandora FMS database container + +This container image is designed for optimal performance using Pandora FMS. + +Is based on the official Percona database image turned to get the maximum performance on PandoraFMS + +## Official Gitgub repo + +Dockerfiles and more info in our official repository: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/percona + +## USAGE + +Similar to the official percona image: +Example: +``` +docker run --name Pandora_DB \ +-p 3306:3306 \ +-e MYSQL_ROOT_PASSWORD=pandora \ +-e MYSQL_DATABASE=pandora \ +-e MYSQL_USER=pandora \ +-e MYSQL_PASSWORD=pandora \ +-d pandorafms/pandorafms-percona-base +``` + +## Environment Variables +When you start the percona image, you can adjust the configuration of the instance by passing one or more environment variables on the docker run command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup. + +__MYSQL_ROOT_PASSWORD__ : This variable is mandatory and specifies the password that will be set for the root superuser account. In the above example, it was set to my-secret-pw. + +__MYSQL_ROOT_HOST__ : By default, root can connect from anywhere. This option restricts root connections to be from the specified host only. Also localhost can be used here for the local-only root access. + +__MYSQL_DATABASE__ : +This variable is optional and allows you to specify the name of a database to be created on image startup. If a user/password was supplied (see below) then that user will be granted superuser access (corresponding to GRANT ALL) to this database. + +__MYSQL_USER, MYSQL_PASSWORD__ :These variables are optional, used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions (see above) for the database specified by the MYSQL_DATABASE variable. Both variables are required for a user to be created. +Do note that there is no need to use this mechanism to create the root superuser, that user gets created by default with the password specified by the MYSQL_ROOT_PASSWORD variable. + +__MYSQL_ALLOW_EMPTY_PASSWORD__ : This is an optional variable. Set to yes to allow the container to be started with a blank password for the root user. NOTE: Setting this variable to yes is not recommended unless you really know what you are doing, since this will leave your instance completely unprotected, allowing anyone to gain complete superuser access. + +__MYSQL_RANDOM_ROOT_PASSWORD__ : This is an optional variable. Set to yes to generate a random initial password for the root user (using pwgen). The generated root password will be printed to stdout (GENERATED ROOT PASSWORD: .....). + +__MYSQL_ONETIME_PASSWORD__ : Sets root (not the user specified in MYSQL_USER!) user as expired once init is complete, forcing a password change on first login. NOTE: This feature is supported on MySQL 5.6+ only. Using this option on MySQL 5.5 will throw an appropriate error during initialization. + +__MYSQL_INITDB_SKIP_TZINFO__ : At first run MySQL automatically loads from the local system the timezone information needed for the CONVERT_TZ() function. If it's is not what is intended, this option disables timezone loading. + +__INIT_TOKUDB__ : Tuns on TokuDB Engine. It can be activated only when transparent huge pages (THP) are disabled. + +__INIT_ROCKSDB__ : Tuns on RocksDB Engine. \ No newline at end of file From ca9b167741bed0c6c8496a51977b6a0f07e172ae Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Fri, 16 Oct 2020 14:00:38 +0200 Subject: [PATCH 033/230] SAML with pandora sessions --- pandora_console/include/auth/mysql.php | 3 +- pandora_console/include/load_session.php | 68 +++++++++++++++++++++--- pandora_console/index.php | 29 +++++----- 3 files changed, 76 insertions(+), 24 deletions(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 930e2cdbd2..f297089ea0 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -239,8 +239,7 @@ function process_user_login_remote($login, $pass, $api=false) // Unknown authentication method default: - $config['auth_error'] = 'User not found in database - or incorrect password'; + $config['auth_error'] = 'User not found in database or incorrect password'; return false; break; } diff --git a/pandora_console/include/load_session.php b/pandora_console/include/load_session.php index 3575310141..bcc1cc594f 100644 --- a/pandora_console/include/load_session.php +++ b/pandora_console/include/load_session.php @@ -198,11 +198,63 @@ function pandora_session_gc($max_lifetime=300) } -$result_handler = session_set_save_handler( - 'pandora_session_open', - 'pandora_session_close', - 'pandora_session_read', - 'pandora_session_write', - 'pandora_session_destroy', - 'pandora_session_gc' -); +/** + * Enables custom session handlers. + * + * @return boolean Context changed or not. + */ +function enable_session_handlers() +{ + global $config; + + if ($config['_using_pandora_sessionhandlers'] !== true) { + if (session_status() !== PHP_SESSION_NONE) { + // Close previous version. + session_write_close(); + } + + $sesion_handler = session_set_save_handler( + 'pandora_session_open', + 'pandora_session_close', + 'pandora_session_read', + 'pandora_session_write', + 'pandora_session_destroy', + 'pandora_session_gc' + ); + + session_start(); + + // Restore previous session. + $config['_using_pandora_sessionhandlers'] = true; + return $sesion_handler; + } + + return false; +} + + +/** + * Disables custom session handlers. + * + * @return void + */ +function disable_session_handlers() +{ + global $config; + + if (session_status() !== PHP_SESSION_NONE) { + // Close previous version. + session_write_close(); + } + + $ss = new SessionHandler(); + session_set_save_handler($ss, true); + + session_start(); + + $config['_using_pandora_sessionhandlers'] = false; +} + + +// Always enable session handler. +$result_handler = enable_session_handlers(); diff --git a/pandora_console/index.php b/pandora_console/index.php index af8671ded7..43645f69cb 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -395,24 +395,25 @@ if (! isset($config['id_user'])) { $nick_in_db = $_SESSION['prepared_login_da']['id_user']; $expired_pass = false; } else if (($config['auth'] == 'saml') && ($login_button_saml)) { - $saml_configured = include_once $config['homedir'].'/'.ENTERPRISE_DIR.'/include/auth/saml.php'; - - if (!$saml_configured) { + $saml_path = $config['homedir'].'/'.ENTERPRISE_DIR.'/include/auth/saml.php'; + if (!$saml_path) { include_once 'general/noaccesssaml.php'; - } + } else { + include_once $saml_path; - $saml_user_id = saml_process_user_login(); + $saml_user_id = saml_process_user_login(); - if (!$saml_user_id) { - include_once 'general/noaccesssaml.php'; - } + if (!$saml_user_id) { + include_once 'general/noaccesssaml.php'; + } - $nick_in_db = $saml_user_id; - if (!$nick_in_db) { - include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; - $as = new SimpleSAML_Auth_Simple($config['saml_source']); - $as->logout(); + $nick_in_db = $saml_user_id; + if (!$nick_in_db) { + include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; + $as = new SimpleSAML_Auth_Simple($config['saml_source']); + $as->logout(); + } } } else { // process_user_login is a virtual function which should be defined in each auth file. @@ -971,7 +972,7 @@ if (isset($_GET['bye'])) { if ($config['auth'] == 'saml') { include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; - $as = new SimpleSAML_Auth_Simple('PandoraFMS'); + $as = new SimpleSAML_Auth_Simple($config['saml_source']); $as->logout(); } From 30c7da054f6e1227339b3ef74f5b76243f9aa98d Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Fri, 16 Oct 2020 15:24:21 +0200 Subject: [PATCH 034/230] fixes SAML --- pandora_console/include/load_session.php | 8 +++++++- pandora_console/index.php | 6 ++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/load_session.php b/pandora_console/include/load_session.php index bcc1cc594f..883704b8e0 100644 --- a/pandora_console/include/load_session.php +++ b/pandora_console/include/load_session.php @@ -236,9 +236,11 @@ function enable_session_handlers() /** * Disables custom session handlers. * + * @param string|null $id_session Force swap to target session. + * * @return void */ -function disable_session_handlers() +function disable_session_handlers($id_session=null) { global $config; @@ -250,6 +252,10 @@ function disable_session_handlers() $ss = new SessionHandler(); session_set_save_handler($ss, true); + if ($id_session !== null) { + session_id($id_session); + } + session_start(); $config['_using_pandora_sessionhandlers'] = false; diff --git a/pandora_console/index.php b/pandora_console/index.php index 43645f69cb..e87fae5353 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -411,8 +411,7 @@ if (! isset($config['id_user'])) { $nick_in_db = $saml_user_id; if (!$nick_in_db) { include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; - $as = new SimpleSAML_Auth_Simple($config['saml_source']); - $as->logout(); + saml_logout(); } } } else { @@ -972,8 +971,7 @@ if (isset($_GET['bye'])) { if ($config['auth'] == 'saml') { include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; - $as = new SimpleSAML_Auth_Simple($config['saml_source']); - $as->logout(); + saml_logout(); } while (@ob_end_flush()) { From 85ac793e2b7c30e841f0f6063ff79d0570feb8f1 Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 16 Oct 2020 16:05:57 +0200 Subject: [PATCH 035/230] force folders creation --- pandora_agents/unix/Darwin/dmg/scripts/postinstall | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pandora_agents/unix/Darwin/dmg/scripts/postinstall b/pandora_agents/unix/Darwin/dmg/scripts/postinstall index 2f76310fee..5b25222a37 100644 --- a/pandora_agents/unix/Darwin/dmg/scripts/postinstall +++ b/pandora_agents/unix/Darwin/dmg/scripts/postinstall @@ -26,11 +26,13 @@ else `/usr/local/share/pandora_agent/inst_utilities/print_conf.pl /usr/local/share/pandora_agent/pandora_agent.conf remote_config $REMOTECFG` # Create agent directories and files - mkdir -p /usr/local/share/pandora_agent/collections - mkdir -p /usr/local/share/pandora_agent/commands + mkdir -p /usr/local/bin/ + mkdir -p /usr/local/share/man/man1/ + mkdir -p /usr/local/share/pandora_agent/collections/ + mkdir -p /usr/local/share/pandora_agent/commands/ mkdir -p /etc/pandora/ - mkdir -p /var/spool/pandora/data_out - mkdir -p /var/log/pandora + mkdir -p /var/spool/pandora/data_out/ + mkdir -p /var/log/pandora/ mv pandora_agent.conf /etc/pandora/ touch /var/log/pandora/pandora_agent.log @@ -70,9 +72,9 @@ ln -s /usr/local/share/pandora_agent/collections /etc/pandora/collections # Copy manuals -cp -f man/man1/pandora_agent.1.gz /usr/local/share/man/man1 +cp -f man/man1/pandora_agent.1.gz /usr/local/share/man/man1/ chmod 644 /usr/local/share/man/man1/pandora_agent.1.gz -cp -f man/man1/tentacle_client.1.gz /usr/local/share/man/man1 +cp -f man/man1/tentacle_client.1.gz /usr/local/share/man/man1/ chmod 644 /usr/local/share/man/man1/tentacle_client.1.gz # Create newsyslog entry From ee45d0c684142bcca838b7bed85bd75f9b3ff2ba Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 16 Oct 2020 16:29:02 +0200 Subject: [PATCH 036/230] Fix autoupdate version issue --- extras/pandora_update_version.sh | 2 +- pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 8a16e8e18d..23ea7a4627 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -143,7 +143,7 @@ done # Darwin dmg installer files echo "Updating DARWIN DMG files..." -sed -i -e "/VERSION/s/=.*/=\"$VERSION\"/" "$AGENT_DARWIN_BUILDER" +sed -i -e "/VERSION/s/=\"7.0NG.*/=\"$VERSION\"/" "$AGENT_DARWIN_BUILDER" sed -i -r "s/(version=\").*(\"\s+onConclusion=)/\1$VERSION\2/g" "$AGENT_DARWIN_DISTR" sed -i -r "s/(CFBundleVersion<\/key>\s*).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST" sed -i -r "s/(CFBundleShortVersionString<\/key>\s*).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST" diff --git a/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh index 325d149578..95878467ab 100644 --- a/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh +++ b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh @@ -22,7 +22,7 @@ fi # DMG package version if [ "$#" -ge 2 ]; then - VERSION="7.0NG.750" + VERSION="$2" else VERSION="7.0NG.750" fi @@ -37,7 +37,7 @@ fi BUILD_DMG="$BUILD_PATH/build" BUILD_TMP="$BUILD_PATH/buildtmp" -FULLNAME="7.0NG.749" +FULLNAME="$DMGNAME-$VERSION.dmg" echo "VERSION-"$VERSION" NAME-"$DMGNAME pushd . cd $LOCALINST From 7b73a36eb02e1b28b63cf88b02c6838204cd4b6e Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Fri, 16 Oct 2020 16:41:42 +0200 Subject: [PATCH 037/230] rc1 --- pandora_console/index.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pandora_console/index.php b/pandora_console/index.php index e87fae5353..8a95702146 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -961,19 +961,23 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { // Log off. if (isset($_GET['bye'])) { - include 'general/logoff.php'; $iduser = $_SESSION['id_usuario']; + $samlid = $_SESSION['samlid']; + + // Process logout. + include 'general/logoff.php'; + + if ($config['auth'] == 'saml' && empty($samlid) === false) { + include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; + enterprise_include('include/auth/saml.php'); + enterprise_hook('saml_logout', [$samlid]); + } $_SESSION = []; session_destroy(); header_remove('Set-Cookie'); setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); - if ($config['auth'] == 'saml') { - include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; - saml_logout(); - } - while (@ob_end_flush()) { // Dumping... continue; From 880c20dcabf256e1841f1c60c2bd9adddd48954a Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 17 Oct 2020 01:00:17 +0200 Subject: [PATCH 038/230] 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 860fa53e6f..8036771849 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201016 +Version: 7.0NG.750-201017 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 14d82208b5..9ece179a3c 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.750-201016" +pandora_version="7.0NG.750-201017" 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 11b8499ec9..f7e5fc94f8 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201016'; +use constant AGENT_BUILD => '201017'; # 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 bee938a225..cd7a96300a 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.750 -%define release 201016 +%define release 201017 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 7ec2298e2f..57e2a07a21 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.750 -%define release 201016 +%define release 201017 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 e32d5c48bf..b214206e72 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201016" +PI_BUILD="201017" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index c006f2f73f..dadd68356b 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201016} +{201017} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index e3c555f2bc..c425dbbacc 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.750(Build 201016)") +#define PANDORA_VERSION ("7.0NG.750(Build 201017)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 5cd7660184..701463a451 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.750(Build 201016))" + VALUE "ProductVersion", "(7.0NG.750(Build 201017))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 85d56dfe7e..377a61d2b5 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201016 +Version: 7.0NG.750-201017 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 0557d70138..90e3b564d5 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.750-201016" +pandora_version="7.0NG.750-201017" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index ca993495be..5d8db22b2e 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 = 'PC201016'; +$build_version = 'PC201017'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index f3e23b3dd1..d3dce49a12 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 3548c5523b..e150ab8f24 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.750 -%define release 201016 +%define release 201017 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index c6aa3914f3..adafea2fbf 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.750 -%define release 201016 +%define release 201017 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index d181358815..a88cee7919 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201016" +PI_BUILD="201017" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 66d2728c8b..40e8cbe764 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.750 PS201016"; +my $version = "7.0NG.750 PS201017"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 926266ada5..48cf6303d8 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.750 PS201016"; +my $version = "7.0NG.750 PS201017"; # save program name for logging my $progname = basename($0); From c560fa6125dcb7eda71aa5d88f0069e4a501d7ba Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 18 Oct 2020 01:00:15 +0200 Subject: [PATCH 039/230] 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 8036771849..c4432a005c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201017 +Version: 7.0NG.750-201018 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 9ece179a3c..acb03b53ae 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.750-201017" +pandora_version="7.0NG.750-201018" 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 f7e5fc94f8..a3570670dc 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201017'; +use constant AGENT_BUILD => '201018'; # 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 cd7a96300a..ae6bc0ce10 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.750 -%define release 201017 +%define release 201018 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 57e2a07a21..0baf83a9bb 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.750 -%define release 201017 +%define release 201018 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 b214206e72..64c8682e98 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201017" +PI_BUILD="201018" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index dadd68356b..051b288b8e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201017} +{201018} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index c425dbbacc..fddbaa1f7a 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.750(Build 201017)") +#define PANDORA_VERSION ("7.0NG.750(Build 201018)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 701463a451..94c388412b 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.750(Build 201017))" + VALUE "ProductVersion", "(7.0NG.750(Build 201018))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 377a61d2b5..59ec97d06c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201017 +Version: 7.0NG.750-201018 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 90e3b564d5..4ed5d0440f 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.750-201017" +pandora_version="7.0NG.750-201018" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 5d8db22b2e..f20a9ffdf7 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 = 'PC201017'; +$build_version = 'PC201018'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index d3dce49a12..b6e91e9bb0 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 e150ab8f24..a55cfee888 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.750 -%define release 201017 +%define release 201018 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index adafea2fbf..5339a1003f 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.750 -%define release 201017 +%define release 201018 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index a88cee7919..56fbe07876 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201017" +PI_BUILD="201018" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 40e8cbe764..3e1768340c 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.750 PS201017"; +my $version = "7.0NG.750 PS201018"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 48cf6303d8..b47c73f1e4 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.750 PS201017"; +my $version = "7.0NG.750 PS201018"; # save program name for logging my $progname = basename($0); From f6020e87918206218775dce0f2f3f3ef33c3fbc3 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 19 Oct 2020 10:59:46 +0200 Subject: [PATCH 040/230] Removed unwanted traces --- pandora_console/general/login_page.php | 7 ++- pandora_console/include/load_session.php | 40 ++++++++----- pandora_console/index.php | 73 +++++++++++++++++------- 3 files changed, 83 insertions(+), 37 deletions(-) diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index c4cd8482bc..97548deee4 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -450,7 +450,12 @@ if ($login_screen == 'logout') { echo '
'; echo '
'; echo '

'.__('Logged out').'

'; - echo '

'.__('Your session has ended. Please close your browser window to close this %s session.', get_product_name()).'

'; + if (empty($config['logout_msg']) === true) { + echo '

'.__('Your session has ended. Please close your browser window to close this %s session.', get_product_name()).'

'; + } else { + echo '

'.__($config['logout_msg']).'

'; + } + echo '
'; echo '
'; html_print_submit_button('Ok', 'hide-login-logout', false); diff --git a/pandora_console/include/load_session.php b/pandora_console/include/load_session.php index 883704b8e0..b557edd5d3 100644 --- a/pandora_console/include/load_session.php +++ b/pandora_console/include/load_session.php @@ -64,14 +64,23 @@ function pandora_session_close() function pandora_session_read($session_id) { $session_id = addslashes($session_id); - $session_data = db_get_value( - 'data', - 'tsessions_php', - 'id_session', - $session_id + + // Do not use SQL cache here. + $session_data = db_get_all_rows_sql( + sprintf( + 'SELECT data + FROM `tsessions_php` WHERE id_session="%s"', + $session_id + ), + false, + false ); - if (!empty($session_data)) { + if (is_array($session_data) === true) { + $session_data = $session_data[0]['data']; + } + + if (empty($session_data) === false) { return $session_data; } else { return ''; @@ -90,7 +99,6 @@ function pandora_session_read($session_id) function pandora_session_write($session_id, $data) { $session_id = addslashes($session_id); - if (is_ajax()) { // Avoid session upadte while processing ajax responses - notifications. if (get_parameter('check_new_notifications', false)) { @@ -101,18 +109,22 @@ function pandora_session_write($session_id, $data) $values = []; $values['last_active'] = time(); - if (!empty($data)) { + if (empty($data) === false) { $values['data'] = addslashes($data); } - $session_exists = (bool) db_get_value( - 'COUNT(id_session)', - 'tsessions_php', - 'id_session', - $session_id + // Do not use SQL cache here. + $session_exists = db_get_all_rows_sql( + sprintf( + 'SELECT id_session + FROM `tsessions_php` WHERE id_session="%s"', + $session_id + ), + false, + false ); - if (!$session_exists) { + if ($session_exists === false) { $values['id_session'] = $session_id; $retval_write = db_process_sql_insert('tsessions_php', $values); } else { diff --git a/pandora_console/index.php b/pandora_console/index.php index 8a95702146..56ea0fcd34 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -222,7 +222,7 @@ echo ''."\n"; ob_start('ui_process_page_head'); // Enterprise main. -enterprise_include('index.php'); +enterprise_include_once('index.php'); echo ' From bd95c0a4f044e15bbd7bdad2f6ab27b8df95dd05 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 24 Oct 2020 01:00:16 +0200 Subject: [PATCH 080/230] 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 4740e86fc1..8749501487 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201023 +Version: 7.0NG.750-201024 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 d2902cd0b6..d404addaff 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.750-201023" +pandora_version="7.0NG.750-201024" 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 472ef319e8..2ee0a04d0e 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201023'; +use constant AGENT_BUILD => '201024'; # 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 cf2e9aa8f4..601f5ab32f 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.750 -%define release 201023 +%define release 201024 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 9ac370795e..336212bdef 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.750 -%define release 201023 +%define release 201024 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 22d8e8c8c5..d29743fbb4 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201023" +PI_BUILD="201024" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 920e330d03..bf58e11259 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201023} +{201024} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index fda4543c24..9ea2ab629d 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.750(Build 201023)") +#define PANDORA_VERSION ("7.0NG.750(Build 201024)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index cd28d733dd..46c0ec4606 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.750(Build 201023))" + VALUE "ProductVersion", "(7.0NG.750(Build 201024))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index e69de672fd..7552eb8101 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201023 +Version: 7.0NG.750-201024 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 540dbb84ab..42c89d379a 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.750-201023" +pandora_version="7.0NG.750-201024" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7918f8f019..a904a0a2eb 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 = 'PC201023'; +$build_version = 'PC201024'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index e735ba79c3..6df85113e0 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 d9a95f2de6..f4f77e4c78 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.750 -%define release 201023 +%define release 201024 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index f6adde89c5..e3e32fa83e 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.750 -%define release 201023 +%define release 201024 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 3fb3c0f849..5281e38f98 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201023" +PI_BUILD="201024" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 810b5b240c..e1e45a7907 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.750 PS201023"; +my $version = "7.0NG.750 PS201024"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 2f180ab4e8..a9bf043069 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.750 PS201023"; +my $version = "7.0NG.750 PS201024"; # save program name for logging my $progname = basename($0); From 89fc211e6feca3e75fc0da1a0e9432dd2aa1c335 Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 25 Oct 2020 01:00:15 +0200 Subject: [PATCH 081/230] 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 8749501487..dc4c494a44 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201024 +Version: 7.0NG.750-201025 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 d404addaff..99efd77bb3 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.750-201024" +pandora_version="7.0NG.750-201025" 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 2ee0a04d0e..43cd220b52 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201024'; +use constant AGENT_BUILD => '201025'; # 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 601f5ab32f..719a9f27a2 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.750 -%define release 201024 +%define release 201025 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 336212bdef..e4f606a7f3 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.750 -%define release 201024 +%define release 201025 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 d29743fbb4..6d07daec17 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201024" +PI_BUILD="201025" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index bf58e11259..a6b7686f1f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201024} +{201025} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 9ea2ab629d..62bf86f47f 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.750(Build 201024)") +#define PANDORA_VERSION ("7.0NG.750(Build 201025)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 46c0ec4606..0dd7d05120 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.750(Build 201024))" + VALUE "ProductVersion", "(7.0NG.750(Build 201025))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 7552eb8101..3cf88cdc63 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201024 +Version: 7.0NG.750-201025 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 42c89d379a..a96c767c7c 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.750-201024" +pandora_version="7.0NG.750-201025" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index a904a0a2eb..9e13c911cc 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 = 'PC201024'; +$build_version = 'PC201025'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 6df85113e0..22a4a5b643 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 f4f77e4c78..079443bbcc 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.750 -%define release 201024 +%define release 201025 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index e3e32fa83e..19820a5bae 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.750 -%define release 201024 +%define release 201025 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 5281e38f98..fd4f821105 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201024" +PI_BUILD="201025" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index e1e45a7907..b2ae2cfc5a 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.750 PS201024"; +my $version = "7.0NG.750 PS201025"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index a9bf043069..8c99b44bc9 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.750 PS201024"; +my $version = "7.0NG.750 PS201025"; # save program name for logging my $progname = basename($0); From 76324679ec9c0746116b55407d8d3faa9ed82278 Mon Sep 17 00:00:00 2001 From: artica Date: Mon, 26 Oct 2020 01:00:14 +0100 Subject: [PATCH 082/230] 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 dc4c494a44..4fecf5d5db 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201025 +Version: 7.0NG.750-201026 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 99efd77bb3..3c41d59799 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.750-201025" +pandora_version="7.0NG.750-201026" 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 43cd220b52..dcf6ce3719 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201025'; +use constant AGENT_BUILD => '201026'; # 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 719a9f27a2..e8d5ba360e 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.750 -%define release 201025 +%define release 201026 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 e4f606a7f3..4e9891f8cc 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.750 -%define release 201025 +%define release 201026 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 6d07daec17..8cf408cc77 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201025" +PI_BUILD="201026" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index a6b7686f1f..1f7a962eae 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201025} +{201026} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 62bf86f47f..4ec547fa68 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.750(Build 201025)") +#define PANDORA_VERSION ("7.0NG.750(Build 201026)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 0dd7d05120..9f5f9872e9 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.750(Build 201025))" + VALUE "ProductVersion", "(7.0NG.750(Build 201026))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 3cf88cdc63..e04b3c9161 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201025 +Version: 7.0NG.750-201026 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 a96c767c7c..890008009a 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.750-201025" +pandora_version="7.0NG.750-201026" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 9e13c911cc..f5a41e3337 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 = 'PC201025'; +$build_version = 'PC201026'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 22a4a5b643..f39f2adc26 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 079443bbcc..63e13ebe52 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.750 -%define release 201025 +%define release 201026 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 19820a5bae..73712e49d1 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.750 -%define release 201025 +%define release 201026 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index fd4f821105..d2dc2b4701 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201025" +PI_BUILD="201026" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index b2ae2cfc5a..94cb21db50 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.750 PS201025"; +my $version = "7.0NG.750 PS201026"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 8c99b44bc9..1304a56793 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.750 PS201025"; +my $version = "7.0NG.750 PS201026"; # save program name for logging my $progname = basename($0); From 29174a87ef41d38638f5877feef99bfe57a6c190 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 26 Oct 2020 10:14:14 +0100 Subject: [PATCH 083/230] removed strict-user from monitor detail --- .../operation/agentes/status_monitor.php | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index a49db7b7f4..7be62557f4 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -701,7 +701,6 @@ foreach ($custom_fields as $custom_field) { $table_custom_fields->data[] = $row; } - $filters = '
'; if (is_metaconsole()) { $table->colspan[4][0] = 7; @@ -1750,24 +1749,13 @@ if (!empty($result)) { // End Build List Result. echo "
"; -// Strict user hidden. -echo ''; enterprise_hook('close_meta_frame'); ui_require_javascript_file('pandora_modules'); ?> - diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 8aa032c9a8..5f9a984048 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -26,17 +26,6 @@ function agents_modules_load_js() $ignored_params['refresh'] = ''; ?> - - + + Date: Wed, 4 Nov 2020 16:41:25 +0100 Subject: [PATCH 143/230] Ent 6680 ventana de perdida de conexion incorrecta --- pandora_console/general/login_page.php | 7 + .../include/javascript/connection_check.js | 170 ++++++++++++++++++ pandora_console/include/javascript/pandora.js | 117 ------------ .../include/javascript/pandora_ui.js | 58 ------ pandora_console/index.php | 2 +- .../operation/agentes/stat_win.php | 1 + .../operation/events/sound_events.php | 7 + .../operation/gis_maps/public_console.php | 2 + .../visual_console/legacy_public_view.php | 5 +- .../operation/visual_console/public_view.php | 9 +- 10 files changed, 191 insertions(+), 187 deletions(-) create mode 100644 pandora_console/include/javascript/connection_check.js diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index c4cd8482bc..9f50b10cb5 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -114,6 +114,13 @@ foreach ($custom_fields as $field) { } } +// Connection lost alert. +ui_require_css_file('register', 'include/styles/', true); +ui_require_javascript_file('connection_check'); +$conn_title = __('Connection with server has been lost'); +$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); +ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); + // Get the custom icons. $docs_logo = ui_get_docs_logo(); $support_logo = ui_get_support_logo(); diff --git a/pandora_console/include/javascript/connection_check.js b/pandora_console/include/javascript/connection_check.js new file mode 100644 index 0000000000..5ea72d2184 --- /dev/null +++ b/pandora_console/include/javascript/connection_check.js @@ -0,0 +1,170 @@ +/** + * ------------------------------------- + * Connection Check + * -------------------------------------- + */ + +checkConnection(1); + +/** + * Performs connection tests every minutes and add connection listeners + * @param {integer} time in minutes + */ + +function checkConnection(minutes) { + var cicle = minutes * 60 * 1000; + var checkConnection = setInterval(handleConnection, cicle); + + // Connection listeters. + window.addEventListener("online", handleConnection); + window.addEventListener("offline", handleConnection); +} + +/** + * Handle connection status test. + * + * Test conectivity with server and shows modal message. + */ +function handleConnection() { + var connected; + var msg = "online"; + + if (navigator.onLine) { + isReachable(getServerUrl()) + .then(function(online) { + if (online) { + // handle online status + connected = true; + showConnectionMessage(connected, msg); + } else { + connected = false; + msg = "No connectivity with server"; + showConnectionMessage(connected, msg); + } + }) + .catch(function(err) { + connected = false; + msg = err; + showConnectionMessage(connected, msg); + }); + } else { + // handle offline status + connected = false; + msg = "Connection offline"; + showConnectionMessage(connected, msg); + } +} + +/** + * Test server reachibilty and get response. + * + * @param {String} url + * + * Return {promise} + */ +function isReachable(url) { + /** + * Note: fetch() still "succeeds" for 404s on subdirectories, + * which is ok when only testing for domain reachability. + * + * Example: + * https://google.com/noexist does not throw + * https://noexist.com/noexist does throw + */ + return fetch(url, { method: "HEAD", mode: "no-cors" }) + .then(function(resp) { + return resp && (resp.ok || resp.type === "opaque"); + }) + .catch(function(error) { + console.warn("[conn test failure]:", error); + }); +} + +/** + * Gets server origin url + */ +function getServerUrl() { + var server_url; + + server_url = window.location.origin; + + return server_url; +} + +/** + * Shows or hide connection infoMessage. + * + * @param {bool} conn + * @param {string} msg + */ +function showConnectionMessage(conn = true, msg = "") { + var data = {}; + if (conn) { + $("div#message_dialog_connection") + .closest(".ui-dialog-content") + .dialog("close"); + } else { + data.title = "Connection with server has been lost"; + data.text = "Connection status: " + msg; + + infoMessage(data, "message_dialog_connection"); + } +} + +function infoMessage(data, idMsg) { + var title = data.title; + var err_messge = data.text; + + if (idMsg == null) { + idMsg = uniqId(); + } + + if ($("#" + idMsg).length === 0) { + $("body").append('
'); + $("#" + idMsg).empty(); + } + + $("#err_msg").empty(); + $("#err_msg").html("\n\n" + err_messge); + + $("#" + idMsg) + .dialog({ + height: 250, + width: 528, + opacity: 1, + modal: true, + position: { + my: "center", + at: "center", + of: window, + collision: "fit" + }, + title: data.title, + buttons: [ + { + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", + text: "Retry", + click: function(e) { + handleConnection(); + } + }, + { + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-cancel", + text: "Close", + click: function() { + $(this).dialog("close"); + } + } + ], + + open: function(event, ui) { + $(".ui-widget-overlay").addClass("error-modal-opened"); + }, + close: function(event, ui) { + $(".ui-widget-overlay").removeClass("error-modal-opened"); + } + }) + .show(); +} diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index e7f007a425..04a8f5336e 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1930,120 +1930,3 @@ function ajaxRequest(id, settings) { } }); } - -/** - * ------------------------------------- - * Connection Check - * -------------------------------------- - */ - -checkConnection(1); - -/** - * Performs connection tests every minutes and add connection listeners - * @param {integer} time in minutes - */ - -function checkConnection(minutes) { - var cicle = minutes * 60 * 1000; - var checkConnection = setInterval(handleConnection, cicle); - - // Connection listeters. - window.addEventListener("online", handleConnection); - window.addEventListener("offline", handleConnection); -} - -/** - * Handle connection status test. - * - * Test conectivity with server and shows modal message. - */ -function handleConnection() { - var connected; - var msg = "online"; - - if (navigator.onLine) { - isReachable(getServerUrl()) - .then(function(online) { - if (online) { - // handle online status - connected = true; - showConnectionMessage(connected, msg); - } else { - connected = false; - msg = "No connectivity with server"; - showConnectionMessage(connected, msg); - } - }) - .catch(function(err) { - connected = false; - msg = err; - showConnectionMessage(connected, msg); - }); - } else { - // handle offline status - connected = false; - msg = "Connection offline"; - showConnectionMessage(connected, msg); - } -} - -/** - * Test server reachibilty and get response. - * - * @param {String} url - * - * Return {promise} - */ -function isReachable(url) { - /** - * Note: fetch() still "succeeds" for 404s on subdirectories, - * which is ok when only testing for domain reachability. - * - * Example: - * https://google.com/noexist does not throw - * https://noexist.com/noexist does throw - */ - return fetch(url, { method: "HEAD", mode: "no-cors" }) - .then(function(resp) { - return resp && (resp.ok || resp.type === "opaque"); - }) - .catch(function(error) { - console.warn("[conn test failure]:", error); - }); -} - -/** - * Gets server origin url - */ -function getServerUrl() { - var server_url; - - try { - server_url = get_php_value("homeurl"); - } catch (SyntaxError) { - console.warn("Pandora homeurl cannot be found."); - server_url = $("#hidden-homeurl").val(); - } - return server_url; -} - -/** - * Shows or hide connection infoMessage. - * - * @param {bool} conn - * @param {string} msg - */ -function showConnectionMessage(conn = true, msg = "") { - var data = {}; - if (conn) { - $("div#message_dialog_connection") - .closest(".ui-dialog-content") - .dialog("close"); - } else { - data.title = "Connection with server has been lost"; - data.text = "Connection status: " + msg; - - infoMessage(data, "message_dialog_connection"); - } -} diff --git a/pandora_console/include/javascript/pandora_ui.js b/pandora_console/include/javascript/pandora_ui.js index 2445473591..15b7f83217 100644 --- a/pandora_console/include/javascript/pandora_ui.js +++ b/pandora_console/include/javascript/pandora_ui.js @@ -494,61 +494,3 @@ function generalShowMsg(data, idMsg) { ] }); } - -function infoMessage(data, idMsg) { - var title = data.title; - var err_messge = data.text; - - if (idMsg == null) { - idMsg = uniqId(); - } - - if ($("#" + idMsg).length === 0) { - $("body").append('
'); - $("#" + idMsg).empty(); - } - - $("#err_msg").empty(); - $("#err_msg").html("\n\n" + err_messge); - - $("#" + idMsg) - .dialog({ - height: 250, - width: 528, - opacity: 1, - modal: true, - position: { - my: "center", - at: "center", - of: window, - collision: "fit" - }, - title: data.title, - buttons: [ - { - class: - "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", - text: "Retry", - click: function(e) { - handleConnection(); - } - }, - { - class: - "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-cancel", - text: "Close", - click: function() { - $(this).dialog("close"); - } - } - ], - - open: function(event, ui) { - $(".ui-widget-overlay").addClass("error-modal-opened"); - }, - close: function(event, ui) { - $(".ui-widget-overlay").removeClass("error-modal-opened"); - } - }) - .show(); -} diff --git a/pandora_console/index.php b/pandora_console/index.php index 599e013c12..f7f3d6b207 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1255,8 +1255,8 @@ echo '
'; echo '
'; echo '
'; - // Connection lost alert. +ui_require_javascript_file('connection_check'); $conn_title = __('Connection with server has been lost'); $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index d5e22eb06b..a75e30e269 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -86,6 +86,7 @@ ui_require_css_file('register', 'include/styles/', true); // Connection lost alert. $conn_title = __('Connection with server has been lost'); $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); +ui_require_javascript_file('connection_check'); ui_print_message_dialog( $conn_title, $conn_text, diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index 5037e63b22..7434c18eaf 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -61,6 +61,13 @@ echo ''; echo ""; echo "

".__('Sound console').'

'; +// Connection lost alert. +ui_require_css_file('register', 'include/styles/', true); +$conn_title = __('Connection with server has been lost'); +$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); +ui_require_javascript_file('connection_check'); +ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); + $table = new StdClass; $table->width = '100%'; $table->styleTable = 'padding-left:16px; padding-right:16px; padding-top:16px;'; diff --git a/pandora_console/operation/gis_maps/public_console.php b/pandora_console/operation/gis_maps/public_console.php index ba5b99633c..a756d04c0c 100755 --- a/pandora_console/operation/gis_maps/public_console.php +++ b/pandora_console/operation/gis_maps/public_console.php @@ -273,8 +273,10 @@ if ($layers != false) { gis_activate_ajax_refresh($layers, $timestampLastOperation, 1, $idMap); // Connection lost alert. + ui_require_css_file('register', 'include/styles/', true); $conn_title = __('Connection with server has been lost'); $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); + ui_require_javascript_file('connection_check'); ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); } diff --git a/pandora_console/operation/visual_console/legacy_public_view.php b/pandora_console/operation/visual_console/legacy_public_view.php index 4df0a6db28..609447800e 100644 --- a/pandora_console/operation/visual_console/legacy_public_view.php +++ b/pandora_console/operation/visual_console/legacy_public_view.php @@ -48,6 +48,7 @@ html_print_input_hidden('homeurl', $config['homeurl']); $url_css_modal = ui_get_full_url('include/styles/register.css', false, false, false); echo ''; // Connection lost alert. +ui_require_javascript_file('connection_check', 'include/javascript/', true); $conn_title = __('Connection with server has been lost'); $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); @@ -157,10 +158,6 @@ echo ''; echo '
'; -// Connection lost alert. -$conn_title = __('Connection with server has been lost'); -$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); -ui_print_message_alert($conn_title, $conn_text, 'connection', '/images/error_1.png'); ui_require_jquery_file('countdown', 'include/javascript/', true); ui_require_javascript_file('wz_jsgraphics', 'include/javascript/', true); diff --git a/pandora_console/operation/visual_console/public_view.php b/pandora_console/operation/visual_console/public_view.php index 301ec3ca9c..6cc9f817a1 100644 --- a/pandora_console/operation/visual_console/public_view.php +++ b/pandora_console/operation/visual_console/public_view.php @@ -29,11 +29,10 @@ if (file_exists(ENTERPRISE_DIR.'/include/functions_login.php')) { require_once $config['homedir'].'/vendor/autoload.php'; ui_require_css_file('visual_maps'); -ui_require_css_file('register'); - -html_print_input_hidden('homeurl', $config['homeurl']); +ui_require_css_file('register', 'include/styles/', true); // Connection lost alert. +ui_require_javascript_file('connection_check', 'include/javascript/', true); $conn_title = __('Connection with server has been lost'); $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); @@ -140,10 +139,6 @@ echo ''; echo '
'; -// Connection lost alert. -$conn_title = __('Connection with server has been lost'); -$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); -ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); // Check groups can access user. $aclUserGroups = []; From 6662b4f2862d3d8cef8c0900f06af10e64072a46 Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 5 Nov 2020 01:00:35 +0100 Subject: [PATCH 144/230] 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 04c7ccfff0..35b6518513 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201104 +Version: 7.0NG.750-201105 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 8b542cabbc..cf2eb1e980 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.750-201104" +pandora_version="7.0NG.750-201105" 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 ecfb28e3a6..331f857f57 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201104'; +use constant AGENT_BUILD => '201105'; # 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 3208823d37..002d42b296 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.750 -%define release 201104 +%define release 201105 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 4940dea73f..7bc7ebbf86 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.750 -%define release 201104 +%define release 201105 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 a577aea1e1..ecae81300e 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201104" +PI_BUILD="201105" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 4452eb0cc6..6fd065ba3c 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201104} +{201105} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index e64936f6fb..f76231aa88 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.750(Build 201104)") +#define PANDORA_VERSION ("7.0NG.750(Build 201105)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 77211c3d7d..d8664851d2 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.750(Build 201104))" + VALUE "ProductVersion", "(7.0NG.750(Build 201105))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a14a6e5917..8812b0febf 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201104 +Version: 7.0NG.750-201105 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 d7baa037d3..b24df3257b 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.750-201104" +pandora_version="7.0NG.750-201105" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 09bf2878c3..1eb5c31d8e 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 = 'PC201104'; +$build_version = 'PC201105'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 58c6e85fa0..a2adc1d133 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 72cc6de732..6718c68ed7 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.750 -%define release 201104 +%define release 201105 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index e5eca20c18..7c589a530c 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.750 -%define release 201104 +%define release 201105 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index e84dc4ff91..2b7651608a 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201104" +PI_BUILD="201105" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 35c3256ef3..cee09ca550 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.750 PS201104"; +my $version = "7.0NG.750 PS201105"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 182804e5b7..ba141b545f 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.750 PS201104"; +my $version = "7.0NG.750 PS201105"; # save program name for logging my $progname = basename($0); From 6337fd3667e9599c56c78330d17a5b735437e382 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Thu, 5 Nov 2020 14:31:26 +0100 Subject: [PATCH 145/230] Fixed CLI update_group --- pandora_server/util/pandora_manage.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ba141b545f..a6fe3bf63c 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5754,16 +5754,22 @@ sub cli_delete_group() { sub cli_update_group() { my ($group_id,$group_name,$parent_group_name,$icon,$description) = @ARGV[2..6]; my $result; - $result = db_do ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id); + + $result = get_db_value ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id); if($result == "0E0"){ print_log "[ERROR] Group '$group_id' doesn`t exist \n\n"; }else{ if(defined($group_name)){ if(defined($parent_group_name)){ - my $parent_group_id = get_group_id($dbh,$parent_group_name); - exist_check($parent_group_id, 'group name', $parent_group_name); + my $parent_group_id = 0; + + if($parent_group_name ne 'All') { + $parent_group_id = get_group_id($dbh,$parent_group_name); + exist_check($parent_group_id, 'group name', $parent_group_name); + } + if(defined($icon)){ if(defined($description)){ db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? , icon=? , description=? WHERE id_grupo=?',$group_name,$parent_group_id,$icon,$description,$group_id); From 64bd9bfc79b397cf1394e4a1269459cbc3f3de4e Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Thu, 5 Nov 2020 16:14:06 +0100 Subject: [PATCH 146/230] Fixed safe input on cli delete_group --- pandora_server/util/pandora_manage.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ba141b545f..193635a3f9 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5734,7 +5734,7 @@ sub cli_delete_group() { my $group_id = get_group_id($dbh,$group_name); exist_check($group_id, 'group name', $group_name); - $group_id = db_do ($dbh, 'DELETE FROM tgrupo WHERE nombre=?', $group_name); + $group_id = db_do ($dbh, 'DELETE FROM tgrupo WHERE nombre=?', safe_input($group_name)); if($group_id == -1) { print_log "[ERROR] A problem has been ocurred deleting group '$group_name'\n\n"; From 2cbe4643bc3b6bb21fc6766585ecf51158681197 Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 6 Nov 2020 01:00:35 +0100 Subject: [PATCH 147/230] 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 35b6518513..e78509f4fb 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201105 +Version: 7.0NG.750-201106 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 cf2eb1e980..34e2c63f75 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.750-201105" +pandora_version="7.0NG.750-201106" 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 331f857f57..6653ed87b4 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201105'; +use constant AGENT_BUILD => '201106'; # 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 002d42b296..82989e2377 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.750 -%define release 201105 +%define release 201106 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 7bc7ebbf86..d8cf7fd85e 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.750 -%define release 201105 +%define release 201106 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 ecae81300e..9b67b8edd0 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201105" +PI_BUILD="201106" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 6fd065ba3c..2d0eefa0b1 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201105} +{201106} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index f76231aa88..77917986e5 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.750(Build 201105)") +#define PANDORA_VERSION ("7.0NG.750(Build 201106)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d8664851d2..3e50c6637e 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.750(Build 201105))" + VALUE "ProductVersion", "(7.0NG.750(Build 201106))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 8812b0febf..36d6e97af4 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201105 +Version: 7.0NG.750-201106 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 b24df3257b..efe9ce72a1 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.750-201105" +pandora_version="7.0NG.750-201106" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1eb5c31d8e..0ff041025b 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 = 'PC201105'; +$build_version = 'PC201106'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index a2adc1d133..dbd1515dfc 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 6718c68ed7..2889ee3920 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.750 -%define release 201105 +%define release 201106 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 7c589a530c..08b2f7f037 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.750 -%define release 201105 +%define release 201106 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 2b7651608a..e405468b23 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201105" +PI_BUILD="201106" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index cee09ca550..f20e41c9ce 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.750 PS201105"; +my $version = "7.0NG.750 PS201106"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ba141b545f..30820b6c7f 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.750 PS201105"; +my $version = "7.0NG.750 PS201106"; # save program name for logging my $progname = basename($0); From 22ae632850e2c245df9caf163e6e34fa11a98f59 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 6 Nov 2020 12:38:06 +0100 Subject: [PATCH 148/230] Added html_print_anchor function for link tags --- pandora_console/include/functions_html.php | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index af6f5ceed9..7ffbda2417 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2159,6 +2159,55 @@ function html_print_div($options, $return=false) } +/** + * Render an anchor html element. + * + * @param array $options Parameters + * - id: string + * - style: string + * - title: string + * - href: string. + * @param boolean $return Return or echo flag. + * + * @return string HTML code if return parameter is true. + */ +function html_print_anchor( + array $options, + bool $return=false +) { + $output = ' Date: Fri, 6 Nov 2020 12:38:35 +0100 Subject: [PATCH 149/230] WIP: Backup upload --- .../include/class/AgentsAlerts.class.php | 1139 ++++++++--------- 1 file changed, 550 insertions(+), 589 deletions(-) diff --git a/pandora_console/include/class/AgentsAlerts.class.php b/pandora_console/include/class/AgentsAlerts.class.php index 1d13db50cc..707e75cf17 100644 --- a/pandora_console/include/class/AgentsAlerts.class.php +++ b/pandora_console/include/class/AgentsAlerts.class.php @@ -85,7 +85,21 @@ class AgentsAlerts extends HTML /** * Full view parameter. */ - private $pure; + private $selectedFullScreen; + + /** + * Undocumented variable + * + * @var integer + */ + private $offset; + + /** + * Undocumented variable + * + * @var integer + */ + private $hor_offset; /** @@ -120,14 +134,17 @@ class AgentsAlerts extends HTML $this->ajaxController = $ajax_controller; // Refresh rate. $this->refreshSelectedRate = (string) get_parameter('refresh-rate', '30'); - // Show modules without alerts. - $this->showWithoutAlertModules = (bool) get_parameter('show-modules', false); + // Show Modules without alerts table. + $this->showWithoutAlertModules = isset($_POST['show-modules-without-alerts']); // Selected group. $this->groupId = (int) get_parameter('groupId', 0); // Create alert token. $this->createAlert = (int) get_parameter('create_alert', 0); // View token (for full screen view). - $this->pure = (int) get_parameter('full-screen-action', 0); + $this->selectedFullScreen = get_parameter('btn-full-screen', $config['pure']); + // Offset and hor-offset (for pagination). + $this->offset = (int) get_parameter('offset', 0); + $this->hor_offset = (int) get_parameter('hor_offset', 0); return $this; } @@ -140,8 +157,10 @@ class AgentsAlerts extends HTML */ public function run() { + global $config; // Javascript. ui_require_jquery_file('pandora'); + // Load own javascript file. $this->loadJS(); // CSS. ui_require_css_file('wizard'); @@ -154,10 +173,252 @@ class AgentsAlerts extends HTML 'v1r1', 'view' ); + + // Update network modules for this group + // Check for Network FLAG change request + // Made it a subquery, much faster on both the database and server side + // TODO. Check if this is used or necessary. + if (isset($_GET['update_netgroup'])) { + $group = get_parameter_get('update_netgroup', 0); + if (check_acl($config['id_user'], $group, 'AW')) { + $where = ['id_agente' => 'ANY(SELECT id_agente FROM tagente WHERE id_grupo = '.$group]; + + db_process_sql_update('tagente_modulo', ['flag' => 1], $where); + } else { + db_pandora_audit('ACL Violation', 'Trying to set flag for groups'); + include 'general/noaccess.php'; + exit; + } + } + // Load the header. - // extensions_add_main_function($this->loadHeader()); $this->loadHeader(); - // Load table. + // If the petition wants to create alert + if ($this->createAlert) { + $this->createAlertAction(); + } + + if ($this->showWithoutAlertModules === true) { + $this->createAlertTable(); + } else { + $this->loadMainAlertTable(); + } + } + + + /** + * + */ + private function createAlertTable() + { + global $config; + + $table = new stdClass(); + + $group_id = $this->groupId; + + if ($group_id > 0) { + $grupo = ' AND tagente.id_grupo = '.$group_id; + } else { + $grupo = ''; + } + + $offset_modules = $this->offset; + + $sql_count = 'SELECT COUNT(tagente_modulo.nombre) FROM tagente_modulo + INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente + WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules)'.$grupo; + + $count_agent_module = db_get_all_rows_sql($sql_count); + + $sql = 'SELECT tagente.alias, tagente_modulo.nombre, + tagente_modulo.id_agente_modulo FROM tagente_modulo + INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente + WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules) '.$grupo.' LIMIT 20 OFFSET '.$offset_modules; + + $agent_modules = db_get_all_rows_sql($sql); + + ui_pagination( + $count_agent_module[0]['COUNT(tagente_modulo.nombre)'], + ui_get_url_refresh(), + 0, + 0, + false, + 'offset', + true, + '', + '', + false, + 'alerts_modules' + ); + + $table->width = '100%'; + $table->class = 'databox data'; + $table->id = 'table_agent_module'; + $table->data = []; + + $table->head[0] = __('Agents'); + $table->head[1] = __('Modules'); + $table->head[2] = __('Actions'); + + $table->style[0] = 'width: 25%;'; + $table->style[1] = 'width: 33%;'; + $table->style[2] = 'width: 33%;'; + + foreach ($agent_modules as $agent_module) { + // Let's build the table. + $data[0] = io_safe_output($agent_module['alias']); + $data[1] = io_safe_output($agent_module['nombre']); + $uniqid = $agent_module['id_agente_modulo']; + $data[2] = html_print_anchor( + [ + 'href' => sprintf( + 'javascript:show_add_alerts(\'%s\')', + $uniqid + ), + 'content' => html_print_image('images/add_mc.png', true), + ], + true + ); + + array_push($table->data, $data); + + $table2 = new stdClass(); + + $table2->width = '100%'; + $table2->id = 'table_add_alert'; + $table2->class = 'databox filters'; + $table2->data = []; + + $table2->data[0][0] = __('Actions'); + + $groups_user = users_get_groups($config['id_user']); + + if (!empty($groups_user)) { + $groups = implode(',', array_keys($groups_user)); + $sql = sprintf( + 'SELECT id, name FROM talert_actions WHERE id_group IN (%s)', + $groups + ); + + $actions = db_get_all_rows_sql($sql); + } + + $table2->data[0][1] = html_print_select( + index_array($actions, 'id', 'name'), + 'action_select', + '', + '', + __('Default action'), + '0', + true, + '', + true, + '', + false, + 'width: 250px;' + ); + $table2->data[0][1] .= ''; + + // Check ACLs for LM users. + if (check_acl($config['id_user'], 0, 'LM')) { + $table2->data[0][1] .= ''; + $table2->data[0][1] .= html_print_image('images/add.png', true); + $table2->data[0][1] .= ''.__('Create Action').''; + $table2->data[0][1] .= ''; + } + + $table2->data[1][0] = __('Template'); + $own_info = get_user_info($config['id_user']); + if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { + $templates = alerts_get_alert_templates(false, ['id', 'name']); + } else { + $usr_groups = users_get_groups($config['id_user'], 'LW', true); + $filter_groups = ''; + $filter_groups = implode(',', array_keys($usr_groups)); + $templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']); + } + + $table2->data[1][1] = html_print_select( + index_array($templates, 'id', 'name'), + 'template', + '', + '', + __('Select'), + 0, + true, + false, + true, + '', + false, + 'width: 250px;' + ); + + $table2->data[1][1] .= html_print_anchor( + [ + 'href' => '#', + 'class' => 'template_details invisible', + 'content' => html_print_image('images/zoom.png', true, ['class' => 'img_help']), + ], + true + ); + + // Check ACLs for LM users. + if (check_acl($config['id_user'], 0, 'LM')) { + $table2->data[1][1] .= html_print_anchor( + [ + 'href' => 'index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$config['pure'], + 'content' => html_print_image('images/add.png', true).''.__('Create Template').'', + ] + ); + } + + $table2->data[2][0] = __('Threshold'); + $table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true); + $table2->data[2][1] .= ' '.__('seconds'); + + $content2 = ''; + + $content2 .= html_print_table($table2, true); + $content2 .= html_print_div( + [ + 'class' => 'action-buttons', + 'style' => 'width: '.$table2->width, + 'content' => html_print_submit_button(__('Add alert'), 'add', false, 'class="sub wand"', true).html_print_input_hidden('create_alert', $uniqid, true), + ] + ); + + $content2 .= ''; + + $module_name = ui_print_truncate_text(io_safe_output($agent_module['nombre']), 40, false, true, false, '…', false); + + html_print_div( + [ + 'id' => 'add_alerts_dialog_'.$uniqid, + 'title' => __('Agent').': '.$agent_module['alias'].' / '.__('module').': '.$module_name, + 'style' => 'display:none', + 'content' => $content2, + ] + ); + } + + html_print_table($table); + } + + + private function mainAlertTable() + { } @@ -167,7 +428,7 @@ class AgentsAlerts extends HTML * * @return void */ - private function createAlert() + private function createAlertAction() { $template2 = get_parameter('template'); $module_action_threshold = get_parameter('module_action_threshold'); @@ -188,6 +449,268 @@ class AgentsAlerts extends HTML } + /** + * Undocumented function + * + * @return void + */ + public function loadMainAlertTable() + { + global $config; + + $block = 20; + + $filter = [ + 'offset' => (int) $this->offset, + 'limit' => (int) $config['block_size'], + ]; + + $filter_count = []; + + if ($this->groupId > 0) { + $filter['id_grupo'] = $this->groupId; + $filter_count['id_grupo'] = $this->groupId; + } + + // Get the id of all agents with alerts. + $sql = 'SELECT DISTINCT(id_agente) + FROM tagente_modulo + WHERE id_agente_modulo IN + (SELECT id_agent_module + FROM talert_template_modules)'; + $agents_with_alerts_raw = db_get_all_rows_sql($sql); + + if ($agents_with_alerts_raw === false) { + $agents_with_alerts_raw = []; + } + + $agents_with_alerts = []; + foreach ($agents_with_alerts_raw as $awar) { + $agents_with_alerts[] = $awar['id_agente']; + } + + $filter['id_agente'] = $agents_with_alerts; + $filter_count['id_agente'] = $agents_with_alerts; + + $agents = agents_get_agents($filter); + + $nagents = count(agents_get_agents($filter_count)); + + if ($agents == false) { + ui_print_info_message( + [ + 'no_close' => true, + 'message' => __('There are no agents with alerts'), + ] + ); + + return false; + } + + $all_alerts = agents_get_alerts_simple(); + + if ($config['pure'] == 1) { + $block = count($all_alerts); + } + + $templates = []; + $agent_alerts = []; + foreach ($all_alerts as $alert) { + $templates[$alert['id_alert_template']] = ''; + $agent_alerts[$alert['agent_name']][$alert['id_alert_template']][] = $alert; + } + + // Prepare pagination. + ui_pagination( + $nagents, + false, + 0, + 3, + false, + 'offset', + true, + '', + '', + [ + 'count' => '', + 'offset' => 'offset_param', + ], + 'alerts_agents' + ); + + echo ''; + echo ''; + echo ''; + + $templates_raw = []; + if (!empty($templates)) { + $sql = sprintf( + 'SELECT id, name + FROM talert_templates + WHERE id IN (%s)', + implode(',', array_keys($templates)) + ); + + $templates_raw = db_get_all_rows_sql($sql); + } + + if (empty($templates_raw)) { + $templates_raw = []; + } + + $alerts = []; + $ntemplates = 0; + if ($this->hor_offset > 0) { + $new_hor_offset = ($this->hor_offset - $block); + echo "'; + } + + foreach ($templates_raw as $temp) { + if (isset($templates[$temp['id']]) && $templates[$temp['id']] == '') { + $ntemplates++; + + if ($ntemplates <= $this->hor_offset || $ntemplates > ($this->hor_offset + $block)) { + continue; + } + + $templates[$temp['id']] = $temp['name']; + + if (empty($temp['name']) === false) { + $outputLine = html_print_div( + [ + 'id' => 'line_header_'.$temp['id'], + 'class' => 'rotate_text_module', + 'content' => ''.ui_print_truncate_text(io_safe_output($temp['name']), 20).'', + ], + true + ); + + echo sprintf('', $outputLine); + } + } + } + + if (($this->hor_offset + $block) < $ntemplates) { + $new_hor_offset = ($this->hor_offset + $block); + echo "'; + } + + echo ''; + + foreach ($agents as $agent) { + $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); + echo ''; + // Name of the agent. + echo ''; + + // Alerts of the agent. + $anyfired = false; + foreach ($templates as $tid => $tname) { + if ($tname == '') { + continue; + } + + echo ''; + } + + echo ''; + } + + echo '
'.__('Agents').' / '.__('Alerts').'"; + + html_print_anchor( + [ + 'href' => sprintf( + 'index.php?sec=extensions&sec2=extensions/agents_alerts&hor_offset=%s&offset=%s&group_id=%s', + $new_hor_offset, + $this->offset, + $this->groupId + ), + 'content' => html_print_image( + 'images/arrow_left_green.png', + true, + [ + 'style' => 'float: right;', + 'title' => __('Previous alerts'), + ] + ), + ] + ); + echo '%s"; + html_print_anchor( + [ + 'href' => sprintf( + 'index.php?sec=extensions&sec2=extensions/agents_alerts&hor_offset=%s&offset=%s&group_id=%s', + $new_hor_offset, + $this->offset, + $this->groupId + ), + 'content' => html_print_image( + 'images/arrow_right_green.png', + true, + [ + 'style' => 'float: right;', + 'title' => __('More alerts'), + ] + ), + ] + ); + echo '
'.$alias['alias'].''; + + if (isset($agent_alerts[$agent['nombre']][$tid])) { + foreach ($agent_alerts[$agent['nombre']][$tid] as $alert) { + if ($alert['times_fired'] > 0) { + $anyfired = true; + } + } + + if ($anyfired) { + $cellstyle = 'background:'.COL_ALERTFIRED.';'; + } else { + $cellstyle = 'background:'.COL_NORMAL.';'; + } + + $uniqid = uniqid(); + + html_print_anchor( + [ + 'href' => sprintf('javascript:show_alerts_details(\'%s\')', $uniqid), + 'content' => html_print_div( + [ + 'id' => 'line_header_'.$temp['id'], + 'class' => 'status_rounded_rectangles text_inside', + 'style' => $cellstyle, + 'content' => count($agent_alerts[$agent['nombre']][$tid]), + ], + true + ), + ] + ); + + $this->printAlertsSummaryModalWindow($uniqid, $agent_alerts[$agent['nombre']][$tid]); + } + + echo '
'; + // echo ''; + ui_pagination( + $nagents, + false, + 0, + 0, + false, + 'offset', + true, + 'pagination-bottom', + '', + [ + 'count' => '', + 'offset' => 'offset_param', + ], + 'alerts_agents' + ); + } + + /** * Show headers and filters * @@ -196,22 +719,6 @@ class AgentsAlerts extends HTML public function loadHeader() { global $config; - // Update network modules for this group - // Check for Network FLAG change request - // Made it a subquery, much faster on both the database and server side - // TODO - if (isset($_GET['update_netgroup'])) { - $group = get_parameter_get('update_netgroup', 0); - if (check_acl($config['id_user'], $group, 'AW')) { - $where = ['id_agente' => 'ANY(SELECT id_agente FROM tagente WHERE id_grupo = '.$group]; - - db_process_sql_update('tagente_modulo', ['flag' => 1], $where); - } else { - db_pandora_audit('ACL Violation', 'Trying to set flag for groups'); - include 'general/noaccess.php'; - exit; - } - } $updated_info = ''; @@ -221,13 +728,6 @@ class AgentsAlerts extends HTML $updated_time = $updated_info; - if ($create_alert) { - $this->createAlert(); - } - - // Get parameters. - $offset = (int) get_parameter('offset', 0); - $hor_offset = (int) get_parameter('hor_offset', 0); // Magic number? $block = 20; $groups = users_get_groups(); @@ -265,10 +765,10 @@ class AgentsAlerts extends HTML $this->printHeader(true) ); - // Start Filter form. + // Start Header form. $headerForm = [ 'action' => ui_get_full_url(), - 'id' => 'form-refresh-rate', + 'id' => 'form-header-filters', 'method' => 'POST', 'class' => 'modal flex flex-row', 'extra' => '', @@ -296,23 +796,17 @@ class AgentsAlerts extends HTML 'label' => __('Show modules without alerts'), 'id' => 'txt-use-agent-ip', 'arguments' => [ - 'name' => 'slides_ids[]', - 'value' => $this->showWithoutAlertModules, - 'input_class' => 'flex-row', - 'type' => 'checkbox', - 'class' => '', - 'return' => true, + 'name' => 'show-modules-without-alerts', + 'checked' => $this->showWithoutAlertModules, + 'input_class' => 'flex-row', + 'type' => 'checkbox', + 'class' => '', + 'disabled_hidden' => true, + 'return' => true, ], ]; - $selectedFullScreen = get_parameter('btn-full-screen', null); - $screenStatus = $config['pure']; - - if ($selectedFullScreen == null) { - $selectedFullScreen = $screenStatus; - } - - if ($selectedFullScreen == 0) { + if ($this->selectedFullScreen == 0) { $screenSwitchTitle = __('Full screen mode'); $screenSwitchClass = 'pure_full'; $screenSwitchPure = 1; @@ -392,375 +886,6 @@ class AgentsAlerts extends HTML ); echo $header; - - if ($show_modules) { - if ($group_id > 0) { - $grupo = " AND tagente.id_grupo = $group_id"; - } else { - $grupo = ''; - } - - $offset_modules = get_parameter('offset', 0); - $sql_count = "SELECT COUNT(tagente_modulo.nombre) FROM tagente_modulo - INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente - WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules) - $grupo"; - $count_agent_module = db_get_all_rows_sql($sql_count); - - $sql = "SELECT tagente.alias, tagente_modulo.nombre, - tagente_modulo.id_agente_modulo FROM tagente_modulo - INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente - WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules) - $grupo LIMIT 20 OFFSET $offset_modules"; - $agent_modules = db_get_all_rows_sql($sql); - - ui_pagination( - $count_agent_module[0]['COUNT(tagente_modulo.nombre)'], - ui_get_url_refresh(), - 0, - 0, - false, - 'offset', - true, - '', - '', - false, - 'alerts_modules' - ); - - $table->width = '100%'; - $table->class = 'databox data'; - $table->id = 'table_agent_module'; - $table->data = []; - - $table->head[0] = __('Agents'); - $table->head[1] = __('Modules'); - $table->head[2] = __('Actions'); - - $table->style[0] = 'width: 25%;'; - $table->style[1] = 'width: 33%;'; - $table->style[2] = 'width: 33%;'; - - foreach ($agent_modules as $agent_module) { - $data[0] = io_safe_output($agent_module['alias']); - $data[1] = io_safe_output($agent_module['nombre']); - $uniqid = $agent_module['id_agente_modulo']; - $data[2] = "".html_print_image('images/add_mc.png', true).''; - array_push($table->data, $data); - - $table2->width = '100%'; - $table2->id = 'table_add_alert'; - $table2->class = 'databox filters'; - $table2->data = []; - // $data[0] = - $table2->data[0][0] = __('Actions'); - - $groups_user = users_get_groups($config['id_user']); - if (!empty($groups_user)) { - $groups = implode(',', array_keys($groups_user)); - $sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)"; - $actions = db_get_all_rows_sql($sql); - } - - $table2->data[0][1] = html_print_select( - index_array($actions, 'id', 'name'), - 'action_select', - '', - '', - __('Default action'), - '0', - true, - '', - true, - '', - false, - 'width: 250px;' - ); - $table2->data[0][1] .= ''; - if (check_acl($config['id_user'], 0, 'LM')) { - $table2->data[0][1] .= ''; - $table2->data[0][1] .= html_print_image('images/add.png', true); - $table2->data[0][1] .= ''.__('Create Action').''; - $table2->data[0][1] .= ''; - } - - $table2->data[1][0] = __('Template'); - $own_info = get_user_info($config['id_user']); - if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { - $templates = alerts_get_alert_templates(false, ['id', 'name']); - } else { - $usr_groups = users_get_groups($config['id_user'], 'LW', true); - $filter_groups = ''; - $filter_groups = implode(',', array_keys($usr_groups)); - $templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']); - } - - $table2->data[1][1] = html_print_select( - index_array($templates, 'id', 'name'), - 'template', - '', - '', - __('Select'), - 0, - true, - false, - true, - '', - false, - 'width: 250px;' - ); - $table2->data[1][1] .= ' '; - if (check_acl($config['id_user'], 0, 'LM')) { - $table2->data[1][1] .= ''; - $table2->data[1][1] .= html_print_image('images/add.png', true); - $table2->data[1][1] .= ''.__('Create Template').''; - $table2->data[1][1] .= ''; - } - - $table2->data[2][0] = __('Threshold'); - $table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true); - $table2->data[2][1] .= ' '.__('seconds'); - - $content2 = '
'; - $content2 .= html_print_table($table2, true); - - $content2 .= '
'; - $content2 .= html_print_submit_button(__('Add alert'), 'add', false, 'class="sub wand"', true); - $content2 .= html_print_input_hidden('create_alert', $uniqid, true); - $content2 .= '
'; - - $module_name = ui_print_truncate_text(io_safe_output($agent_module['nombre']), 40, false, true, false, '…', false); - echo ''; - } - - html_print_table($table); - } else { - $filter = [ - 'offset' => (int) $offset, - 'limit' => (int) $config['block_size'], - ]; - $filter_count = []; - - if ($group_id > 0) { - $filter['id_grupo'] = $group_id; - $filter_count['id_grupo'] = $group_id; - } - - // Get the id of all agents with alerts - $sql = 'SELECT DISTINCT(id_agente) - FROM tagente_modulo - WHERE id_agente_modulo IN - (SELECT id_agent_module - FROM talert_template_modules)'; - $agents_with_alerts_raw = db_get_all_rows_sql($sql); - - if ($agents_with_alerts_raw === false) { - $agents_with_alerts_raw = []; - } - - $agents_with_alerts = []; - foreach ($agents_with_alerts_raw as $awar) { - $agents_with_alerts[] = $awar['id_agente']; - } - - $filter['id_agente'] = $agents_with_alerts; - $filter_count['id_agente'] = $agents_with_alerts; - - $agents = agents_get_agents($filter); - - $nagents = count(agents_get_agents($filter_count)); - - if ($agents == false) { - ui_print_info_message( - [ - 'no_close' => true, - 'message' => __('There are no agents with alerts'), - ] - ); - - return false; - } - - $all_alerts = agents_get_alerts_simple(); - - if ($config['pure'] == 1) { - $block = count($all_alerts); - } - - $templates = []; - $agent_alerts = []; - foreach ($all_alerts as $alert) { - $templates[$alert['id_alert_template']] = ''; - $agent_alerts[$alert['agent_name']][$alert['id_alert_template']][] = $alert; - } - - // Prepare pagination. - ui_pagination( - $nagents, - false, - 0, - 3, - false, - 'offset', - true, - '', - '', - [ - 'count' => '', - 'offset' => 'offset_param', - ], - 'alerts_agents' - ); - - echo ''; - echo ''; - echo ''; - - $templates_raw = []; - if (!empty($templates)) { - $sql = sprintf( - 'SELECT id, name - FROM talert_templates - WHERE id IN (%s)', - implode(',', array_keys($templates)) - ); - - $templates_raw = db_get_all_rows_sql($sql); - } - - if (empty($templates_raw)) { - $templates_raw = []; - } - - $alerts = []; - $ntemplates = 0; - if ($hor_offset > 0) { - $new_hor_offset = ($hor_offset - $block); - echo "'; - } - - foreach ($templates_raw as $temp) { - if (isset($templates[$temp['id']]) && $templates[$temp['id']] == '') { - $ntemplates++; - if ($ntemplates <= $hor_offset || $ntemplates > ($hor_offset + $block)) { - continue; - } - - $templates[$temp['id']] = $temp['name']; - - if (empty($temp['name']) === false) { - $outputLine = html_print_div( - [ - 'id' => 'line_header_'.$temp['id'], - 'class' => 'rotate_text_module', - 'content' => ''.ui_print_truncate_text(io_safe_output($temp['name']), 20).'', - ], - true - ); - - echo sprintf('', $outputLine); - } - } - } - - if (($hor_offset + $block) < $ntemplates) { - $new_hor_offset = ($hor_offset + $block); - echo "'; - } - - echo ''; - - foreach ($agents as $agent) { - $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); - echo ''; - // Name of the agent. - echo ''; - - // Alerts of the agent. - $anyfired = false; - foreach ($templates as $tid => $tname) { - if ($tname == '') { - continue; - } - - echo ''; - } - - echo ''; - } - - echo '
'.__('Agents').' / '.__('Alerts').' - ".html_print_image('images/arrow_left_green.png', true, ['style' => 'float: right;', 'title' => __('Previous templates')]).' %s"; - echo "".html_print_image('images/arrow_right_green.png', true, ['style' => 'float: right;', 'title' => __('More templates')]).''; - echo '
'.$alias['alias'].''; - - if (isset($agent_alerts[$agent['nombre']][$tid])) { - foreach ($agent_alerts[$agent['nombre']][$tid] as $alert) { - if ($alert['times_fired'] > 0) { - $anyfired = true; - } - } - - $cellstyle = ''; - if ($anyfired) { - $cellstyle = 'background:'.COL_ALERTFIRED.';'; - } else { - $cellstyle = 'background:'.COL_NORMAL.';'; - } - - $uniqid = uniqid(); - - $row = ''; - - $row .= html_print_div( - [ - 'id' => 'line_header_'.$temp['id'], - 'class' => 'status_rounded_rectangles text_inside', - 'style' => $cellstyle, - 'content' => count($agent_alerts[$agent['nombre']][$tid]), - ], - true - ); - - $row .= ''; - - echo $row; - - $this->printAlertsSummaryModalWindow($uniqid, $agent_alerts[$agent['nombre']][$tid]); - } - - echo '
'; - // echo ''; - ui_pagination( - $nagents, - false, - 0, - 0, - false, - 'offset', - true, - 'pagination-bottom', - '', - [ - 'count' => '', - 'offset' => 'offset_param', - ], - 'alerts_agents' - ); - } - - // return $header; - } @@ -883,181 +1008,7 @@ class AgentsAlerts extends HTML */ public function loadTable() { - // $hor_offset - // $block - // $nagents - // $modules_by_name - // $group_id - // $agents - // $total_pagination - // - echo ''; - echo ''; - - echo "'; - - if ($hor_offset > 0) { - $new_hor_offset = ($hor_offset - $block); - echo "'; - } - - $nmodules = 0; - foreach ($modules_by_name as $module) { - $nmodules++; - - if ($nmodules <= $hor_offset || $nmodules > ($hor_offset + $block)) { - continue; - } - - $text = ui_print_truncate_text(io_safe_output($module['name']), 'module_small'); - - echo ''; - } - - if (($hor_offset + $block) < $nmodules) { - $new_hor_offset = ($hor_offset + $block); - echo "'; - } - - echo ''; - - $filter_agents = [ - 'offset' => (int) $offset, - 'disabled' => 0, - ]; - if ($group_id > 0) { - $filter_agents['id_grupo'] = $group_id; - } - - // Prepare pagination. - $url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m; - ui_pagination($total_pagination, $url); - - foreach ($agents as $agent) { - // Get stats for this group. - $agent_status = agents_get_status($agent['id_agente']); - $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); - if (empty($alias['alias'])) { - $alias['alias'] = $agent['nombre']; - } - - switch ($agent_status) { - case 4: - // Alert fired status. - $rowcolor = 'group_view_alrm'; - break; - - case 1: - // Critical status. - $rowcolor = 'group_view_crit'; - break; - - case 2: - // Warning status. - $rowcolor = 'group_view_warn'; - break; - - case 0: - // Normal status. - $rowcolor = 'group_view_ok'; - break; - - case 3: - case -1: - default: - // Unknown status. - $rowcolor = 'group_view_unk'; - break; - } - - echo ""; - - echo "'; - // TODO TAGS agents_get_modules. - $agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true); - - $nmodules = 0; - foreach ($modules_by_name as $module) { - $nmodules++; - - if ($nmodules <= $hor_offset || $nmodules > ($hor_offset + $block)) { - continue; - } - - $match = false; - - foreach ($module['id'] as $module_id) { - if (!$match && array_key_exists($module_id, $agent_modules)) { - $status = modules_get_agentmodule_status($module_id); - echo "'; - $match = true; - } - } - - if (!$match) { - echo ''; - } - } - - echo ''; - } - - echo '
".__('Agents').' / '.__('Alerts').'".html_print_image( - 'images/arrow_left_green.png', - true, - ['title' => __('Previous modules')] - ).' -
- -
-
".html_print_image( - 'images/arrow_right_green.png', - true, - ['title' => __('More modules')] - ).'
- ".$alias['alias'].'"; - $win_handle = dechex(crc32($module_id.$module['name'])); - $graph_type = return_graphtype(modules_get_agentmodule_type($module_id)); - $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."', 800, 480)"; - - echo ''; - - $module_last_value = modules_get_last_value($module_id); - if (!is_numeric($module_last_value)) { - $module_last_value = htmlspecialchars($module_last_value); - } - - switch ($status) { - case AGENT_MODULE_STATUS_NORMAL: - ui_print_status_image('module_ok.png', $module_last_value, false); - break; - - case AGENT_MODULE_STATUS_CRITICAL_BAD: - ui_print_status_image('module_critical.png', $module_last_value, false); - break; - - case AGENT_MODULE_STATUS_WARNING: - ui_print_status_image('module_warning.png', $module_last_value, false); - break; - - case AGENT_MODULE_STATUS_UNKNOWN: - ui_print_status_image('module_unknown.png', $module_last_value, false); - break; - - case AGENT_MODULE_STATUS_NORMAL_ALERT: - case AGENT_MODULE_STATUS_WARNING_ALERT: - case AGENT_MODULE_STATUS_CRITICAL_ALERT: - ui_print_status_image('module_alertsfired.png', $module_last_value, false); - break; - - case 4: - ui_print_status_image('module_no_data.png', $module_last_value, false); - break; - } - - echo ''; - echo '
'; } @@ -1074,6 +1025,12 @@ class AgentsAlerts extends HTML Date: Tue, 10 Nov 2020 16:51:28 +0100 Subject: [PATCH 158/230] Fix error with category --- pandora_console/extensions/agents_alerts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/extensions/agents_alerts.php b/pandora_console/extensions/agents_alerts.php index 8d05430ef5..53ebe3d2e2 100755 --- a/pandora_console/extensions/agents_alerts.php +++ b/pandora_console/extensions/agents_alerts.php @@ -2,7 +2,7 @@ /** * Agents/Alerts Monitoring view. * - * @category Agent Wizard + * @category Operations * @package Pandora FMS * @subpackage Opensource * @version 1.0.0 From b8fde5e8f5dc6f0117d43c254bcc8b5298e438c9 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 10 Nov 2020 17:56:56 +0100 Subject: [PATCH 159/230] Tools (trim) added --- pandora_server/lib/PandoraFMS/Tools.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 300e66e5a6..4c9683c888 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -856,6 +856,24 @@ sub clean_blank { return $input; } +################################################################################ +# Erase blank spaces before and after the string +################################################################################ +sub trim { + my $string = shift; + if (is_empty($string)){ + return ""; + } + + $string =~ s/\r//g; + + chomp($string); + $string =~ s/^\s+//g; + $string =~ s/\s+$//g; + + return $string; +} + ################################################################################ # sub sqlWrap(texto) # Elimina comillas y caracteres problematicos y los sustituye por equivalentes From 7ea84a438487e7cbc8f4794c69b48381452b7abd Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 10 Nov 2020 19:24:08 +0100 Subject: [PATCH 160/230] added tentacle common dir, TODO clean copies, group in CICD tasks --- tentacle/tentacle_client | 1101 ++++++++++++++++++++++ tentacle/tentacle_server | 1884 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 2985 insertions(+) create mode 100755 tentacle/tentacle_client create mode 100755 tentacle/tentacle_server diff --git a/tentacle/tentacle_client b/tentacle/tentacle_client new file mode 100755 index 0000000000..913beda931 --- /dev/null +++ b/tentacle/tentacle_client @@ -0,0 +1,1101 @@ +#!/usr/bin/perl +################################################################################ +# +# Copyright (c) 2007-2008 Ramon Novoa +# Copyright (c) 2007-2008 Artica Soluciones Tecnologicas S.L. +# +# tentacle_client.pl Tentacle Client. See https://pandorafms.com/docs/ for +# protocol description. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +################################################################################ + +package tentacle::client; + +=head1 NAME + +tentacle_client - Tentacle Client + +=head1 VERSION + +Version 0.4.0 + +=head1 USAGE + +tentacle_client [options] [file] [file] ... + +=head1 DESCRIPTION + +B is a client for B, a B file transfer protocol that aims to be: + +=over + +=item * Secure by design. + +=item * Easy to use. + +=item * Versatile and cross-platform. + +=back + +Tentacle was created to replace more complex tools like SCP and FTP for simple file transfer/retrieval, and switch from authentication mechanisms like .netrc, interactive logins and SSH keys to X.509 certificates. Simple password authentication over a SSL secured connection is supported too. + +The client and server (B) are designed to be run from the command line or called from a shell script, and B. + +If IO::Socket::INET6 is installed, the tentacle client supports IPv6. + +=cut + +use strict; +use File::Basename; +use Getopt::Std; +use IO::Select; +my $zlib_available = 1; + +eval { + eval "use IO::Compress::Zip qw(zip);1" or die($@); + eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@); +}; +if ($@) { + print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip)."); + $zlib_available = 0; +} + +use Socket (qw(SOCK_STREAM AF_INET AF_INET6)); +my $SOCKET_MODULE = + eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' + : eval { require IO::Socket::INET } ? 'IO::Socket::INET' + : die $@; + +if ($SOCKET_MODULE eq 'IO::Socket::INET') { + print_log ("IO::Socket::INET6 is not found. IPv6 is disabled."); +} + +# Program version +our $VERSION = '0.4.0'; + +# Server address +my $t_address = '127.0.0.1'; + +# Block size for socket read/write operations in bytes +my $t_block_size = 1024; + +# Log messages, 1 enabled, 0 disabled +my $t_log = 0; + +# Server port +my $t_port = 41121; + +# Do not output error messages, 1 enabled, 0 disabled +my $t_quiet = 0; + +# Proxy address +my $t_proxy_address = ''; + +# Proxy user +my $t_proxy_user = ''; + +# Proxy password +my $t_proxy_pass = ''; + +# Proxy port +my $t_proxy_port = 0; + +# Server password +my $t_pwd = ''; + +# Receive mode, 1 enabled, 0 disabled +my $t_recv = 0; + +# Retries for socket read/write operations +my $t_retries = 3; + +# Select handler +my $t_select; + +# Server socket +my $t_socket; + +# Use SSL, 1 true, 0 false +my $t_ssl = 0; + +# SSL ca certificate file +my $t_ssl_ca = ''; + +# SSL certificate file +my $t_ssl_cert = ''; + +# SSL private key file +my $t_ssl_key = ''; + +# SSL private key file password +my $t_ssl_pwd = ''; + +# Timeout for socket read/write operations in seconds +my $t_timeout = 1; + +# bind ipaddr +my $t_bind_address = undef; + +# Compress data before sending it through the socket. +my $t_zip = 0; + +################################################################################ +## SUB print_help +## Print help screen. +################################################################################ +sub print_help { + + print ("Usage: $0 [options] [file] [file] ...\n\n"); + print ("Tentacle client v$VERSION. See https://pandorafms.com/docs/ for protocol description.\n\n"); + print ("Options:\n"); + print ("\t-a address\tServer address (default $t_address).\n"); + print ("\t-b localaddress\tLocal address to bind.\n"); + print ("\t-c\t\tEnable SSL without a client certificate.\n"); + print ("\t-e cert\t\tOpenSSL certificate file. Enables SSL.\n"); + print ("\t-f ca\t\tVerify that the peer certificate is signed by a ca.\n"); + print ("\t-g\t\tGet files from the server.\n"); + print ("\t-h\t\tShow help.\n"); + print ("\t-k key\t\tOpenSSL private key file.\n"); + print ("\t-p port\t\tServer port (default $t_port).\n"); + print ("\t-q\t\tQuiet. Do now print error messages.\n"); + print ("\t-r number\tNumber of retries for network operations (default $t_retries).\n"); + print ("\t-t time\t\tTime-out for network operations in seconds (default ${t_timeout}s).\n"); + print ("\t-v\t\tBe verbose.\n"); + print ("\t-w\t\tPrompt for OpenSSL private key password.\n"); + print ("\t-x pwd\t\tServer password.\n"); + print ("\t-y proxy\tProxy server string (user:password\@address:port).\n"); + print ("\t-z Compress data.\n\n"); +} + +################################################################################ +## SUB parse_options +## Parse command line options and initialize global variables. +################################################################################ +sub parse_options { + my %opts; + my $tmp; + + # Get options + if (getopts ('a:b:ce:f:ghk:p:qr:t:vwx:y:z', \%opts) == 0 || defined ($opts{'h'})) { + print_help (); + exit 1; + } + + # Address + if (defined ($opts{'a'})) { + $t_address = $opts{'a'}; + if (($t_address !~ /^[a-zA-Z\.][a-zA-Z0-9\.\-]+$/ && ($t_address !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ + || $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255 + || $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255)) && + ($t_address !~ /^[0-9a-f:]+$/o)) { + error ("Address $t_address is not valid."); + } + + } + + # Bind local address + if (defined ($opts{'b'})) { + $t_bind_address = $opts{'b'}; + if (($t_bind_address !~ /^[a-zA-Z\.][a-zA-Z0-9\.\-]+$/ && ($t_bind_address !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ + || $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255 + || $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255)) && + ($t_address !~ /^[0-9a-f:]+$/o)) { + error ("Local address $t_bind_address is not valid."); + } + + } + + # Enable SSL without a client certificate + if (defined ($opts{'c'})) { + require IO::Socket::SSL; + $t_ssl = 1; + } + + # Enable SSL + if (defined ($opts{'e'})) { + + if (defined ($opts{'c'})) { + error ("Flags -c and -e can not be used at the same time."); + } + + require IO::Socket::SSL; + + $t_ssl_cert = $opts{'e'}; + if (! -f $t_ssl_cert) { + error ("File $t_ssl_cert does not exist."); + } + + $t_ssl = 1; + } + + # Verify peer certificate + if (defined ($opts{'f'})) { + + if (! defined ($opts{'e'})) { + error ("Flag -e must be set to enable peer certificate verify."); + } + + $t_ssl_ca = $opts{'f'}; + if (! -f $t_ssl_ca) { + error ("File $t_ssl_ca does not exist."); + } + } + + # Get files + if (defined ($opts{'g'})) { + $t_recv = 1; + } + + # SSL private key file + if (defined ($opts{'k'})) { + + if (! defined ($opts{'e'})) { + error ("Flag -e must be set to use a private key file."); + } + + $t_ssl_key = $opts{'k'}; + if (! -f $t_ssl_key) { + error ("File $t_ssl_key does not exist."); + } + } + + # Port + if (defined ($opts{'p'})) { + $t_port = $opts{'p'}; + if ($t_port !~ /^\d+$/ || $t_port < 1 || $t_port > 65535) { + error ("Port $t_port is not valid."); + } + } + + # Quiet mode + if (defined ($opts{'q'})) { + $t_quiet = 1; + } + + # Retries + if (defined ($opts{'r'})) { + $t_retries = $opts{'r'}; + if ($t_retries !~ /^\d+$/ || $t_retries < 1) { + error ("Invalid number of retries for network operations."); + } + } + + # Timeout + if (defined ($opts{'t'})) { + $t_timeout = $opts{'t'}; + if ($t_timeout !~ /^\d+$/ || $t_timeout < 1) { + error ("Invalid timeout for network operations."); + } + } + + # Be verbose + if (defined ($opts{'v'})) { + $t_log = 1; + } + + # SSL private key password + if (defined ($opts{'w'})) { + + if (! defined ($opts{'e'})) { + error ("Flag -k must be set to provide a private key password."); + } + + $t_ssl_pwd = ask_passwd ("Enter private key file password: ", "Enter private key file password again for confirmation: "); + } + + # Server password + if (defined ($opts{'x'})) { + $t_pwd = $opts{'x'}; + } + + # Proxy server + if (defined ($opts{'y'})) { + if ($opts{'y'} !~ /^((.*):(.*)@){0,1}(\S+):(\d+)$/) { + error ("Invalid proxy string: " . $opts{'y'}); + } + + ($t_proxy_user, $t_proxy_pass, $t_proxy_address, $t_proxy_port) = ($2, $3, $4, $5); + $t_proxy_user = '' unless defined ($t_proxy_user); + $t_proxy_pass = '' unless defined ($t_proxy_pass); + if ($t_proxy_port < 1 || $t_proxy_port > 65535) { + error ("Proxy port $t_proxy_port is not valid."); + } + } + + # Compress data + if (defined ($opts{'z'})) { + if ($zlib_available == 1) { + $t_zip = 1; + } + } +} + +################################################################################ +## SUB start_client +## Open the server socket. +################################################################################ +sub start_client { + + # Connect to server + if ($SOCKET_MODULE ne 'IO::Socket::INET') { + if (defined ($t_bind_address)) { + $t_socket = $SOCKET_MODULE->new ( + Domain => AF_INET6, + PeerAddr => $t_address, + PeerPort => $t_port, + LocalAddr => $t_bind_address, + Type => SOCK_STREAM + ); + } + else { + $t_socket = $SOCKET_MODULE->new ( + Domain => AF_INET6, + PeerAddr => $t_address, + PeerPort => $t_port, + Type => SOCK_STREAM + ); + } + } + if (! defined ($t_socket)) { + if (defined ($t_bind_address)) { + $t_socket = $SOCKET_MODULE->new ( + Domain => AF_INET, + PeerAddr => $t_address, + PeerPort => $t_port, + LocalAddr => $t_bind_address, + Type => SOCK_STREAM + ); + } + else { + $t_socket = $SOCKET_MODULE->new ( + Domain => AF_INET, + PeerAddr => $t_address, + PeerPort => $t_port, + Type => SOCK_STREAM + ); + } + } + + if (! defined ($t_socket)) { + error ("Cannot connect to $t_address on port $t_port: $!."); + } + + # Add server socket to select queue + $t_select = IO::Select->new (); + $t_select->add ($t_socket); + + print_log ("Connected to $t_address port $t_port"); +} + +################################################################################ +## SUB start_client_proxy +## Open the server socket. Connects to the Tentacle server through an HTTP proxy. +################################################################################ +sub start_client_proxy { + + # Connect to proxy + if ($SOCKET_MODULE ne 'IO::Socket::INET') { + if (defined ($t_bind_address)) { + $t_socket = $SOCKET_MODULE->new ( + Domain => AF_INET6, + PeerAddr => $t_proxy_address, + PeerPort => $t_proxy_port, + LocalAddr => $t_bind_address, + ); + } + else { + $t_socket = $SOCKET_MODULE->new ( + Domain => AF_INET6, + PeerAddr => $t_proxy_address, + PeerPort => $t_proxy_port, + ); + } + } + if (! defined ($t_socket)) { + if (defined ($t_bind_address)) { + $t_socket = $SOCKET_MODULE->new ( + Domain => AF_INET, + PeerAddr => $t_proxy_address, + PeerPort => $t_proxy_port, + LocalAddr => $t_bind_address, + ); + } + else { + $t_socket = $SOCKET_MODULE->new ( + Domain => AF_INET, + PeerAddr => $t_proxy_address, + PeerPort => $t_proxy_port, + ); + } + } + + if (! defined ($t_socket)) { + error ("Cannot connect to proxy server $t_proxy_address on port $t_proxy_port: $!."); + } + + # Add server socket to select queue + $t_select = IO::Select->new (); + $t_select->add ($t_socket); + + print_log ("Connected to proxy server $t_proxy_address port $t_proxy_port"); + + # Try to CONNECT to the Tentacle server + send_data ("CONNECT " . $t_address . ":" . $t_port . " HTTP/1.0\r\n"); + + # Authenticate to the proxy + if ($t_proxy_user ne '') { + send_data ("Proxy-Authorization: Basic " . base64 ($t_proxy_user . ":" . $t_proxy_pass) . "\r\n"); + } + + send_data ("\r\n"); + + # Check for an HTTP 200 response + my $response = recv_data ($t_block_size); + if ($response !~ m/HTTP.* 200 /) { + my $error = (split (/\r\n/, $response))[0]; + error ("CONNECT error: $error"); + } + + print_log ("Connected to $t_address port $t_port"); +} + +################################################################################ +## SUB stop_client +## Close the server socket. +################################################################################ +sub stop_client { + + $t_socket->shutdown(2); + $t_socket->close (); +} + +################################################################################ +## SUB start_ssl +## Convert the server socket to an IO::Socket::SSL socket. +################################################################################ +sub start_ssl { + my $err; + + if ($t_ssl_cert eq ''){ + IO::Socket::SSL->start_SSL ( + $t_socket, + # No authentication + SSL_verify_mode => 0x00, + ); + } + elsif ($t_ssl_ca eq '') { + IO::Socket::SSL->start_SSL ( + $t_socket, + SSL_cert_file => $t_ssl_cert, + SSL_key_file => $t_ssl_key, + SSL_passwd_cb => sub {return $t_ssl_pwd}, + SSL_use_cert =>'1', + # No authentication + SSL_verify_mode => 0x00, + ); + } + else { + IO::Socket::SSL->start_SSL ( + $t_socket, + SSL_ca_file => $t_ssl_ca, + SSL_cert_file => $t_ssl_cert, + SSL_key_file => $t_ssl_key, + SSL_passwd_cb => sub {return $t_ssl_pwd}, + SSL_use_cert =>'1', + # Verify peer + SSL_verify_mode => 0x01, + ); + } + + $err = IO::Socket::SSL::errstr (); + if ($err ne '') { + error ($err); + } +} + +################################################################################ +## SUB auth_pwd +## Authenticate client with server password. +################################################################################ +sub auth_pwd { + my $command; + my $pwd_digest; + + require Digest::MD5; + + $pwd_digest = Digest::MD5::md5 ($t_pwd); + $pwd_digest = Digest::MD5::md5_hex ($pwd_digest); + + send_data ("PASS $pwd_digest\n"); + + $command = recv_command ($t_block_size); + if ($command !~ /^PASS OK$/) { + error ("Authentication failed."); + } +} + +################################################################################ +## SUB base64 +## Returns the base 64 encoding of a string. +################################################################################ +my @alphabet = ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'); +sub base64 { + my $str = shift; + my $str64; + + # Pre-processing + my $msg = unpack ("B*", pack ("A*", $str)); + my $bit_len = length ($msg); + + # Process the message in successive 24-bit chunks + for (my $i = 0; $i < $bit_len; $i += 24) { + my $chunk_len = length (substr ($msg, $i, 24)); + $str64 .= $alphabet[ord (pack ("B8", "00" . substr ($msg, $i, 6)))]; + $str64 .= $alphabet[ord (pack ("B8", "00" . substr ($msg, $i+6, 6)))]; + $str64 .= ($chunk_len <= 12) ? "=" : $alphabet[ord (pack ("B8", "00" . substr ($msg, $i+12, 6)))]; + $str64 .= ($chunk_len <= 18) ? "=" : $alphabet[ord (pack ("B8", "00" . substr ($msg, $i+18, 6)))]; + } + + return $str64; +} + + +################################################################################ +## SUB recv_file +## Receive a file from the server +################################################################################ +sub recv_file { + my $data = ''; + my $file = $_[0]; + my $response; + my $size; + + # Request file + send_data ("RECV <$file>\n"); + + # Wait for server response + $response = recv_command (); + if ($response !~ /^RECV SIZE (\d+)$/) { + error ("Server responded $response."); + } + + $size = $1; + send_data ("RECV OK\n"); + + # Receive file + $data = recv_data_block ($size); + + # Write it to disk + open (FILE, "> $file") || error ("Cannot open file '$file' for writing."); + binmode (FILE); + print (FILE $data); + close (FILE); + + print_log ("Received file '$file'"); +} + +################################################################################ +## SUB zrecv_file +## Receive a compressed file from the server +################################################################################ +sub zrecv_file { + my $data = ''; + my $file = $_[0]; + my $response; + my $size; + my $zdata = ''; + + # Request file + send_data ("ZRECV <$file>\n"); + + # Wait for server response + $response = recv_command (); + if ($response !~ /^ZRECV SIZE (\d+)$/) { + error ("Server responded $response."); + } + + $size = $1; + send_data ("ZRECV OK\n"); + + # Receive file + $zdata = recv_data_block ($size); + if (!unzip(\$zdata => \$data)) { + print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError"); + send_data ("ZRECV ERR\n"); + return; + } + + # Write it to disk + open (FILE, "> $file") || error ("Cannot open file '$file' for writing."); + binmode (FILE); + print (FILE $data); + close (FILE); + + print_log ("Received compressed file '$file'"); +} + +################################################################################ +## SUB send_file +## Send a file to the server +################################################################################ +sub send_file { + my $base_name; + my $data = ''; + my $response = ''; + my $retries; + my $file = $_[0]; + my $size; + my $written; + + $base_name = basename ($file); + $size = -s $file; + + # Request to send file + send_data ("SEND <$base_name> SIZE $size\n"); + + print_log ("Request to send file '$base_name' size ${size}b"); + + # Wait for server response + $response = recv_command (); + + # Server rejected the file + if ($response ne "SEND OK") { + send_data ("QUIT\n"); + error ("Server responded $response."); + } + + print_log ("Server responded SEND OK"); + + # Send the file + open (FILE, $file) || error ("Cannot open file '$file' for reading."); + binmode (FILE); + { + local $/ = undef; + $data = ; + } + send_data ($data); + + close (FILE); + + # Wait for server response + $response = recv_command (); + if ($response ne "SEND OK") { + send_data ("QUIT\n"); + error ("Server responded $response."); + } + + print_log ("File sent"); +} + +################################################################################ +## SUB zsend_file +## Send a file to the server (compressed) +################################################################################ +sub zsend_file { + my $base_name; + my $data = ''; + my $response = ''; + my $retries; + my $file = $_[0]; + my $size; + my $written; + + # Read the file and compress its contents + if (! zip($file => \$data)) { + send_data ("QUIT\n"); + error ("Compression error: $IO::Compress::Zip::ZipError"); + return; + } + + $size = length($data); + $base_name = basename ($file); + + # Request to send file + send_data ("ZSEND <$base_name> SIZE $size\n"); + print_log ("Request to send file '$base_name' size ${size}b (compressed)"); + + # Wait for server response + $response = recv_command (); + + # Server rejected the file + if ($response ne "ZSEND OK") { + send_data ("QUIT\n"); + error ("Server responded $response."); + } + + print_log ("Server responded ZSEND OK"); + send_data ($data); + + # Wait for server response + $response = recv_command (); + if ($response ne "ZSEND OK") { + send_data ("QUIT\n"); + error ("Server responded $response."); + } + + print_log ("File sent"); +} + +################################################################################ +# Common functions +################################################################################ + +################################################################################ +## SUB print_log +## Print log messages. +################################################################################ +sub print_log { + + if ($t_log == 1) { + print (STDOUT "[log] $_[0]\n"); + } +} + +################################################################################ +## SUB error +## Print an error and exit the program. +################################################################################ +sub error { + + if ($t_quiet == 0) { + print (STDERR "[err] $_[0]\n"); + } + + exit 1; +} + +################################################################################ +## SUB recv_data +## Read data from the client socket. Returns the number of bytes read and the +## string of bytes as a two element array. +################################################################################ +sub recv_data { + my $data; + my $read; + my $retries = 0; + my $size = $_[0]; + + while (1) { + + # Try to read data from the socket + if ($t_select->can_read ($t_timeout)) { + + # Read at most $size bytes + $read = sysread ($t_socket, $data, $size); + + # Read error + if (! defined ($read)) { + error ("Read error from " . $t_socket->sockhost () . ": $!."); + } + + # EOF + if ($read == 0) { + error ("Connection from " . $t_socket->sockhost () . " unexpectedly closed."); + } + + return ($read, $data); + } + + # Retry + $retries++; + + # But check for error conditions first + if ($retries > $t_retries) { + error ("Connection from " . $t_socket->sockhost () . " timed out."); + } + } +} + +################################################################################ +## SUB send_data +## Write data to the client socket. +################################################################################ +sub send_data { + my $data = $_[0]; + my $block_size; + my $retries = 0; + my $size; + my $total = 0; + my $written; + + $size = length ($data); + + while (1) { + + # Try to write data to the socket + if ($t_select->can_write ($t_timeout)) { + + $block_size = ($size - $total) > $t_block_size ? $t_block_size : ($size - $total); + $written = syswrite ($t_socket, $data, $block_size, $total); + + # Read error + if (! defined ($written)) { + error ("Connection error from " . $t_socket->sockhost () . ": $!."); + } + + # EOF + if ($written == 0) { + error ("Connection from " . $t_socket->sockhost () . " unexpectedly closed."); + } + + $total += $written; + + # All data was written + if ($total == $size) { + return; + } + # Retry + } else { + $retries++; + if ($retries > $t_retries) { + error ("Connection from " . $t_socket->sockhost () . " timed out."); + } + } + } +} + +################################################################################ +## SUB recv_command +## Read a command from the client, ended by a new line character. +################################################################################ +sub recv_command { + my $buffer; + my $char; + my $command = ''; + my $read; + my $total = 0; + + while (1) { + + ($read, $buffer) = recv_data ($t_block_size); + $command .= $buffer; + $total += $read; + + # Check if the command is complete + $char = chop ($command); + if ($char eq "\n") { + return $command; + } + + $command .= $char; + + # Avoid overflow + if ($total > $t_block_size) { + error ("Received too much data from " . $t_socket->sockhost ()); + } + } +} + +################################################################################ +## SUB recv_data_block +## Read $_[0] bytes of data from the client. +################################################################################ +sub recv_data_block { + my $buffer = ''; + my $data = ''; + my $read; + my $size = $_[0]; + my $total = 0; + + while (1) { + + ($read, $buffer) = recv_data ($size - $total); + $data .= $buffer; + $total += $read; + + # Check if all data has been read + if ($total == $size) { + return $data; + } + } +} + +################################################################################ +## SUB ask_passwd +## Asks the user for a password. +################################################################################ +sub ask_passwd { + my $msg1 = $_[0]; + my $msg2 = $_[1]; + my $pwd1; + my $pwd2; + + require Term::ReadKey; + + # Disable keyboard echo + Term::ReadKey::ReadMode('noecho'); + + # Promt for password + print ($msg1); + $pwd1 = Term::ReadKey::ReadLine(0); + print ("\n$msg2"); + $pwd2 = Term::ReadKey::ReadLine(0); + print ("\n"); + + # Restore original settings + Term::ReadKey::ReadMode('restore'); + + if ($pwd1 ne $pwd2) { + # Call print to bypass quiet mode. + print ("[err] Passwords do not match.\n"); + exit 1; + } + + # Remove the trailing new line character + chop $pwd1; + + return $pwd1; +} + +################################################################################ +# Main +################################################################################ + +my $file; + +# Parse command line options +parse_options (); + +# Check command line arguments +if ($t_recv == 0 && $#ARGV == -1) { + error ("No files to send."); +} + +# Connect to the server +if ($t_proxy_address eq '') { + start_client (); +} else { + start_client_proxy (); +} + +# Start SSL +if ($t_ssl == 1) { + start_ssl (); +} + +# Authenticate with server +if ($t_pwd ne '') { + auth_pwd (); +} + +if ($t_recv == 0) { + # Check that all files exist before trying to send them + foreach $file (@ARGV) { + if (! -f $file) { + error ("File '$file' does not exist."); + } + } + + # Send the files + foreach $file (@ARGV) { + if ($t_zip == 1) { + zsend_file($file); + } else { + send_file ($file); + } + } +} +else { + # Receive the files + foreach $file (@ARGV) { + if ($t_zip == 1) { + zrecv_file ($file); + } else { + recv_file ($file); + } + } +} + +# Tell the server that we are finished +send_data ("QUIT\n"); + +stop_client (); + +exit 0; + + +__END__ + +=head1 OPTIONS + +=over + +=item I<-a address> B (default 127.0.0.1). + +=item I<-c> Enable B without a client certificate. + +=item I<-e cert> B file. Enables SSL. + +=item I<-f ca> Verify that the peer certificate is signed by a B (Certificate Authority). + +=item I<-g> B files from the server. + +=item I<-h> Show B. + +=item I<-k key> B file. + +=item I<-p port> B (default I<41121>). + +=item I<-q> B. Do now print error messages. + +=item I<-r number> B for network operations (default I<3>). + +=item I<-t time> B for network operations in seconds (default I<1s>). + +=item I<-v> Be B. + +=item I<-w> Prompt for B. + +=item I<-x pwd> B. + +=item I<-z> Compress data. + +=back + +=head1 EXIT STATUS + +=over + +=item 0 on Success + +=item 1 on Error + +=back + +=head1 CONFIGURATION + +Tentacle doesn't use any configurationf files, all the configuration is done by the options passed when it's started. + +=head1 DEPENDENCIES + +L, L, L, L + +=head1 LICENSE + +This is released under the GNU Lesser General Public License. + +=head1 SEE ALSO + +L, L, L, L + +Protocol description and more info at: L<< https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Tentacle >> + +=head1 COPYRIGHT + +Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L + +=cut + diff --git a/tentacle/tentacle_server b/tentacle/tentacle_server new file mode 100755 index 0000000000..feb8ecf9af --- /dev/null +++ b/tentacle/tentacle_server @@ -0,0 +1,1884 @@ +#!/usr/bin/perl +########################################################################## +# Tentacle Server +# See https://pandorafms.com/docs/ for protocol description. +# Tentacle have IANA assigned port tpc/41121 as official port. +########################################################################## +# Copyright (c) 2007-2008 Ramon Novoa +# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L +# +# tentacle_server.pl Tentacle Server. See https://pandorafms.com/docs/ for +# protocol description. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +########################################################################## + +package tentacle::server; +=head1 NAME + +tentacle_server - Tentacle Server + +=head1 VERSION + +Version 0.6.1 + +=head1 USAGE + +tentacle_server B<< -s F >> [I] + +=head1 DESCRIPTION + +B is a server for B, a B file transfer protocol that aims to be: + +=over + +=item * Secure by design. + +=item * Easy to use. + +=item * Versatile and cross-platform. + +=back + +Tentacle was created to replace more complex tools like SCP and FTP for simple file transfer/retrieval, and switch from authentication mechanisms like .netrc, interactive logins and SSH keys to X.509 certificates. Simple password authentication over a SSL secured connection is supported too. + +The client and server (B) are designed to be run from the command line or called from a shell script, and B. + +=cut + +use strict; +use warnings; +use Getopt::Std; +use IO::Select; +use IO::Compress::Zip qw(zip $ZipError); +use IO::Uncompress::Unzip qw(unzip $UnzipError); +use threads; +use Thread::Semaphore; +use POSIX ":sys_wait_h"; +use Time::HiRes qw(usleep); +use Scalar::Util qw(refaddr); +use POSIX qw(strftime); + +# Constants for Win32 services. +use constant WIN32_SERVICE_STOPPED => 0x01; +use constant WIN32_SERVICE_RUNNING => 0x04; + +my $t_libwrap_installed = eval { require Authen::Libwrap } ? 1 : 0; + +if ($t_libwrap_installed) { + Authen::Libwrap->import( qw( hosts_ctl STRING_UNKNOWN ) ); +} + +# Log errors, 1 enabled, 0 disabled +my $t_log = 0; + +# Log information, 1 enabled, 0 enabled +my $t_log_hard = 0; + +my $SOCKET_MODULE; +if ($^O eq 'MSWin32') { + # Only support INET on windows + require IO::Socket::INET; + $SOCKET_MODULE = 'IO::Socket::INET'; +} else { + $SOCKET_MODULE = + eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' + : eval { require IO::Socket::INET } ? 'IO::Socket::INET' + : die $@; +} + +# Service name for Win32. +my $SERVICE_NAME="Tentacle Server"; + +# Service parameters. +my $SERVICE_PARAMS=join(' ', @ARGV); + +# Program version +our $VERSION = '0.6.2'; + +# IPv4 address to listen on +my @t_addresses = ('0', '0.0.0.0'); + +# Block size for socket read/write operations in bytes +my $t_block_size = 1024; + +# Client socket +my $t_client_socket; + +# Run as daemon, 1 true, 0 false +my $t_daemon = 0; + +# Storage directory +my $t_directory = ''; + +# Filters +my @t_filters; + +# Enable (1) or disable (0) insecure mode +my $t_insecure = 0; + +# String containing quoted invalid file name characters +my $t_invalid_chars = '\?\[\]\/\\\=\+\<\>\:\;\'\,\*\~'; + +# Maximum number of simultaneous connections +my $t_max_conn = 10; + +# Maximum file size allowed by the server in bytes +my $t_max_size = 2000000; + +# File overwrite, 1 enabled, 0 disabled +my $t_overwrite = 0; + +# Port to listen on +my $t_port = 41121; + +# Server password +my $t_pwd = ''; + +# Do not output error messages, 1 enabled, 0 disabled +my $t_quiet = 0; + +# Number of retries for socket read/write operations +my $t_retries = 3; + +# Select handler +my $t_select; + +# Semaphore +my $t_sem :shared; + +# Server socket +my @t_server_sockets; + +# Server select handler +my $t_server_select; + +# Use SSL, 1 true, 0 false +my $t_ssl = 0; + +# SSL ca certificate file +my $t_ssl_ca = ''; + +# SSL certificate file +my $t_ssl_cert = ''; + +# SSL private key file +my $t_ssl_key = ''; + +# SSL private key password +my $t_ssl_pwd = ''; + +# Timeout for socket read/write operations in seconds +my $t_timeout = 1; + +# Address to proxy client requests to +my $t_proxy_ip = undef; + +# Port to proxy client requests to +my $t_proxy_port = 41121; + +# Proxy socket +my $t_proxy_socket; + +# Proxy selected handler +my $t_proxy_select; + +# Use libwrap, 1 true, 0 false +my $t_use_libwrap = 0; + +# Program name for libwrap +my $t_program_name = $0; +$t_program_name =~ s/.*\///g; + +# Log file +my $log_file = undef; + +################################################################################ +## SUB print_help +## Print help screen. +################################################################################ +sub print_help { + $" = ','; + + print ("Usage: $0 -s [options]\n\n"); + print ("Tentacle server v$VERSION. See https://pandorafms.com/docs/ for protocol description.\n\n"); + print ("Options:\n"); + print ("\t-a ip_addresses\tIP addresses to listen on (default @t_addresses).\n"); + print ("\t \t(Multiple addresses separated by comma can be defined.)\n"); + print ("\t-c number\tMaximum number of simultaneous connections (default $t_max_conn).\n"); + print ("\t-d\t\tRun as daemon.\n"); + print ("\t-e cert\t\tOpenSSL certificate file. Enables SSL.\n"); + print ("\t-f ca_cert\tVerify that the peer certificate is signed by a ca.\n"); + print ("\t-F config_file\tConfiguration file full path.\n"); + print ("\t-h\t\tShow help.\n"); + print ("\t-I\t\tEnable insecure operations (file listing and moving).\n"); + print ("\t-i\t\tFilters.\n"); + print ("\t-k key\t\tOpenSSL private key file.\n"); + print ("\t-l log_file\t\tFile to write logs.\n"); + print ("\t-m size\t\tMaximum file size in bytes (default ${t_max_size}b).\n"); + print ("\t-o\t\tEnable file overwrite.\n"); + print ("\t-p port\t\tPort to listen on (default $t_port).\n"); + print ("\t-q\t\tQuiet. Do now print error messages.\n"); + print ("\t-r number\tNumber of retries for network opertions (default $t_retries).\n"); + print ("\t-S (install|uninstall|run) Manage the win32 service.\n"); + print ("\t-t time\t\tTime-out for network operations in seconds (default ${t_timeout}s).\n"); + print ("\t-v\t\tBe verbose (display errors).\n"); + print ("\t-V\t\tBe verbose on hard way (display errors and other info).\n"); + print ("\t-w\t\tPrompt for OpenSSL private key password.\n"); + print ("\t-x pwd\t\tServer password.\n"); + print ("\t-b ip_address\tProxy requests to the given address.\n"); + print ("\t-g port\t\tProxy requests to the given port.\n"); + print ("\t-T\t\tEnable tcpwrappers support.\n"); + print ("\t \t\t(To use this option, 'Authen::Libwrap' should be installed.)\n\n"); +} + +################################################################################ +## SUB daemonize +## Turn the current process into a daemon. +################################################################################ +sub daemonize { + my $pid; + + require POSIX; + + chdir ('/') || error ("Cannot chdir to /: $!."); + umask 0; + + open (STDIN, '/dev/null') || error ("Cannot read /dev/null: $!."); + + # Do not be verbose when running as a daemon + open (STDOUT, '>/dev/null') || error ("Cannot write to /dev/null: $!."); + open (STDERR, '>/dev/null') || error ("Cannot write to /dev/null: $!."); + + # Fork + $pid = fork (); + if (! defined ($pid)) { + error ("Cannot fork: $!."); + } + + # Parent + if ($pid != 0) { + exit; + } + + # Child + POSIX::setsid () || error ("Cannot start a new session: $!."); +} + +################################################################################ +## SUB parse_options +## Parse command line options and initialize global variables. +################################################################################ +sub parse_options { + my %opts; + my $CONF = {}; + my $token_value; + my $tmp; + my @t_addresses_tmp; + + # Get options + if (getopts ('a:b:c:de:f:F:g:hIi:k:l:m:op:qr:s:S:t:TvVwx:', \%opts) == 0 || defined ($opts{'h'})) { + print_help (); + exit 1; + } + + # The Win32 service must be installed/uninstalled without checking other parameters. + if (defined ($opts{'S'})) { + my $service_action = $opts{'S'}; + if ($^O ne 'MSWin32') { + error ("Windows services are only available on Win32."); + } else { + eval "use Win32::Daemon"; + die($@) if ($@); + + if ($service_action eq 'install') { + install_service(); + } elsif ($service_action eq 'uninstall') { + uninstall_service(); + } + } + } + + # Configuration file + if (defined($opts{'F'})) { + parse_config_file($opts{'F'}, $CONF); + } + + # Address + $token_value = get_config_value($opts{'a'}, $CONF->{'addresses'}); + if (defined ($token_value)) { + @t_addresses = (); + @t_addresses_tmp = split(/,/, $token_value); + + foreach my $t_address (@t_addresses_tmp) { + $t_address =~ s/^ *(.*?) *$/$1/; + if (($t_address ne '0') && + ($t_address !~ /^[a-zA-Z\.]+$/ && ($t_address !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ + || $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255 + || $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255)) && + ($t_address !~ /^[0-9a-f:]+$/o)) { + error ("Address $t_address is not valid."); + } + push @t_addresses, $t_address; + } + } + + # Maximum simultaneous connections + $token_value = get_config_value($opts{'c'}, $CONF->{'max_connections'}); + if (defined ($token_value)) { + $t_max_conn = $token_value; + if ($t_max_conn !~ /^\d+$/ || $t_max_conn < 1) { + error ("Invalid number of maximum simultaneous connections."); + } + } + + # Run as daemon + $token_value = get_config_value($opts{'d'}, $CONF->{'daemon'}, 1); + if (defined ($token_value)) { + if ($^ eq 'MSWin32') { + error ("-d flag not available for this OS."); + } + + $t_daemon = 1; + } + + # Enable SSL + $token_value = get_config_value($opts{'e'}, $CONF->{'ssl_cert'}); + if (defined ($token_value)) { + + require IO::Socket::SSL; + + $t_ssl_cert = $token_value; + if (! -f $t_ssl_cert) { + error ("File $t_ssl_cert does not exist."); + } + + $t_ssl = 1; + } + + # Verify peer certificate + $token_value = get_config_value($opts{'f'}, $CONF->{'ssl_ca'}); + if (defined ($token_value)) { + $t_ssl_ca = $token_value; + if (! -f $t_ssl_ca) { + error ("File $t_ssl_ca does not exist."); + } + } + + # Insecure mode + $token_value = get_config_value($opts{'I'}, $CONF->{'insecure'}, 1); + if (defined ($token_value)) { + $t_insecure = 1; + } + + # Filters (regexp:dir;regexp:dir...) + $token_value = get_config_value($opts{'i'}, $CONF->{'filters'}); + if (defined ($token_value)) { + my @filters = split (';', $token_value); + foreach my $filter (@filters) { + my ($regexp, $dir) = split (':', $filter); + next unless defined ($regexp) && defined ($dir); + + # Remove any trailing / + my $char = chop ($dir); + $dir .= $char if ($char) ne '/'; + + push(@t_filters, [$regexp, $dir]); + } + } + + # SSL private key file + $token_value = get_config_value($opts{'k'}, $CONF->{'ssl_key'}); + if (defined ($token_value)) { + $t_ssl_key = $token_value; + if (! -f $t_ssl_key) { + error ("File $t_ssl_key does not exist."); + } + } + + # Maximum file size + $token_value = get_config_value($opts{'m'}, $CONF->{'max_size'}); + if (defined ($token_value)) { + $t_max_size = $token_value; + if ($t_max_size !~ /^\d+$/ || $t_max_size < 1) { + error ("Invalid maximum file size."); + } + } + + # File overwrite + $token_value = get_config_value($opts{'o'}, $CONF->{'overwrite'}, 1); + if (defined ($token_value)) { + $t_overwrite = 1; + } + + # Port + $token_value = get_config_value($opts{'p'}, $CONF->{'port'}); + if (defined ($token_value)) { + $t_port = $token_value; + if ($t_port !~ /^\d+$/ || $t_port < 1 || $t_port > 65535) { + error ("Port $t_port is not valid."); + } + } + + # Quiet mode + $token_value = get_config_value($opts{'q'}, $CONF->{'quiet'}, 1); + if (defined ($token_value)) { + $t_quiet = 1; + } + + # Retries + $token_value = get_config_value($opts{'r'}, $CONF->{'retries'}); + if (defined ($token_value)) { + $t_retries = $token_value; + if ($t_retries !~ /^\d+$/ || $t_retries < 1) { + error ("Invalid number of retries for network operations."); + } + } + + # Storage directory + $token_value = get_config_value($opts{'s'}, $CONF->{'directory'}); + if (defined ($token_value)) { + + $t_directory = $token_value; + + # Check that directory exists + if (! -d $t_directory) { + error ("Directory $t_directory does not exist."); + } + + # Check directory permissions + if (! -w $t_directory) { + error ("Cannot write to directory $t_directory."); + } + + # Remove the trailing / if present + $tmp = chop ($t_directory); + if ($tmp ne '/') { + $t_directory .= $tmp; + } + } + else { + $token_value = get_config_value($opts{'b'}, $CONF->{'proxy_ip'}); + if (! defined($token_value)) { + print_help (); + exit 1; + } + } + + # Timeout + $token_value = get_config_value($opts{'t'}, $CONF->{'timeout'}); + if (defined ($token_value)) { + $t_timeout = $token_value; + if ($t_timeout !~ /^\d+$/ || $t_timeout < 1) { + error ("Invalid timeout for network operations."); + } + } + + # Read verbose from config file + if (defined($CONF->{'verbose'})) { + if ($CONF->{'verbose'} eq "1") { + $t_log = 1; + } elsif ($CONF->{'verbose'} eq "2") { + $t_log = 1; + $t_log_hard = 1; + } + } + # Be verbose + if (defined ($opts{'v'})) { + $t_log = 1; + $t_log_hard = 0; + } + # Be verbose hard + if (defined ($opts{'V'})) { + $t_log = 1; + $t_log_hard = 1; + } + + # SSL private key password + $token_value = get_config_value($opts{'w'}, $CONF->{'ssl_password'}, 1); + if (defined ($token_value)) { + $t_ssl_pwd = ask_passwd ("Enter private key file password: ", "Enter private key file password again for confirmation: "); + } + + # Server password + $token_value = get_config_value($opts{'x'}, $CONF->{'password'}); + if (defined ($token_value)) { + $t_pwd = $token_value; + } + + #Proxy IP address + $token_value = get_config_value($opts{'b'}, $CONF->{'proxy_ip'}); + if (defined ($token_value)) { + $t_proxy_ip = $token_value; + if ($t_proxy_ip !~ /^[a-zA-Z\.]+$/ && ($t_proxy_ip !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ + || $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255 + || $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255) && + $t_proxy_ip !~ /^[0-9a-f:]+$/o) { + error ("Proxy address $t_proxy_ip is not valid."); + } + } + + # Proxy Port + $token_value = get_config_value($opts{'g'}, $CONF->{'proxy_port'}); + if (defined ($token_value)) { + $t_proxy_port = $token_value; + if ($t_proxy_port !~ /^\d+$/ || $t_proxy_port < 1 || $t_proxy_port > 65535) { + error ("Proxy port $t_port is not valid."); + } + } + + # TCP wrappers support + $token_value = get_config_value($opts{'T'}, $CONF->{'use_libwrap'}, 1); + if (defined ($token_value)) { + if ($t_libwrap_installed) { + $t_use_libwrap = 1; + } else { + error ("Authen::Libwrap is not installed."); + } + } + + # Win32 service management + if (defined ($opts{'S'})) { + my $service_action = $opts{'S'}; + if ($^O ne 'MSWin32') { + error ("Windows services are only available on Win32."); + } else { + eval "use Win32::Daemon"; + die($@) if ($@); + + if ($service_action eq 'run') { + Win32::Daemon::RegisterCallbacks({ + start => \&callback_start, + running => \&callback_running, + stop => \&callback_stop, + }); + Win32::Daemon::StartService(); + exit 0; + } else { + error("Unknown action: $service_action"); + } + } + } + + # Get the config file + $token_value = get_config_value($opts{'l'}, $CONF->{'log_file'}); + if (defined ($token_value)) { + $log_file = $token_value; + } + + # No command lines config values + + # Get the block size + if (defined ($CONF->{'block_size'})) { + if ($t_port !~ /^\d+$/ || $t_port < 1) { + error ("Invalid block size: " . $CONF->{'block_size'} . "."); + } + $t_block_size = $CONF->{'block_size'}; + } + + # Configuration file invalid chars + if (defined ($CONF->{'invalid_chars'})) { + $t_invalid_chars = $CONF->{'invalid_chars'}; + } +} + +################################################################################ +## SUB parse_config_file +## Get all options from a config file. +################################################################################ +sub parse_config_file { + my ($config_file, $CONF) = @_; + + # File should be writable + if (! -r $config_file) { + print "Configuration file $config_file is not readable.\n"; + return; + } + + # Open the file + my $FH; + if (! open ($FH, "< $config_file")) { + print "Cannot open configuration file $config_file.\n"; + return; + } + + # Read the file and only get the well formed lines + while (<$FH>) { + my $buffer_line = $_; + if ($buffer_line =~ /^[a-zA-Z]/){ # begins with letters + if ($buffer_line =~ m/([\w\-\_\.]+)\s+(.*)/){ + $CONF->{$1} = $2 unless $2 eq ""; + } + } + } + + close ($FH); + return; +} + +################################################################################ +## SUB parse_config_file +## Search in command line options and config hash from configuration file +## to get a value (command line is a priority) +################################################################################ +sub get_config_value { + my ($cmd_value, $conf_value, $bool) = @_; + $bool = 0 unless defined($bool); + + return $cmd_value if defined($cmd_value); + # The boolean type value is 1 or undef (0 should be translated like undefP) + if ($bool && defined($conf_value)) { + return undef if ($conf_value ne "1"); + } + return $conf_value; +} + +################################################################################ +## SUB start_proxy +## Open the proxy server socket. +################################################################################ +sub start_proxy { + + # Connect to server + $t_proxy_socket = $SOCKET_MODULE->new ( + PeerAddr => $t_proxy_ip, + PeerPort => $t_proxy_port, + ); + + if (! defined ($t_proxy_socket)) { + error ("Cannot connect to $t_proxy_ip on port $t_proxy_port: $!."); + } + + # Create proxy selector + $t_proxy_select = IO::Select->new (); + $t_proxy_select->add ($t_proxy_socket); + +} + +################################################################################ +## SUB start_server +## Open the server socket. +################################################################################ +sub start_server { + + my $t_server_socket; + + foreach my $t_address (@t_addresses) { + + $t_server_socket = $SOCKET_MODULE->new ( + Listen => $t_max_conn, + LocalAddr => $t_address, + LocalPort => $t_port, + Proto => 'tcp', + ReuseAddr => 1, + ); + + if (! defined ($t_server_socket)) { + print_log ("Cannot open socket for address $t_address on port $t_port: $!."); + next; + } + + print_log ("Server listening on $t_address port $t_port (press to stop)"); + + # Say message if tentacle proxy is enable + if (defined ($t_proxy_ip)) { + print_log ("Proxy Mode enable, data will be sent to $t_proxy_ip port $t_proxy_port"); + } + + push @t_server_sockets, $t_server_socket; + } + + if (!@t_server_sockets) { + error ("Cannot open socket for all addresses on port $t_port: $!."); + } + + $t_server_select = IO::Select->new(); + foreach my $t_server_socket (@t_server_sockets){ + $t_server_select->add($t_server_socket); + } +} + +################################################################################ +## SUB send_data_proxy +## Send data to proxy socket. +################################################################################ +sub send_data_proxy { + my $data = $_[0]; + my $block_size; + my $retries = 0; + my $size; + my $total = 0; + my $written; + + $size = length ($data); + + while (1) { + + # Try to write data to the socket + if ($t_proxy_select->can_write ($t_timeout)) { + + $block_size = ($size - $total) > $t_block_size ? $t_block_size : ($size - $total); + $written = syswrite ($t_proxy_socket, $data, $size - $total, $total); + + # Write error + if (! defined ($written)) { + error ("Connection error from " . $t_proxy_socket->sockhost () . ": $!."); + } + + # EOF + if ($written == 0) { + error ("Connection from " . $t_proxy_socket->sockhost () . " unexpectedly closed."); + } + + $total += $written; + + # Check if all data was written + if ($total == $size) { + return; + } + } + # Retry + else { + $retries++; + if ($retries > $t_retries) { + error ("Connection from " . $t_proxy_socket->sockhost () . " timed out."); + } + } + } +} + +################################################################################ +## SUB close_proxy +## Close the proxy socket. +################################################################################ +sub close_proxy { + $t_proxy_socket->shutdown (2); + $t_proxy_socket->close (); +} + +################################################################################ +## SUB stop_server +## Close the server socket. +################################################################################ +sub stop_server { + + foreach my $t_server_socket (@t_server_sockets) { + $t_server_socket->shutdown (2); + $t_server_socket->close (); + } + print_log ("Server going down"); + + exit 0; +} + +################################################################################ +## SUB start_ssl +## Convert the client socket to an IO::Socket::SSL socket. +################################################################################ +sub start_ssl { + my $err; + + if ($t_ssl_ca eq '') { + IO::Socket::SSL->start_SSL ( + $t_client_socket, + SSL_cert_file => $t_ssl_cert, + SSL_key_file => $t_ssl_key, + SSL_passwd_cb => sub {return $t_ssl_pwd}, + SSL_server => 1, + # Verify peer + SSL_verify_mode => 0x01, + ); + } + else { + IO::Socket::SSL->start_SSL ( + $t_client_socket, + SSL_ca_file => $t_ssl_ca, + SSL_cert_file => $t_ssl_cert, + SSL_key_file => $t_ssl_key, + SSL_passwd_cb => sub {return $t_ssl_pwd}, + SSL_server => 1, + # Fail verification if no peer certificate exists + SSL_verify_mode => 0x03, + ); + } + + $err = IO::Socket::SSL::errstr (); + if ($err ne '') { + error ($err); + } + + print_log ("SSL started for " . $t_client_socket->sockhost ()); +} + +################################################################################ +## SUB accept_connections +## Manage incoming connections. +################################################################################ +sub accept_connections { + my $pid; + my $t_server_socket; + + # Ignore SIGPIPE + $SIG{PIPE} = 'IGNORE'; + + # Start server + start_server (); + + # Initialize semaphore + $t_sem = Thread::Semaphore->new ($t_max_conn); + + while (1) { + my @ready = $t_server_select->can_read; + foreach $t_server_socket (@ready) { + + # Accept connection + $t_client_socket = $t_server_socket->accept (); + + if (! defined ($t_client_socket)) { + next if ($! ne ''); # EINTR + error ("accept: $!."); + } + + print_info ("Client connected from " . $t_client_socket->peerhost ()); + + if ($t_use_libwrap && (! hosts_ctl($t_program_name, $t_client_socket))) { + print_log ("Connection from " . $t_client_socket->peerhost() . " is closed by tcpwrappers."); + $t_client_socket->shutdown (2); + $t_client_socket->close(); + } + else { + + # Create a new thread and serve the client + $t_sem->down(); + my $thr = threads->create(\&serve_client); + if (! defined ($thr)) { + error ("Error creating thread: $!."); + } + $thr->detach(); + $t_client_socket->close (); + } + } + + usleep (1000); + } +} + +################################################################################ +## SUB serve_client +## Serve a connected client. +################################################################################ +sub serve_client() { + + eval { + # Add client socket to select queue + $t_select = IO::Select->new (); + $t_select->add ($t_client_socket); + + # Start SSL + if ($t_ssl == 1) { + start_ssl (); + } + + # Authenticate client + if ($t_pwd ne '') { + auth_pwd (); + } + + # Check if proxy mode is enable + if (defined ($t_proxy_ip)) { + serve_proxy_connection (); + } else { + serve_connection (); + } + }; + + $t_client_socket->shutdown (2); + $t_client_socket->close (); + $t_sem->up(); +} + +################################################################################ +## SUB serve_proxy_connection +## Actuate as a proxy between its client and other tentacle server. +################################################################################ +sub serve_proxy_connection { + + # We are a proxy! Start a connection to the Tentacle Server. + start_proxy(); + + # Forward data between the client and the server. + eval { + my $select = IO::Select->new (); + $select->add($t_proxy_socket); + $select->add($t_client_socket); + while (my @ready = $select->can_read()) { + foreach my $socket (@ready) { + if (refaddr($socket) == refaddr($t_client_socket)) { + my ($read, $data) = recv_data($t_block_size); + return unless defined($data); + send_data_proxy($data); + } + else { + my ($read, $data) = recv_data_proxy($t_block_size); + return unless defined($data); + send_data($data); + } + } + } + }; + + # Close the connection to the Tentacle Server. + close_proxy(); +} + +################################################################################ +## SUB serve_connection +## Read and process commands from the client. +################################################################################ +sub serve_connection { + my $command; + + # Read commands + while ($command = recv_command ($t_block_size)) { + + # Client wants to send a file + if ($command =~ /^SEND <(.*)> SIZE (\d+)$/) { + print_info ("Request to send file '$1' size ${2}b from " . $t_client_socket->sockhost ()); + recv_file ($1, $2); + } + # Client wants to receive a file + elsif ($command =~ /^RECV <(.*)>$/) { + print_info ("Request to receive file '$1' from " . $t_client_socket->sockhost ()); + send_file ($1); + } + elsif ($command =~ /^ZSEND <(.*)> SIZE (\d+)$/) { + print_info ("Request to send compressed file '$1' size ${2}b from " . $t_client_socket->sockhost ()); + zrecv_file ($1, $2); + } + # Client wants to receive a file + elsif ($command =~ /^ZRECV <(.*)>$/) { + print_info ("Request to receive compressed file '$1' from " . $t_client_socket->sockhost ()); + zsend_file ($1); + } + # Quit + elsif ($command =~ /^QUIT$/) { + print_info ("Connection closed from " . $t_client_socket->sockhost ()); + last; + } + # File listing. + elsif ($command =~ /^LS <(.*)>$/) { + if ($t_insecure == 0) { + print_info ("Insecure mode disabled. Rejected request to list files matched by filter $1 from " . $t_client_socket->sockhost ()); + last; + } + + print_info ("Request to list files matched by filter $1 from " . $t_client_socket->sockhost ()); + send_file_list ($1); + } + # Client wants to move a file + elsif ($command =~ /^MV <(.*)>$/) { + if ($t_insecure == 0) { + print_info ("Insecure mode disabled. Rejected request to move file $1 from " . $t_client_socket->sockhost ()); + last; + } + + print_info ("Request to move file '$1' from " . $t_client_socket->sockhost ()); + move_file ($1); + } + # Unknown command + else { + print_log ("Unknown command '$command' from " . $t_client_socket->sockhost ()); + last; + } + } +} + +################################################################################ +## SUB auth_pwd +## Authenticate client with server password. +################################################################################ +sub auth_pwd { + my $client_digest; + my $command; + my $pwd_digest; + + require Digest::MD5; + + # Wait for password + $command = recv_command ($t_block_size); + if ($command !~ /^PASS (.*)$/) { + error ("Client " . $t_client_socket->sockhost () . " did not authenticate."); + } + + $client_digest = $1; + $pwd_digest = Digest::MD5::md5 ($t_pwd); + $pwd_digest = Digest::MD5::md5_hex ($pwd_digest); + + if ($client_digest ne $pwd_digest) { + error ("Invalid password from " . $t_client_socket->sockhost () . "."); + } + + print_log ("Client " . $t_client_socket->sockhost () . " authenticated"); + send_data ("PASS OK\n"); +} + +################################################################################ +## SUB recv_file +## Receive a file of size $_[1] and save it in $t_directory as $_[0]. +################################################################################ +sub recv_file { + my $base_name = $_[0]; + my $data = ''; + my $file; + my $size = $_[1]; + + # Check file name + if ($base_name =~ /[$t_invalid_chars]/) { + print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " has an invalid file name"); + send_data ("SEND ERR (invalid file name)\n"); + return; + } + + # Check file size, empty files are not allowed + if ($size < 1 || $size > $t_max_size) { + print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " is too big"); + send_data ("SEND ERR (file is too big)\n"); + return; + } + + # Apply filters + $file = "$t_directory/" . apply_filters ($base_name) . $base_name; + + # Check if file exists + if (-f $file && $t_overwrite == 0) { + print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " already exists"); + send_data ("SEND ERR (file already exists)\n"); + return; + } + + send_data ("SEND OK\n"); + + # Receive file + $data = recv_data_block ($size); + + # Write it to disk + open (FILE, "> $file") || error ("Cannot open file '$file' for writing."); + binmode (FILE); + print (FILE $data); + close (FILE); + + send_data ("SEND OK\n"); + print_info ("Received file '$base_name' size ${size}b from " . $t_client_socket->sockhost ()); +} + +################################################################################ +## SUB zrecv_file +## Receive a compressed file of size $_[1] and save it in $t_directory as $_[0]. +################################################################################ +sub zrecv_file { + my $base_name = $_[0]; + my $data = ''; + my $file; + my $size = $_[1]; + my $zdata = ''; + + # Check file name + if ($base_name =~ /[$t_invalid_chars]/) { + print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " has an invalid file name"); + send_data ("ZSEND ERR (invalid file name)\n"); + return; + } + + # Check file size, empty files are not allowed + if ($size < 1 || $size > $t_max_size) { + print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " is too big"); + send_data ("ZSEND ERR (file is too big)\n"); + return; + } + + # Apply filters + $file = "$t_directory/" . apply_filters ($base_name) . $base_name; + + # Check if file exists + if (-f $file && $t_overwrite == 0) { + print_log ("File '$base_name' size ${size}b from " . $t_client_socket->sockhost () . " already exists"); + send_data ("ZSEND ERR (file already exists)\n"); + return; + } + + send_data ("ZSEND OK\n"); + + # Receive file + $zdata = recv_data_block ($size); + if (!unzip(\$zdata => \$data)) { + print_log ("Uncompress error: $UnzipError"); + send_data ("ZSEND ERR\n"); + return; + } + + # Write it to disk + open (FILE, "> $file") || error ("Cannot open file '$file' for writing."); + binmode (FILE); + print (FILE $data); + close (FILE); + + send_data ("ZSEND OK\n"); + print_info ("Received compressed file '$base_name' size ${size}b from " . $t_client_socket->sockhost ()); +} + +################################################################################ +## SUB send_file +## Send a file to the client +################################################################################ +sub send_file { + my $base_name = $_[0]; + my $data = ''; + my $file; + my $response; + my $size; + + # Check file name + if ($base_name =~ /[$t_invalid_chars]/) { + print_log ("Requested file '$base_name' from " . $t_client_socket->sockhost () . " has an invalid file name"); + send_data ("RECV ERR (file has an invalid file name)\n"); + return; + } + + # Apply filters + $file = "$t_directory/" . apply_filters ($base_name) . $base_name; + + # Check if file exists + if (! -f $file) { + print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " does not exist"); + send_data ("RECV ERR (file does not exist)\n"); + return; + } + + $size = -s $file; + send_data ("RECV SIZE $size\n"); + + # Wait for client response + $response = recv_command ($t_block_size); + if ($response ne "RECV OK") { + print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " not sent"); + return; + } + + # Send the file + open (FILE, $file) || error ("Cannot open file '$file' for reading."); + binmode (FILE); + { + local $/ = undef; + $data = ; + } + + send_data ($data); + close (FILE); + + print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " sent"); +} + +################################################################################ +## SUB zsend_file +## Send a file to the client +################################################################################ +sub zsend_file { + my $base_name = $_[0]; + my $data = ''; + my $file; + my $response; + my $size; + + # Check file name + if ($base_name =~ /[$t_invalid_chars]/) { + print_log ("Requested compressed file '$base_name' from " . $t_client_socket->sockhost () . " has an invalid file name"); + send_data ("ZRECV ERR (file has an invalid file name)\n"); + return; + } + + # Apply filters + $file = "$t_directory/" . apply_filters ($base_name) . $base_name; + + # Check if file exists + if (! -f $file) { + print_log ("Requested compressed '$file' from " . $t_client_socket->sockhost () . " does not exist"); + send_data ("ZRECV ERR (file does not exist)\n"); + return; + } + + # Read the file and compress its contents + if (! zip($file => \$data)) { + send_data ("QUIT\n"); + error ("Compression error: $ZipError"); + return; + } + + $size = length($data); + send_data ("ZRECV SIZE $size\n"); + + # Wait for client response + $response = recv_command ($t_block_size); + if ($response ne "ZRECV OK") { + print_log ("Requested compressed '$file' from " . $t_client_socket->sockhost () . " not sent"); + return; + } + + # Send the file + send_data ($data); + + print_log ("Requested compressed '$file' from " . $t_client_socket->sockhost () . " sent"); +} + +################################################################################ +# Common functions +################################################################################ + +################################################################################ +## SUB print_log +## Print log messages. +################################################################################ +sub print_log($) { + + my ($msg) = @_; + + return unless ($t_log == 1); + + my $fh = *STDOUT; + if (defined($log_file)) { + open($fh, ">>", $log_file) || die("Starting log failed: $!.\n"); + } + + print ($fh strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "[log]$msg.\n"); + + close ($fh) if (defined($log_file)); + +} + +################################################################################ +## SUB print_log +## Print log messages. +################################################################################ +sub print_info($) { + + my ($msg) = @_; + + return unless ($t_log_hard == 1); + + my $fh = *STDOUT; + if (defined($log_file)) { + open($fh, ">>", $log_file) || die("Starting log failed: $!.\n"); + } + + print ($fh strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "[info]$msg.\n"); + + close ($fh) if (defined($log_file)); + +} + +################################################################################ +## SUB error +## Print an error and exit the program. +################################################################################ +sub error { + + my ($msg) = @_; + + return unless ($t_quiet == 0); + + my $fh = *STDERR; + if (defined($log_file)) { + open($fh, ">>", $log_file) || die("$!\n"); + } + + print ($fh strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "[err]$msg\n"); + + close ($fh) if (defined($log_file)); + + die("\n"); +} + +################################################################################ +## SUB move_file +## Send a file to the client and delete it +################################################################################ +sub move_file { + my $base_name = $_[0]; + my $data = ''; + my $file; + my $response; + my $size; + + # Check file name + if ($base_name =~ /[$t_invalid_chars]/) { + print_log ("Requested file '$base_name' from " . $t_client_socket->sockhost () . " has an invalid file name"); + send_data ("MV ERR\n"); + return; + } + + # Apply filters + $file = "$t_directory/" . apply_filters ($base_name) . $base_name; + + # Check if file exists + if (! -f $file) { + print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " does not exist"); + send_data ("MV ERR\n"); + return; + } + + $size = -s $file; + send_data ("MV SIZE $size\n"); + + # Wait for client response + $response = recv_command ($t_block_size); + if ($response ne "MV OK") { + print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " not sent"); + return; + } + + # Send the file + open (FILE, $file) || error ("Cannot open file '$file' for reading."); + binmode (FILE); + + while ($data = ) { + send_data ($data); + } + + close (FILE); + unlink($file); + + print_log ("Requested file '$file' from " . $t_client_socket->sockhost () . " sent and deleted"); +} + +################################################################################ +## SUB send_file_list +## Send a list of files to the client after applying the given filter. +################################################################################ +sub send_file_list { + my $filter = $_[0]; + my $data = ''; + my $dir; + my $dh; + my $response; + my $size; + + # Check file name + if ($filter =~ /[$t_invalid_chars]/) { + print_log ("Invalid file listing filter '$filter' from " . $t_client_socket->sockhost ()); + send_data ("LS ERR\n"); + return; + } + + # Apply filters + $dir = "$t_directory/" . apply_filters ($filter); + + # Open the directory. + if (! opendir ($dh, $dir)) { + print_log ("Error opening directory $dir as requested from " . $t_client_socket->sockhost () . ": $!"); + send_data ("LS ERR\n"); + return; + } + + # List files. + while (my $file = readdir ($dh)) { + next if ($file =~ /[$t_invalid_chars]/); # Only list files valid for Tentacle. + $data .= "$file\n"; + } + closedir $dh; + + $size = length ($data); + send_data ("LS SIZE $size\n"); + + # Wait for client response + $response = recv_command ($t_block_size); + if ($response ne "LS OK") { + print_log ("Requested directory listing from " . $t_client_socket->sockhost () . " not sent"); + return; + } + + send_data ($data); + + print_log ("Requested directory listing from " . $t_client_socket->sockhost () . " sent"); +} + +################################################################################ +## SUB recv_data_proxy +## Recv data from proxy socket. +################################################################################ +sub recv_data_proxy { + my $data; + my $read; + my $retries = 0; + my $size = $_[0]; + + while (1) { + + # Try to read data from the socket + if ($t_proxy_select->can_read ($t_timeout)) { + + # Read at most $size bytes + $read = sysread ($t_proxy_socket, $data, $size); + + # Read error + if (! defined ($read)) { + error ("Read error from " . $t_proxy_socket->sockhost () . ": $!."); + } + + # EOF + if ($read == 0) { + error ("Connection from " . $t_proxy_socket->sockhost () . " unexpectedly closed."); + } + + return ($read, $data); + } + + # Retry + $retries++; + + # But check for error conditions first + if ($retries > $t_retries) { + error ("Connection from " . $t_proxy_socket->sockhost () . " timed out."); + } + } +} +################################################################################ +## SUB recv_data +## Read data from the client socket. Returns the number of bytes read and the +## string of bytes as a two element array. +################################################################################ +sub recv_data { + my $data; + my $read; + my $retries = 0; + my $size = $_[0]; + + while (1) { + + # Try to read data from the socket + if ($t_select->can_read ($t_timeout)) { + + # Read at most $size bytes + $read = sysread ($t_client_socket, $data, $size); + + # Read error + if (! defined ($read)) { + error ("Read error from " . $t_client_socket->sockhost () . ": $!."); + } + + # EOF + if ($read == 0) { + error ("Connection from " . $t_client_socket->sockhost () . " unexpectedly closed."); + } + + return ($read, $data); + } + + # Retry + $retries++; + + # But check for error conditions first + if ($retries > $t_retries) { + error ("Connection from " . $t_client_socket->sockhost () . " timed out."); + } + } +} + +################################################################################ +## SUB send_data +## Write data to the client socket. +################################################################################ +sub send_data { + my $data = $_[0]; + my $block_size; + my $retries = 0; + my $size; + my $total = 0; + my $written; + + $size = length ($data); + + while (1) { + + # Try to write data to the socket + if ($t_select->can_write ($t_timeout)) { + + $block_size = ($size - $total) > $t_block_size ? $t_block_size : ($size - $total); + $written = syswrite ($t_client_socket, $data, $block_size, $total); + + # Write error + if (! defined ($written)) { + error ("Connection error from " . $t_client_socket->sockhost () . ": $!."); + } + + # EOF + if ($written == 0) { + error ("Connection from " . $t_client_socket->sockhost () . " unexpectedly closed."); + } + + $total += $written; + + # Check if all data was written + if ($total == $size) { + return; + } + } + # Retry + else { + $retries++; + if ($retries > $t_retries) { + error ("Connection from " . $t_client_socket->sockhost () . " timed out."); + } + } + } +} + +################################################################################ +## SUB recv_command +## Read a command from the client, ended by a new line character. +################################################################################ +sub recv_command { + my $buffer; + my $char; + my $command = ''; + my $read; + my $total = 0; + + while (1) { + + ($read, $buffer) = recv_data ($t_block_size); + $command .= $buffer; + $total += $read; + + # Check if the command is complete + $char = chop ($command); + if ($char eq "\n") { + return $command; + } + + $command .= $char; + + # Avoid overflow + if ($total > $t_block_size) { + error ("Received too much data from " . $t_client_socket->sockhost () . "."); + } + } +} + +################################################################################ +## SUB recv_data_block +## Read $_[0] bytes of data from the client. +################################################################################ +sub recv_data_block { + my $buffer = ''; + my $data = ''; + my $read; + my $size = $_[0]; + my $total = 0; + + while (1) { + + ($read, $buffer) = recv_data ($size - $total); + $data .= $buffer; + $total += $read; + + # Check if all data has been read + if ($total == $size) { + return $data; + } + } +} + +################################################################################ +## SUB ask_passwd +## Asks the user for a password. +################################################################################ +sub ask_passwd { + my $msg1 = $_[0]; + my $msg2 = $_[1]; + my $pwd1; + my $pwd2; + + require Term::ReadKey; + + # Disable keyboard echo + Term::ReadKey::ReadMode('noecho'); + + # Promt for password + print ($msg1); + $pwd1 = Term::ReadKey::ReadLine(0); + print ("\n$msg2"); + $pwd2 = Term::ReadKey::ReadLine(0); + print ("\n"); + + # Restore original settings + Term::ReadKey::ReadMode('restore'); + + if ($pwd1 ne $pwd2) { + print ("Error: passwords do not match.\n"); + exit 1; + } + + # Remove the trailing new line character + chop $pwd1; + + return $pwd1; +} + +################################################################################ +## SUB apply_filters +## Applies filters to the given file. +################################################################################ +sub apply_filters ($) { + my ($file_name) = @_; + + foreach my $filter (@t_filters) { + my ($regexp, $dir) = @{$filter}; + if ($file_name =~ /$regexp/) { + print_log ("File '$file_name' matches filter '$regexp' (changing to directory '$dir')"); + return $dir . '/'; + } + } + + return ''; +} + +################################################################################ +## SUB install_service +## Install the Windows service. +################################################################################ +sub install_service() { + + my $service_path = $0; + my $service_params = $SERVICE_PARAMS; + + # Change the service parameter from 'install' to 'run'. + $service_params =~ s/\-S\s+\S+/\-S run/; + + my %service_hash = ( + machine => '', + name => 'TENTACLESRV', + display => $SERVICE_NAME, + path => $service_path, + user => '', + pwd => '', + description => 'Tentacle Server http://sourceforge.net/projects/tentacled/', + parameters => $service_params + ); + + if (Win32::Daemon::CreateService(\%service_hash)) { + print "Successfully added.\n"; + exit 0; + } else { + print "Failed to add service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n"; + exit 1; + } +} + +################################################################################ +## SUB uninstall_service +## Install the Windows service. +################################################################################ +sub uninstall_service() { + if (Win32::Daemon::DeleteService('', 'TENTACLESRV')) { + print "Successfully deleted.\n"; + exit 0; + } else { + print "Failed to delete service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n"; + exit 1; + } +} + +################################################################################ +## SUB callback_running +## Windows service callback function for the running event. +################################################################################ +sub callback_running { + + if (Win32::Daemon::State() == WIN32_SERVICE_RUNNING) { + } +} + +################################################################################ +## SUB callback_start +## Windows service callback function for the start event. +################################################################################ +sub callback_start { + + # Accept_connections (); + my $thr = threads->create(\&accept_connections); + if (!defined($thr)) { + Win32::Daemon::State(WIN32_SERVICE_STOPPED); + Win32::Daemon::StopService(); + return; + } + $thr->detach(); + + Win32::Daemon::State(WIN32_SERVICE_RUNNING); +} + +################################################################################ +## SUB callback_stop +## Windows service callback function for the stop event. +################################################################################ +sub callback_stop { + + foreach my $t_server_socket (@t_server_sockets) { + $t_server_socket->shutdown (2); + $t_server_socket->close (); + } + + Win32::Daemon::State(WIN32_SERVICE_STOPPED); + Win32::Daemon::StopService(); +} + + +################################################################################ +## SUB check_ssleay_version +## Print a message if the installed version of Net::SSLeay may leak memory. +################################################################################ +sub check_ssleay_version { + eval { + require Net::SSLeay; + return unless defined($Net::SSLeay::VERSION) && $Net::SSLeay::VERSION =~ m/^(\d+)\.(\d+)/ && $1 <= 1 && $2 < 88; + print_log ("Net::SSLeay version $Net::SSLeay::VERSION detected. Versions prior to 1.88 may leak memory. To upgrade it see: https://metacpan.org/pod/Net::SSLeay"); + }; +} + +################################################################################ +# Main +################################################################################ + +# Never run as root +if ($> == 0 && $^O ne 'MSWin32') { + print ("Error: for safety reasons $0 cannot be run with root privileges.\n"); + exit 1; +} + +# Parse command line options +parse_options (); + +# Check command line arguments +if ($#ARGV != -1) { + print_help (); + exit 1; +} + +check_ssleay_version() if $t_ssl == 1; + +# Show IPv6 status +if ($SOCKET_MODULE eq 'IO::Socket::INET') { + print_log ("IO::Socket::INET6 is not found. IPv6 is disabled."); +} + +# Run as daemon? +if ($t_daemon == 1 && $^O ne 'MSWin32') { + daemonize (); +} + +# Handle ctr-c +if ($^O eq 'MSWin32') { + no warnings; + $SIG{INT2} = \&stop_server; + use warnings; +} +else { + $SIG{INT} = \&stop_server; +} + +# Accept connections +accept_connections(); + +__END__ + +=head1 REQUIRED ARGUMENTES + +=over + +=item B<< -s F >> Root directory to store the files received by the server + +=back + +=head1 OPTIONS + +=over + +=item I<-a ip_address> Address to B on (default I<0.0.0.0>). + +=item I<-c number> B number of simultaneous B (default I<10>). + +=item I<-d> Run as B. + +=item I<-e cert> B file. Enables SSL. + +=item I<-f ca_cert> Verify that the peer certificate is signed by a B. + +=item I<-h> Show B. + +=item I<-i> B. + +=item I<-k key> B file. + +=item I<-m size> B in bytes (default I<2000000b>). + +=item I<-o> Enable file B. + +=item I<-p port> B on (default I<41121>). + +=item I<-q> B. Do now print error messages. + +=item I<-r number> B for network opertions (default I<3>). + +=item I<-t time> B for network operations in B (default I<1s>). + +=item I<-v> Be B. + +=item I<-w> Prompt for B. + +=item I<-x> pwd B. + +=back + +=head1 EXIT STATUS + +=over + +=item 0 on Success + +=item 1 on Error + +=back + +=head1 CONFIGURATION + +Tentacle doesn't use any configurationf files, all the configuration is done by the options passed when it's started. + +=head1 DEPENDENCIES + +L, L, L, L, L + + +=head1 LICENSE + +This is released under the GNU Lesser General Public License. + +=head1 SEE ALSO + +L, L, L, L, L + +Protocol description and more info at: L<< https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Tentacle >> + +=head1 COPYRIGHT + +Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L + +=cut + From edb0ebd5080442e118554d24148dac1a60e7f890 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 10 Nov 2020 19:31:14 +0100 Subject: [PATCH 161/230] minor changes --- pandora_server/pandora_server_installer | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index dbd631dc57..973cf3f121 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -262,6 +262,7 @@ install () { ln -s /usr/local/bin/pandora_server $DESTDIR$PREFIX/bin ln -s /usr/local/bin/pandora_exec $DESTDIR$PREFIX/bin ln -s /usr/local/bin/tentacle_server $DESTDIR$PREFIX/bin + ln -s /usr/local/bin/tentacle_client $DESTDIR$PREFIX/bin fi fi fi @@ -495,7 +496,9 @@ uninstall () { rm -f $DESTDIR$PANDORA_SERVER 2> /dev/null rm -f $DESTDIR$PREFIX/bin/pandora_server 2> /dev/null rm -f $DESTDIR$PREFIX/bin/pandora_exec 2> /dev/null - rm -f $DESTDIR$PREFIX/bin/tentacle_server 2> /dev/null + # Do not remove tentacle files if agent is still installed... + [ -e $DESTDIR$PREFIX/bin/pandora_agent ] || rm -f $DESTDIR$PREFIX/bin/tentacle_server 2> /dev/null + [ -e $DESTDIR$PREFIX/bin/pandora_agent ] || rm -f $DESTDIR$PREFIX/bin/tentacle_client 2> /dev/null rm -Rf $DESTDIR$PANDORA_HOME rm -f $DESTDIR/etc/cron.hourly/pandora_db rm -f $DESTDIR/etc/logrotate.d/pandora_server From 33fbdd1819d8c19f33f946a26cd2e34a5d11761c Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 11 Nov 2020 01:00:32 +0100 Subject: [PATCH 162/230] 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 9d8383f3cd..d45b4bafb5 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201110 +Version: 7.0NG.750-201111 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 895c172aff..0fa21bd5a0 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.750-201110" +pandora_version="7.0NG.750-201111" 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 248e478e90..f15435c581 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201110'; +use constant AGENT_BUILD => '201111'; # 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 775e0b8d03..d3d3cfc4c8 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.750 -%define release 201110 +%define release 201111 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 f5216f943e..d8e990c2a6 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.750 -%define release 201110 +%define release 201111 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 2c888df984..782c61cce4 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201110" +PI_BUILD="201111" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 73e5275392..02ce38fb77 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201110} +{201111} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 694a757fa1..cfdae5a3a3 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.750(Build 201110)") +#define PANDORA_VERSION ("7.0NG.750(Build 201111)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index dd07c7e05e..b327a39ac2 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.750(Build 201110))" + VALUE "ProductVersion", "(7.0NG.750(Build 201111))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index cb163f7a71..b2eb6352d5 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201110 +Version: 7.0NG.750-201111 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 e91af80084..1f4736fe3d 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.750-201110" +pandora_version="7.0NG.750-201111" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 8081929e5f..7ff6335385 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 = 'PC201110'; +$build_version = 'PC201111'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 06268b68a7..5938e2f1bc 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 a85eb9033a..de60dbcdab 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.750 -%define release 201110 +%define release 201111 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 4256526172..08f8aa5ed9 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.750 -%define release 201110 +%define release 201111 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index dbd631dc57..c95cb92ab2 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201110" +PI_BUILD="201111" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index d0f9298278..250829ecbd 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.750 PS201110"; +my $version = "7.0NG.750 PS201111"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index e043a0a4b3..3fb25264fd 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.750 PS201110"; +my $version = "7.0NG.750 PS201111"; # save program name for logging my $progname = basename($0); From 2632256c10e2a74a441dd9f2e4b65024f78b14c7 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 11 Nov 2020 17:45:21 +0100 Subject: [PATCH 163/230] fixed agent creation with unique ip condition --- pandora_console/include/functions_api.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index a7f6ef8c81..b69bc9efe0 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1570,7 +1570,9 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) $nombre_agente = $alias; } - if ($direccion_agente != '') { + $exists_ip = false; + + if ($config['unique_ip'] && $direccion_agente != '') { $exists_ip = db_get_row_sql('SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"'); } From 834b102ad2a405e89d2ee0155d12d0c2e46826cc Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 12 Nov 2020 01:00:32 +0100 Subject: [PATCH 164/230] 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 d45b4bafb5..b2e9a3be90 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201111 +Version: 7.0NG.750-201112 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 0fa21bd5a0..dda4461ab0 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.750-201111" +pandora_version="7.0NG.750-201112" 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 f15435c581..5fade62bba 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201111'; +use constant AGENT_BUILD => '201112'; # 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 d3d3cfc4c8..2cd67ee579 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.750 -%define release 201111 +%define release 201112 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 d8e990c2a6..1fc7ff3f06 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.750 -%define release 201111 +%define release 201112 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 782c61cce4..e2d0595a52 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201111" +PI_BUILD="201112" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 02ce38fb77..8b61d57cc0 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201111} +{201112} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index cfdae5a3a3..e0ae457e3b 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.750(Build 201111)") +#define PANDORA_VERSION ("7.0NG.750(Build 201112)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index b327a39ac2..1c3b3d4c29 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.750(Build 201111))" + VALUE "ProductVersion", "(7.0NG.750(Build 201112))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index b2eb6352d5..35796ce95a 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201111 +Version: 7.0NG.750-201112 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 1f4736fe3d..35e2211f6c 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.750-201111" +pandora_version="7.0NG.750-201112" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7ff6335385..4417e157a5 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 = 'PC201111'; +$build_version = 'PC201112'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 5938e2f1bc..668b70b74c 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 de60dbcdab..55bd553b9a 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.750 -%define release 201111 +%define release 201112 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 08f8aa5ed9..afb1e8290d 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.750 -%define release 201111 +%define release 201112 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index c95cb92ab2..356cafbfd2 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201111" +PI_BUILD="201112" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 250829ecbd..67a9718866 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.750 PS201111"; +my $version = "7.0NG.750 PS201112"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3fb25264fd..bd64108725 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.750 PS201111"; +my $version = "7.0NG.750 PS201112"; # save program name for logging my $progname = basename($0); From 023c72b44b20f2d96f60eb17f731295a61ae269d Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 12 Nov 2020 15:42:43 +0100 Subject: [PATCH 165/230] change compose to use latest --- extras/docker/centos8/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/docker/centos8/docker-compose.yml b/extras/docker/centos8/docker-compose.yml index f33b6fe9ed..5ac5385133 100644 --- a/extras/docker/centos8/docker-compose.yml +++ b/extras/docker/centos8/docker-compose.yml @@ -17,7 +17,7 @@ services: - pandora pandora: - image: pandorafms/pandorafms-open-stack-el8:749 + image: pandorafms/pandorafms-open-stack-el8:latest restart: always depends_on: - db From 6fcc1107ec0221f0670dd164053f999a6eb7ce4a Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 13 Nov 2020 01:00:33 +0100 Subject: [PATCH 166/230] 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 b2e9a3be90..11af93db7a 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201112 +Version: 7.0NG.750-201113 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 dda4461ab0..44e2ba2f16 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.750-201112" +pandora_version="7.0NG.750-201113" 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 5fade62bba..6b1ad5db29 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201112'; +use constant AGENT_BUILD => '201113'; # 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 2cd67ee579..841a7d88a5 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.750 -%define release 201112 +%define release 201113 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 1fc7ff3f06..68d99d4b99 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.750 -%define release 201112 +%define release 201113 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 e2d0595a52..7086c680d2 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201112" +PI_BUILD="201113" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 8b61d57cc0..573a61183b 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201112} +{201113} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index e0ae457e3b..b0fbe22041 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.750(Build 201112)") +#define PANDORA_VERSION ("7.0NG.750(Build 201113)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 1c3b3d4c29..f701ac13b0 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.750(Build 201112))" + VALUE "ProductVersion", "(7.0NG.750(Build 201113))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 35796ce95a..d553f1c1c0 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201112 +Version: 7.0NG.750-201113 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 35e2211f6c..1964be545a 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.750-201112" +pandora_version="7.0NG.750-201113" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4417e157a5..b54255fd23 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 = 'PC201112'; +$build_version = 'PC201113'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 668b70b74c..061c98a038 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 55bd553b9a..660259f4a8 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.750 -%define release 201112 +%define release 201113 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index afb1e8290d..40575b6ead 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.750 -%define release 201112 +%define release 201113 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 356cafbfd2..b22c22dbb3 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201112" +PI_BUILD="201113" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 67a9718866..a76bb23d2b 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.750 PS201112"; +my $version = "7.0NG.750 PS201113"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index bd64108725..7a34f7112d 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.750 PS201112"; +my $version = "7.0NG.750 PS201113"; # save program name for logging my $progname = basename($0); From 86d22909612cf26b166aa3785df2b19cecacc59b Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 14:53:31 +0100 Subject: [PATCH 167/230] Solve issue --- pandora_console/include/functions_events.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 33c2309e30..5fabdedda0 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4166,7 +4166,15 @@ function events_page_details($event, $server='') if (!empty($agent)) { $data = []; $data[0] = '
'.__('Name').'
'; - if (can_user_access_node()) { + if (can_user_access_node() && is_metaconsole() && agents_check_agent_exists($event['id_agente'], true, true)) { + $data[1] = ui_print_truncate_text( + $agent['alias'], + 'agent_medium', + true, + true, + true + ).ui_print_help_tip(__('This agent belongs to metaconsole, is not possible display it'), true); + } else if (can_user_access_node()) { $data[1] = ui_print_agent_name( $event['id_agente'], true, From 26ab48073b0d1f7b24dbb998b27115d8ccdcb24c Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 14 Nov 2020 01:00:30 +0100 Subject: [PATCH 168/230] 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 11af93db7a..77927230cc 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201113 +Version: 7.0NG.750-201114 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 44e2ba2f16..6596e22263 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.750-201113" +pandora_version="7.0NG.750-201114" 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 6b1ad5db29..685dbe9ac6 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201113'; +use constant AGENT_BUILD => '201114'; # 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 841a7d88a5..b8696f339b 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.750 -%define release 201113 +%define release 201114 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 68d99d4b99..4b778a1d0e 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.750 -%define release 201113 +%define release 201114 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 7086c680d2..bb8af40557 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201113" +PI_BUILD="201114" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 573a61183b..f166853a8f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201113} +{201114} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b0fbe22041..8b00ba52aa 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.750(Build 201113)") +#define PANDORA_VERSION ("7.0NG.750(Build 201114)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index f701ac13b0..996992df06 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.750(Build 201113))" + VALUE "ProductVersion", "(7.0NG.750(Build 201114))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index d553f1c1c0..baafcc681a 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201113 +Version: 7.0NG.750-201114 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 1964be545a..e2b7fc5c21 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.750-201113" +pandora_version="7.0NG.750-201114" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b54255fd23..740769e181 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 = 'PC201113'; +$build_version = 'PC201114'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 061c98a038..dc4e2e2183 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 660259f4a8..60fe49f9dc 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.750 -%define release 201113 +%define release 201114 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 40575b6ead..66dd616155 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.750 -%define release 201113 +%define release 201114 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index b22c22dbb3..678e7eeb1c 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201113" +PI_BUILD="201114" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index a76bb23d2b..5b20db345c 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.750 PS201113"; +my $version = "7.0NG.750 PS201114"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 7a34f7112d..117acd233e 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.750 PS201113"; +my $version = "7.0NG.750 PS201114"; # save program name for logging my $progname = basename($0); From efa96ab9477542a06b37f1e273df5f2f7641c891 Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 15 Nov 2020 01:00:31 +0100 Subject: [PATCH 169/230] 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 77927230cc..d0f3dcd2df 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201114 +Version: 7.0NG.750-201115 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 6596e22263..c269449cc2 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.750-201114" +pandora_version="7.0NG.750-201115" 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 685dbe9ac6..64a252655c 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201114'; +use constant AGENT_BUILD => '201115'; # 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 b8696f339b..89869980cc 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.750 -%define release 201114 +%define release 201115 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 4b778a1d0e..ea370a6e40 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.750 -%define release 201114 +%define release 201115 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 bb8af40557..39f7961ae6 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201114" +PI_BUILD="201115" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index f166853a8f..f4f3d7bcc5 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201114} +{201115} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 8b00ba52aa..651ad47e8c 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.750(Build 201114)") +#define PANDORA_VERSION ("7.0NG.750(Build 201115)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 996992df06..403e7a8e0a 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.750(Build 201114))" + VALUE "ProductVersion", "(7.0NG.750(Build 201115))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index baafcc681a..ab25862c7c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201114 +Version: 7.0NG.750-201115 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 e2b7fc5c21..a6306391f5 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.750-201114" +pandora_version="7.0NG.750-201115" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 740769e181..978f097e4c 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 = 'PC201114'; +$build_version = 'PC201115'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index dc4e2e2183..73e4739bb6 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 60fe49f9dc..bf5cb70a53 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.750 -%define release 201114 +%define release 201115 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 66dd616155..28ea5515f9 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.750 -%define release 201114 +%define release 201115 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 678e7eeb1c..cf20d3fafb 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201114" +PI_BUILD="201115" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 5b20db345c..5e6c066c2c 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.750 PS201114"; +my $version = "7.0NG.750 PS201115"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 117acd233e..4faeca32b4 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.750 PS201114"; +my $version = "7.0NG.750 PS201115"; # save program name for logging my $progname = basename($0); From 810db1eec449e55358038ed0a2bee8eee015ef5e Mon Sep 17 00:00:00 2001 From: artica Date: Mon, 16 Nov 2020 01:00:30 +0100 Subject: [PATCH 170/230] 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 d0f3dcd2df..abe975fa4b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201115 +Version: 7.0NG.750-201116 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 c269449cc2..df9a496ca0 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.750-201115" +pandora_version="7.0NG.750-201116" 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 64a252655c..fefe27defc 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201115'; +use constant AGENT_BUILD => '201116'; # 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 89869980cc..791d58aa08 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.750 -%define release 201115 +%define release 201116 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 ea370a6e40..1efdfb74ca 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.750 -%define release 201115 +%define release 201116 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 39f7961ae6..309724cd5d 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201115" +PI_BUILD="201116" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index f4f3d7bcc5..118ca3e011 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201115} +{201116} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 651ad47e8c..05ad54b828 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.750(Build 201115)") +#define PANDORA_VERSION ("7.0NG.750(Build 201116)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 403e7a8e0a..512b2e5d30 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.750(Build 201115))" + VALUE "ProductVersion", "(7.0NG.750(Build 201116))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ab25862c7c..29b793cb75 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201115 +Version: 7.0NG.750-201116 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 a6306391f5..2cea2ac429 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.750-201115" +pandora_version="7.0NG.750-201116" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 978f097e4c..28111b9785 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 = 'PC201115'; +$build_version = 'PC201116'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 73e4739bb6..1e31dde741 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 bf5cb70a53..d399b2df1f 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.750 -%define release 201115 +%define release 201116 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 28ea5515f9..82aa51a63f 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.750 -%define release 201115 +%define release 201116 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index cf20d3fafb..8c3b442014 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201115" +PI_BUILD="201116" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 5e6c066c2c..48104968ac 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.750 PS201115"; +my $version = "7.0NG.750 PS201116"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 4faeca32b4..bd0c7035cb 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.750 PS201115"; +my $version = "7.0NG.750 PS201116"; # save program name for logging my $progname = basename($0); From 8bcbe0ab775554ea3ef239b80fe54e1e8399f9d4 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 16 Nov 2020 19:16:25 +0100 Subject: [PATCH 171/230] Fixed agent details in MC --- pandora_console/include/functions.php | 33 ++++++++++++++----- .../include/functions_treeview.php | 29 +++++++++++++--- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index a67379b07d..b1c537c6aa 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2289,13 +2289,19 @@ function check_login($output=true) * @param integer $id_group Agents group id to check from * @param string $access Access privilege * @param boolean $onlyOneGroup Flag to check acl for specified group only (not to roots up, or check acl for 'All' group when $id_group is 0). + * @param boolean $cache Use cache. * * @return boolean 1 if the user has privileges, 0 if not. */ -function check_acl($id_user, $id_group, $access, $onlyOneGroup=false) -{ +function check_acl( + $id_user, + $id_group, + $access, + $onlyOneGroup=false, + $cache=true +) { if (empty($id_user)) { - // User ID needs to be specified + // User ID needs to be specified. trigger_error('Security error: check_acl got an empty string for user id', E_USER_WARNING); return 0; } else if (is_user_admin($id_user)) { @@ -2305,7 +2311,15 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup=false) } if ($id_group != 0 || $onlyOneGroup === true) { - $groups_list_acl = users_get_groups($id_user, $access, false, true, null); + $groups_list_acl = users_get_groups( + $id_user, + $access, + false, + true, + null, + 'id_grupo', + $cache + ); } else { $groups_list_acl = get_users_acl($id_user); } @@ -2330,16 +2344,17 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup=false) /** * Check the ACL of a list of groups. * - * @param string $id_user to check the ACL - * @param array $groups. All groups to check - * @param string $access. Profile to check + * @param string $id_user to check the ACL + * @param array $groups. All groups to check + * @param string $access. Profile to check + * @param boolean $cache Use cached group information. * * @return boolean True if at least one of this groups check the ACL */ -function check_acl_one_of_groups($id_user, $groups, $access) +function check_acl_one_of_groups($id_user, $groups, $access, $cache=true) { foreach ($groups as $group) { - if (check_acl($id_user, $group, $access)) { + if (check_acl($id_user, $group, $access, false, $cache)) { return true; } } diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 67bed22be3..6663623e8b 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -537,15 +537,30 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) // Check all groups $groups = agents_get_all_groups_agent($id_agente, $agent['id_grupo']); - if (! check_acl_one_of_groups($config['id_user'], $groups, 'AR') && ! check_acl_one_of_groups($config['id_user'], $groups, 'AW') && !$is_extra) { + + if (is_metaconsole()) { + if (! check_acl_one_of_groups($config['id_user'], $groups, 'AR', false) + && ! check_acl_one_of_groups($config['id_user'], $groups, 'AW', false) + ) { + $grants_on_node = false; + } else { + $grants_on_node = true; + } + } + + if (is_metaconsole()) { + metaconsole_restore_db(); + } + + if (! check_acl_one_of_groups($config['id_user'], $groups, 'AR', false) + && ! check_acl_one_of_groups($config['id_user'], $groups, 'AW', false) + && !$is_extra + ) { db_pandora_audit( 'ACL Violation', 'Trying to access Agent General Information' ); include_once 'general/noaccess.php'; - if (!empty($server_data) && is_metaconsole()) { - metaconsole_restore_db(); - } return; } @@ -586,7 +601,11 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) $hashdata = md5($hashdata); $url = $server_data['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agent['id_agente'].'&'.'loginhash=auto&'."loginhash_data=$hashdata&".'loginhash_user='.str_rot13($user); - $cellName .= ''.''.$agent['alias'].''; + if ($grants_on_node) { + $cellName .= ''.''.$agent['alias'].''; + } else { + $cellName .= ''.$agent['alias'].''; + } } else { $url = ui_get_full_url( 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'] From 9bfdfa87f6e49faac531e48677452bdbfe0b4655 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 17 Nov 2020 01:00:35 +0100 Subject: [PATCH 172/230] 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 abe975fa4b..c04532b201 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201116 +Version: 7.0NG.750-201117 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 df9a496ca0..062fd2b5ab 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.750-201116" +pandora_version="7.0NG.750-201117" 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 fefe27defc..b95ec56038 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201116'; +use constant AGENT_BUILD => '201117'; # 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 791d58aa08..9adeec5ba6 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.750 -%define release 201116 +%define release 201117 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 1efdfb74ca..9377d1c075 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.750 -%define release 201116 +%define release 201117 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 309724cd5d..87e6074406 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201116" +PI_BUILD="201117" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 118ca3e011..71a39cd889 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201116} +{201117} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 05ad54b828..a214e86e92 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.750(Build 201116)") +#define PANDORA_VERSION ("7.0NG.750(Build 201117)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 512b2e5d30..d8e3d7c0f3 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.750(Build 201116))" + VALUE "ProductVersion", "(7.0NG.750(Build 201117))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 29b793cb75..4790280bb5 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201116 +Version: 7.0NG.750-201117 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 2cea2ac429..b65682bfe7 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.750-201116" +pandora_version="7.0NG.750-201117" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 28111b9785..e7efbbb0a0 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 = 'PC201116'; +$build_version = 'PC201117'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 1e31dde741..d54728a983 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 d399b2df1f..e9bebe9e88 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.750 -%define release 201116 +%define release 201117 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 82aa51a63f..a8e32d58b6 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.750 -%define release 201116 +%define release 201117 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 4ed4bfc774..e57ae135b4 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201116" +PI_BUILD="201117" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 48104968ac..dece40fdca 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.750 PS201116"; +my $version = "7.0NG.750 PS201117"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index bd0c7035cb..8015aa4681 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.750 PS201116"; +my $version = "7.0NG.750 PS201117"; # save program name for logging my $progname = basename($0); From f9ab9878255e16c3a51f3ba31bc5009503ec4481 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 17 Nov 2020 11:44:52 +0100 Subject: [PATCH 173/230] Avoid check ha nodes while navigating, scheduled --- .../include/class/ConsoleSupervisor.php | 149 +++++++++--------- 1 file changed, 77 insertions(+), 72 deletions(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 473a5d3be5..893823576b 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -153,58 +153,58 @@ class ConsoleSupervisor /* * PHP configuration warnings: - * NOTIF.PHP.SAFE_MODE - * NOTIF.PHP.INPUT_TIME - * NOTIF.PHP.EXECUTION_TIME - * NOTIF.PHP.UPLOAD_MAX_FILESIZE - * NOTIF.PHP.MEMORY_LIMIT - * NOTIF.PHP.DISABLE_FUNCTIONS - * NOTIF.PHP.PHANTOMJS - * NOTIF.PHP.VERSION + * NOTIF.PHP.SAFE_MODE + * NOTIF.PHP.INPUT_TIME + * NOTIF.PHP.EXECUTION_TIME + * NOTIF.PHP.UPLOAD_MAX_FILESIZE + * NOTIF.PHP.MEMORY_LIMIT + * NOTIF.PHP.DISABLE_FUNCTIONS + * NOTIF.PHP.PHANTOMJS + * NOTIF.PHP.VERSION */ $this->checkPHPSettings(); /* * Check license. - * NOTIF.LICENSE.EXPIRATION + * NOTIF.LICENSE.EXPIRATION */ $this->checkLicense(); /* * Check component statuses (servers down - frozen). - * NOTIF.SERVER.STATUS.ID_SERVER + * NOTIF.SERVER.STATUS.ID_SERVER */ $this->checkPandoraServers(); /* * Check at least 1 server running in master mode. - * NOTIF.SERVER.MASTER + * NOTIF.SERVER.MASTER */ $this->checkPandoraServerMasterAvailable(); /* * Check if CRON is running. - * NOTIF.CRON.CONFIGURED + * NOTIF.CRON.CONFIGURED */ - if (enterprise_installed()) { + if ((bool) enterprise_installed() === true) { $this->checkCronRunning(); } /* * Check if instance is registered. - * NOTIF.UPDATEMANAGER.REGISTRATION + * NOTIF.UPDATEMANAGER.REGISTRATION */ $this->checkUpdateManagerRegistration(); /* * Check if there're new messages in UM. - * NOTIF.UPDATEMANAGER.MESSAGES + * NOTIF.UPDATEMANAGER.MESSAGES */ $this->getUMMessages(); @@ -212,31 +212,32 @@ class ConsoleSupervisor /* * Check if the Server and Console has * the same versions. + * NOTIF.SERVER.MISALIGNED */ + $this->checkConsoleServerVersions(); /* * Check if AllowOverride is None or All. * NOTIF.ALLOWOVERIDE.MESSAGE */ - $this->checkAllowOverrideEnabled(); - /* - * Check if AllowOverride is None or All. - * NOTIF.HAMASTER.MESSAGE - */ - $this->checkHaStatus(); + $this->checkAllowOverrideEnabled(); /* * Check if the Pandora Console log * file remains in old location. + * NOTIF.PANDORACONSOLE.LOG.OLD */ + $this->checkPandoraConsoleLogOldLocation(); /* * Check if the audit log file * remains in old location. + * NOTIF.AUDIT.LOG.OLD */ + $this->checkAuditLogOldLocation(); } @@ -280,65 +281,65 @@ class ConsoleSupervisor /* * Check license. - * NOTIF.LICENSE.EXPIRATION - * NOTIF.LICENSE.LIMITED + * NOTIF.LICENSE.EXPIRATION + * NOTIF.LICENSE.LIMITED */ $this->checkLicense(); /* * Check number of files in attachment: - * NOTIF.FILES.ATTACHMENT + * NOTIF.FILES.ATTACHMENT */ $this->checkAttachment(); /* * Files in data_in: - * NOTIF.FILES.DATAIN (>1000) - * NOTIF.FILES.DATAIN.BADXML (>150) + * NOTIF.FILES.DATAIN (>1000) + * NOTIF.FILES.DATAIN.BADXML (>150) */ $this->checkDataIn(); /* * Check module queues not growing: - * NOTIF.SERVER.QUEUE.ID_SERVER + * NOTIF.SERVER.QUEUE.ID_SERVER */ $this->checkServers(); /* * Check component statuses (servers down - frozen). - * NOTIF.SERVER.STATUS.ID_SERVER + * NOTIF.SERVER.STATUS.ID_SERVER */ $this->checkPandoraServers(); /* * Check at least 1 server running in master mode. - * NOTIF.SERVER.MASTER + * NOTIF.SERVER.MASTER */ $this->checkPandoraServerMasterAvailable(); /* * PHP configuration warnings: - * NOTIF.PHP.SAFE_MODE - * NOTIF.PHP.INPUT_TIME - * NOTIF.PHP.EXECUTION_TIME - * NOTIF.PHP.UPLOAD_MAX_FILESIZE - * NOTIF.PHP.MEMORY_LIMIT - * NOTIF.PHP.DISABLE_FUNCTIONS - * NOTIF.PHP.PHANTOMJS - * NOTIF.PHP.VERSION + * NOTIF.PHP.SAFE_MODE + * NOTIF.PHP.INPUT_TIME + * NOTIF.PHP.EXECUTION_TIME + * NOTIF.PHP.UPLOAD_MAX_FILESIZE + * NOTIF.PHP.MEMORY_LIMIT + * NOTIF.PHP.DISABLE_FUNCTIONS + * NOTIF.PHP.PHANTOMJS + * NOTIF.PHP.VERSION */ $this->checkPHPSettings(); /* * Check connection with historical DB (if enabled). - * NOTIF.HISTORYDB + * NOTIF.HISTORYDB */ $this->checkPandoraHistoryDB(); @@ -346,23 +347,23 @@ class ConsoleSupervisor /* * Check pandoradb running in main DB. * Check pandoradb running in historical DB. - * NOTIF.PANDORADB - * NOTIF.PANDORADB.HISTORICAL + * NOTIF.PANDORADB + * NOTIF.PANDORADB.HISTORICAL */ $this->checkPandoraDBMaintenance(); /* * Check historical DB MR version. - * NOTIF.HISTORYDB.MR + * NOTIF.HISTORYDB.MR */ $this->checkPandoraHistoryDBMR(); /* * Check external components. - * NOTIF.EXT.ELASTICSEARCH - * NOTIF.EXT.LOGSTASH + * NOTIF.EXT.ELASTICSEARCH + * NOTIF.EXT.LOGSTASH * */ @@ -370,76 +371,76 @@ class ConsoleSupervisor /* * Check Metaconsole synchronization issues. - * NOTIF.METACONSOLE.DB_CONNECTION + * NOTIF.METACONSOLE.DB_CONNECTION */ $this->checkMetaconsole(); /* * Check incoming scheduled downtimes (< 15d). - * NOTIF.DOWNTIME + * NOTIF.DOWNTIME */ $this->checkDowntimes(); /* * Check if instance is registered. - * NOTIF.UPDATEMANAGER.REGISTRATION + * NOTIF.UPDATEMANAGER.REGISTRATION */ $this->checkUpdateManagerRegistration(); /* * Check if event storm protection is activated. - * NOTIF.MISC.EVENTSTORMPROTECTION + * NOTIF.MISC.EVENTSTORMPROTECTION */ $this->checkEventStormProtection(); /* * Check if develop_bypass is enabled. - * NOTIF.MISC.DEVELOPBYPASS + * NOTIF.MISC.DEVELOPBYPASS */ $this->checkDevelopBypass(); /* * Check if fontpath exists. - * NOTIF.MISC.FONTPATH + * NOTIF.MISC.FONTPATH */ $this->checkFont(); /* * Check if default user and password exists. - * NOTIF.SECURITY.DEFAULT_PASSWORD + * NOTIF.SECURITY.DEFAULT_PASSWORD */ $this->checkDefaultPassword(); /* * Check if there're new updates. - * NOTIF.UPDATEMANAGER.OPENSETUP - * NOTIF.UPDATEMANAGER.UPDATE + * NOTIF.UPDATEMANAGER.OPENSETUP + * NOTIF.UPDATEMANAGER.UPDATE */ $this->checkUpdates(); /* * Check if there're new minor updates available. - * NOTIF.UPDATEMANAGER.MINOR + * NOTIF.UPDATEMANAGER.MINOR */ $this->checkMinorRelease(); - if (enterprise_installed()) { + if ((bool) enterprise_installed() === true) { // Release the lock. enterprise_hook('cron_supervisor_release_lock'); } /* * Check if CRON is running. - * NOTIF.CRON.CONFIGURED + * NOTIF.CRON.CONFIGURED */ if (enterprise_installed()) { @@ -448,14 +449,14 @@ class ConsoleSupervisor /* * Check if instance is registered. - * NOTIF.UPDATEMANAGER.REGISTRATION + * NOTIF.UPDATEMANAGER.REGISTRATION */ $this->checkUpdateManagerRegistration(); /* * Check if there're new messages in UM. - * NOTIF.UPDATEMANAGER.MESSAGES + * NOTIF.UPDATEMANAGER.MESSAGES */ $this->getUMMessages(); @@ -463,18 +464,23 @@ class ConsoleSupervisor /* * Check if the Server and Console has * the same versions. + * NOTIF.SERVER.MISALIGNED */ + $this->checkConsoleServerVersions(); /* * Check if AllowOverride is None or All. + * NOTIF.ALLOWOVERRIDE.MESSAGE */ + $this->checkAllowOverrideEnabled(); - /* - * Check if HA status. - */ - if (enterprise_installed()) { + /* + * Check if HA status. + */ + + if ((bool) enterprise_installed() === true) { $this->checkHaStatus(); } @@ -482,13 +488,8 @@ class ConsoleSupervisor * Check if the audit log file * remains in old location. */ + $this->checkAuditLogOldLocation(); - - /* - Check if AllowOverride is None or All. - */ - $this->checkAllowOverrideEnabled(); - } @@ -960,11 +961,11 @@ class ConsoleSupervisor { global $config; - $remote_config_dir = io_safe_output($config['remote_config']); + $remote_config_dir = (string) io_safe_output($config['remote_config']); - if (enterprise_installed() - && isset($config['license_nms']) - && $config['license_nms'] != 1 + if ((bool) enterprise_installed() === true + && isset($config['license_nms']) === true + && (int) $config['license_nms'] !== 1 ) { if (is_readable($remote_config_dir) !== true) { $this->notify( @@ -1200,6 +1201,8 @@ class ConsoleSupervisor */ public function checkPandoraServers() { + global $config; + $servers = db_get_all_rows_sql( 'SELECT id_server, @@ -1297,6 +1300,8 @@ class ConsoleSupervisor */ public function checkPandoraServerMasterAvailable() { + global $config; + $n_masters = db_get_value_sql( 'SELECT count(*) as n @@ -2541,7 +2546,7 @@ class ConsoleSupervisor } - /* + /** * Check if Pandora console log file remains in old location. * * @return void From e0404d565a6f9fe8ce9724c1e761ecb59e77f606 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 17 Nov 2020 14:49:26 +0100 Subject: [PATCH 174/230] Fix vulnerability --- pandora_console/godmode/wizards/HostDevices.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index cb90d927b8..14ff80b163 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -336,6 +336,12 @@ class HostDevices extends Wizard ) ) ); + + // Forbidden chars cleaning. + foreach ($network as $key => $singleNetwork) { + $network[$key] = preg_replace('/[A-Za-z-()\']/', '', $singleNetwork); + } + unlink($_FILES['network_csv']['tmp_name']); if (empty($network) || is_array($network) === false) { $this->msg = __( From ce814ba5800b68bb8681e36eb88d1ed76f424720 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 18 Nov 2020 01:00:20 +0100 Subject: [PATCH 175/230] 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 c04532b201..1a85f7efbc 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201117 +Version: 7.0NG.750-201118 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 062fd2b5ab..6320af2c6a 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.750-201117" +pandora_version="7.0NG.750-201118" 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 b95ec56038..393197ca79 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201117'; +use constant AGENT_BUILD => '201118'; # 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 9adeec5ba6..8ddc1e1ba8 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.750 -%define release 201117 +%define release 201118 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 9377d1c075..602a8f2821 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.750 -%define release 201117 +%define release 201118 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 87e6074406..b1fc6d41e3 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201117" +PI_BUILD="201118" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 71a39cd889..921590b09a 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201117} +{201118} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index a214e86e92..58edb326e2 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.750(Build 201117)") +#define PANDORA_VERSION ("7.0NG.750(Build 201118)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d8e3d7c0f3..189d0d58c9 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.750(Build 201117))" + VALUE "ProductVersion", "(7.0NG.750(Build 201118))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 4790280bb5..4fb8d8f508 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201117 +Version: 7.0NG.750-201118 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 b65682bfe7..aacbc3f530 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.750-201117" +pandora_version="7.0NG.750-201118" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index e7efbbb0a0..ce9bd24b06 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 = 'PC201117'; +$build_version = 'PC201118'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index d54728a983..686a40172c 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 e9bebe9e88..4badf2fa3b 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.750 -%define release 201117 +%define release 201118 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index a8e32d58b6..33a601adef 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.750 -%define release 201117 +%define release 201118 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index e57ae135b4..2f2965202c 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201117" +PI_BUILD="201118" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index dece40fdca..af69a76ec9 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.750 PS201117"; +my $version = "7.0NG.750 PS201118"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 8015aa4681..7cbad9e4e8 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.750 PS201117"; +my $version = "7.0NG.750 PS201118"; # save program name for logging my $progname = basename($0); From 96387a874f1b81e0ff4474f7a52bb4aaba04a454 Mon Sep 17 00:00:00 2001 From: marcos Date: Wed, 18 Nov 2020 10:38:49 +0100 Subject: [PATCH 176/230] remove console log --- pandora_console/general/register.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index 12196fab08..07b63421a5 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -193,7 +193,6 @@ if (!$double_auth_enabled && $config['2FA_all_users'] != '' ?> '; echo ''; echo ''; - // Store servers timezone offset to be retrieved from js + // Store servers timezone offset to be retrieved from js. set_js_value('timezone_offset', date('Z', time())); } -extensions_add_operation_menu_option(__('Realtime graphs'), 'estado', null, 'v1r1', 'view'); +extensions_add_operation_menu_option( + __('Realtime graphs'), + 'estado', + null, + 'v1r1', + 'view' +); extensions_add_main_function('pandora_realtime_graphs'); $db = null; diff --git a/pandora_console/extensions/realtime_graphs/ajax.php b/pandora_console/extensions/realtime_graphs/ajax.php index dea94a5753..a09ef9bb29 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -69,15 +69,34 @@ switch ($graph) { case 'snmp_interface': case 'snmp_module': - $snmp_address = $_POST['snmp_address']; - $snmp_community = $_POST['snmp_community']; - $snmp_ver = $_POST['snmp_ver']; - $snmp_oid = $_POST['snmp_oid']; + $snmp_address = get_parameter('snmp_address', ''); + $snmp_community = get_parameter('snmp_community', ''); + $snmp_ver = get_parameter('snmp_ver', ''); + $snmp_oid = get_parameter('snmp_oid', ''); + $snmp3_auth_user = get_parameter('snmp3_auth_user', ''); + $snmp3_security_level = get_parameter('snmp3_security_level', ''); + $snmp3_auth_method = get_parameter('snmp3_auth_method', ''); + $snmp3_auth_pass = get_parameter('snmp3_auth_pass', ''); + $snmp3_privacy_method = get_parameter('snmp3_privacy_method', ''); + $snmp3_privacy_pass = get_parameter('snmp3_privacy_pass', ''); if (empty($snmp_address) || empty($snmp_oid)) { $data = 0; } else { - $data = get_snmpwalk($snmp_address, $snmp_ver, $snmp_community, '', '', '', '', '', '', 0, $snmp_oid); + $data = get_snmpwalk( + $snmp_address, + $snmp_ver, + $snmp_community, + $snmp3_auth_user, + $snmp3_security_level, + $snmp3_auth_method, + $snmp3_auth_pass, + $snmp3_privacy_method, + $snmp3_privacy_pass, + 0, + $snmp_oid, + $snmp_port + ); $data_index = array_keys($data); $graph_title = $data_index[0]; if (!empty($data)) { diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.js b/pandora_console/extensions/realtime_graphs/realtime_graphs.js index b5d6c1eaa8..088f31dbf6 100644 --- a/pandora_console/extensions/realtime_graphs/realtime_graphs.js +++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.js @@ -1,3 +1,4 @@ +/* global $, get_php_value */ (function() { var numberOfPoints = 100; var refresh = parseInt($("#refresh").val()); @@ -14,7 +15,7 @@ container: $("#chartLegend") }, xaxis: { - tickFormatter: function(timestamp, axis) { + tickFormatter: function(timestamp) { var date = new Date(timestamp * 1000); var server_timezone_offset = get_php_value("timezone_offset"); @@ -39,7 +40,7 @@ } }, yaxis: { - tickFormatter: function(value, axis) { + tickFormatter: function(value) { return shortNumber(roundToTwo(value)); } }, @@ -66,10 +67,16 @@ data: { graph: $("#graph :selected").val(), graph_title: $("#graph :selected").html(), - snmp_community: $("#text-snmp_community").val(), - snmp_oid: $("#text-snmp_oid").val(), - snmp_ver: $("#snmp_version :selected").val(), - snmp_address: $("#text-ip_target").val(), + snmp_community: $("#text-community").val(), + snmp_oid: $("#text-starting_oid").val(), + snmp_ver: $("#snmp_browser_version").val(), + snmp_address: $("#text-target_ip").val(), + snmp3_auth_user: $("#text-snmp3_browser_auth_user").val(), + snmp3_security_level: $("#snmp3_browser_security_level").val(), + snmp3_auth_method: $("#snmp3_browser_auth_method").val(), + snmp3_auth_pass: $("#password-snmp3_browser_auth_pass").val(), + snmp3_privacy_method: $("#snmp3_browser_privacy_method").val(), + snmp3_privacy_pass: $("#password-snmp3_browser_privacy_pass").val(), refresh: refresh }, success: function(serie) { @@ -87,7 +94,7 @@ } if (data.length === 0) { - for (i = 0; i < numberOfPoints; i++) { + for (var i = 0; i < numberOfPoints; i++) { var step = i * (refresh / 1000); serie.data.unshift([timestamp - step, 0]); } @@ -123,7 +130,7 @@ var data = plot.getData(); if (data.length === 0) return; - for (i = 0; i < data[0].data.length; i++) { + for (var i = 0; i < data[0].data.length; i++) { data[0].data[i][1] = 0; } if (incremental) lastIncVal = null; diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index e28c255f9c..b28cde4936 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -3395,16 +3395,16 @@ function recursive_get_dt_from_modules_tree(&$f_modules, $modules, $deep) /** * @brief Get the button with the link to open realtime stats into a new window - * Only to native (not satellite discovered) snmp modules. + * Only to native (not satellite discovered) snmp modules. * - * @param array With all the module info - * @return string All the HTML code to paint the button + * @param array $module With all the module info. + * @return string Link to chart. */ function get_module_realtime_link_graph($module) { global $config; - // Sometimes some parameters are renamed + // Sometimes some parameters are renamed. if (!isset($module['id_tipo_modulo'])) { $module['id_tipo_modulo'] = $module['module_type']; } @@ -3413,36 +3413,51 @@ function get_module_realtime_link_graph($module) $module['nombre'] = $module['module_name']; } - // Avoid to show on metaconsole + // Avoid to show on metaconsole. if (is_metaconsole()) { return ''; } - // Realtime graph is an extension and it should be enabled + // Realtime graph is an extension and it should be enabled. if (!extensions_is_enabled_extension('realtime_graphs.php')) { return ''; } - // Only to remote_snmp, remote_snmp_proc. snmp_snmp_inc - if ($module['id_tipo_modulo'] != 15 && $module['id_tipo_modulo'] != 16 && $module['id_tipo_modulo'] != 18) { + // Only to remote_snmp, remote_snmp_proc. snmp_snmp_inc. + if ($module['id_tipo_modulo'] != 15 + && $module['id_tipo_modulo'] != 16 + && $module['id_tipo_modulo'] != 18 + ) { return ''; } - // Only version 1, 2 and 2c - if ($module['tcp_send'] != '1' && $module['tcp_send'] != '2' && $module['tcp_send'] != '2c') { + // Only version 1, 2, 2c and 3 + if ($module['tcp_send'] != '1' + && $module['tcp_send'] != '2' + && $module['tcp_send'] != '2c' + && $module['tcp_send'] != '3' + ) { return ''; } $params = [ - 'graph' => 'snmp_module', - 'agent_alias' => urlencode(modules_get_agentmodule_agent_alias($module['id_agente_modulo'])), - 'module_name' => urlencode($module['nombre']), - 'snmp_address' => $module['ip_target'], - 'snmp_community' => urlencode($module['snmp_community']), - 'snmp_oid' => $module['snmp_oid'], - 'snmp_ver' => $module['tcp_send'], - 'hide_header' => 1, - 'rel_path' => '../../', + 'graph' => 'snmp_module', + 'agent_alias' => urlencode( + modules_get_agentmodule_agent_alias($module['id_agente_modulo']) + ), + 'module_name' => urlencode($module['nombre']), + 'target_ip' => $module['ip_target'], + 'community' => urlencode($module['snmp_community']), + 'starting_oid' => urlencode($module['snmp_oid']), + 'snmp_browser_version' => urlencode($module['tcp_send']), + 'snmp3_auth_user' => urlencode($module['plugin_user']), + 'snmp3_security_level' => urlencode($module['custom_string_3']), + 'snmp3_auth_method' => urlencode($module['plugin_parameters']), + 'snmp3_auth_pass' => urlencode($module['plugin_pass']), + 'snmp3_privacy_method' => urlencode($module['custom_string_1']), + 'snmp3_privacy_pass' => urlencode($module['custom_string_2']), + 'hide_header' => 1, + 'rel_path' => '../../', ]; // Incremental type if ($module['id_tipo_modulo'] == 16) { @@ -3456,9 +3471,13 @@ function get_module_realtime_link_graph($module) $link = substr($link, 0, -1); - $win_handle = 'realtime_'.dechex(crc32($module['id_agente_modulo'].$module['nombre'])); + $win_handle = 'realtime_'; + $win_handle .= dechex( + crc32($module['id_agente_modulo'].$module['nombre']) + ); - $link_button = ''.html_print_image( + $link_button = ''; + $link_button .= html_print_image( 'images/realtime_shortcut.png', true, [ @@ -3466,7 +3485,8 @@ function get_module_realtime_link_graph($module) 'alt' => '', 'title' => __('Realtime SNMP graph'), ] - ).''; + ); + $link_button .= ''; return $link_button; } diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index c4ef3b05ab..3f66c790ae 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -669,18 +669,29 @@ function snmp_browser_print_oid( /** - * Print the div that contains the SNMP browser. + * Print browser container. * - * @param bool return The result is printed if set to true or returned if set to false. - * @param string width Width of the SNMP browser. Units must be specified. - * @param string height Height of the SNMP browser. Units must be specified. - * @param string display CSS display value for the container div. Set to none to hide the div. + * @param boolean $return The result is printed + * if set to true or returned if set to false. + * @param string $width Width of the SNMP browser. + * Units must be specified. + * @param string $height Height of the SNMP browser. + * Units must be specified. + * @param string $display CSS display value for the + * container div. Set to none to hide the div. + * @param boolean $show_massive_buttons Massive buttons. * - * @return string The container div. + * @return string html. */ -function snmp_browser_print_container($return=false, $width='100%', $height='60%', $display='', $show_massive_buttons=false) -{ - // Target selection +function snmp_browser_print_container( + $return=false, + $width='100%', + $height='60%', + $display='', + $show_massive_buttons=false +) { + $snmp_version = get_parameter('snmp_browser_version', '2c'); + // Target selection. $table = new stdClass(); $table->width = '100%'; $table->class = 'databox filters'; @@ -754,12 +765,36 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60% } } - $table->data[1][1] = ''.__('Server to execute').'   '; - $table->data[1][1] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true); + $table->data[1][1] = ''; + $table->data[1][1] .= __('Server to execute'); + $table->data[1][1] .= '   '; + $table->data[1][1] .= html_print_select( + $servers_to_exec, + 'server_to_exec', + '', + '', + '', + '', + true + ); - $table->data[1][2] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true); + $table->data[1][2] = html_print_button( + __('Browse'), + 'browse', + false, + 'snmpBrowse()', + 'class="sub search" style="margin-top:0px;"', + true + ); + + // SNMP v3 options. + $snmp3_auth_user = get_parameter('snmp3_auth_user', ''); + $snmp3_security_level = get_parameter('snmp3_security_level', 'authNoPriv'); + $snmp3_auth_method = get_parameter('snmp3_auth_method', 'MD5'); + $snmp3_auth_pass = get_parameter('snmp3_auth_pass', ''); + $snmp3_privacy_method = get_parameter('snmp3_privacy_method', 'AES'); + $snmp3_privacy_pass = get_parameter('snmp3_privacy_pass', ''); - // SNMP v3 options $table3 = new stdClass(); $table3->width = '100%'; @@ -767,18 +802,69 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60% $table3->valign[1] = ''; $table3->data[2][1] = ''.__('Auth user').''; - $table3->data[2][2] = html_print_input_text('snmp3_browser_auth_user', '', '', 15, 60, true); + $table3->data[2][2] = html_print_input_text( + 'snmp3_browser_auth_user', + $snmp3_auth_user, + '', + 15, + 60, + true + ); + $table3->data[2][3] = ''.__('Auth password').''; - $table3->data[2][4] = html_print_input_password('snmp3_browser_auth_pass', '', '', 15, 60, true); - $table3->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_fsb', true); + $table3->data[2][4] = html_print_input_password( + 'snmp3_browser_auth_pass', + $snmp3_auth_pass, + '', + 15, + 60, + true + ); + + $table3->data[2][4] .= html_print_input_hidden_extended( + 'active_snmp_v3', + 0, + 'active_snmp_v3_fsb', + true + ); $table3->data[5][0] = ''.__('Privacy method').''; - $table3->data[5][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_browser_privacy_method', '', '', '', '', true); + $table3->data[5][1] = html_print_select( + [ + 'DES' => __('DES'), + 'AES' => __('AES'), + ], + 'snmp3_browser_privacy_method', + $snmp3_privacy_method, + '', + '', + '', + true + ); + $table3->data[5][2] = ''.__('Privacy pass').''; - $table3->data[5][3] = html_print_input_password('snmp3_browser_privacy_pass', '', '', 15, 60, true); + $table3->data[5][3] = html_print_input_password( + 'snmp3_browser_privacy_pass', + $snmp3_privacy_pass, + '', + 15, + 60, + true + ); $table3->data[6][0] = ''.__('Auth method').''; - $table3->data[6][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_browser_auth_method', '', '', '', '', true); + $table3->data[6][1] = html_print_select( + [ + 'MD5' => __('MD5'), + 'SHA' => __('SHA'), + ], + 'snmp3_browser_auth_method', + $snmp3_auth_method, + '', + '', + '', + true + ); $table3->data[6][2] = ''.__('Security level').''; $table3->data[6][3] = html_print_select( [ @@ -787,29 +873,92 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60% 'authPriv' => __('Auth and privacy method'), ], 'snmp3_browser_security_level', - '', + $snmp3_security_level, '', '', '', true ); - // Search tools + // Search tools. $table2 = new stdClass(); $table2->width = '100%'; $table2->class = 'databox filters'; $table2->size = []; $table2->data = []; - $table2->data[0][0] = html_print_input_text('search_text', '', '', 25, 0, true); - $table2->data[0][0] .= ''.html_print_image('images/zoom.png', true, ['title' => __('Search'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchText();']).''; - $table2->data[0][1] = ' '.''.html_print_image('images/go_first.png', true, ['title' => __('First match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchFirstMatch();']).''; - $table2->data[0][1] .= ' '.''.html_print_image('images/go_previous.png', true, ['title' => __('Previous match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchPrevMatch();']).''; - $table2->data[0][1] .= ' '.''.html_print_image('images/go_next.png', true, ['title' => __('Next match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchNextMatch();']).''; - $table2->data[0][1] .= ' '.''.html_print_image('images/go_last.png', true, ['title' => __('Last match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchLastMatch();']).''; + $table2->data[0][0] = html_print_input_text( + 'search_text', + '', + '', + 25, + 0, + true + ); + $table2->data[0][0] .= ''; + $table2->data[0][0] .= html_print_image( + 'images/zoom.png', + true, + [ + 'title' => __('Search'), + 'style' => 'vertical-align: middle;', + 'onclick' => 'searchText();', + ] + ); + $table2->data[0][0] .= ''; + + $table2->data[0][1] = ' '; + $table2->data[0][1] .= ''; + $table2->data[0][1] .= html_print_image( + 'images/go_first.png', + true, + [ + 'title' => __('First match'), + 'style' => 'vertical-align: middle;', + 'onclick' => 'searchFirstMatch();', + ] + ); + $table2->data[0][1] .= ''; + $table2->data[0][1] .= ' '; + $table2->data[0][1] .= ''; + $table2->data[0][1] .= html_print_image( + 'images/go_previous.png', + true, + [ + 'title' => __('Previous match'), + 'style' => 'vertical-align: middle;', + 'onclick' => 'searchPrevMatch();', + ] + ); + $table2->data[0][1] .= ''; + $table2->data[0][1] .= ' '; + $table2->data[0][1] .= ''; + $table2->data[0][1] .= html_print_image( + 'images/go_next.png', + true, + [ + 'title' => __('Next match'), + 'style' => 'vertical-align: middle;', + 'onclick' => 'searchNextMatch();', + ] + ); + $table2->data[0][1] .= ''; + $table2->data[0][1] .= ' '; + $table2->data[0][1] .= ''; + $table2->data[0][1] .= html_print_image( + 'images/go_last.png', + true, + [ + 'title' => __('Last match'), + 'style' => 'vertical-align: middle;', + 'onclick' => 'searchLastMatch();', + ] + ); + $table2->data[0][1] .= ''; $table2->cellstyle[0][1] = 'text-align:center;'; - $table2->data[0][2] = ' '.''.html_print_image( + $table2->data[0][2] = ' '; + $table2->data[0][2] .= ''.html_print_image( 'images/expand.png', true, [ @@ -817,8 +966,20 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60% 'style' => 'vertical-align: middle;', 'onclick' => 'expandAll();', ] - ).''; - $table2->data[0][2] .= ' '.''.html_print_image('images/collapse.png', true, ['title' => __('Collapse the tree'), 'style' => 'vertical-align: middle;', 'onclick' => 'collapseAll();']).''; + ); + $table2->data[0][2] .= ''; + $table2->data[0][2] .= ' '; + $table2->data[0][2] .= ''; + $table2->data[0][2] .= html_print_image( + 'images/collapse.png', + true, + [ + 'title' => __('Collapse the tree'), + 'style' => 'vertical-align: middle;', + 'onclick' => 'collapseAll();', + ] + ); + $table2->data[0][2] .= ''; $table2->cellstyle[0][2] = 'text-align:center;'; // This extra div that can be handled by jquery's dialog. @@ -828,7 +989,7 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60% $output .= html_print_table($table, true); $output .= '
'; - if (!isset($snmp_version)) { + if (isset($snmp_version) === false) { $snmp_version = null; } @@ -838,40 +999,61 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60% $output .= ''; $output .= '
'; - $output .= ui_toggle(html_print_table($table2, true), __('Search options'), '', '', true, true); + $output .= ui_toggle( + html_print_table($table2, true), + __('Search options'), + '', + '', + true, + true + ); $output .= '
'; - // SNMP tree container + // SNMP tree container. $output .= '
'; $output .= html_print_input_hidden('search_count', 0, true); $output .= html_print_input_hidden('search_index', -1, true); - // Save some variables for javascript functions - $output .= html_print_input_hidden('ajax_url', ui_get_full_url('ajax.php'), true); - $output .= html_print_input_hidden('search_matches_translation', __('Search matches'), true); + // Save some variables for javascript functions. + $output .= html_print_input_hidden( + 'ajax_url', + ui_get_full_url('ajax.php'), + true + ); + $output .= html_print_input_hidden( + 'search_matches_translation', + __('Search matches'), + true + ); $output .= ''; $output .= ''; $output .= '
'; $output .= '
'; - $output .= '
'; + $output .= ''; $output .= '
'; $output .= '
'; $output .= '
'; if ($show_massive_buttons) { $output .= ''; + $output .= '
'; } if ($return) { diff --git a/pandora_console/operation/agentes/realtime_win.php b/pandora_console/operation/agentes/realtime_win.php index 93c8c85ea2..dbf9cf9f71 100644 --- a/pandora_console/operation/agentes/realtime_win.php +++ b/pandora_console/operation/agentes/realtime_win.php @@ -1,18 +1,31 @@ '; echo ''; - ui_print_error_message(__('There was a problem connecting with the node')); + ui_print_error_message( + __('There was a problem connecting with the node') + ); echo ''; echo ''; exit; @@ -43,7 +58,9 @@ if (is_metaconsole() && !empty($server_id)) { $user_language = get_user_language($config['id_user']); if (file_exists('../../include/languages/'.$user_language.'.mo')) { - $l10n = new gettext_reader(new CachedFileReader('../../include/languages/'.$user_language.'.mo')); + $l10n = new gettext_reader( + new CachedFileReader('../../include/languages/'.$user_language.'.mo') + ); $l10n->load_tables(); } @@ -53,7 +70,7 @@ echo ' 0) { $query = ui_get_url_refresh(false); @@ -70,7 +87,7 @@ echo ' Date: Mon, 30 Nov 2020 14:52:03 +0100 Subject: [PATCH 227/230] Ent 6148 new report permissions --- .../reporting_builder.item_editor.php | 196 ++++++++++++++++-- .../godmode/reporting/reporting_builder.php | 16 ++ .../godmode/users/configure_user.php | 2 + pandora_console/godmode/users/user_list.php | 47 +++++ pandora_console/include/constants.php | 3 + pandora_console/include/functions_html.php | 60 ++++-- .../include/functions_reporting.php | 129 ++++++++++++ .../include/functions_reporting_html.php | 118 +++++++++++ pandora_console/include/functions_reports.php | 31 +-- pandora_console/include/functions_users.php | 33 ++- .../javascript/multiselect_filtered.js | 8 +- .../include/styles/multiselect_filtered.css | 19 +- pandora_console/include/styles/pandora.css | 7 + 13 files changed, 613 insertions(+), 56 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index c2dc30cf22..c635773ce7 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -156,6 +156,11 @@ $agent_max_value = true; $agent_min_value = true; $uncompressed_module = true; +// Users. +$id_users = []; +$users_groups = []; +$select_by_group = false; + $nothing = __('Local metaconsole'); $nothing_value = 0; @@ -752,6 +757,22 @@ switch ($action) { $top_n_value = $item['top_n_value']; break; + case 'permissions_report': + $description = $item['description']; + $es = json_decode($item['external_source'], true); + $id_users = array_combine( + array_values($es['id_users']), + array_values($es['id_users']) + ); + + if (isset($id_users[0]) && $id_users[0] == 0) { + $id_users[0] = __('None'); + } + + $users_groups = $es['users_groups']; + $select_by_group = $es['select_by_group']; + break; + default: // It's not possible. break; @@ -1046,23 +1067,6 @@ $class = 'databox filters'; - - - - - - - - - + + + + + + + + + + + + + + + + $user) { + $select_users[$user['id_user']] = $user['id_user']; + } + + $input_data = [ + 'type' => 'select_multiple_filtered', + 'class' => 'w80p mw600px', + 'name' => 'id_users', + 'return' => 0, + 'available' => array_diff( + $select_users, + $id_users + ), + 'selected' => $id_users, + 'group_filter' => [ + 'page' => 'godmode/users/user_list', + 'method' => 'get_users_by_group', + 'nothing' => __('Unnasigned group'), + 'nothing_value' => -1, + 'id' => $id_users, + ], + 'texts' => [ + 'title-left' => 'Available users', + 'title-right' => 'Selected users', + 'filter-item' => 'Filter user name', + ], + 'sections' => [ + 'filters' => 1, + 'item-selected-filters' => 0, + ], + ]; + + html_print_input($input_data, 'div', true); + ?> + + + + + + + + + + + + ".__('Please checked a custom interval option.').'

'; echo '
'; +echo "'; + +echo "'; + ui_require_javascript_file( 'pandora_inventory', ENTERPRISE_DIR.'/include/javascript/' @@ -3936,6 +4043,20 @@ $(document).ready (function () { }); }); + $("#checkbox-select_by_group").change(function () { + var select_by_group = $('#checkbox-select_by_group').prop('checked'); + + if(select_by_group == true) { + $("#row_users").hide(); + $("#row_profiles_group").show(); + + } else { + $("#row_users").show(); + $("#row_profiles_group").hide(); + + } + }); + $("#checkbox-fullscale").change(function(e){ if(e.target.checked === true) { $("#graph_render").prop('disabled', 'disabled'); @@ -3999,6 +4120,16 @@ $(document).ready (function () { return false; } break; + case 'permissions_report': + if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) { + dialog_message('#message_no_group'); + return false; + } + if ($("#checkbox-select_by_group").prop("checked") == false && $("select#selected-select-id_users>option:selected").val() == 0) { + dialog_message('#message_no_user'); + return false; + } + break; default: break; } @@ -4120,6 +4251,18 @@ $(document).ready (function () { return false; } break; + + case 'permissions_report': + if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) { + dialog_message('#message_no_group'); + return false; + } + if ($("#checkbox-select_by_group").prop("checked") == false && $("select#selected-select-id_users>option:selected").val() == 0) { + dialog_message('#message_no_user'); + return false; + } + break; + default: break; } @@ -5006,6 +5149,10 @@ function chooseType() { $("#row_select_fields2").hide(); $("#row_select_fields3").hide(); $("#row_uncompressed_module").hide(); + $("#row_users").hide(); + $("#row_profiles_group").hide(); + $("#row_select_by_group").hide(); + // SLA list default state. $("#sla_list").hide(); @@ -5690,7 +5837,21 @@ function chooseType() { $("#row_period").show(); $("#row_quantity").show(); break; + + case 'permissions_report': + $("#row_description").show(); + $("#row_users").show(); + $("#row_profiles_group").show(); + $("#row_select_by_group").show(); + + if($("#checkbox-select_by_group").prop("checked")) { + $("#row_users").hide(); + } else { + $("#row_profiles_group").hide(); + } + } + switch (type) { case 'event_report_agent': case 'simple_graph': @@ -5779,4 +5940,5 @@ function dialog_message(message_id) { } }); } + diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 724be2b1d5..a550e9768a 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -2054,6 +2054,14 @@ switch ($action) { } break; + case 'permissions_report': + $es['id_users'] = get_parameter('selected-select-id_users', 0); + $es['users_groups'] = get_parameter('users_groups', 0); + $es['select_by_group'] = get_parameter('select_by_group', 0); + $description = get_parameter('description'); + $values['external_source'] = json_encode($es); + break; + default: // Default. break; @@ -2669,6 +2677,14 @@ switch ($action) { } break; + case 'permissions_report': + $es['id_users'] = get_parameter('selected-select-id_users'); + $es['users_groups'] = get_parameter('users_groups', 0); + $es['select_by_group'] = get_parameter('select_by_group', 0); + $description = get_parameter('description'); + $values['external_source'] = json_encode($es); + break; + default: // Default. break; diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index d13e9bc227..f9618b64a1 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -196,6 +196,8 @@ if (is_ajax()) { } } + + $tab = get_parameter('tab', 'user'); if ($id) { diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 783c22c8af..77ca07acce 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -33,6 +33,53 @@ if (! check_acl($config['id_user'], 0, 'UM')) { exit; } +if (is_ajax()) { + $method = get_parameter('method'); + $group_id = get_parameter('group_id'); + $group_recursion = (bool) get_parameter('group_recursion', 0); + $return_all = false; + + if ($group_id == -1) { + $sql = 'SELECT tusuario.id_user FROM tusuario + LEFT OUTER JOIN tusuario_perfil + ON tusuario.id_user = tusuario_perfil.id_usuario + WHERE tusuario_perfil.id_usuario IS NULL'; + + $users = io_safe_output(db_get_all_rows_sql($sql)); + + foreach ($users as $key => $user) { + $ret_user[$user['id_user']] = $user['id_user']; + } + + echo json_encode($ret_user); + return; + } + + if ($group_id == 0) { + $users = io_safe_output(db_get_all_rows_filter('tusuario', [], 'id_user')); + foreach ($users as $key => $user) { + $ret_user[$user['id_user']] = $user['id_user']; + } + + echo json_encode($ret_user); + return; + } + + if ($method === 'get_users_by_group') { + if ($group_recursion === true) { + $group_id = groups_get_children_ids($group_id); + } + + $users_id = io_safe_output(users_get_user_users(false, 'AR', false, null, $group_id)); + foreach ($users_id as $key => $user_id) { + $ret_id[$user_id] = $user_id; + } + + echo json_encode($ret_id); + return; + } +} + $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $tab = get_parameter('tab', 'user'); diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 258b6e805c..66b784d712 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -457,6 +457,9 @@ define('REPORT_OLD_TYPE_SUMATORY', 10); define('REPORT_GENERAL_NOT_GROUP_BY_AGENT', 0); define('REPORT_GENERAL_GROUP_BY_AGENT', 1); +define('REPORT_PERMISSIONS_NOT_GROUP_BY_GROUP', 0); +define('REPORT_PERMISSIONS_GROUP_BY_GROUP', 1); + define('REPORTING_CUSTOM_GRAPH_LEGEND_EACH_MODULE_VERTICAL_SIZE', 15); // POLICIES. diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index bda3a759e0..5929d25069 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -913,28 +913,45 @@ function html_print_select_multiple_filtered( $sections = []; } - if (empty($sections['filters']) === true) { + if (isset($sections['filters']) === false) { $sections['filters'] = 1; } - if (empty($sections['group-filter']) === true) { + // Show/hide all left/rigth sfilters. + if (isset($sections['item-selected-filters']) === false) { + $sections['item-selected-filters'] = 1; + } + + if (isset($sections['item-available-filters']) === false) { + $sections['item-available-filters'] = 1; + } + + if (isset($sections['group-filter']) == false) { $sections['group-filter'] = 1; } - if (empty($sections['item-available-filter']) === true) { + if (isset($sections['item-available-filter']) === false) { $sections['item-available-filter'] = 1; } - if (empty($sections['item-selected-filter']) === true) { + if (isset($sections['item-selected-filter']) === false) { $sections['item-selected-filter'] = 1; } - if (empty($group_filter) === true) { + if (isset($group_filter) === false) { $sections['group-filter'] = 0; } + if (isset($group_filter['nothing']) === false) { + $group_filter['nothing'] = ''; + } + + if (isset($group_filter['nothing_value']) === false) { + $group_filter['nothing_value'] = 0; + } + // Main container. - $output = '
'; + $output = '
'; // Left box. $output .= '
'; @@ -943,6 +960,7 @@ function html_print_select_multiple_filtered( // Filtering. if (isset($sections['filters']) === true && $sections['filters'] === 1 + && $sections['item-available-filters'] === 1 ) { // Filtering. if (isset($sections['group-filter']) === true @@ -962,6 +980,7 @@ function html_print_select_multiple_filtered( $output .= html_print_input( [ + 'input_class' => 'flex-row-vcenter', 'label' => __('Filter group'), 'name' => 'id-group-available-select-'.$rid, 'returnAllGroup' => true, @@ -969,16 +988,20 @@ function html_print_select_multiple_filtered( 'type' => 'select_groups', 'return' => true, 'script' => $reload_content, + 'nothing' => $group_filter['nothing'], + 'nothing_value' => $group_filter['nothing_value'], ] ); $output .= html_print_input( [ - 'label' => __('Group recursion'), - 'name' => 'id-group-recursion-available-select-'.$rid, - 'type' => 'checkbox', - 'script' => $reload_content, - 'return' => true, + 'label' => __('Group recursion'), + 'input_class' => 'flex-row-vcenter', + 'name' => 'id-group-recursion-available-select-'.$rid, + 'id' => 'checkbox-id-group-recursion-available-select-'.$rid, + 'type' => 'switch', + 'onchange' => $reload_content, + 'return' => true, ] ); @@ -1087,6 +1110,7 @@ function html_print_select_multiple_filtered( // Filtering. if (isset($sections['filters']) === true && $sections['filters'] === 1 + && $sections['item-selected-filters'] ) { if (isset($sections['group-filter']) === true && $sections['group-filter'] === 1 @@ -1105,6 +1129,7 @@ function html_print_select_multiple_filtered( $output .= html_print_input( [ + 'input_class' => 'flex-row-vcenter', 'label' => __('Filter group'), 'name' => 'id-group-selected-select-'.$rid, 'returnAllGroup' => true, @@ -1117,11 +1142,12 @@ function html_print_select_multiple_filtered( $output .= html_print_input( [ - 'label' => __('Group recursion'), - 'name' => 'id-group-recursion-selected-select-'.$rid, - 'type' => 'checkbox', - 'script' => $reload_content, - 'return' => true, + 'input_class' => 'flex-row-vcenter', + 'label' => __('Group recursion'), + 'name' => 'id-group-recursion-selected-select-'.$rid, + 'type' => 'checkbox', + 'script' => $reload_content, + 'return' => true, ] ); @@ -1152,7 +1178,7 @@ function html_print_select_multiple_filtered( 'label' => __($texts['filter-item']), 'name' => 'filter-item-selected-'.$rid, 'onKeyUp' => $f, - 'input_class' => 'filter w100p', + 'input_class' => 'flex-row-vcenter filter w100p', 'size' => 20, 'type' => 'text', 'return' => true, diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 479adc67c8..3d72dcb5ca 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -694,6 +694,13 @@ function reporting_make_reporting_data( ); break; + case 'permissions_report': + $report['contents'][] = reporting_permissions( + $report, + $content + ); + break; + case 'group_report': $report['contents'][] = reporting_group_report( $report, @@ -3577,6 +3584,128 @@ function reporting_last_value($report, $content) } +function reporting_permissions($report, $content) +{ + global $config; + + $return['type'] = 'permissions_report'; + + if (empty($content['name'])) { + $content['name'] = __('Permissions report'); + } + + $return['title'] = $content['name']; + $return['landscape'] = $content['landscape']; + $return['pagebreak'] = $content['pagebreak']; + $return['description'] = $content['description']; + $return['date'] = reporting_get_date_text($report, $content); + + $external_source = io_safe_input(json_decode($content['external_source'], true)); + $id_users = $external_source['id_users']; + $id_groups = $external_source['users_groups']; + + // Select subtype: group by user or by group. + $select_by_group = $external_source['select_by_group']; + $return['subtype'] = (int) $select_by_group; + + if ($select_by_group === REPORT_PERMISSIONS_NOT_GROUP_BY_GROUP) { + foreach ($id_users as $id_user) { + $user_name = db_get_value_filter('fullname', 'tusuario', ['id_user' => $id_user]); + + $sql = sprintf( + "SELECT name, id_grupo FROM tusuario_perfil + INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil + WHERE tusuario_perfil.id_usuario like '%s'", + $id_user + ); + + $profiles = db_get_all_rows_sql($sql); + + $user_profiles = []; + if (empty($profiles)) { + $user_profiles[] = __('The user doesn\'t have any assigned profile/group'); + } else { + foreach ($profiles as $user_profile) { + $user_profiles[] = $user_profile['name'].' / '.groups_get_name($user_profile['id_grupo'], true); + } + } + + $data[] = [ + 'user_id' => io_safe_output($id_user), + 'user_name' => io_safe_output($user_name), + 'user_profiles' => io_safe_output($user_profiles), + ]; + } + } else { + $group_users = []; + foreach ($id_groups as $id_group) { + if ($id_group === '') { + $group_name = __('Unnasigned group'); + $sql = 'SELECT tusuario.id_user, tusuario.fullname FROM tusuario + LEFT OUTER JOIN tusuario_perfil + ON tusuario.id_user = tusuario_perfil.id_usuario + WHERE tusuario_perfil.id_usuario IS NULL'; + $group_users = db_get_all_rows_sql($sql); + $group_name = __('Unassigned group'); + } else { + $group_name = groups_get_name($id_group, true); + $group_users = users_get_user_users( + $id_group, + 'AR', + false, + [ + 'id_user', + 'fullname', + + ], + [$id_group] + ); + } + + $row['users'] = []; + foreach ($group_users as $user) { + $id_user = $user['id_user']; + + // Get user fullanme. + $row['users'][$id_user]['fullname'] = $user['fullname']; + + if ($id_group === '') { + $row['users'][$id_user]['profiles'][] = __('The user doesn\'t have any assigned profile/group'); + } else { + // Incluide id group = 0 for 'All' profile. + $sql = sprintf( + "SELECT id_perfil FROM tusuario_perfil + WHERE id_usuario LIKE '%s' + AND ( + id_grupo LIKE '%s' + OR id_grupo LIKE '0' + )", + $id_user, + $id_group + ); + + $user_profiles_id = db_get_all_rows_sql($sql); + + foreach ($user_profiles_id as $profile_id) { + $row['users'][$id_user]['profiles'][] = profile_get_name($profile_id['id_perfil']); + } + } + } + + $data[] = [ + 'group_name' => $group_name, + 'users' => $row['users'], + ]; + } + } + + $return['data'] = []; + $return['data'] = $data; + + return reporting_check_structure_content($return); +} + + function reporting_group_configuration($report, $content) { global $config; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index c501c8526f..48a09385d5 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -236,6 +236,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) reporting_html_log($table, $item); break; + case 'permissions_report': + reporting_html_permissions($table, $item); + break; + case 'availability_graph': reporting_html_availability_graph($table, $item); break; @@ -5649,3 +5653,117 @@ function reporting_html_planned_downtimes_table($planned_downtimes) return $downtimes_table; } + + +function reporting_html_permissions($table, $item, $pdf=0) +{ + global $config; + + $table1 = new stdClass(); + $table1->width = '100%'; + + $table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;'; + $table1->class = 'databox data'; + $table1->cellpadding = 1; + $table1->cellspacing = 1; + $table1->styleTable = 'overflow: wrap; table-layout: fixed;'; + + if ($item['subtype'] === REPORT_PERMISSIONS_NOT_GROUP_BY_GROUP) { + $table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;'; + $table1->style[1] = 'text-align: left;vertical-align: top;min-width: 100px;'; + $table1->style[2] = 'text-align: left;vertical-align: top; min-width: 100px'; + + $table1->head = [ + __('User ID'), + __('Full name'), + __('Permissions'), + ]; + + $table1->headstyle[0] = 'text-align: left'; + $table1->headstyle[1] = 'text-align: left'; + $table1->headstyle[2] = 'text-align: left'; + } + + if ($item['subtype'] === REPORT_PERMISSIONS_GROUP_BY_GROUP) { + $table1->style[0] = 'text-align: left;vertical-align: top;min-width: 150px;'; + $table1->style[1] = 'text-align: left;vertical-align: top;min-width: 150px;'; + $table1->style[2] = 'text-align: left;vertical-align: top;min-width: 150px;'; + $table1->style[3] = 'text-align: left;vertical-align: top;min-width: 150px;'; + + $table1->headstyle[0] = 'text-align: left'; + $table1->headstyle[1] = 'text-align: left'; + $table1->headstyle[2] = 'text-align: left'; + $table1->headstyle[3] = 'text-align: left'; + + $table1->head = [ + __('Group'), + __('User ID'), + __('Full name'), + __('Permissions'), + ]; + } + + $table1->data = []; + + foreach ($item['data'] as $data) { + if ($item['subtype'] === REPORT_PERMISSIONS_NOT_GROUP_BY_GROUP) { + $profile_group_name = ''; + foreach ($data['user_profiles'] as $user_profile) { + $profile_group_name .= $user_profile.'
'; + } + + $row = [ + $data['user_id'], + $data['user_name'], + $profile_group_name, + ]; + } + + if ($item['subtype'] === REPORT_PERMISSIONS_GROUP_BY_GROUP) { + $user_profile_id_users = ''; + $user_profile_name = ''; + $user_profile_users_name = ''; + $group_name = $data['group_name'].'
'; + + foreach ($data['users'] as $user => $user_data) { + $user_profile_id_users .= $user.'
'; + $user_profile_users_name .= $user_data['fullname'].'
'; + + foreach ($user_data['profiles'] as $profile) { + $user_profile_id_users .= '
'; + $user_profile_users_name .= '
'; + $user_profile_name .= $profile.'
'; + } + + $user_profile_name .= '
'; + } + + $row = [ + $group_name, + $user_profile_id_users, + $user_profile_users_name, + $user_profile_name, + ]; + } + + $table1->data[] = $row; + + if ($pdf !== 0) { + $table1->data[] = '
'; + } + } + + if ($pdf === 0) { + $table->colspan['permissions']['cell'] = 3; + $table->cellstyle['permissions']['cell'] = 'text-align: center;'; + $table->data['permissions']['cell'] = html_print_table( + $table1, + true + ); + } else { + return html_print_table( + $table1, + true + ); + } +} diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 130fe4deb0..878ded7968 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -54,7 +54,7 @@ function reports_get_report($id_report, $filter=false, $fields=false) return false; } - if (! is_array($filter)) { + if (!is_array($filter)) { $filter = []; } @@ -72,7 +72,7 @@ function reports_get_report($id_report, $filter=false, $fields=false) $report = db_get_row_filter('treport', $filter, $fields); - if (! check_acl($config['id_user'], $report['id_group'], 'RR')) { + if (!check_acl($config['id_user'], $report['id_group'], 'RR')) { return false; } @@ -104,16 +104,16 @@ function reports_get_reports( ) { global $config; - if (! is_array($filter)) { + if (!is_array($filter)) { $filter = []; } - /* - if (!is_user_admin ($config["id_user"])) + /* + if (!is_user_admin ($config["id_user"])) $filter[] = sprintf ('private = 0 OR (private = 1 AND id_user = "%s")', $config['id_user']); - */ - $filter['hidden'] = 0; + */ + $filter['hidden'] = 0; if (is_array($fields)) { $fields[] = 'id_group'; $fields[] = 'id_user'; @@ -146,7 +146,7 @@ function reports_get_reports( } if ($config['id_user'] != $report['id_user'] - && ! check_acl($config['id_user'], $report['id_group'], $privileges) + && !check_acl($config['id_user'], $report['id_group'], $privileges) ) { continue; } @@ -173,7 +173,7 @@ function reports_create_report($name, $id_group, $values=false) { global $config; - if (! is_array($values)) { + if (!is_array($values)) { $values = []; } @@ -246,7 +246,7 @@ function reports_get_content($id_report_content, $filter=false, $fields=false) return false; } - if (! is_array($filter)) { + if (!is_array($filter)) { $filter = []; } @@ -293,7 +293,7 @@ function reports_create_content($id_report, $values) return false; } - if (! is_array($values)) { + if (!is_array($values)) { return false; } @@ -341,7 +341,7 @@ function reports_get_contents($id_report, $filter=false, $fields=false) return []; } - if (! is_array($filter)) { + if (!is_array($filter)) { $filter = []; } @@ -546,7 +546,7 @@ function reports_delete_content($id_report_content) function get_report_name($type, $template=false) { $types = reports_get_report_types($template); - if (! isset($types[$type])) { + if (!isset($types[$type])) { return __('Unknown'); } @@ -890,5 +890,10 @@ function reports_get_report_types($template=false, $not_editor=false) ]; } + $types['permissions_report'] = [ + 'optgroup' => __('Permissions report'), + 'name' => __('Permissions report'), + ]; + return $types; } diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 7b310889ac..73e7340838 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -616,7 +616,8 @@ function users_get_user_users( $id_user=false, $privilege='AR', $returnAllGroup=true, - $fields=null + $fields=null, + $filter_group=[] ) { global $config; @@ -625,8 +626,12 @@ function users_get_user_users( $user_users = []; $array_user_group = []; - foreach ($user_groups as $id_user_group => $name_user_group) { - $array_user_group[] = $id_user_group; + if (empty($filter_group)) { + foreach ($user_groups as $id_user_group => $name_user_group) { + $array_user_group[] = $id_user_group; + } + } else { + $array_user_group = $filter_group; } $group_users = groups_get_users($array_user_group, false, $returnAllGroup); @@ -831,3 +836,25 @@ function users_get_user_profile($id_user) return $user_profiles; } + + +/** + * Obtiene una matriz con la informacion de cada usuario que pertenece a un grupo + * + * @param string User id + * @return array Return . + */ +function users_get_users_group_by_group($id_group) +{ + $sql = sprintf( + "SELECT tusuario.* FROM tusuario + LEFT JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user + AND tusuario_perfil.id_grupo = '%s' + GROUP BY tusuario_perfil.id_usuario", + $id_group + ); + + $users = db_get_all_rows_sql($sql); + + return $users; +} diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js index 27135c6843..7976158740 100644 --- a/pandora_console/include/javascript/multiselect_filtered.js +++ b/pandora_console/include/javascript/multiselect_filtered.js @@ -113,7 +113,9 @@ function reloadContent(id, url, options, side, noneStr) { data.side = side; data.group_recursion = $("#checkbox-id-group-recursion-" + current).prop( "checked" - ); + ) + ? 1 + : 0; data.group_id = $("#id-group-" + current).val(); $.ajax({ @@ -139,8 +141,8 @@ function reloadContent(id, url, options, side, noneStr) { for (var [value, label] of items) { if ( - $("#" + opposite + " option[value=" + value + "]").length == 0 && - $("#tmp-" + current + " option[value=" + value + "]").length == 0 + $("#" + opposite + " option[value='" + value + "']").length == 0 && + $("#tmp-" + current + " option[value='" + value + "']").length == 0 ) { // Does not exist in opposite box nor is filtered. $("#" + current).append(new Option(label, value)); diff --git a/pandora_console/include/styles/multiselect_filtered.css b/pandora_console/include/styles/multiselect_filtered.css index a938422456..c1eebbe657 100644 --- a/pandora_console/include/styles/multiselect_filtered.css +++ b/pandora_console/include/styles/multiselect_filtered.css @@ -2,9 +2,6 @@ flex: 1 1 200px; min-width: 200px; } -.multi-select-container * { - flex: 1 1 auto; -} .multi-select.flex-column { justify-content: space-between; @@ -16,10 +13,12 @@ .multi-select-container.flex-column { flex-wrap: nowrap; + align-self: flex-end; } .arrows-container { width: 50px; + margin-bottom: 65px; } .multi-select-container .filter input, @@ -40,8 +39,11 @@ .group-filter.flex-row-vcenter div, .item-filter.flex-row-vcenter div { + display: flex; flex: 1 1 auto; width: 100%; + justify-content: space-between; + align-items: center; } .multi-select-container .title { @@ -58,3 +60,14 @@ .multi-select-container.flex-column div input { margin-left: 1em; } + +.multi-select-container + .select2-container--default + .select2-selection--single + .select2-selection__rendered { + line-height: inherit !important; +} + +.p-slider { + margin: auto !important; +} diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index d8b4777fbb..bc743e9c77 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -612,6 +612,13 @@ select:-internal-list-box { align-items: center; } +.flex-row-end { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: flex-end; +} + .flex-space-around { justify-content: space-around; } From e0266b53ba32e3113a9bab2a95e2bebbbb2fe73f Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 1 Dec 2020 01:00:46 +0100 Subject: [PATCH 228/230] 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 ac65800a20..f282e0cf96 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201130 +Version: 7.0NG.750-201201 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 2a3e9af4f9..d916788748 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.750-201130" +pandora_version="7.0NG.750-201201" 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 65215d3e8c..d6e6da535a 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -46,7 +46,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201130'; +use constant AGENT_BUILD => '201201'; # 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 8e4006b2fb..c259ced047 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.750 -%define release 201130 +%define release 201201 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 cf7a3bc749..2f41863aa8 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.750 -%define release 201130 +%define release 201201 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 36e9bb11b7..b6cb60cb45 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201130" +PI_BUILD="201201" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index ac934c8c08..779dafc5c2 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201130} +{201201} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index a5bf5f61b6..5ff45d4e3d 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.750(Build 201130)") +#define PANDORA_VERSION ("7.0NG.750(Build 201201)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 95a72f3223..d7902c37dc 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.750(Build 201130))" + VALUE "ProductVersion", "(7.0NG.750(Build 201201))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index b12b783921..4d584831da 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201130 +Version: 7.0NG.750-201201 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 56d64760d3..364b93bb74 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.750-201130" +pandora_version="7.0NG.750-201201" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 79ca8cf182..7ad88456ef 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 = 'PC201130'; +$build_version = 'PC201201'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index de9f4636d4..38fd478750 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 fe223e5266..f82992ebc8 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.750 -%define release 201130 +%define release 201201 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 8f86ffbf89..e329e84cd8 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.750 -%define release 201130 +%define release 201201 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 575d144bd0..1396e29cf3 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201130" +PI_BUILD="201201" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 5922eed398..ae356313fd 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.750 PS201130"; +my $version = "7.0NG.750 PS201201"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 84ccb95554..a3ed71fc91 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.750 PS201130"; +my $version = "7.0NG.750 PS201201"; # save program name for logging my $progname = basename($0); From aeb7a7e9c6686ab1c83869009799a3f47a003a66 Mon Sep 17 00:00:00 2001 From: Luis Date: Tue, 1 Dec 2020 11:56:15 +0100 Subject: [PATCH 229/230] Add decimal separator to all pandora csv --- .../godmode/setup/setup_visuals.php | 2 +- .../include/class/ModuleTemplates.class.php | 20 ++++++++++++++++--- pandora_console/include/functions.php | 16 +++++++++++---- .../include/graphs/export_data.php | 12 ++++++++++- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 8c07381452..d1230f8c35 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1482,7 +1482,7 @@ $row++; '.' => '.', ',' => ',', ]; - $table_other->data[$row][0] = __('CSV decimal separator').ui_print_help_tip(__('Only for csv reports'), true); + $table_other->data[$row][0] = __('CSV decimal separator'); $table_other->data[$row][1] = html_print_select($decimal_separator, 'csv_decimal_separator', $config['csv_decimal_separator'], '', '', '', true, false, false); $row++; diff --git a/pandora_console/include/class/ModuleTemplates.class.php b/pandora_console/include/class/ModuleTemplates.class.php index f9573b6c0e..8d89519486 100644 --- a/pandora_console/include/class/ModuleTemplates.class.php +++ b/pandora_console/include/class/ModuleTemplates.class.php @@ -409,6 +409,8 @@ class ModuleTemplates extends HTML case 'export': global $config; + enterprise_include_once('include/functions_reporting_csv.php'); + $id_network_profile = safe_int($this->id_np); if (empty($id_network_profile)) { return false; @@ -500,7 +502,7 @@ class ModuleTemplates extends HTML } // Then print the first line (row names) - echo '"'.implode('","', $row_names).'"'; + echo '"'.implode('"'.$config['csv_divider'].'"', $row_names).'"'; echo "\n"; // Then print the rest of the data. Encapsulate in quotes in case we have comma's in any of the descriptions @@ -509,7 +511,19 @@ class ModuleTemplates extends HTML unset($row[$bad_key]); } - echo '"'.implode('","', $row).'"'; + if ($config['csv_decimal_separator'] !== '.') { + foreach ($row as $name => $data) { + if (is_numeric($data)) { + // Get the number of decimals, if > 0, format dec comma. + $decimals = strlen(substr(strrchr($data, '.'), 1)); + if ($decimals !== 0) { + $row[$name] = csv_format_numeric((float) $data, $decimals, true); + } + } + } + } + + echo '"'.implode('"'.$config['csv_divider'].'"', $row).'"'; echo "\n"; } @@ -845,7 +859,7 @@ class ModuleTemplates extends HTML $row['id_np'], '', true, - ['title' => 'Export to CSV'] + ['title' => 'Export tdaso CSV'] ); $data[3] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; $data[3] .= ''.html_print_image('images/csv.png', true, ['title' => __('Export to CSV')]).''; diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index b1c537c6aa..f79c56b764 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3904,17 +3904,23 @@ function series_type_graph_array($data, $show_elements_graph) $data_return['legend'][$key] .= __('Min:').remove_right_zeros( number_format( $value['min'], - $config['graph_precision'] + $config['graph_precision'], + $config['csv_decimal_separator'], + $config['csv_decimal_separator'] == ',' ? '.' : ',' ) ).' '.__('Max:').remove_right_zeros( number_format( $value['max'], - $config['graph_precision'] + $config['graph_precision'], + $config['csv_decimal_separator'], + $config['csv_decimal_separator'] == ',' ? '.' : ',' ) ).' '._('Avg:').remove_right_zeros( number_format( $value['avg'], - $config['graph_precision'] + $config['graph_precision'], + $config['csv_decimal_separator'], + $config['csv_decimal_separator'] == ',' ? '.' : ',' ) ).' '.$str; @@ -3978,7 +3984,8 @@ function series_type_graph_array($data, $show_elements_graph) $data_return['legend'][$key] .= remove_right_zeros( number_format( $value['avg'], - $config['graph_precision'] + $config['graph_precision'], + $config['csv_decimal_separator'] ) ).' '.$str; } @@ -5911,4 +5918,5 @@ function send_test_email( } return $result; + } diff --git a/pandora_console/include/graphs/export_data.php b/pandora_console/include/graphs/export_data.php index 8aca5c04b5..cab03220d5 100644 --- a/pandora_console/include/graphs/export_data.php +++ b/pandora_console/include/graphs/export_data.php @@ -15,6 +15,7 @@ // This file only uses data retrieved in a request. require_once '../../include/config.php'; require_once '../../include/functions.php'; +enterprise_include_once('include/functions_reporting_csv.php'); global $config; @@ -49,7 +50,10 @@ $filename = io_safe_output($filename); * ); */ $output_csv = function ($data, $filename) { - $separator = (string) get_parameter('separator', ';'); + global $config; + + $separator = (string) $config['csv_divider']; + $excel_encoding = (bool) get_parameter('excel_encoding', false); // CSV Output @@ -68,9 +72,15 @@ $output_csv = function ($data, $filename) { throw new Exception(__('An error occured exporting the data')); } + // Get key for item value. + $value_key = array_search('value', $items['head']); + $head_line = implode($separator, $items['head']); echo $head_line."\n"; foreach ($items['data'] as $item) { + // Find value and replace csv decimal separator. + $item[$value_key] = csv_format_numeric($item[$value_key]); + $item = str_replace('--> '.__('Selected'), '', $item); $line = implode($separator, $item); From 913dc554eb1de0cd8422d8651c0eb8d1c5c1d4ed Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 2 Dec 2020 01:00:17 +0100 Subject: [PATCH 230/230] 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 f282e0cf96..ab8076382f 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201201 +Version: 7.0NG.750-201202 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 d916788748..350aa46700 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.750-201201" +pandora_version="7.0NG.750-201202" 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 d6e6da535a..e229ac10da 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -46,7 +46,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201201'; +use constant AGENT_BUILD => '201202'; # 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 c259ced047..aec512fb71 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.750 -%define release 201201 +%define release 201202 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 2f41863aa8..3f605ab943 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.750 -%define release 201201 +%define release 201202 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 b6cb60cb45..3ebcd9f8b7 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201201" +PI_BUILD="201202" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 779dafc5c2..b31ae50202 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201201} +{201202} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 5ff45d4e3d..a2caf79ae2 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.750(Build 201201)") +#define PANDORA_VERSION ("7.0NG.750(Build 201202)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d7902c37dc..a8ff1c1cf5 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.750(Build 201201))" + VALUE "ProductVersion", "(7.0NG.750(Build 201202))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 4d584831da..a4c9c5a2be 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201201 +Version: 7.0NG.750-201202 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 364b93bb74..0dc958f481 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.750-201201" +pandora_version="7.0NG.750-201202" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7ad88456ef..ef1086f605 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 = 'PC201201'; +$build_version = 'PC201202'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 38fd478750..b466b012a1 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 f82992ebc8..f3cb7c6ffa 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.750 -%define release 201201 +%define release 201202 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index e329e84cd8..d43220af9e 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.750 -%define release 201201 +%define release 201202 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 1396e29cf3..d9854f5375 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201201" +PI_BUILD="201202" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index ae356313fd..ae2cf2518f 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.750 PS201201"; +my $version = "7.0NG.750 PS201202"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 6ce1cef272..2dd964a859 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.750 PS201201"; +my $version = "7.0NG.750 PS201202"; # save program name for logging my $progname = basename($0);