From 3e90c362503a1b3a1c98d5fd581219651b80e9c4 Mon Sep 17 00:00:00 2001 From: sergio Date: Mon, 28 Nov 2022 11:31:44 +0100 Subject: [PATCH 001/110] #9713 New button for real path in filemanager --- .../include/functions_filemanager.php | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 94e16e822b..cfa7ed143c 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -571,6 +571,40 @@ function filemanager_file_explorer( } }).show(); } + + function show_modal_real_path (path) { + $('#modal_real_path').addClass('file_table_modal_active'); + $('#real_path').empty(); + $('#real_path').html(path); + title_action = ""; + $('#modal_real_path') + .dialog({ + title: title_action, + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 448, + minWidth: 448, + minHeight: 213, + maxWidth: 800, + maxHeight: 300, + close: function () { + $('#modal_real_path').removeClass('file_table_modal_active'); + } + }).show(); + + $("#submit-submit").on("click",copyToClipboard); + } + + function copyToClipboard() { + navigator.clipboard.writeText($("#real_path").text()).then(function (){ + $('#modal_real_path').dialog('close'); + }); + } '; } + if (is_writable($fileinfo['realpath']) === true + && (is_dir($fileinfo['realpath']) === false || count(scandir($fileinfo['realpath'])) < 3) + && ($readOnly === false) + ) { + $data[4] .= ''.html_print_image('images/book_edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Real path'), 'class' => 'invert_filter']).''; + } + $data[4] .= ''; array_push($table->data, $data); @@ -925,6 +966,18 @@ function filemanager_file_explorer( ); echo ''; + // Show Modal Real Path + $modal_real_path = "
Real path to plugin execution is:
+
+
".html_print_submit_button(__('Copy'), 'submit', false, 'class="sub next"', true).'
'; + html_print_div( + [ + 'id' => 'modal_real_path', + 'class' => 'invisible', + 'content' => $modal_real_path, + ] + ); + echo ''; } else { echo "
"; From 9cf50d005cc1b34676de072b348f41c7c9847b7e Mon Sep 17 00:00:00 2001 From: KANAYAMA Akihiro Date: Tue, 20 Dec 2022 12:06:18 +0900 Subject: [PATCH 002/110] fixed typo --- pandora_server/util/plugin/pandora_snmp_bandwidth.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl index 9b28848b48..db38b8444d 100755 --- a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl +++ b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl @@ -563,7 +563,7 @@ foreach my $iface (keys %{$analysis_tree}) { $inUsage += $analysis_tree->{$iface}{'inUsage'}; $j++; } - if (is_enabled($analysis_tree->{$iface}{'outUsage'}) || $analysis_tree->{$iface}{'inUsage'} == 0) { + if (is_enabled($analysis_tree->{$iface}{'outUsage'}) || $analysis_tree->{$iface}{'outUsage'} == 0) { $outUsage += $analysis_tree->{$iface}{'outUsage'}; $k++; } From c503836634e995f7337db335fbe3c47c82604fe3 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Thu, 12 Jan 2023 12:28:40 +0100 Subject: [PATCH 003/110] Restrict access to collections with nms license --- .../godmode/agentes/configurar_agente.php | 8 +++++--- pandora_console/godmode/menu.php | 3 ++- pandora_console/include/constants.php | 1 + pandora_console/include/functions.php | 16 ++++++++++++++++ pandora_console/include/functions_api.php | 10 ++++++++++ pandora_console/operation/agentes/ver_agente.php | 8 +++++--- 6 files changed, 39 insertions(+), 7 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 4432fef1cd..62807fa7c9 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -485,10 +485,12 @@ if ($id_agente) { } // Collection. - $collectiontab = enterprise_hook('collection_tab'); + if ($config['license_nms'] !== 1) { + $collectiontab = enterprise_hook('collection_tab'); - if ($collectiontab == -1) { - $collectiontab = ''; + if ($collectiontab == -1) { + $collectiontab = ''; + } } // NetworkConfigManager tab. diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index fef71922e3..7e9a7964a3 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -26,7 +26,8 @@ * GNU General Public License for more details. * ============================================================================ */ - +$config['license_nms'] = 1; +// ! Eliminar! // Begin. require_once 'include/config.php'; require_once 'include/functions_menu.php'; diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 96fb1c216b..18b32b6de4 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -805,6 +805,7 @@ define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management'); define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management'); define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management'); define('AUDIT_LOG_UMC', 'Warp Manager'); +define('AUDIT_LOG_NMS_VIOLATION', 'NMS Violation'); // MIMEs. define( diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 7c2df5603b..a333006da8 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6342,3 +6342,19 @@ function setDownloadCookieToken() ); } } + + +/** + * Check nms license on api. + * + * @return boolean + */ +function nms_check_api() +{ + global $config; + + if ($config['license_nms'] === 1) { + returnError('license_error'); + return true; + } +} diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index db79ed3c86..f322f5c2de 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -198,6 +198,16 @@ function returnError($typeError, $returnType='string') ); break; + case 'license_error': + returnData( + $returnType, + [ + 'type' => 'string', + 'data' => __('License not allowed for this operation.'), + ] + ); + break; + default: returnData( $returnType, diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 2ee6781f00..89c7c70d8e 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1461,9 +1461,11 @@ if ($inventorytab == -1 || $inventoryCount === 0) { } // Collection. -$collectiontab = enterprise_hook('collection_tab'); -if ($collectiontab == -1) { - $collectiontab = ''; +if ($config['license_nms'] !== 1) { + $collectiontab = enterprise_hook('collection_tab'); + if ($collectiontab == -1) { + $collectiontab = ''; + } } From aff91aa1b2e6df9e572965ecd5e7ed6a4ae009cb Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 12 Jan 2023 12:42:48 +0100 Subject: [PATCH 004/110] #10126 added button save in visual console --- .../godmode/reporting/visual_console_builder.elements.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index b331f5bdac..870316af29 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -862,9 +862,15 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/'); height: 300, autoOpen: false, beforeClose: function() { + console.log("Entra"); var id_layout_data = $("#active_id_layout_data").val(); var label = tinyMCE.activeEditor.getContent(); $("#hidden-label_" + id_layout_data).val(label); + }, + buttons: { + Save: function() { + $(this).dialog("close"); + } } }); From 4392bd7fa8b7f96ff74aa5e1f84cefd1b94d30d7 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Fri, 13 Jan 2023 12:09:15 +0100 Subject: [PATCH 005/110] 9220 Restrict access to collections with nms license --- pandora_console/godmode/menu.php | 3 +-- pandora_console/godmode/servers/modificar_server.php | 10 ++++++---- .../include/class/SatelliteCollection.class.php | 9 +++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 7e9a7964a3..fef71922e3 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -26,8 +26,7 @@ * GNU General Public License for more details. * ============================================================================ */ -$config['license_nms'] = 1; -// ! Eliminar! + // Begin. require_once 'include/config.php'; require_once 'include/functions_menu.php'; diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index 17f2020d13..748c707227 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -141,11 +141,13 @@ if (isset($_GET['server'])) { ]; - $buttons['collections'] = [ - 'active' => false, - 'text' => ''.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'', + if ($config['license_nms'] !== 1) { + $buttons['collections'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'', - ]; + ]; + } } $buttons[$tab]['active'] = true; diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php index 34348fdc7a..b8535f5cc6 100644 --- a/pandora_console/include/class/SatelliteCollection.class.php +++ b/pandora_console/include/class/SatelliteCollection.class.php @@ -84,6 +84,15 @@ class SatelliteCollection extends HTML return; } + if ($config['license_nms'] === 1) { + db_pandora_audit( + AUDIT_LOG_NMS_VIOLATION, + 'Trying to access satellite collections' + ); + include $config['homedir'].'/general/noaccess.php'; + return; + } + // Set the ajax controller. $this->ajaxController = $ajaxController; // Capture all parameters before start. From 67b7234e583a2094926799f3dfeb90d2942b958c Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Thu, 19 Jan 2023 10:49:48 +0100 Subject: [PATCH 006/110] implement filter save and load feature in monitor view --- pandora_console/extras/mr/62.sql | 23 + pandora_console/include/ajax/module.php | 536 ++++++++++++++++++ .../operation/agentes/status_monitor.php | 202 ++++++- pandora_console/pandoradb.sql | 23 + 4 files changed, 756 insertions(+), 28 deletions(-) create mode 100644 pandora_console/extras/mr/62.sql diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql new file mode 100644 index 0000000000..c2a309eb32 --- /dev/null +++ b/pandora_console/extras/mr/62.sql @@ -0,0 +1,23 @@ +START TRANSACTION; + +CREATE TABLE IF NOT EXISTS `tmonitor_filter` ( + `id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `id_name` VARCHAR(600) NOT NULL, + `id_group_filter` INT NOT NULL DEFAULT 0, + `ag_group` INT NOT NULL DEFAULT 0, + `recursion` TEXT, + `status` INT NOT NULL DEFAULT -1, + `ag_modulename` TEXT, + `ag_freestring` TEXT, + `tag_filter` TEXT, + `moduletype` TEXT, + `module_option` INT DEFAULT 1, + `modulegroup` INT NOT NULL DEFAULT -1, + `min_hours_status` TEXT, + `datatype` TEXT, + `not_condition` TEXT, + `ag_custom_fields` TEXT, + PRIMARY KEY (`id_filter`) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; + +COMMIT; diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 61720a99a4..03eb150573 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -66,6 +66,12 @@ if (check_login()) { 0 ); + $load_filter_modal = get_parameter('load_filter_modal', 0); + $save_filter_modal = get_parameter('save_filter_modal', 0); + $get_monitor_filters = get_parameter('get_monitor_filters', 0); + $save_monitor_filter = get_parameter('save_monitor_filter', 0); + $update_monitor_filter = get_parameter('update_monitor_filter', 0); + if ($get_agent_modules_json_by_name === true) { $agent_name = get_parameter('agent_name'); @@ -1629,4 +1635,534 @@ if (check_login()) { return; } + + // Saves an event filter. + if ($save_monitor_filter) { + $values = []; + $values['id_name'] = get_parameter('id_name'); + $values['id_group_filter'] = get_parameter('id_group_filter'); + $values['ag_group'] = get_parameter('ag_group'); + $values['modulegroup'] = get_parameter('modulegroup'); + $values['recursion'] = get_parameter('recursion'); + $values['status'] = get_parameter('status'); + $values['ag_modulename'] = get_parameter('ag_modulename'); + $values['ag_freestring'] = get_parameter('ag_freestring'); + $values['tag_filter'] = json_encode(get_parameter('tag_filter')); + $values['moduletype'] = get_parameter('moduletype'); + $values['module_option'] = get_parameter('module_option'); + $values['min_hours_status'] = get_parameter('min_hours_status'); + $values['datatype'] = get_parameter('datatype'); + $values['not_condition'] = get_parameter('not_condition'); + $values['ag_custom_fields'] = get_parameter('ag_custom_fields'); + + $exists = (bool) db_get_value_filter( + 'id_filter', + 'tmonitor_filter', + $values + ); + + if ($exists === true) { + echo 'duplicate'; + } else { + $result = db_process_sql_insert('tmonitor_filter', $values); + + if ($result === false) { + echo 'error'; + } else { + echo $result; + } + } + } + + if ($update_monitor_filter) { + $values = []; + $id = get_parameter('id'); + + $values['ag_group'] = get_parameter('ag_group'); + $values['modulegroup'] = get_parameter('modulegroup'); + $values['recursion'] = get_parameter('recursion'); + $values['status'] = get_parameter('status'); + $values['ag_modulename'] = get_parameter('ag_modulename'); + $values['ag_freestring'] = get_parameter('ag_freestring'); + $values['tag_filter'] = json_encode(get_parameter('tag_filter')); + $values['moduletype'] = get_parameter('moduletype'); + $values['module_option'] = get_parameter('module_option'); + $values['min_hours_status'] = get_parameter('min_hours_status'); + $values['datatype'] = get_parameter('datatype'); + $values['not_condition'] = get_parameter('not_condition'); + $values['ag_custom_fields'] = get_parameter('ag_custom_fields'); + + $result = db_process_sql_update( + 'tmonitor_filter', + $values, + ['id_filter' => $id] + ); + + if ($result === false) { + echo 'error'; + } else { + echo 'ok'; + } + } + + if ($get_monitor_filters) { + $sql = 'SELECT id_filter, id_name FROM tmonitor_filter'; + + $monitor_filters = db_get_all_rows_sql($sql); + + $result = []; + + if ($monitor_filters !== false) { + foreach ($monitor_filters as $monitor_filter) { + $result[$monitor_filter['id_filter']] = $monitor_filter['id_name']; + } + } + + echo io_json_mb_encode($result); + } + + if ((int) $load_filter_modal === 1) { + $user_groups = users_get_groups( + $config['id_user'], + 'AR', + users_can_manage_group_all(), + true + ); + + $sql = 'SELECT id_filter, id_name + FROM tmonitor_filter + WHERE id_group_filter IN ('.implode(',', array_keys($user_groups)).')'; + + $event_filters = db_get_all_rows_sql($sql); + + $filters = []; + foreach ($event_filters as $event_filter) { + $filters[$event_filter['id_filter']] = $event_filter['id_name']; + } + + echo '
'; + echo '
'; + + $table = new StdClass; + $table->id = 'load_filter_form'; + $table->width = '100%'; + $table->cellspacing = 4; + $table->cellpadding = 4; + $table->class = 'databox'; + if (is_metaconsole()) { + $table->cellspacing = 0; + $table->cellpadding = 0; + $table->class = 'databox filters'; + } + + $table->styleTable = 'font-weight: bold; color: #555; text-align:left;'; + $filter_id_width = '200px'; + if (is_metaconsole()) { + $filter_id_width = '150px'; + } + + $data = []; + $table->rowid[3] = 'update_filter_row1'; + $data[0] = __('Load filter').$jump; + $data[0] .= html_print_select( + $filters, + 'filter_id', + $current, + '', + __('None'), + 0, + true, + false, + true, + '', + false, + 'margin-left:5px; width:'.$filter_id_width.';' + ); + $data[1] = html_print_submit_button( + __('Load filter'), + 'load_filter', + false, + 'class="sub upd"', + true + ); + $data[1] .= html_print_input_hidden('load_filter', 1, true); + $table->data[] = $data; + $table->rowclass[] = ''; + + html_print_table($table); + echo '
'; + echo '
'; + ?> + + + '; + if (check_acl($config['id_user'], 0, 'EW') + || check_acl($config['id_user'], 0, 'EM') + ) { + echo '
'; + $table = new StdClass; + $table->id = 'save_filter_form'; + $table->width = '100%'; + $table->cellspacing = 4; + $table->cellpadding = 4; + $table->class = 'databox'; + if (is_metaconsole()) { + $table->class = 'databox filters'; + $table->cellspacing = 0; + $table->cellpadding = 0; + } + + $table->styleTable = 'font-weight: bold; text-align:left;'; + if (!is_metaconsole()) { + $table->style[0] = 'width: 50%; width:50%;'; + } + + $data = []; + $table->rowid[0] = 'update_save_selector'; + $data[0] = html_print_radio_button( + 'filter_mode', + 'new', + '', + true, + true + ).__('New filter').''; + + $data[1] = html_print_radio_button( + 'filter_mode', + 'update', + '', + false, + true + ).__('Update filter').''; + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[1] = 'save_filter_row1'; + $data[0] = __('Filter name').$jump; + $data[0] .= html_print_input_text('id_name', '', '', 15, 255, true); + if (is_metaconsole()) { + $data[1] = __('Save in Group').$jump; + } else { + $data[1] = __('Filter group').$jump; + } + + $user_groups_array = users_get_groups_for_select( + $config['id_user'], + 'EW', + users_can_manage_group_all(), + true + ); + + $data[1] .= html_print_select( + $user_groups_array, + 'id_group_filter_dialog', + $id_group_filter, + '', + '', + 0, + true, + false, + false, + 'w130' + ); + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[2] = 'save_filter_row2'; + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[3] = 'update_filter_row1'; + $data[0] = __('Overwrite filter').$jump; + + $sql = 'SELECT id_filter, id_name FROM tmonitor_filter'; + $monitor_filters = db_get_all_rows_sql($sql); + + $_filters_update = []; + + if ($monitor_filters !== false) { + foreach ($monitor_filters as $monitor_filter) { + $_filters_update[$monitor_filter['id_filter']] = $monitor_filter['id_name']; + } + } + + $data[0] .= html_print_select( + $_filters_update, + 'overwrite_filter', + '', + '', + '', + 0, + true + ); + $data[1] = html_print_submit_button( + __('Update filter'), + 'update_filter', + false, + 'class="sub upd" onclick="save_update_filter();"', + true + ); + + $table->data[] = $data; + $table->rowclass[] = ''; + + html_print_table($table); + echo '
'; + echo html_print_submit_button( + __('Save filter'), + 'save_filter', + false, + 'class="sub upd float-right" onclick="save_new_filter();"', + true + ); + echo '
'; + } else { + include 'general/noaccess.php'; + } + + echo '
'; + ?> + + 0) { + $user_groups_fl = users_get_groups( + $config['id_user'], + 'AR', + users_can_manage_group_all(), + true + ); + + $sql = sprintf( + 'SELECT id_filter, id_name + FROM tmonitor_filter + WHERE id_filter = %d AND id_group_filter IN (%s)', + $load_filter_id, + implode(',', array_keys($user_groups_fl)) + ); + + $loaded_filter = db_get_row_sql($sql); +} + +if ($loaded_filter['id_filter'] > 0) { + $query_filter['id_filter'] = $load_filter_id; + $filter = db_get_row_filter('tmonitor_filter', $query_filter, false); + if ($filter !== false) { + $ag_group = $filter['ag_group']; + $recursion = $filter['recursion']; + $status = $filter['status']; + $modulegroup = $filter['modulegroup']; + $ag_modulename = $filter['ag_modulename']; + $ag_freestring = $filter['ag_freestring']; + $tag_filter = $filter['tag_filter']; + $moduletype = $filter['moduletype']; + $module_option = $filter['module_option']; + $min_hours_status = $filter['min_hours_status']; + $datatype = $filter['datatype']; + $not_condition = $filter['not_condition']; + $ag_custom_fields = $filter['ag_custom_fields']; + + if ($not_condition === 'false') { + $not_condition = ''; + } + + if ($not_condition !== '') { + $is_none = 'None'; + $not_condition = 'NOT'; + } + + if ($not_condition !== '') { + $condition_query = '!='; + } + + if (is_array($tag_filter) === false) { + $tag_filter = json_decode($tag_filter, true); + } + if ($tag_filter === '') { + $tag_filter = [0 => 0]; + } + + if (is_array($ag_custom_fields) === false) { + $ag_custom_fields = json_decode(io_safe_output($ag_custom_fields), true); + } + } +} + // Agent group selector. if (!$is_metaconsole) { if ($ag_group > 0 && check_acl($config['id_user'], $ag_group, 'AR')) { @@ -370,19 +436,21 @@ if (!empty($ag_custom_fields)) { } } +$all_tags = in_array(0, $tag_filter); + // Filter by tag. -if ($tag_filter !== 0) { - if ($is_metaconsole) { - $sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN ( - SELECT ttag_module.id_agente_modulo - FROM ttag_module - WHERE ttag_module.id_tag '.$not_condition.' IN ('.$tag_filter.'))'; - } else { - $sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN ( - SELECT ttag_module.id_agente_modulo - FROM ttag_module - WHERE ttag_module.id_tag '.$condition_query.' '.$tag_filter.')'; +if ($all_tags === false) { + $sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN ( + SELECT ttag_module.id_agente_modulo + FROM ttag_module + WHERE 1=1'; + + if ($all_tags === false) { + $sql_conditions .= ' AND ttag_module.id_tag '.$not_condition.' IN ('.implode(',', $tag_filter).'))'; } +} else if ($not_condition === 'NOT') { + // Match nothing if not condition has been selected along with all tags selected (none). + $sql_conditions .= ' AND 0=0'; } @@ -475,13 +543,14 @@ $table->data[0][1] .= html_print_select_groups( false, $not_condition ); + $table->data[0][1] .= '
'; $table->data[0][1] .= html_print_input( [ 'type' => 'checkbox', 'name' => 'recursion', 'return' => true, - 'checked' => $recursion, + 'checked' => ($recursion === true || $recursion === 'true' || $recursion === '1') ? 'checked' : false, 'value' => 1, ] ); @@ -556,13 +625,13 @@ if (empty($tags)) { } else { $table->data[1][5] = html_print_select( $tags, - 'tag_filter', + 'tag_filter[]', $tag_filter, '', - __($is_none), - '', + __('All'), + 0, + true, true, - false, true, '', false, @@ -666,7 +735,6 @@ $table2->data[1][0] = 'data[1][0] .= '>'.__('Data type').''; $table2->data[1][1] .= '
'; - switch ($moduletype) { case 1: $sql = sprintf( @@ -771,7 +839,7 @@ $table2->data[1][3] = html_print_div( 'type' => 'switch', 'name' => 'not_condition', 'return' => false, - 'checked' => $check_not_condition, + 'checked' => ($check_not_condition === true || $check_not_condition === 'true' || $check_not_condition === '1') ? 'checked' : false, 'value' => 'NOT', 'id' => 'not_condition_switch', 'onclick' => 'changeNotConditionStatus(this)', @@ -855,9 +923,30 @@ $table->data[3][0] = ui_toggle( 'white_table_graph' ); -$table->colspan[4][0] = 7; +$table->colspan[4][0] = 2; $table->cellstyle[4][0] = 'padding-top: 0px;'; -$table->data[4][0] = html_print_submit_button( +$table->data[4][0] = html_print_button( + __('Load filter'), + 'load-filter', + false, + '', + 'class="float-left margin-right-2 sub config"', + true +); + +$table->cellstyle[4][0] .= 'padding-top: 0px;'; +$table->data[4][0] .= html_print_button( + __('Save filter'), + 'save-filter', + false, + '', + 'class="float-left margin-right-2 sub wand"', + true +); + +$table->colspan[4][2] = 5; +$table->cellstyle[4][2] = 'padding-top: 0px;'; +$table->data[4][2] = html_print_submit_button( __('Show'), 'uptbutton', false, @@ -2017,16 +2106,76 @@ if (!empty($result)) { } - // End Build List Result. - echo "
"; +// End Build List Result. +echo "
"; - enterprise_hook('close_meta_frame'); +// Load filter div for dialog. +echo ''; +echo ''; - ui_require_javascript_file('pandora_modules'); +enterprise_hook('close_meta_frame'); + +ui_require_javascript_file('pandora_modules'); ?> '; From d2856e09bd72c94972bcd7dbc5913b845c6bc124 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 13 Feb 2023 13:39:20 +0100 Subject: [PATCH 079/110] implemented per-task sap license --- pandora_console/include/functions_config.php | 4 ---- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 12 ++++++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index b0d15d5cef..1acbfa0760 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -463,10 +463,6 @@ function config_update_config() if (config_update_value('ipam_ocuppied_warning_treshold', get_parameter('ipam_ocuppied_warning_treshold'), true) === false) { $error_update[] = __('Ipam Ocuppied Manager Warning'); } - - if (config_update_value('sap_license', get_parameter('sap_license'), true) === false) { - $error_update[] = __('SAP/R3 Plugin Licence'); - } } break; diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index e6c42fab34..2d5928333d 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -221,10 +221,14 @@ sub data_consumer ($$) { if ($task->{'type'} == DISCOVERY_APP_SAP) { # SAP TASK, retrieve license. - $task->{'sap_license'} = pandora_get_config_value( - $dbh, - 'sap_license' - ); + if (defined($task->{'field4'}) && $task->{'field4'} ne "") { + $task->{'sap_license'} = $task->{'field4'}; + } else { + $task->{'sap_license'} = pandora_get_config_value( + $dbh, + 'sap_license' + ); + } # Retrieve credentials for task (optional). if (defined($task->{'auth_strings'}) From b3ca6c78bf46abd2637b0a519d1d1372e8d853e3 Mon Sep 17 00:00:00 2001 From: sergio Date: Mon, 13 Feb 2023 13:58:37 +0100 Subject: [PATCH 080/110] #9713 ent Problems with the copy button fixed --- .../include/functions_filemanager.php | 193 +++++++++--------- 1 file changed, 93 insertions(+), 100 deletions(-) diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 1db21b308a..4fc6dd0b14 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -1,4 +1,5 @@ - function show_create_text_file() { - actions_dialog('create_text_file'); - $("#create_text_file").css("display", "block"); - check_opened_dialog('create_text_file'); - } + function show_create_text_file() { + actions_dialog('create_text_file'); + $("#create_text_file").css("display", "block"); + check_opened_dialog('create_text_file'); + } + function show_upload_file() { actions_dialog('upload_file'); $("#upload_file").css("display", "block"); check_opened_dialog('upload_file'); } - function check_opened_dialog(check_opened){ - if(check_opened !== 'create_folder'){ + function check_opened_dialog(check_opened) { + if (check_opened !== 'create_folder') { if (($("#create_folder").hasClass("ui-dialog-content") && $('#create_folder').dialog('isOpen') === true)) { $('#create_folder').dialog('close'); } } - if(check_opened !== 'create_text_file'){ - if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) { - $('#create_text_file').dialog('close'); + if (check_opened !== 'create_text_file') { + if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) { + $('#create_text_file').dialog('close'); + } } - } - if(check_opened !== 'upload_file'){ + if (check_opened !== 'upload_file') { if (($("#upload_file").hasClass("ui-dialog-content") && $('#upload_file').dialog('isOpen')) === true) { $('#upload_file').dialog('close'); } } } - function actions_dialog(action){ - $('.'+action).addClass('file_table_modal_active'); - var title_action =''; + function actions_dialog(action) { + $('.' + action).addClass('file_table_modal_active'); + var title_action = ''; switch (action) { case 'create_folder': - title_action = ""; + title_action = ""; break; - - case 'create_text_file': - title_action = ""; - break; - + + case 'create_text_file': + title_action = ""; + break; + case 'upload_file': - title_action = ""; + title_action = ""; break; default: break; } - $('#'+action) - .dialog({ - title: title_action, - resizable: true, - draggable: true, - modal: true, - overlay: { - opacity: 0.5, - background: "black" - }, - width: 500, - minWidth: 500, - minHeight: 210, - maxWidth: 800, - maxHeight: 300, - close: function () { - $('.'+action).removeClass('file_table_modal_active'); - } - }).show(); + $('#' + action) + .dialog({ + title: title_action, + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 500, + minWidth: 500, + minHeight: 210, + maxWidth: 800, + maxHeight: 300, + close: function() { + $('.' + action).removeClass('file_table_modal_active'); + } + }).show(); } - function show_modal_real_path (path) { + function show_modal_real_path(path) { + if (navigator.clipboard && window.isSecureContext) ; + else ; $('#modal_real_path').addClass('file_table_modal_active'); $('#real_path').empty(); $('#real_path').html(path); title_action = ""; $('#modal_real_path') - .dialog({ - title: title_action, - resizable: true, - draggable: true, - modal: true, - overlay: { - opacity: 0.5, - background: "black" - }, - width: 448, - minWidth: 448, - minHeight: 213, - maxWidth: 800, - maxHeight: 300, - close: function () { - $('#modal_real_path').removeClass('file_table_modal_active'); - } - }).show(); + .dialog({ + title: title_action, + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 448, + minWidth: 448, + minHeight: 213, + maxWidth: 800, + maxHeight: 300, + close: function() { + $('#modal_real_path').removeClass('file_table_modal_active'); + } + }).show(); - $("#submit-submit").on("click",copyToClipboard); + $("#submit-submit").on("click", copyToClipboard); } function copyToClipboard() { - navigator.clipboard.writeText($("#real_path").text()).then(function (){ - $('#modal_real_path').dialog('close'); - }); + if (navigator.clipboard && window.isSecureContext) { + window.navigator.clipboard.writeText($("#real_path").text()).then(function() { + $('#modal_real_path').dialog('close'); + }); + } } '.$data[1].''; + $error_message = __('This file could be executed by any user'); + $error_message .= '. '.__('Make sure it can\'t perform dangerous tasks'); + $data[1] = ''.$data[1].''; } $data[2] = ui_print_timestamp( @@ -753,11 +742,11 @@ function filemanager_file_explorer( $data[3] = ui_format_filesize($fileinfo['size']); } - // Actions buttons - // Delete button. - $data[4] = ''; - $data[4] .= ''; - $typefile = array_pop(explode('.', $fileinfo['name'])); + // Actions buttons + // Delete button. + $data[4] = ''; + $data[4] .= ''; + $typefile = array_pop(explode('.', $fileinfo['name'])); if (is_writable($fileinfo['realpath']) === true && (is_dir($fileinfo['realpath']) === false || count(scandir($fileinfo['realpath'])) < 3) && ($readOnly === false) @@ -805,9 +794,9 @@ function filemanager_file_explorer( $data[4] .= ''.html_print_image('images/book_edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Real path'), 'class' => 'invert_filter']).''; } - $data[4] .= ''; + $data[4] .= ''; - array_push($table->data, $data); + array_push($table->data, $data); } } else { ui_print_info_message( @@ -900,7 +889,7 @@ function filemanager_file_explorer( 'content' => html_print_input_file( 'file', true, - [ 'style' => 'border:0; padding:0; width:100%' ] + ['style' => 'border:0; padding:0; width:100%'] ), ], true @@ -985,8 +974,12 @@ function filemanager_file_explorer( // Show Modal Real Path $modal_real_path = "
Real path to plugin execution is:
-
-
".html_print_submit_button(__('Copy'), 'submit', false, 'class="sub next"', true).'
'; +
"; + + if (isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') { + $modal_real_path .= "
".html_print_submit_button(__('Copy'), 'submit', false, 'class="sub next"', true).'
'; + } + html_print_div( [ 'id' => 'modal_real_path', @@ -1141,4 +1134,4 @@ function filemanager_safe_directory( } return $directory; -} \ No newline at end of file +} From a9832e9886b9bbff50c51021b0fe1d44c721ae7e Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 13 Feb 2023 15:40:55 +0100 Subject: [PATCH 081/110] WIP: Added pandora notification if missing library on agent --- .../include/class/ConsoleSupervisor.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index b6a6d3df43..17d7b2213a 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -518,6 +518,14 @@ class ConsoleSupervisor $this->checkSyncQueueLength(); $this->checkSyncQueueStatus(); } + + /* + * Checkc agent missing libraries. + * NOTIF.AGENT.LIBRARY + */ + if ((bool) enterprise_installed() === true) { + $this->checkLibaryError(); + } } @@ -2806,4 +2814,29 @@ class ConsoleSupervisor } + /** + * Chechs if an agent has a dependency eror on omnishell + * + * @return void + */ + public function checkLibaryError() + { + $sql = 'SELECT COUNT(errorlevel) from tremote_command_target WHERE errorlevel = 2'; + + $error_dependecies = db_get_sql($sql); + if ($error_dependecies > 0) { + $this->notify( + [ + 'type' => 'NOTIF.AGENT.LIBRARY', + 'title' => __('Agent dependency error'), + 'message' => __( + 'There are omnishell agents with dependency errors', + ), + 'url' => $url, + ] + ); + } + } + + } From 5b263981c477010b8d6d5dcd813cd25e1ad480ef Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 13 Feb 2023 17:06:09 +0100 Subject: [PATCH 082/110] #10118 Added group multiselector --- pandora_console/extras/mr/61.sql | 2 ++ .../include/class/NetworkMap.class.php | 21 ++++++++++++------- .../agentes/pandora_networkmap.editor.php | 14 ++++++++++--- .../operation/agentes/pandora_networkmap.php | 6 +++--- .../agentes/pandora_networkmap.view.php | 2 -- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/pandora_console/extras/mr/61.sql b/pandora_console/extras/mr/61.sql index b73069c058..2812efb2a6 100644 --- a/pandora_console/extras/mr/61.sql +++ b/pandora_console/extras/mr/61.sql @@ -2,6 +2,8 @@ START TRANSACTION; ALTER TABLE `tserver` ADD COLUMN `server_keepalive_utimestamp` BIGINT NOT NULL DEFAULT 0; +ALTER TABLE `tmap` MODIFY COLUMN `id_group` TEXT NOT NULL default ''; + CREATE TABLE IF NOT EXISTS `tmonitor_filter` ( `id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT, `id_name` VARCHAR(600) NOT NULL, diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 7b43a3daf6..ebfa966a9b 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -792,17 +792,22 @@ class NetworkMap || $this->mapOptions['map_filter']['dont_show_subgroups'] == 1 ) { // Show only current selected group. - $filter['id_grupo'] = $this->idGroup; + $filter['id_grupo'] = explode(',', $this->idGroup); } else { // Show current group and children. - $childrens = groups_get_children($this->idGroup, null, true); - if (!empty($childrens)) { - $childrens = array_keys($childrens); + foreach (explode(',', $this->idGroup) as $key => $group) { + $childrens = groups_get_children($group, null, true); + if (!empty($childrens)) { + $childrens = array_keys($childrens); - $filter['id_grupo'] = $childrens; - $filter['id_grupo'][] = $this->idGroup; - } else { - $filter['id_grupo'] = $this->idGroup; + if (empty($filter['id_grupo']) === false) { + $filter['id_grupo'] = array_merge($filter['id_grupo'], $childrens); + } else { + $filter['id_grupo'] = $childrens; + } + } else { + $filter['id_grupo'][] = $group; + } } } diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 507e037b1e..0d2c7193e1 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -337,7 +337,14 @@ if ($not_found) { ); $table->data[3][0] = __('Description'); - $table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true); + $table->data[3][1] = html_print_input_text( + 'description', + $description, + '', + 100, + 100, + true + ); $table->data[4][0] = __('Position X'); $table->data[4][1] = html_print_input_text('pos_x', $offset_x, '', 2, 10, true); @@ -401,11 +408,12 @@ if ($not_found) { $config['id_user'], 'AR', true, - 'id_group', - $id_group, + 'id_group[]', + explode(',', $id_group), '', '', '', + true, true ).'
'; $table->data['source_data_group'][1] .= html_print_image( diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 9c57ad033f..9fcf1b7fae 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -237,7 +237,7 @@ if ($new_networkmap || $save_networkmap) { } if ($save_networkmap) { - $id_group = (int) get_parameter('id_group', 0); + $id_group = get_parameter('id_group', 0); $id_group_map = (int) get_parameter('id_group_map', 0); @@ -292,7 +292,7 @@ if ($new_networkmap || $save_networkmap) { $values = []; $values['name'] = $name; - $values['id_group'] = $id_group; + $values['id_group'] = implode(',', $id_group); $values['source_period'] = 60; $values['width'] = $width; $values['height'] = $height; @@ -333,7 +333,7 @@ if ($new_networkmap || $save_networkmap) { if ($source == 'group') { $values['source'] = 0; - $values['source_data'] = $id_group; + $values['source_data'] = implode(',', $id_group); } else if ($source == 'recon_task') { $values['source'] = 1; $values['source_data'] = $recon_task_id; diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 6613daea79..61cfba9e97 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -315,8 +315,6 @@ if (is_ajax() === true) { $("#source").change(function() { const source = $(this).val(); - console.log("aaaaaaaaaaaaaaaa"); - if (source == \'recon_task\') { $("#form_editor-source_data_ip_mask") .css(\'display\', \'none\'); From 8ca25c01a2e4e8db00d3b23bc8a1d9bc5866ba65 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 13 Feb 2023 17:11:19 +0100 Subject: [PATCH 083/110] #10384 Sql error correction delete modules in bulk --- pandora_console/include/functions_modules.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 15c6da909e..aa45aacc10 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -519,12 +519,13 @@ function modules_delete_agent_module($id_agent_module) 'disabled' => 1, 'delete_pending' => 1, ]; - $result = db_process_sql_update( + $id_agent = db_process_sql_update( 'tagente_modulo', $values, ['id_agente_modulo' => $id_borrar_modulo] ); - if ($result === false) { + + if ($id_agent === false) { $error++; } else { // Set flag to update module status count. @@ -562,7 +563,7 @@ function modules_delete_agent_module($id_agent_module) $result = db_process_delete_temp( 'ttag_module', 'id_agente_modulo', - $id_borrar_modulo + $id_agent ); if ($result === false) { $error++; From 1d62129357ef41d17af10f6bdd3de92d9b3c79b9 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 14 Feb 2023 01:01:40 +0100 Subject: [PATCH 084/110] 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 7802c679e5..cb4b34773f 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.768-230213 +Version: 7.0NG.768-230214 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 eb4279b84f..2fdf61f38b 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.768-230213" +pandora_version="7.0NG.768-230214" 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 1668a50e86..9d3cc8cba6 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.768'; -use constant AGENT_BUILD => '230213'; +use constant AGENT_BUILD => '230214'; # 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 4482ace58a..7a8736a942 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_linux %define version 7.0NG.768 -%define release 230213 +%define release 230214 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 1b07645a58..e3a4334b3d 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_linux %define version 7.0NG.768 -%define release 230213 +%define release 230214 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 601db13b4b..ba729305b9 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230213" +PI_BUILD="230214" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 1cf8ab41dc..15174f2833 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230213} +{230214} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index d44d4eb5a1..5138ad8fe4 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.768 Build 230213") +#define PANDORA_VERSION ("7.0NG.768 Build 230214") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index e983b3cba2..bcba63f1ba 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.768(Build 230213))" + VALUE "ProductVersion", "(7.0NG.768(Build 230214))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 8b393620b9..5fdad46edb 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.768-230213 +Version: 7.0NG.768-230214 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 399096ff6a..02c7869a01 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.768-230213" +pandora_version="7.0NG.768-230214" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 5a8c0631b1..a38089f89a 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 = 'PC230213'; +$build_version = 'PC230214'; $pandora_version = 'v7.0NG.768'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 835b2efaea..77ba7bc29c 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 90ebdbf8bc..8dbbf2efa9 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.768 -%define release 230213 +%define release 230214 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 9698e8c1dc..e4390722e2 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.768 -%define release 230213 +%define release 230214 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 52e6b86b35..1f651d7741 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230213" +PI_BUILD="230214" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index d29d04b6a7..77d8749d2d 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.768 Build 230213"; +my $version = "7.0NG.768 Build 230214"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 378688aa67..e3522c3c6a 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.768 Build 230213"; +my $version = "7.0NG.768 Build 230214"; # save program name for logging my $progname = basename($0); From 9c4a0f8a2bcae7f3094f8d72a3ff2a5917767ff6 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 14 Feb 2023 09:03:51 +0100 Subject: [PATCH 085/110] Agent library error notification --- pandora_console/include/class/ConsoleSupervisor.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 17d7b2213a..1f82d1cea0 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -258,6 +258,14 @@ class ConsoleSupervisor $this->checkSyncQueueStatus(); } + /* + * Checkc agent missing libraries. + * NOTIF.AGENT.LIBRARY + */ + if ((bool) enterprise_installed() === true) { + $this->checkLibaryError(); + } + } @@ -2832,7 +2840,8 @@ class ConsoleSupervisor 'message' => __( 'There are omnishell agents with dependency errors', ), - 'url' => $url, + + 'url' => '__url__/index.php?sec=gextensions&sec2=enterprise/tools/omnishell', ] ); } From ccb0cda3057fa784e0675723031d1732a7113da8 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 14 Feb 2023 12:16:38 +0100 Subject: [PATCH 086/110] #10118 changed CIDR input --- .../include/class/NetworkMap.class.php | 4 ++- .../include/functions_networkmap.php | 15 ++++++----- .../agentes/pandora_networkmap.editor.php | 26 ++++++++++++++++++- .../agentes/pandora_networkmap.view.php | 11 +++++++- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index ebfa966a9b..3f1a5f6e9a 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -782,7 +782,9 @@ class NetworkMap if ($this->network) { // Network map, based on direct network. $nodes = networkmap_get_nodes_from_ip_mask( - $this->network + $this->network, + false, + ' ' ); } else if ($this->mapOptions['map_filter']['empty_map']) { // Empty map returns no data. diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 120af5b571..de685384be 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1356,9 +1356,10 @@ function networkmap_get_types($strict_user=false) */ function networkmap_get_nodes_from_ip_mask( $ip_mask, - $return_ids_only=false + $return_ids_only=false, + $separator=',', ) { - $list_ip_masks = explode(',', $ip_mask); + $list_ip_masks = explode($separator, $ip_mask); if (empty($list_ip_masks) === true) { return []; @@ -1375,14 +1376,14 @@ function networkmap_get_nodes_from_ip_mask( $sql = sprintf( 'SELECT * FROM `tagente` - INNER JOIN - (SELECT DISTINCT `id_agent` FROM + INNER JOIN + (SELECT DISTINCT `id_agent` FROM (SELECT `id_agente` AS "id_agent", `direccion` AS "ip" - FROM `tagente` + FROM `tagente` UNION SELECT ag.`id_agent`, a.`ip` - FROM `taddress_agent` ag - INNER JOIN `taddress` a + FROM `taddress_agent` ag + INNER JOIN `taddress` a ON ag.id_a=a.id_a ) t_tmp WHERE (-1 << %d) & INET_ATON(t_tmp.ip) = INET_ATON("%s") diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 0d2c7193e1..59f2befad4 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -273,6 +273,21 @@ if (!empty($result)) { if ($not_found) { ui_print_error_message(__('Not found networkmap.')); } else { + if ($disabled_source === false) { + $info1 = __('To create a network map that visually recreates link-level (L2) relationships, you must first discover these relationships with Discovery Server. Network maps only reflect relationships that have already been discovered.'); + $separator = '
'; + $info2 = __('Discovery Server discovers relationships between interfaces (L2) through SNMP and relationships between hosts (L3) through route discovery.'); + $info3 = __('You can also create these relationships manually by editing nodes or re-passing a discovery task after adding new information (for example by adding new SNMP communities).'); + $info4 = __('See our documentation for more information.'); + ui_print_info_message( + [ + 'no_close' => false, + 'message' => $info1.$separator.$info2.$separator.$info3.$separator.$info4, + ], + 'style="width: 98%;"' + ); + } + $table = new stdClass(); $table->id = 'form_editor'; @@ -401,7 +416,16 @@ if ($not_found) { ); $table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask'); - $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source); + $table->data['source_data_ip_mask'][1] = html_print_textarea( + 'ip_mask', + 3, + 5, + $ip_mask, + 'style="width: 238px"', + true, + '', + $disabled_source + ); $table->data['source_data_group'][0] = __('Source group'); $table->data['source_data_group'][1] = '
'.html_print_select_groups( diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 61cfba9e97..d85264b093 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -237,7 +237,16 @@ if (is_ajax() === true) { ); $table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask'); - $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $map_info['source_data'], '', 20, 255, true); + $table->data['source_data_ip_mask'][1] = html_print_textarea( + 'ip_mask', + 3, + 5, + $map_info['source_data'], + '', + true, + '', + $disabled_source + ); $dont_show_subgroups = 0; if (isset($map_filter['dont_show_subgroups'])) { From 856fade86cfe187f715cc0db73fdff42f2b3631f Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 14 Feb 2023 14:45:46 +0100 Subject: [PATCH 087/110] #10118 Added spinner --- .../operation/agentes/pandora_networkmap.editor.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 59f2befad4..a638bc9aa9 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -274,6 +274,10 @@ if ($not_found) { ui_print_error_message(__('Not found networkmap.')); } else { if ($disabled_source === false) { + echo '
'; + echo html_print_image('images/spinner.gif', true, 'width: 50px;height: 50px;'); + echo '
'.__('Creating map...').'
'; + echo '
'; $info1 = __('To create a network map that visually recreates link-level (L2) relationships, you must first discover these relationships with Discovery Server. Network maps only reflect relationships that have already been discovered.'); $separator = '
'; $info2 = __('Discovery Server discovers relationships between interfaces (L2) through SNMP and relationships between hosts (L3) through route discovery.'); @@ -546,6 +550,7 @@ if ($not_found) {