From 3e90c362503a1b3a1c98d5fd581219651b80e9c4 Mon Sep 17 00:00:00 2001 From: sergio Date: Mon, 28 Nov 2022 11:31:44 +0100 Subject: [PATCH 01/82] #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 02/82] 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 03/82] 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 4392bd7fa8b7f96ff74aa5e1f84cefd1b94d30d7 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Fri, 13 Jan 2023 12:09:15 +0100 Subject: [PATCH 04/82] 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 0ec58067abf3291f421f278978e1aad728e19278 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Tue, 24 Jan 2023 14:45:42 +0100 Subject: [PATCH 05/82] 9220 Cast config['license_nms'] --- pandora_console/godmode/agentes/configurar_agente.php | 2 +- pandora_console/godmode/servers/modificar_server.php | 2 +- pandora_console/include/class/SatelliteCollection.class.php | 2 +- pandora_console/include/functions.php | 2 +- pandora_console/operation/agentes/ver_agente.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 36b1d5302a..6503a0fb0b 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -498,7 +498,7 @@ if ($id_agente) { } // Collection. - if ($config['license_nms'] !== 1) { + if ((int) $config['license_nms'] !== 1) { $collectiontab = enterprise_hook('collection_tab'); if ($collectiontab == -1) { diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index 748c707227..b7541586b3 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -141,7 +141,7 @@ if (isset($_GET['server'])) { ]; - if ($config['license_nms'] !== 1) { + if ((int) $config['license_nms'] !== 1) { $buttons['collections'] = [ 'active' => false, 'text' => ''.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'', diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php index b8535f5cc6..769ec5c6f4 100644 --- a/pandora_console/include/class/SatelliteCollection.class.php +++ b/pandora_console/include/class/SatelliteCollection.class.php @@ -84,7 +84,7 @@ class SatelliteCollection extends HTML return; } - if ($config['license_nms'] === 1) { + if ((int) $config['license_nms'] === 0) { db_pandora_audit( AUDIT_LOG_NMS_VIOLATION, 'Trying to access satellite collections' diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 8940dc08ae..c6e8812100 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6398,7 +6398,7 @@ function nms_check_api() { global $config; - if ($config['license_nms'] === 1) { + if ((int) $config['license_nms'] === 1) { returnError('license_error'); return true; } diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 6112ecbb52..c1bf5c27d7 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1473,7 +1473,7 @@ if ($tab == 'inventory') { } // Collection. -if ($config['license_nms'] !== 1) { +if ((int) $config['license_nms'] !== 1) { $collectiontab = enterprise_hook('collection_tab'); if ($collectiontab == -1) { $collectiontab = ''; From 783f9a17939cb510406efab94db6d646071da1a7 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 25 Jan 2023 17:01:28 +0100 Subject: [PATCH 06/82] #10115 fixed login with special character in ldap --- pandora_console/include/auth/mysql.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index be845f3fc0..e33ce54f5b 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -360,7 +360,7 @@ function process_user_login_remote($login, $pass, $api=false) } $user_info = [ - 'fullname' => $login, + 'fullname' => io_safe_input($login), 'comments' => 'Imported from '.$config['auth'], ]; @@ -1565,7 +1565,7 @@ function local_ldap_search( $filter = ''; if (!empty($access_attr) && !empty($user)) { - $filter = " -s sub '(".$access_attr.'='.$user.")' "; + $filter = ' -s sub '.escapeshellarg('('.$access_attr.'='.$user.')'); } $tls = ''; @@ -1591,7 +1591,7 @@ function local_ldap_search( $ldap_admin_pass = ' -w '.escapeshellarg($ldap_admin_pass); } - $dn = " -b '".$dn."'"; + $dn = ' -b '.escapeshellarg($dn); $ldapsearch_command = 'ldapsearch -LLL -o ldif-wrap=no -o nettimeout='.$ldap_search_time.' -x'.$ldap_host.$ldap_version.' -E pr=10000/noprompt '.$ldap_admin_user.$ldap_admin_pass.$dn.$filter.$tls.' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'; $shell_ldap_search = explode("\n", shell_exec($ldapsearch_command)); foreach ($shell_ldap_search as $line) { From 8fb5fc0d852fea1be7abcff9647e0b29a53f6e4c Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 26 Jan 2023 09:16:02 +0100 Subject: [PATCH 07/82] #10115 fixed special character in fullname if user have permission --- pandora_console/include/auth/mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index e33ce54f5b..94e91116e4 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -398,7 +398,7 @@ function process_user_login_remote($login, $pass, $api=false) $config['auth_error'] = __('User not found in database or incorrect password'); return false; } else { - $user_info['fullname'] = $sr['cn'][0]; + $user_info['fullname'] = io_safe_input($sr['cn'][0]); $user_info['email'] = $sr['mail'][0]; // Create the user. From 96efef07d2cb04747f3569c76ec6ec3c50d9c3b9 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 26 Jan 2023 09:28:29 +0100 Subject: [PATCH 08/82] #10115 changed function for control special character in mysql.php --- pandora_console/include/auth/mysql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 94e91116e4..fd138f7fbe 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -360,7 +360,7 @@ function process_user_login_remote($login, $pass, $api=false) } $user_info = [ - 'fullname' => io_safe_input($login), + 'fullname' => db_escape_string_sql($login), 'comments' => 'Imported from '.$config['auth'], ]; @@ -398,7 +398,7 @@ function process_user_login_remote($login, $pass, $api=false) $config['auth_error'] = __('User not found in database or incorrect password'); return false; } else { - $user_info['fullname'] = io_safe_input($sr['cn'][0]); + $user_info['fullname'] = db_escape_string_sql($sr['cn'][0]); $user_info['email'] = $sr['mail'][0]; // Create the user. From 81ae7fdb08fcf85f09b6f745ea7498104d7973e7 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 27 Jan 2023 12:41:06 +0100 Subject: [PATCH 09/82] fix filter events sounds pandora_enterprise#10188 --- pandora_console/include/ajax/events.php | 31 ++++++++++++++++++++ pandora_console/include/functions_events.php | 1 - 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index d9be30cc33..bfff7a1171 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -2493,6 +2493,37 @@ if ($get_events_fired) { $filter = events_get_event_filter($filter_id); } + if (is_metaconsole() === true) { + $servers = metaconsole_get_servers(); + if (is_array($servers) === true) { + $servers = array_reduce( + $servers, + function ($carry, $item) { + $carry[$item['id']] = $item['server_name']; + return $carry; + } + ); + } else { + $servers = []; + } + + if ($filter['server_id'] === '') { + $filter['server_id'] = array_keys($servers); + } else { + if (is_array($filter['server_id']) === false) { + if (is_numeric($filter['server_id']) === true) { + if ($filter['server_id'] !== 0) { + $filter['server_id'] = [$filter['server_id']]; + } else { + $filter['server_id'] = array_keys($servers); + } + } else { + $filter['server_id'] = explode(',', $filter['server_id']); + } + } + } + } + // Set time. $filter['event_view_hr'] = 0; diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 3740257717..48ef7b2c30 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4948,7 +4948,6 @@ function events_page_general_acknowledged($event_id) global $config; $Acknowledged = ''; $event = db_get_row('tevento', 'id_evento', $event_id); - hd($event['ack_utimestamp'], true); if ($event !== false && $event['estado'] == 1) { $user_ack = db_get_value( 'fullname', From 69db3c80316acddfa4df9d403072c5aa9b21ce60 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 27 Jan 2023 12:44:15 +0100 Subject: [PATCH 10/82] blink button test sound events pandora_enterprise#10189 --- .../include/javascript/pandora_events.js | 2 + .../include/styles/sound_events.css | 56 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index c2ee675f0d..92eadf14fe 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -1030,8 +1030,10 @@ function openSoundEventModal(settings) { function test_sound_button(test_sound, urlSound) { if (test_sound === true) { + $("#button-melody_sound").addClass("blink-image"); add_audio(urlSound); } else { + $("#button-melody_sound").removeClass("blink-image"); remove_audio(); } } diff --git a/pandora_console/include/styles/sound_events.css b/pandora_console/include/styles/sound_events.css index 667446b1e8..9990550fda 100644 --- a/pandora_console/include/styles/sound_events.css +++ b/pandora_console/include/styles/sound_events.css @@ -301,3 +301,59 @@ background: #e63c52; } } + +/* Firefox old*/ +@-moz-keyframes blink { + 0% { + opacity: 1; + } + 50% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +@-webkit-keyframes blink { + 0% { + opacity: 1; + } + 50% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +/* IE */ +@-ms-keyframes blink { + 0% { + opacity: 1; + } + 50% { + opacity: 0.5; + } + 100% { + opacity: 1; + } +} +/* Opera and prob css3 final iteration */ +@keyframes blink { + 0% { + opacity: 1; + } + 50% { + opacity: 0.5; + } + 100% { + opacity: 1; + } +} +.blink-image { + -moz-animation: blink normal 2s infinite ease-in-out; /* Firefox */ + -webkit-animation: blink normal 2s infinite ease-in-out; /* Webkit */ + -ms-animation: blink normal 2s infinite ease-in-out; /* IE */ + animation: blink normal 2s infinite ease-in-out; /* Opera and prob css3 final iteration */ + filter: hue-rotate(120deg); +} From 9305fd17babafe6ef2cb69444cb44bc224be981f Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 30 Jan 2023 17:16:20 +0100 Subject: [PATCH 11/82] Fix get agent status on unknown modules --- pandora_server/lib/PandoraFMS/DB.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 338a914ab4..4a42019023 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -618,8 +618,13 @@ sub get_agent_status ($$$) { $module_status = 2; } elsif ($module_status != 2) { - if ($m_status == 0) { - $module_status = 0; + if ($m_status == 3) { + $module_status = 3; + } + elsif ($module_status != 3) { + if ($m_status == 3) { + $module_status = 3; + } } } } @@ -647,6 +652,8 @@ sub get_agent_status ($$$) { return 3; } } + + print "MS ::::::::::::::".Dumper($module_status); return $module_status; } From 825137d18bdfdbbd5de0ffb38619ef5fc0df6d39 Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 30 Jan 2023 17:17:48 +0100 Subject: [PATCH 12/82] Fix get agent status on unknown modules --- pandora_server/lib/PandoraFMS/DB.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 4a42019023..993f4e1fe8 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -622,8 +622,8 @@ sub get_agent_status ($$$) { $module_status = 3; } elsif ($module_status != 3) { - if ($m_status == 3) { - $module_status = 3; + if ($m_status == 0) { + $module_status = 0; } } } From cb6e523e337e4b4f9e67d912f91e64a5404e2db0 Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 30 Jan 2023 17:27:00 +0100 Subject: [PATCH 13/82] Fix style --- pandora_server/lib/PandoraFMS/DB.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 993f4e1fe8..7795ffbcea 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -623,7 +623,7 @@ sub get_agent_status ($$$) { } elsif ($module_status != 3) { if ($m_status == 0) { - $module_status = 0; + $module_status = 0; } } } From 6f55707e731003414edb4aa97b8ec292c4f849c2 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 31 Jan 2023 09:11:03 +0100 Subject: [PATCH 14/82] Fix style --- pandora_server/lib/PandoraFMS/DB.pm | 2 -- 1 file changed, 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 7795ffbcea..91f838dfd9 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -653,8 +653,6 @@ sub get_agent_status ($$$) { } } - print "MS ::::::::::::::".Dumper($module_status); - return $module_status; } From a200362ffe4223e3bae63692b36a4964b28d7205 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 31 Jan 2023 09:54:31 +0100 Subject: [PATCH 15/82] Make sure producers always release agent locks. A MySQL error that didn't bring the server down could result in a consumer returning without releasing its agent lock. --- pandora_server/lib/PandoraFMS/DataServer.pm | 38 ++++++++------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 6f16bd4281..ac4364dca1 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -304,21 +304,22 @@ sub data_consumer ($$) { agent_unlock($pa_config, $agent_name); return; } - unlink ($file_name); - if (defined($xml_data->{'server_name'})) { - process_xml_server ($self->getConfig (), $file_name, $xml_data, $self->getDBH ()); - } elsif (defined($xml_data->{'connection_source'})) { - enterprise_hook('process_xml_connections', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]); - } elsif (defined($xml_data->{'ipam_source'})) { - enterprise_hook('process_xml_ipam', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]); - } elsif (defined($xml_data->{'network_matrix'})){ - process_xml_matrix_network( - $self->getConfig(), $xml_data, $self->getDBH() - ); - } else { - process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ()); - } + + eval { + if (defined($xml_data->{'server_name'})) { + process_xml_server ($self->getConfig (), $file_name, $xml_data, $self->getDBH ()); + } elsif (defined($xml_data->{'connection_source'})) { + enterprise_hook('process_xml_connections', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]); + } elsif (defined($xml_data->{'ipam_source'})) { + enterprise_hook('process_xml_ipam', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]); + } elsif (defined($xml_data->{'network_matrix'})){ + process_xml_matrix_network( $self->getConfig(), $xml_data, $self->getDBH()); + } else { + process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ()); + } + }; + agent_unlock($pa_config, $agent_name); return; } @@ -1174,15 +1175,6 @@ sub process_xml_matrix_network { sub agent_lock { my ($pa_config, $dbh, $agent_name) = @_; - # Do not lock on LIFO mode if the agent already exist. - # get_agent_id will be called again from process_xml_data, - # so the should be no race conditions if the agent does - # not exist. - if ($pa_config->{'dataserver_lifo'} == 1 && - get_agent_id ($dbh, $agent_name) > 0) { - return 1; - } - $AgentSem->down (); if (defined ($Agents{$agent_name})) { $AgentSem->up (); From 6437460e8381781ad75d8368e3e6f6d004a1e497 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 31 Jan 2023 09:57:55 +0100 Subject: [PATCH 16/82] Fix style --- pandora_server/lib/PandoraFMS/DB.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 91f838dfd9..27ea483870 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -620,11 +620,11 @@ sub get_agent_status ($$$) { elsif ($module_status != 2) { if ($m_status == 3) { $module_status = 3; - } + } elsif ($module_status != 3) { - if ($m_status == 0) { - $module_status = 0; - } + if ($m_status == 0) { + $module_status = 0; + } } } } From 407ce7baa0156ee15ab18dbbd743a1330200ffe6 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 31 Jan 2023 13:33:02 +0100 Subject: [PATCH 17/82] #9003 changed command center name to Merging tool --- pandora_console/general/node_deactivated.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/general/node_deactivated.php b/pandora_console/general/node_deactivated.php index c88f4f599e..ae0e3b8f24 100644 --- a/pandora_console/general/node_deactivated.php +++ b/pandora_console/general/node_deactivated.php @@ -56,7 +56,7 @@ ui_require_css_file('maintenance'); 'Please navigate to %s to unify system', ''.__('command center').'' + ).'" target="_new">'.__('merging tool').'' ); ?>

From 2b9f7f9b09a3b76310c1bc30a0fa7a5c6458cb99 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 1 Feb 2023 10:47:36 +0100 Subject: [PATCH 18/82] #10267 limit entries in events list --- pandora_console/operation/events/events.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 18c928727a..ba27a38a6e 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -2413,8 +2413,6 @@ try { 100, 200, 500, - 1000, - -1, ], [ $config['block_size'], @@ -2423,8 +2421,6 @@ try { 100, 200, 500, - 1000, - 'All', ], ], 'order' => [ From e465fb67596758b1c039f34a91f3d70c71574688 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 1 Feb 2023 17:35:56 +0100 Subject: [PATCH 19/82] #9003 changed merging tool for command center in warning --- pandora_console/general/node_deactivated.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/general/node_deactivated.php b/pandora_console/general/node_deactivated.php index ae0e3b8f24..c88f4f599e 100644 --- a/pandora_console/general/node_deactivated.php +++ b/pandora_console/general/node_deactivated.php @@ -56,7 +56,7 @@ ui_require_css_file('maintenance'); 'Please navigate to %s to unify system', ''.__('merging tool').'' + ).'" target="_new">'.__('command center').'' ); ?>

From 18f2cee2a7698e6b6e4624d72d14400109eea0ce Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 2 Feb 2023 11:18:47 +0100 Subject: [PATCH 20/82] #10283 fixed filter design in snmp console --- .../include/class/SnmpConsole.class.php | 105 +++++++++--------- pandora_console/include/styles/tables.css | 22 +++- 2 files changed, 74 insertions(+), 53 deletions(-) diff --git a/pandora_console/include/class/SnmpConsole.class.php b/pandora_console/include/class/SnmpConsole.class.php index 9aae307bc5..96553d2ac4 100644 --- a/pandora_console/include/class/SnmpConsole.class.php +++ b/pandora_console/include/class/SnmpConsole.class.php @@ -413,73 +413,74 @@ class SnmpConsole extends HTML 'class' => 'flex-row', 'inputs' => [ [ - 'label' => __('Alert'), - 'type' => 'select', - 'id' => 'filter_alert', - 'name' => 'filter_alert', - 'class' => 'w200px', - 'fields' => $show_alerts, - 'return' => true, - 'selected' => $this->filter_alert, + 'label' => __('Alert'), + 'type' => 'select', + 'id' => 'filter_alert', + 'input_class' => 'filter_input_datatable', + 'name' => 'filter_alert', + 'fields' => $show_alerts, + 'return' => true, + 'selected' => $this->filter_alert, ], [ - 'label' => __('Severity'), - 'type' => 'select', - 'id' => 'filter_severity', - 'name' => 'filter_severity', - 'class' => 'w200px', - 'fields' => $severities, - 'return' => true, - 'selected' => $this->filter_severity, + 'label' => __('Severity'), + 'type' => 'select', + 'id' => 'filter_severity', + 'input_class' => 'filter_input_datatable', + 'name' => 'filter_severity', + 'fields' => $severities, + 'return' => true, + 'selected' => $this->filter_severity, ], [ - 'label' => __('Free search'), - 'type' => 'text', - 'class' => 'w400px', - 'id' => 'filter_free_search', - 'name' => 'filter_free_search', - 'value' => $this->filter_free_search, + 'label' => __('Free search'), + 'type' => 'text', + 'id' => 'filter_free_search', + 'input_class' => 'filter_input_datatable', + 'name' => 'filter_free_search', + 'value' => $this->filter_free_search, ], [ - 'label' => __('Status'), - 'type' => 'select', - 'id' => 'filter_status', - 'name' => 'filter_status', - 'class' => 'w200px', - 'fields' => $status_array, - 'return' => true, - 'selected' => $this->filter_status, + 'label' => __('Status'), + 'type' => 'select', + 'id' => 'filter_status', + 'input_class' => 'filter_input_datatable', + 'name' => 'filter_status', + 'fields' => $status_array, + 'return' => true, + 'selected' => $this->filter_status, ], [ - 'label' => __('Group by Enterprise String/IP'), - 'type' => 'select', - 'name' => 'filter_group_by', - 'selected' => $this->filter_group_by, - 'disabled' => false, - 'return' => true, - 'id' => 'filter_group_by', - 'fields' => [ + 'label' => __('Group by Enterprise String/IP'), + 'type' => 'select', + 'name' => 'filter_group_by', + 'selected' => $this->filter_group_by, + 'disabled' => false, + 'return' => true, + 'id' => 'filter_group_by', + 'input_class' => 'filter_input_datatable', + 'fields' => [ 0 => __('No'), 1 => __('Yes'), ], ], [ - 'label' => __('Max. hours old'), - 'type' => 'text', - 'class' => 'w200px', - 'id' => 'filter_hours_ago', - 'name' => 'filter_hours_ago', - 'value' => $this->filter_hours_ago, + 'label' => __('Max. hours old'), + 'type' => 'text', + 'id' => 'filter_hours_ago', + 'input_class' => 'filter_input_datatable', + 'name' => 'filter_hours_ago', + 'value' => $this->filter_hours_ago, ], [ - 'label' => __('Trap type'), - 'type' => 'select', - 'id' => 'filter_trap_type', - 'name' => 'filter_trap_type', - 'class' => 'w200px', - 'fields' => $trap_types, - 'return' => true, - 'selected' => $this->filter_trap_type, + 'label' => __('Trap type'), + 'type' => 'select', + 'id' => 'filter_trap_type', + 'input_class' => 'filter_input_datatable', + 'name' => 'filter_trap_type', + 'fields' => $trap_types, + 'return' => true, + 'selected' => $this->filter_trap_type, ], ], ], diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index 40ecaf11ba..fca924b6e0 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -323,6 +323,25 @@ a.pandora_pagination.current:hover { cursor: default; } +.filter_input_datatable { + width: 45% !important; + display: flex; + flex-wrap: nowrap; + flex-direction: row; + max-width: 450px; + min-width: 400px; +} +.filter_input_datatable input { + flex: 1; +} +.filter_input_datatable label { + width: 93px; + max-width: 100%; +} +.filter_input_datatable .select2.select2-container { + flex: 1; +} + /* Default datatable filter style */ .datatable_filter.content { display: flex; @@ -336,7 +355,8 @@ a.pandora_pagination.current:hover { } .datatable_filter.content li { flex: 1 1 auto; - margin: 1em auto; + margin: 1em 0; + padding: 0px 10px; } .sorting_desc { background: url(../../images/sort_down_green.png) no-repeat; From c9ea46e219f58da0df3eacbec1b89933add280f0 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 2 Feb 2023 11:25:59 +0100 Subject: [PATCH 21/82] #10283 align left input only in datatable_filter --- pandora_console/include/styles/tables.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index fca924b6e0..30592ed6db 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -341,7 +341,9 @@ a.pandora_pagination.current:hover { .filter_input_datatable .select2.select2-container { flex: 1; } - +.datatable_filter.content li.filter_input_datatable { + margin: 1em 0; +} /* Default datatable filter style */ .datatable_filter.content { display: flex; @@ -355,7 +357,7 @@ a.pandora_pagination.current:hover { } .datatable_filter.content li { flex: 1 1 auto; - margin: 1em 0; + margin: 1em auto; padding: 0px 10px; } .sorting_desc { From 5106e658c362e9599dfa2ecbc292385f20245e44 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 2 Feb 2023 11:49:09 +0100 Subject: [PATCH 22/82] Improve pandora_server_tasks. * Do not let pandora_server_tasks die. * Remove a query from self_monitoring that could freeze the pandora_server_tasks thread. --- pandora_server/bin/pandora_server | 180 +++++++++++++------------- pandora_server/lib/PandoraFMS/Core.pm | 11 -- 2 files changed, 91 insertions(+), 100 deletions(-) diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index fd8fa0d99d..1f6d17af49 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -387,112 +387,114 @@ sub pandora_server_tasks ($) { my $counter = 0; my $first_run = 1; while ($THRRUN == 1) { - if (pandora_is_master($pa_config) == 1) { + eval { + if (pandora_is_master($pa_config) == 1) { - # TASKS EXECUTED ONCE - # ------------------- - if ($first_run == 1) { - $first_run = 0; + # TASKS EXECUTED ONCE + # ------------------- + if ($first_run == 1) { + $first_run = 0; - # Update the agent cache. - enterprise_hook('update_agent_cache', [\%Config]); - } - - # TASKS EXECUTED EVERY 5 SECONDS (Low latency tasks) - # -------------------------------------------------- - if (($counter % 5) == 0) { - - # Update forced alerts - pandora_exec_forced_alerts ($pa_config, $dbh); - - my @agents = get_db_rows ($dbh, 'SELECT id_agente, update_alert_count FROM tagente WHERE update_alert_count=1'); - foreach my $agent (@agents) { - if ($agent->{'update_alert_count'} == 1) { - pandora_update_agent_alert_count ($pa_config, $dbh, $agent->{'id_agente'}); - } + # Update the agent cache. + enterprise_hook('update_agent_cache', [\%Config]); } - } - # TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks) - # --------------------------------------------------- - if (($counter % 30) == 0) { + # TASKS EXECUTED EVERY 5 SECONDS (Low latency tasks) + # -------------------------------------------------- + if (($counter % 5) == 0) { - # Update module status and fired alert counts - my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_secondary_groups FROM tagente WHERE (update_module_count=1 OR update_secondary_groups=1)'); - foreach my $agent (@agents) { - logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10); + # Update forced alerts + pandora_exec_forced_alerts ($pa_config, $dbh); - if ($agent->{'update_module_count'} == 1) { - pandora_update_agent_module_count ($pa_config, $dbh, $agent->{'id_agente'}); - } - - if ($agent->{'update_secondary_groups'} == 1) { - pandora_update_secondary_groups_cache ($pa_config, $dbh, $agent->{'id_agente'}); + my @agents = get_db_rows ($dbh, 'SELECT id_agente, update_alert_count FROM tagente WHERE update_alert_count=1'); + foreach my $agent (@agents) { + if ($agent->{'update_alert_count'} == 1) { + pandora_update_agent_alert_count ($pa_config, $dbh, $agent->{'id_agente'}); + } } } - # Keepalive module control.(very DB intensive, not run frecuently - pandora_module_keep_alive_nd ($pa_config, $dbh); - - # Set the status of unknown modules - pandora_module_unknown ($pa_config, $dbh); - - # Check if an autodisabled agent needs to be autodisable - pandora_disable_autodisable_agents ($pa_config, $dbh); - } - - # TASKS EXECUTED EVERY 60 SECONDS (High latency tasks) - # ---------------------------------------------------- - if (($counter % 60) == 0) { - # Downtimes are executed only 30 x Server Threshold secs - pandora_planned_downtime ($pa_config, $dbh); - - # Realtime stats (Only master server!) - ( VERY HEAVY !) - # Realtimestats == 1, generated by WEB Console, not by server! - if (defined($pa_config->{"realtimestats"}) && $pa_config->{"realtimestats"} == 0){ + # TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks) + # --------------------------------------------------- + if (($counter % 30) == 0) { + + # Update module status and fired alert counts + my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_secondary_groups FROM tagente WHERE (update_module_count=1 OR update_secondary_groups=1)'); + foreach my $agent (@agents) { + logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10); + + if ($agent->{'update_module_count'} == 1) { + pandora_update_agent_module_count ($pa_config, $dbh, $agent->{'id_agente'}); + } + + if ($agent->{'update_secondary_groups'} == 1) { + pandora_update_secondary_groups_cache ($pa_config, $dbh, $agent->{'id_agente'}); + } + } + + # Keepalive module control.(very DB intensive, not run frecuently + pandora_module_keep_alive_nd ($pa_config, $dbh); - # Check if I need to refresh stats - my $last_execution_stats = get_db_value ($dbh, "SELECT MAX(utimestamp) FROM tgroup_stat"); - if (!defined($last_execution_stats) || $last_execution_stats < (time() - $pa_config->{"stats_interval"})){ - pandora_group_statistics ($pa_config, $dbh); - pandora_server_statistics ($pa_config, $dbh); - } + # Set the status of unknown modules + pandora_module_unknown ($pa_config, $dbh); + + # Check if an autodisabled agent needs to be autodisable + pandora_disable_autodisable_agents ($pa_config, $dbh); } - # Check if snmptrapd is freeze. - pandora_snmptrapd_still_working ($pa_config, $dbh); + # TASKS EXECUTED EVERY 60 SECONDS (High latency tasks) + # ---------------------------------------------------- + if (($counter % 60) == 0) { + # Downtimes are executed only 30 x Server Threshold secs + pandora_planned_downtime ($pa_config, $dbh); + + # Realtime stats (Only master server!) - ( VERY HEAVY !) + # Realtimestats == 1, generated by WEB Console, not by server! + if (defined($pa_config->{"realtimestats"}) && $pa_config->{"realtimestats"} == 0){ + + # Check if I need to refresh stats + my $last_execution_stats = get_db_value ($dbh, "SELECT MAX(utimestamp) FROM tgroup_stat"); + if (!defined($last_execution_stats) || $last_execution_stats < (time() - $pa_config->{"stats_interval"})){ + pandora_group_statistics ($pa_config, $dbh); + pandora_server_statistics ($pa_config, $dbh); + } + } + + # Check if snmptrapd is freeze. + pandora_snmptrapd_still_working ($pa_config, $dbh); - # Event auto-expiry - my $expiry_time = $pa_config->{"event_expiry_time"}; - my $expiry_window = $pa_config->{"event_expiry_window"}; - if ($expiry_time > 0 && $expiry_window > 0 && $expiry_window > $expiry_time) { - my $time_ref = time (); - my $expiry_limit = $time_ref - $expiry_time; - my $expiry_window = $time_ref - $expiry_window; - db_do ($dbh, 'UPDATE tevento SET estado=1, ack_utimestamp=? WHERE estado=0 AND utimestamp < ? AND utimestamp > ?', $time_ref, $expiry_limit, $expiry_window); + # Event auto-expiry + my $expiry_time = $pa_config->{"event_expiry_time"}; + my $expiry_window = $pa_config->{"event_expiry_window"}; + if ($expiry_time > 0 && $expiry_window > 0 && $expiry_window > $expiry_time) { + my $time_ref = time (); + my $expiry_limit = $time_ref - $expiry_time; + my $expiry_window = $time_ref - $expiry_window; + db_do ($dbh, 'UPDATE tevento SET estado=1, ack_utimestamp=? WHERE estado=0 AND utimestamp < ? AND utimestamp > ?', $time_ref, $expiry_limit, $expiry_window); + } } } - } - # COMMON TASKS (master and non-master) - # --------------------------------------------------------------- - if (($counter % 30) == 0) { - # Update configuration options from the console. - pandora_get_sharedconfig ($pa_config, $dbh); + # COMMON TASKS (master and non-master) + # --------------------------------------------------------------- + if (($counter % 30) == 0) { + # Update configuration options from the console. + pandora_get_sharedconfig ($pa_config, $dbh); - # Rotate the log file. - pandora_rotate_logfile($pa_config); - - # Set event storm protection - pandora_set_event_storm_protection (pandora_get_tconfig_token ($dbh, 'event_storm_protection', 0)); - } - # Pandora self monitoring - if (defined($pa_config->{"self_monitoring"}) - && $pa_config->{"self_monitoring"} == 1 - && !is_metaconsole($pa_config) - && $counter % $pa_config->{'self_monitoring_interval'} == 0) { - pandora_self_monitoring ($pa_config, $dbh); - } + # Rotate the log file. + pandora_rotate_logfile($pa_config); + + # Set event storm protection + pandora_set_event_storm_protection (pandora_get_tconfig_token ($dbh, 'event_storm_protection', 0)); + } + # Pandora self monitoring + if (defined($pa_config->{"self_monitoring"}) + && $pa_config->{"self_monitoring"} == 1 + && !is_metaconsole($pa_config) + && $counter % $pa_config->{'self_monitoring_interval'} == 0) { + pandora_self_monitoring ($pa_config, $dbh); + } + }; # Avoid counter overflow if ($counter >= ~0){ diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index b2ea690cfa..89e283a64e 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -6005,10 +6005,6 @@ sub pandora_self_monitoring ($$) { $pandoradb = 1; } - my $start_performance = time; - get_db_value($dbh, "SELECT COUNT(*) FROM tagente_datos"); - my $read_speed = int((time - $start_performance) * 1e6); - my $elasticsearch_perfomance = enterprise_hook("elasticsearch_performance", [$pa_config, $dbh]); $xml_output .= $elasticsearch_perfomance if defined($elasticsearch_perfomance); @@ -6055,13 +6051,6 @@ sub pandora_self_monitoring ($$) { $xml_output .=" "; } - $xml_output .=" "; - $xml_output .=" Execution_Time"; - $xml_output .=" generic_data"; - $xml_output .=" us"; - $xml_output .=" $read_speed"; - $xml_output .=" "; - $xml_output .= ""; my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{'servername'}.".self.".$utimestamp.".data"; From 925880dbdbe1bd0b31859700975977909aabd5cc Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 2 Feb 2023 17:06:28 +0100 Subject: [PATCH 23/82] #9523 dialog title plugins --- pandora_console/godmode/servers/plugin.php | 46 +++++++++++----------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 5a0d8a063a..b6d78e1d98 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -892,7 +892,7 @@ if (($create != '') || ($view != '')) { echo ''; $output .= '
    '; + $output .= html_print_input_hidden( + 'ajax_file_sound_console', + ui_get_full_url('ajax.php', false, false, false), + true + ); + $output .= html_print_input_hidden( + 'meta', + is_metaconsole(), + true + ); + $output .= '
    '; $output .= '
    '; $output .= ''; @@ -2511,29 +2522,32 @@ if ($get_events_fired) { $return = []; if (empty($data) === false) { foreach ($data as $event) { - $return[] = [ - 'fired' => $event['id_evento'], - 'message' => ui_print_string_substr( - strip_tags(io_safe_output($event['evento'])), - 75, - true, - '9' - ), - 'priority' => ui_print_event_priority($event['criticity'], true, true), - 'type' => events_print_type_img( - $event['event_type'], - true - ), - 'timestamp' => ui_print_timestamp( - $event['timestamp'], - true, - ['style' => 'font-size: 9pt; letter-spacing: 0.3pt;'] - ), - ]; + $return[] = array_merge( + $event, + [ + 'fired' => $event['id_evento'], + 'message' => ui_print_string_substr( + strip_tags(io_safe_output($event['evento'])), + 75, + true, + '9' + ), + 'priority' => ui_print_event_priority($event['criticity'], true, true), + 'type' => events_print_type_img( + $event['event_type'], + true + ), + 'timestamp' => ui_print_timestamp( + $event['timestamp'], + true, + ['style' => 'font-size: 9pt; letter-spacing: 0.3pt;'] + ), + ] + ); } } - echo io_json_mb_encode($return); + echo io_safe_output(io_json_mb_encode($return)); return; } diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index c2ee675f0d..d2fc5698a6 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -2,7 +2,15 @@ // Show the modal window of an event function show_event_dialog(event, dialog_page) { - var ajax_file = $("#hidden-ajax_file").val(); + var ajax_file = getUrlAjax(); + + var view = ``; + + if ($("#event_details_window").length) { + view = "#event_details_window"; + } else if ($("#sound_event_details_window").length) { + view = "#sound_event_details_window"; + } if (dialog_page == undefined) { dialog_page = "general"; @@ -39,7 +47,7 @@ function show_event_dialog(event, dialog_page) { filter: values }, function(data) { - $("#event_details_window") + $(view) .hide() .empty() .append(data) @@ -312,6 +320,8 @@ function event_change_status(event_ids, server_id) { $("#button-status_button").attr("disabled", "disabled"); $("#response_loading").show(); + var url = getUrlAjax(); + jQuery.ajax({ data: { page: "include/ajax/events", @@ -321,7 +331,7 @@ function event_change_status(event_ids, server_id) { server_id: server_id }, type: "POST", - url: $("#hidden-ajax_file").val(), + url: url, dataType: "json", success: function(data) { $("#button-status_button").removeAttr("disabled"); @@ -350,9 +360,12 @@ function event_change_status(event_ids, server_id) { } }); - $("#table_events") - .DataTable() - .draw(false); + if ($("#table_events").length) { + $("#table_events") + .DataTable() + .draw(false); + } + $("#notification_status_success").show(); $("#general_status") @@ -371,6 +384,8 @@ function event_change_status(event_ids, server_id) { // Change te owner of an event to one user of empty function event_change_owner(event_id, server_id) { + var url = getUrlAjax(); + var new_owner = $("#id_owner").val(); $("#button-owner_button").attr("disabled", "disabled"); @@ -385,7 +400,7 @@ function event_change_owner(event_id, server_id) { new_owner: new_owner }, type: "POST", - url: $("#hidden-ajax_file").val(), + url: url, async: true, dataType: "html", success: function(data) { @@ -404,9 +419,12 @@ function event_change_owner(event_id, server_id) { // if (typeof dt_events !== "undefined") { // dt_events.draw(false); // } - $("#table_events") - .DataTable() - .draw(false); + + if ($("#table_events").length) { + $("#table_events") + .DataTable() + .draw(false); + } $("#notification_owner_success").show(); if (new_owner == -1) { $("#extended_event_general_page table td.general_owner").html( @@ -456,11 +474,11 @@ function event_comment(current_event) { $("#button-comment_button").attr("disabled", "disabled"); $("#response_loading").show(); - + var url = getUrlAjax(); jQuery.ajax({ data: params.join("&"), type: "POST", - url: $("#hidden-ajax_file").val(), + url: url, dataType: "html", success: function() { $("#button-comment_button").removeAttr("disabled"); @@ -481,11 +499,11 @@ function update_event(table, id_evento, type, event_rep, row, server_id) { values[this.name] = $(this).val(); }); var t1 = new Date(); - + var url = getUrlAjax(); $.ajax({ async: true, type: "POST", - url: $("#hidden-ajax_file").val(), + url: url, data: { page: "include/ajax/events", validate_event: type.validate_event, @@ -1147,6 +1165,7 @@ function check_event_sound(settings) { // Add elements. data.forEach(function(element) { var li = document.createElement("li"); + var b64 = btoa(JSON.stringify(element)); li.insertAdjacentHTML( "beforeend", '
    ' + element.priority + "
    " @@ -1157,7 +1176,7 @@ function check_event_sound(settings) { ); li.insertAdjacentHTML( "beforeend", - '
    ' + element.message + "
    " + `` ); li.insertAdjacentHTML( "beforeend", @@ -1216,3 +1235,11 @@ function table_info_response_event(response_id, event_id, server_id, massive) { } }); } + +function getUrlAjax() { + if ($("#hidden-ajax_file").length) { + return $("#hidden-ajax_file").val(); + } else if ($("#hidden-ajax_file_sound_console").length) { + return $("#hidden-ajax_file_sound_console").val(); + } +} From ea789804f4ac561671f97444e80aeb2c4a645663 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 7 Feb 2023 17:41:27 +0100 Subject: [PATCH 35/82] #10190 fixed response option --- pandora_console/include/ajax/events.php | 1 + .../include/javascript/pandora_events.js | 46 +++++++++++-------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index b4ad49546b..71d65b0f48 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -2418,6 +2418,7 @@ if ($drawConsoleSound === true) { true ); $output .= '
    '; + $output .= '
    '; $output .= ''; $output .= ''; diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index d2fc5698a6..2153686774 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -130,7 +130,7 @@ function execute_response(event_id, server_id) { jQuery.ajax({ data: params, type: "POST", - url: $("#hidden-ajax_file").val(), + url: getUrlAjax(), dataType: "json", success: function(response) { // If cannot get response abort it @@ -161,7 +161,7 @@ function execute_response_massive(events, response_id, response_parameters) { jQuery.ajax({ data: params, type: "POST", - url: $("#hidden-ajax_file").val(), + url: getUrlAjax(), dataType: "json", success: function(data) { // If cannot get response abort it @@ -211,7 +211,7 @@ function execute_response_massive(events, response_id, response_parameters) { jQuery.ajax({ data: params, type: "POST", - url: $("#hidden-ajax_file").val(), + url: getUrlAjax(), dataType: "html", success: function(data) { $(".container-massive-events-response").append(data); @@ -248,13 +248,21 @@ function show_response_dialog(response_id, response) { params.push({ name: "server_id", value: response.server_id }); params.push({ name: "response", value: JSON.stringify(response) }); + var view = ``; + + if ($("#event_response_window").length) { + view = "#event_response_window"; + } else if ($("#sound_event_response_window").length) { + view = "#sound_event_response_window"; + } + jQuery.ajax({ data: params, type: "POST", - url: $("#hidden-ajax_file").val(), + url: getUrlAjax(), dataType: "html", success: function(data) { - $("#event_response_window") + $(view) .hide() .empty() .append(data) @@ -300,7 +308,7 @@ function perform_response(response, response_id, index) { jQuery.ajax({ data: params, type: "POST", - url: $("#hidden-ajax_file").val(), + url: getUrlAjax(), dataType: "html", success: function(data) { var out = data.replace(/[\n|\r]/g, "
    "); @@ -320,8 +328,6 @@ function event_change_status(event_ids, server_id) { $("#button-status_button").attr("disabled", "disabled"); $("#response_loading").show(); - var url = getUrlAjax(); - jQuery.ajax({ data: { page: "include/ajax/events", @@ -331,7 +337,7 @@ function event_change_status(event_ids, server_id) { server_id: server_id }, type: "POST", - url: url, + url: getUrlAjax(), dataType: "json", success: function(data) { $("#button-status_button").removeAttr("disabled"); @@ -384,8 +390,6 @@ function event_change_status(event_ids, server_id) { // Change te owner of an event to one user of empty function event_change_owner(event_id, server_id) { - var url = getUrlAjax(); - var new_owner = $("#id_owner").val(); $("#button-owner_button").attr("disabled", "disabled"); @@ -400,7 +404,7 @@ function event_change_owner(event_id, server_id) { new_owner: new_owner }, type: "POST", - url: url, + url: getUrlAjax(), async: true, dataType: "html", success: function(data) { @@ -474,11 +478,11 @@ function event_comment(current_event) { $("#button-comment_button").attr("disabled", "disabled"); $("#response_loading").show(); - var url = getUrlAjax(); + jQuery.ajax({ data: params.join("&"), type: "POST", - url: url, + url: getUrlAjax(), dataType: "html", success: function() { $("#button-comment_button").removeAttr("disabled"); @@ -499,11 +503,11 @@ function update_event(table, id_evento, type, event_rep, row, server_id) { values[this.name] = $(this).val(); }); var t1 = new Date(); - var url = getUrlAjax(); + $.ajax({ async: true, type: "POST", - url: url, + url: getUrlAjax(), data: { page: "include/ajax/events", validate_event: type.validate_event, @@ -794,7 +798,7 @@ function show_response_dialog_massive(response_id, response_parameters) { jQuery.ajax({ data: params, type: "POST", - url: $("#hidden-ajax_file").val(), + url: getUrlAjax(), dataType: "json", success: function(response) { // If cannot get response abort it @@ -932,7 +936,7 @@ function process_buffers(buffers) { jQuery.ajax({ data: params.join("&"), type: "POST", - url: $("#hidden-ajax_file").val(), + url: getUrlAjax(), async: true, dataType: "html", success: function(data) { @@ -1204,10 +1208,12 @@ function table_info_response_event(response_id, event_id, server_id, massive) { params.push({ name: "server_id", value: server_id }); params.push({ name: "event_id", value: event_id }); + var url = getUrlAjax(); + jQuery.ajax({ data: params, type: "POST", - url: $("#hidden-ajax_file").val(), + url: url, dataType: "json", success: function(response) { if (response) { @@ -1220,7 +1226,7 @@ function table_info_response_event(response_id, event_id, server_id, massive) { jQuery.ajax({ data: params, type: "POST", - url: $("#hidden-ajax_file").val(), + url: url, dataType: "html", success: function(output) { if (massive === true) { From f845cc94787a8cda7aadef2a1c0d64ba008e533a Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 8 Feb 2023 01:01:58 +0100 Subject: [PATCH 36/82] 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 41c4d14609..fe5bad7109 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-230207 +Version: 7.0NG.768-230208 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 8356fb5e9a..38f99a713f 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-230207" +pandora_version="7.0NG.768-230208" 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 8b85b2f4f8..f01ddb5744 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 => '230207'; +use constant AGENT_BUILD => '230208'; # 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 6fd83ca74f..c1b7aa663a 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 230207 +%define release 230208 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 339dd209ba..962b9077ba 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 230207 +%define release 230208 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 1a412689bb..a6a9b0271b 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="230207" +PI_BUILD="230208" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 8488ced2e5..4f5de91e58 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230207} +{230208} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b5110d1f98..304f3a22f8 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 230207") +#define PANDORA_VERSION ("7.0NG.768 Build 230208") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 075e64c86e..030041571c 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 230207))" + VALUE "ProductVersion", "(7.0NG.768(Build 230208))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a56cde214b..807a36e537 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.768-230207 +Version: 7.0NG.768-230208 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 15b27b4dff..6ff898257a 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-230207" +pandora_version="7.0NG.768-230208" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index e3ab2c4a2a..1777d0bb57 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 = 'PC230207'; +$build_version = 'PC230208'; $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 89d4d17655..064cf37935 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 02ff4577ac..fff8104658 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 230207 +%define release 230208 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index ae0f408b01..7b79bbbd4c 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 230207 +%define release 230208 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index ed97ed63d9..3696050dea 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230207" +PI_BUILD="230208" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 887f138e91..cb45ea6415 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 230207"; +my $version = "7.0NG.768 Build 230208"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 55eb14fda9..f3346387d2 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 230207"; +my $version = "7.0NG.768 Build 230208"; # save program name for logging my $progname = basename($0); From fc7673f6516d1445f361eeb6562ae8db57c77023 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 8 Feb 2023 14:59:24 +0100 Subject: [PATCH 37/82] 10242 adding scripts for external databases --- .../deploy-scripts/deploy_ext_database_el8.sh | 320 ++++++++++++++++++ .../deploy_ext_database_ubuntu_2204.sh | 257 ++++++++++++++ 2 files changed, 577 insertions(+) create mode 100644 extras/deploy-scripts/deploy_ext_database_el8.sh create mode 100644 extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh diff --git a/extras/deploy-scripts/deploy_ext_database_el8.sh b/extras/deploy-scripts/deploy_ext_database_el8.sh new file mode 100644 index 0000000000..422887b0e2 --- /dev/null +++ b/extras/deploy-scripts/deploy_ext_database_el8.sh @@ -0,0 +1,320 @@ +#!/bin/bash +####################################################### +# PandoraFMS Community online installation script +####################################################### +## Tested versions ## +# Centos 8.4, 8.5 +# Rocky 8.4, 8.5, 8.6, 8.7 +# Almalinuz 8.4, 8.5 +# RedHat 8.5 + +#Constants +S_VERSION='202302081' +LOGFILE="/tmp/deploy-ext-db-$(date +%F).log" + + +# define default variables +[ "$TZ" ] || TZ="Europe/Madrid" +[ "$MYVER" ] || MYVER=57 +[ "$DBHOST" ] || DBHOST=127.0.0.1 +[ "$DBNAME" ] || DBNAME=pandora +[ "$DBUSER" ] || DBUSER=pandora +[ "$DBPASS" ] || DBPASS=pandora +[ "$DBPORT" ] || DBPORT=3306 +[ "$DBROOTUSER" ] || DBROOTUSER=root +[ "$DBROOTPASS" ] || DBROOTPASS=pandora +[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 +[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 +[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") + +# Ansi color code variables +red="\e[0;91m" +green="\e[0;92m" +cyan="\e[0;36m" +reset="\e[0m" + +# Functions +execute_cmd () { + local cmd="$1" + local msg="$2" + + echo -e "${cyan}$msg...${reset}" + $cmd &>> "$LOGFILE" + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + [ "$3" ] && echo "$3" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf "$HOME"/pandora_deploy_tmp &>> "$LOGFILE" + exit 1 + else + echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}" + return 0 + fi +} + +check_cmd_status () { + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + [ "$1" ] && echo "$1" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE" + exit 1 + else + echo -e "${green}OK${reset}" + return 0 + fi +} + +check_root_permissions () { + echo -en "${cyan}Checking root account... ${reset}" + if [ "$(whoami)" != "root" ]; then + echo -e "${red}Fail${reset}" + echo "Please use a root account or sudo for installing Pandora FMS" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 + + else + echo -e "${green}OK${reset}" + fi +} + +## Main +echo "Starting PandoraFMS External DB deployment EL8 ver. $S_VERSION" + +# Centos Version +if [ ! "$(grep -Ei 'centos|rocky|Almalinux|Red Hat Enterprise' /etc/redhat-release)" ]; then + printf "\n ${red}Error this is not a Centos/Rocky/Almalinux Base system, this installer is compatible with RHEL/Almalinux/Centos/Rockylinux systems only${reset}\n" + exit 1 +fi + + +echo -en "${cyan}Check Centos Version...${reset}" +[ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ] +check_cmd_status 'Error OS version, RHEL/Almalinux/Centos/Rockylinux 8+ is expected' + +#Detect OS +os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"') +execute_cmd "echo $os_name" "OS detected: ${os_name}" + +# initialice logfile +execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE" +echo "Community installer version: $S_VERSION" >> "$LOGFILE" + +# Pre checks +# Root permisions +check_root_permissions + +# Systemd +execute_cmd "systemctl status" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8' + +# Check memomry greather or equal to 2G +execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)' + +# Check disk size at least 10 Gb free space +execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)' + +# Setting timezone +rm -rf /etc/localtime &>> "$LOGFILE" +execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ" + +# Execute tools check +execute_cmd "awk --version" 'Checking needed tools: awk' +execute_cmd "grep --version" 'Checking needed tools: grep' +execute_cmd "sed --version" 'Checking needed tools: sed' +execute_cmd "dnf --version" 'Checking needed tools: dnf' + +# Creating working directory +rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE" +mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE" +execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp" + +## Extra steps on redhat envs +if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then + ## In case REDHAT + # Check susbscription manager status: + echo -en "${cyan}Checking Red Hat Enterprise subscription... ${reset}" + subscription-manager list &>> "$LOGFILE" + subscription-manager status &>> "$LOGFILE" + check_cmd_status 'Error checking subscription status, make sure your server is activated and suscribed to Red Hat Enterprise repositories' + + # Ckeck repolist + dnf repolist &>> "$LOGFILE" + echo -en "${cyan}Checking Red Hat Enterprise repolist... ${reset}" + dnf repolist | grep 'rhel-8-for-x86_64-baseos-rpms' &>> "$LOGFILE" + check_cmd_status 'Error checking repositories status, could try a subscription-manager attach command or contact sysadmin' + + #install extra repos + extra_repos=" \ + tar \ + dnf-utils \ + https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \ + https://repo.percona.com/yum/percona-release-latest.noarch.rpm" + + execute_cmd "dnf install -y $extra_repos" "Installing extra repositories" + execute_cmd "subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms" "Enabling subscription to codeready-builder" +else + # For alma/rocky/centos + extra_repos=" \ + tar \ + dnf-utils \ + epel-release \ + https://repo.percona.com/yum/percona-release-latest.noarch.rpm" + + execute_cmd "dnf install -y $extra_repos" "Installing extra repositories" + execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools" +fi + + +#Installing wget +execute_cmd "dnf install -y wget" "Installing wget" + + +# Install percona Database +execute_cmd "dnf module disable -y mysql" "Disabiling mysql module" + +if [ "$MYVER" -eq '80' ] ; then + execute_cmd "percona-release setup ps80 -y" "Enabling mysql80 module" + execute_cmd "dnf install -y percona-server-server percona-xtrabackup-24" "Installing Percona Server 80" +fi + +if [ "$MYVER" -ne '80' ] ; then + execute_cmd "dnf install -y Percona-Server-server-57 percona-xtrabackup-24" "Installing Percona Server 57" +fi + +# Disabling SELINUX and firewalld +setenforce 0 &>> "$LOGFILE" +sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE" +systemctl disable firewalld --now &>> "$LOGFILE" + +# Adding standar cnf for initial setup. +cat > /etc/my.cnf << EO_CONFIG_TMP +[mysqld] +datadir=/var/lib/mysql +socket=/var/lib/mysql/mysql.sock +symbolic-links=0 +log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid +EO_CONFIG_TMP + +#Configuring Database +if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then + execute_cmd "systemctl start mysqld" "Starting database engine" + export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev) + if [ "$MYVER" -eq '80' ] ; then + echo """ + SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!'; + UNINSTALL COMPONENT 'file://component_validate_password'; + SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS'; + """ | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE" + fi + + if [ "$MYVER" -ne '80' ] ; then + echo """ + SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!'); + UNINSTALL PLUGIN validate_password; + SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS'); + """ | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi + fi + + export MYSQL_PWD=$DBROOTPASS + echo -en "${cyan}Creating Pandora FMS database...${reset}" + echo "create database $DBNAME" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST + check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support." + + echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST + echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST + echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST + +#Generating my.cnf +cat > /etc/my.cnf << EO_CONFIG_F +[mysqld] +datadir=/var/lib/mysql +socket=/var/lib/mysql/mysql.sock +user=mysql +character-set-server=utf8 +skip-character-set-client-handshake +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 +# Mysql optimizations for Pandora FMS +# Please check the documentation in http://pandorafms.com for better results + +max_allowed_packet = 64M +innodb_buffer_pool_size = $POOL_SIZE +innodb_lock_wait_timeout = 90 +innodb_file_per_table +innodb_flush_log_at_trx_commit = 0 +innodb_flush_method = O_DIRECT +innodb_log_file_size = 64M +innodb_log_buffer_size = 16M +innodb_io_capacity = 100 +thread_cache_size = 8 +thread_stack = 256K +max_connections = 100 + +key_buffer_size=4M +read_buffer_size=128K +read_rnd_buffer_size=128K +sort_buffer_size=128K +join_buffer_size=4M + +query_cache_type = 1 +query_cache_size = 64M +query_cache_min_res_unit = 2k +query_cache_limit = 256K + +#skip-log-bin + +sql_mode="" + +[mysqld_safe] +log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid + +EO_CONFIG_F + + if [ "$MYVER" -eq '80' ] ; then + sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf + sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf + fi + + execute_cmd "systemctl restart mysqld" "Configuring database engine" + execute_cmd "systemctl enable mysqld --now" "Enabling Database service" +fi +export MYSQL_PWD=$DBPASS + + +# Kernel optimization + +if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then +cat >> /etc/sysctl.conf < /dev/null # remove last log before start + +# define default variables +[ "$TZ" ] || TZ="Europe/Madrid" +[ "$DBHOST" ] || DBHOST=127.0.0.1 +[ "$DBNAME" ] || DBNAME=pandora +[ "$DBUSER" ] || DBUSER=pandora +[ "$DBPASS" ] || DBPASS=pandora +[ "$DBPORT" ] || DBPORT=3306 +[ "$DBROOTPASS" ] || DBROOTPASS=pandora +[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 +[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 +[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") + + +# Ansi color code variables +red="\e[0;91m" +green="\e[0;92m" +cyan="\e[0;36m" +reset="\e[0m" + +# Functions + +execute_cmd () { + local cmd="$1" + local msg="$2" + + echo -e "${cyan}$msg...${reset}" + $cmd &>> "$LOGFILE" + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + [ "$3" ] && echo "$3" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf "$WORKDIR" &>> "$LOGFILE" + exit 1 + else + echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}" + return 0 + fi +} + +check_cmd_status () { + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + [ "$1" ] && echo "$1" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf "$WORKDIR" &>> "$LOGFILE" + exit 1 + else + echo -e "${green}OK${reset}" + return 0 + fi +} + +check_root_permissions () { + echo -en "${cyan}Checking root account... ${reset}" + if [ "$(whoami)" != "root" ]; then + echo -e "${red}Fail${reset}" + echo "Please use a root account or sudo for installing Pandora FMS" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 + + else + echo -e "${green}OK${reset}" + fi +} + +## Main +echo "Starting PandoraFMS External DB deployment Ubuntu 22.04 ver. $S_VERSION" + +# Ubuntu Version +if [ ! "$(grep -Ei 'Ubuntu' /etc/lsb-release)" ]; then + printf "\n ${red}Error this is not a Ubuntu system, this installer is compatible with Ubuntu systems only${reset}\n" + exit 1 +fi + + +echo -en "${cyan}Check Ubuntu Version...${reset}" +[ $(sed -nr 's/VERSION_ID+=\s*"([0-9][0-9].[0-9][0-9])"$/\1/p' /etc/os-release) == "22.04" ] +check_cmd_status 'Error OS version, Ubuntu 22.04 is expected' + +#Detect OS +os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"') +execute_cmd "echo $os_name" "OS detected: ${os_name}" + +# initialice logfile +execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE" +echo "Community installer version: $S_VERSION" >> "$LOGFILE" + +# Pre checks +# Root permisions +check_root_permissions + +#Install awk, sed, grep if not present +execute_cmd "apt install -y gawk sed grep" 'Installing needed tools' + +# Systemd +execute_cmd "systemctl --version" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8' + +# Check memomry greather or equal to 2G +execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)' + +# Check disk size at least 10 Gb free space +execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)' + +# Setting timezone +rm -rf /etc/localtime &>> "$LOGFILE" +execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ" + +# Execute tools check +execute_cmd "awk --version" 'Checking needed tools: awk' +execute_cmd "grep --version" 'Checking needed tools: grep' +execute_cmd "sed --version" 'Checking needed tools: sed' +execute_cmd "apt --version" 'Checking needed tools: apt' + +# Creating working directory +rm -rf "$WORKDIR" &>> "$LOGFILE" +mkdir -p "$WORKDIR" &>> "$LOGFILE" +execute_cmd "cd $WORKDIR" "Moving to workdir: $WORKDIR" + +## Install utils +execute_cmd "apt update" "Updating repos" +execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https" "Installing utils" + +# Disabling apparmor and ufw +systemctl stop ufw.service &>> "$LOGFILE" +systemctl disable ufw &>> "$LOGFILE" +systemctl stop apparmor &>> "$LOGFILE" +systemctl disable apparmor &>> "$LOGFILE" + +#install mysql +execute_cmd "curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb" "Downloading Percona repository for MySQL8" +execute_cmd "apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb" "Installing Percona repository for MySQL8" +execute_cmd "percona-release setup ps80" "Configuring Percona repository for MySQL8" + +echo -en "${cyan}Installing Percona Server for MySQL8...${reset}" + env DEBIAN_FRONTEND=noninteractive apt install -y percona-server-server &>> "$LOGFILE" +check_cmd_status "Error Installing MySql Server" + +#Configuring Database +if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then + execute_cmd "systemctl start mysql" "Starting database engine" + + echo """ + ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DBROOTPASS'; + """ | mysql -uroot &>> "$LOGFILE" + + export MYSQL_PWD=$DBROOTPASS + echo -en "${cyan}Creating Pandora FMS database...${reset}" + echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST + check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support." + + echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST + echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST + echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST +fi +export MYSQL_PWD=$DBPASS + +#Generating my.cnf +cat > /etc/mysql/my.cnf << EOF_DB +[mysqld] +datadir=/var/lib/mysql +user=mysql +character-set-server=utf8 +skip-character-set-client-handshake +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 +# Mysql optimizations for Pandora FMS +# Please check the documentation in http://pandorafms.com for better results + +max_allowed_packet = 64M +innodb_buffer_pool_size = $POOL_SIZE +innodb_lock_wait_timeout = 90 +innodb_file_per_table +innodb_flush_log_at_trx_commit = 0 +innodb_flush_method = O_DIRECT +innodb_log_file_size = 64M +innodb_log_buffer_size = 16M +innodb_io_capacity = 100 +thread_cache_size = 8 +thread_stack = 256K +max_connections = 100 + +key_buffer_size=4M +read_buffer_size=128K +read_rnd_buffer_size=128K +sort_buffer_size=128K +join_buffer_size=4M + +skip-log-bin + +sql_mode="" + +log-error=/var/log/mysql/error.log +[mysqld_safe] +log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid + +EOF_DB + +execute_cmd "systemctl restart mysql" "Configuring and restarting database engine" + +# Kernel optimization +if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then +cat >> /etc/sysctl.conf < Date: Mon, 6 Feb 2023 12:47:36 +0100 Subject: [PATCH 38/82] Update pandora_exec and pandora_agent_exec. The previous versions of pandora_exec and pandora_agent_exec did not kill the running process after a timeout. --- pandora_agents/pc/pandora_agent_exec | 61 ++++++++++++------------ pandora_agents/unix/pandora_agent_exec | 61 ++++++++++++------------ pandora_server/bin/pandora_exec | 65 ++++++++++++-------------- 3 files changed, 87 insertions(+), 100 deletions(-) diff --git a/pandora_agents/pc/pandora_agent_exec b/pandora_agents/pc/pandora_agent_exec index 48fba5c0d8..2a990067ae 100644 --- a/pandora_agents/pc/pandora_agent_exec +++ b/pandora_agents/pc/pandora_agent_exec @@ -1,15 +1,8 @@ #!/usr/bin/perl -########################################################################## -# pandora_agent_exec +################################################################################ +# pandora_exec - Execute a command with a time limit. # -# Executes the given command and prints its output to stdout. If the -# execution times out or the command does not exist nothing is printed -# to stdout. This is part of Pandora FMS Plugin server, do not delete!. -# -# Usage: pandora_agent_exec -########################################################################## -# Copyright (c) 2008-2010 Ramon Novoa, rnovoa@gmail.com -# (c) 2008-2010 Artica Soluciones Tecnologicas S.L +# Copyright (c) 2008-2023 Artica PFMS S.L. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,37 +15,41 @@ # 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. -########################################################################## - +################################################################################ use strict; use warnings; +use POSIX qw(WEXITSTATUS WIFEXITED); -# Check command line parameters +# Check command line arguments. if ($#ARGV < 1) { + print("Usage: $0 \n"); exit 1; } my @opts = @ARGV; my $timeout = shift(@opts); -my $command = join(' ', @opts); -my $output = ''; -my $ReturnCode = 0; +my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent. + join(' ', @opts) : + join(' ', map { quotemeta($_) } @opts); -# Execute the command -eval { - local $SIG{ALRM} = sub { die "alarm\n" }; - alarm $timeout; - - $output = `$command`; - $ReturnCode = ($? >> 8) & 0xff; - alarm 0; -}; - -# Timeout -if ($@ eq "alarm\n") { - exit 3; +# Fork: +# * The child will run the command. +# * The parent will timeout if needed +# and exit with the appropriate exit status. +my $pid = fork(); +if ($pid == 0) { + setpgrp(); + exec($command); +} else { + eval { + local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; }; + alarm $timeout; + waitpid($pid, 0); + alarm 0; + if (WIFEXITED(${^CHILD_ERROR_NATIVE})) { + exit WEXITSTATUS(${^CHILD_ERROR_NATIVE}); + } + }; } -print $output; - -exit $ReturnCode; +exit 1; diff --git a/pandora_agents/unix/pandora_agent_exec b/pandora_agents/unix/pandora_agent_exec index 48fba5c0d8..2a990067ae 100755 --- a/pandora_agents/unix/pandora_agent_exec +++ b/pandora_agents/unix/pandora_agent_exec @@ -1,15 +1,8 @@ #!/usr/bin/perl -########################################################################## -# pandora_agent_exec +################################################################################ +# pandora_exec - Execute a command with a time limit. # -# Executes the given command and prints its output to stdout. If the -# execution times out or the command does not exist nothing is printed -# to stdout. This is part of Pandora FMS Plugin server, do not delete!. -# -# Usage: pandora_agent_exec -########################################################################## -# Copyright (c) 2008-2010 Ramon Novoa, rnovoa@gmail.com -# (c) 2008-2010 Artica Soluciones Tecnologicas S.L +# Copyright (c) 2008-2023 Artica PFMS S.L. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,37 +15,41 @@ # 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. -########################################################################## - +################################################################################ use strict; use warnings; +use POSIX qw(WEXITSTATUS WIFEXITED); -# Check command line parameters +# Check command line arguments. if ($#ARGV < 1) { + print("Usage: $0 \n"); exit 1; } my @opts = @ARGV; my $timeout = shift(@opts); -my $command = join(' ', @opts); -my $output = ''; -my $ReturnCode = 0; +my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent. + join(' ', @opts) : + join(' ', map { quotemeta($_) } @opts); -# Execute the command -eval { - local $SIG{ALRM} = sub { die "alarm\n" }; - alarm $timeout; - - $output = `$command`; - $ReturnCode = ($? >> 8) & 0xff; - alarm 0; -}; - -# Timeout -if ($@ eq "alarm\n") { - exit 3; +# Fork: +# * The child will run the command. +# * The parent will timeout if needed +# and exit with the appropriate exit status. +my $pid = fork(); +if ($pid == 0) { + setpgrp(); + exec($command); +} else { + eval { + local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; }; + alarm $timeout; + waitpid($pid, 0); + alarm 0; + if (WIFEXITED(${^CHILD_ERROR_NATIVE})) { + exit WEXITSTATUS(${^CHILD_ERROR_NATIVE}); + } + }; } -print $output; - -exit $ReturnCode; +exit 1; diff --git a/pandora_server/bin/pandora_exec b/pandora_server/bin/pandora_exec index d6d5da1c8c..2a990067ae 100755 --- a/pandora_server/bin/pandora_exec +++ b/pandora_server/bin/pandora_exec @@ -1,15 +1,8 @@ #!/usr/bin/perl -########################################################################## -# pandora_exec +################################################################################ +# pandora_exec - Execute a command with a time limit. # -# Executes the given command and prints its output to stdout. If the -# execution times out or the command does not exist nothing is printed -# to stdout. This is part of Pandora FMS Plugin server, do not delete!. -# -# Usage: pandora_exec -########################################################################## -# Copyright (c) 2008 Ramon Novoa, rnovoa@gmail.com -# (c) 2008 Artica Soluciones Tecnologicas S.L +# Copyright (c) 2008-2023 Artica PFMS S.L. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,41 +15,41 @@ # 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. -########################################################################## - +################################################################################ use strict; use warnings; +use POSIX qw(WEXITSTATUS WIFEXITED); -# Check command line parameters +# Check command line arguments. if ($#ARGV < 1) { + print("Usage: $0 \n"); exit 1; } my @opts = @ARGV; my $timeout = shift(@opts); -my $command; -foreach my $arg (@opts) { - $command .= $^O ne 'MSWin32' ? quotemeta ($arg) . ' ' : '"' . $arg . '" '; -} -chomp ($command); -my $output = ''; -my $ReturnCode = 0; +my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent. + join(' ', @opts) : + join(' ', map { quotemeta($_) } @opts); -# Execute the command -eval { - local $SIG{ALRM} = sub { die "alarm\n" }; - alarm $timeout; - - $output = `$command`; - $ReturnCode = ($? >> 8) & 0xff; - alarm 0; -}; - -# Timeout -if ($@ eq "alarm\n") { - exit 3; +# Fork: +# * The child will run the command. +# * The parent will timeout if needed +# and exit with the appropriate exit status. +my $pid = fork(); +if ($pid == 0) { + setpgrp(); + exec($command); +} else { + eval { + local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; }; + alarm $timeout; + waitpid($pid, 0); + alarm 0; + if (WIFEXITED(${^CHILD_ERROR_NATIVE})) { + exit WEXITSTATUS(${^CHILD_ERROR_NATIVE}); + } + }; } -print $output; - -exit $ReturnCode; +exit 1; From 34c61bb513b86c7a51c67365242784ea3d676cbb Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 9 Feb 2023 01:02:05 +0100 Subject: [PATCH 39/82] 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 fe5bad7109..4cfb010cf2 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-230208 +Version: 7.0NG.768-230209 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 38f99a713f..38048034a1 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-230208" +pandora_version="7.0NG.768-230209" 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 f01ddb5744..228a025448 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 => '230208'; +use constant AGENT_BUILD => '230209'; # 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 c1b7aa663a..1fb9eac584 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 230208 +%define release 230209 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 962b9077ba..1c08401142 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 230208 +%define release 230209 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 a6a9b0271b..66d6f764fa 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="230208" +PI_BUILD="230209" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 4f5de91e58..faf4af76a5 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230208} +{230209} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 304f3a22f8..af6acde6bc 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 230208") +#define PANDORA_VERSION ("7.0NG.768 Build 230209") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 030041571c..fb7c956dcf 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 230208))" + VALUE "ProductVersion", "(7.0NG.768(Build 230209))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 807a36e537..6fbb9eae7c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.768-230208 +Version: 7.0NG.768-230209 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 6ff898257a..19865fc581 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-230208" +pandora_version="7.0NG.768-230209" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1777d0bb57..2f11c97e68 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 = 'PC230208'; +$build_version = 'PC230209'; $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 064cf37935..e7026a9169 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 fff8104658..de33a9be3f 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 230208 +%define release 230209 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 7b79bbbd4c..8ce0f6c363 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 230208 +%define release 230209 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 3696050dea..0714a32686 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230208" +PI_BUILD="230209" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index cb45ea6415..6192b62b47 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 230208"; +my $version = "7.0NG.768 Build 230209"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index f3346387d2..3a9abd0f9b 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 230208"; +my $version = "7.0NG.768 Build 230209"; # save program name for logging my $progname = basename($0); From 9f8d302719765df6144dfc0266c5056319854afc Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 10 Feb 2023 01:01:50 +0100 Subject: [PATCH 40/82] 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 4cfb010cf2..b565d1ff22 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-230209 +Version: 7.0NG.768-230210 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 38048034a1..7dc4394f80 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-230209" +pandora_version="7.0NG.768-230210" 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 228a025448..3d0e51330f 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 => '230209'; +use constant AGENT_BUILD => '230210'; # 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 1fb9eac584..48e2b24538 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 230209 +%define release 230210 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 1c08401142..92666a0db0 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 230209 +%define release 230210 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 66d6f764fa..b5ad7ba5c4 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="230209" +PI_BUILD="230210" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index faf4af76a5..8927624adc 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230209} +{230210} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index af6acde6bc..5067264a29 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 230209") +#define PANDORA_VERSION ("7.0NG.768 Build 230210") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index fb7c956dcf..54596f74f5 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 230209))" + VALUE "ProductVersion", "(7.0NG.768(Build 230210))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 6fbb9eae7c..9a08efb4dc 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.768-230209 +Version: 7.0NG.768-230210 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 19865fc581..70a58b8f43 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-230209" +pandora_version="7.0NG.768-230210" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 2f11c97e68..79016bf075 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 = 'PC230209'; +$build_version = 'PC230210'; $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 e7026a9169..e19455763e 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 de33a9be3f..35238d78ba 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 230209 +%define release 230210 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 8ce0f6c363..ab61c7894d 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 230209 +%define release 230210 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 0714a32686..4a3432fbfe 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230209" +PI_BUILD="230210" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 6192b62b47..15b8b0897e 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 230209"; +my $version = "7.0NG.768 Build 230210"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3a9abd0f9b..b0839f05af 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 230209"; +my $version = "7.0NG.768 Build 230210"; # save program name for logging my $progname = basename($0); From 06442fa6e30cb00fe4d41245814ff53831722c96 Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 10 Feb 2023 15:03:57 +0100 Subject: [PATCH 41/82] WIP: Omnishell error xml if YAML::Tiny not installed on agent --- pandora_agents/unix/pandora_agent | 46 ++++++++++++++++++------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f01ddb5744..90b7d93c7c 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -556,30 +556,38 @@ BEGIN { sub runCommand { my ($self, $ref, $output_mode) = @_; + my $result; if($self->load_libraries()) { # Functionality possible. my $command = $self->{'commands'}->{$ref}; - my $result = $self->evaluate_command($ref); - if (ref($result) eq "HASH") { - # Process command result. - if (defined($output_mode) && $output_mode eq 'xml') { - my $output = ''; - $output .= "\n"; - $output .= " \n"; - $output .= " {'name'}."]]>\n"; - $output .= " \n"; - $output .= " {'error_level'}."]]>\n"; - $output .= " {'stdout'}."]]>\n"; - $output .= " {'stderr'}."]]>\n"; - $output .= " \n"; - $output .= "\n"; + $result = $self->evaluate_command($ref); + } else { + $result = { + 'stderr' => 'Cannot use commands without YAML dependency, please install it.', + 'name' => 'YAML::Tiny', + 'error_level' => 2, + }; + } - return $output; - } - return $result; - } else { - $self->set_last_error('Failed to process ['.$ref.']: '.$result); + if (ref($result) eq "HASH") { + # Process command result. + if (defined($output_mode) && $output_mode eq 'xml') { + my $output = ''; + $output .= "\n"; + $output .= " \n"; + $output .= " {'name'}."]]>\n"; + $output .= " \n"; + $output .= " {'error_level'}."]]>\n"; + $output .= " {'stdout'}."]]>\n"; + $output .= " {'stderr'}."]]>\n"; + $output .= " \n"; + $output .= "\n"; + + return $output; } + return $result; + } else { + $self->set_last_error('Failed to process ['.$ref.']: '.$result); } return undef; From 1e5ac4281c0751f6ed6a72d2b2004c766ac1650b Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 11 Feb 2023 01:02:09 +0100 Subject: [PATCH 42/82] 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 b565d1ff22..19d729f0d0 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-230210 +Version: 7.0NG.768-230211 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 7dc4394f80..c33f1bed6d 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-230210" +pandora_version="7.0NG.768-230211" 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 3d0e51330f..b745fd89b1 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 => '230210'; +use constant AGENT_BUILD => '230211'; # 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 48e2b24538..ce2bcea385 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 230210 +%define release 230211 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 92666a0db0..817db34242 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 230210 +%define release 230211 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 b5ad7ba5c4..66c90d0773 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="230210" +PI_BUILD="230211" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 8927624adc..89efa6e3c2 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230210} +{230211} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 5067264a29..f1ffa7392a 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 230210") +#define PANDORA_VERSION ("7.0NG.768 Build 230211") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 54596f74f5..473b20bbb9 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 230210))" + VALUE "ProductVersion", "(7.0NG.768(Build 230211))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 9a08efb4dc..8f221ab965 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.768-230210 +Version: 7.0NG.768-230211 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 70a58b8f43..b2c8bfcebd 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-230210" +pandora_version="7.0NG.768-230211" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 79016bf075..176d23b0d6 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 = 'PC230210'; +$build_version = 'PC230211'; $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 e19455763e..851451d651 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 35238d78ba..1defcc1be7 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 230210 +%define release 230211 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index ab61c7894d..d99379b166 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 230210 +%define release 230211 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 4a3432fbfe..0a51e9e089 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230210" +PI_BUILD="230211" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 15b8b0897e..9d0a89c017 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 230210"; +my $version = "7.0NG.768 Build 230211"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index b0839f05af..5b81529bb2 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 230210"; +my $version = "7.0NG.768 Build 230211"; # save program name for logging my $progname = basename($0); From 98c05a4bea3facfab91cb6fced89b39e120d0a07 Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 12 Feb 2023 01:02:01 +0100 Subject: [PATCH 43/82] 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 19d729f0d0..e7b513e141 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-230211 +Version: 7.0NG.768-230212 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 c33f1bed6d..962bdbdedc 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-230211" +pandora_version="7.0NG.768-230212" 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 b745fd89b1..f3c98efa21 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 => '230211'; +use constant AGENT_BUILD => '230212'; # 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 ce2bcea385..8137d70444 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 230211 +%define release 230212 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 817db34242..0662632ca1 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 230211 +%define release 230212 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 66c90d0773..ea44be02b3 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="230211" +PI_BUILD="230212" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 89efa6e3c2..92c21d5c1d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230211} +{230212} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index f1ffa7392a..baebb9ff14 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 230211") +#define PANDORA_VERSION ("7.0NG.768 Build 230212") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 473b20bbb9..754d2fed2a 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 230211))" + VALUE "ProductVersion", "(7.0NG.768(Build 230212))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 8f221ab965..0b84ee5643 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.768-230211 +Version: 7.0NG.768-230212 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 b2c8bfcebd..810cdafcb5 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-230211" +pandora_version="7.0NG.768-230212" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 176d23b0d6..1155531082 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 = 'PC230211'; +$build_version = 'PC230212'; $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 851451d651..178158ddb4 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 1defcc1be7..a777c099e7 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 230211 +%define release 230212 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index d99379b166..2989d2001e 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 230211 +%define release 230212 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 0a51e9e089..d09995795c 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230211" +PI_BUILD="230212" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 9d0a89c017..7909617726 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 230211"; +my $version = "7.0NG.768 Build 230212"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 5b81529bb2..a6533edb52 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 230211"; +my $version = "7.0NG.768 Build 230212"; # save program name for logging my $progname = basename($0); From 885c128556752d4d3848b4808d36ff876092fbcd Mon Sep 17 00:00:00 2001 From: artica Date: Mon, 13 Feb 2023 01:01:18 +0100 Subject: [PATCH 44/82] 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 e7b513e141..7802c679e5 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-230212 +Version: 7.0NG.768-230213 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 962bdbdedc..eb4279b84f 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-230212" +pandora_version="7.0NG.768-230213" 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 f3c98efa21..1668a50e86 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 => '230212'; +use constant AGENT_BUILD => '230213'; # 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 8137d70444..4482ace58a 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 230212 +%define release 230213 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 0662632ca1..1b07645a58 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 230212 +%define release 230213 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 ea44be02b3..601db13b4b 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="230212" +PI_BUILD="230213" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 92c21d5c1d..1cf8ab41dc 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230212} +{230213} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index baebb9ff14..d44d4eb5a1 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 230212") +#define PANDORA_VERSION ("7.0NG.768 Build 230213") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 754d2fed2a..e983b3cba2 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 230212))" + VALUE "ProductVersion", "(7.0NG.768(Build 230213))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 0b84ee5643..8b393620b9 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.768-230212 +Version: 7.0NG.768-230213 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 810cdafcb5..399096ff6a 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-230212" +pandora_version="7.0NG.768-230213" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1155531082..5a8c0631b1 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 = 'PC230212'; +$build_version = 'PC230213'; $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 178158ddb4..835b2efaea 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 a777c099e7..90ebdbf8bc 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 230212 +%define release 230213 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 2989d2001e..9698e8c1dc 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 230212 +%define release 230213 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index d09995795c..52e6b86b35 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230212" +PI_BUILD="230213" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 7909617726..2667cdbbb7 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 230212"; +my $version = "7.0NG.768 Build 230213"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index a6533edb52..378688aa67 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 230212"; +my $version = "7.0NG.768 Build 230213"; # save program name for logging my $progname = basename($0); From 4cd0820f117a4428c65e4e6dae60603fc3d4d340 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 13 Feb 2023 11:44:01 +0100 Subject: [PATCH 45/82] #10118 Changed radio button --- .../agentes/pandora_networkmap.editor.php | 33 ++++++++++++------- .../agentes/pandora_networkmap.view.php | 30 +++++++++++++---- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index c03af62bf3..507e037b1e 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -352,7 +352,23 @@ 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', __('Discovery 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_select( + [ + 'group' => __('Group'), + 'recon_task' => __('Discovery task'), + 'ip_mask' => __('CIDR IP mask'), + ], + 'source', + $source, + '', + '', + 0, + true, + false, + false, + '', + $disabled_source + ); $table->data['source_data_recon_task'][0] = __('Source from recon task'); $table->data['source_data_recon_task'][0] .= ui_print_help_tip( @@ -498,9 +514,9 @@ if ($not_found) { '; 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 46/82] 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 47/82] #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 48/82] 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 49/82] #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 50/82] #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 51/82] 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 52/82] 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 53/82] #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 54/82] #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) {