From 4b1fd315c5d7e489d4a3670314b57cb11cd4b350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Fri, 30 Sep 2022 10:35:47 +0200 Subject: [PATCH 01/27] Added token in pandora_server conf file --- pandora_server/conf/pandora_server.conf.new | 3 +++ pandora_server/lib/PandoraFMS/DB.pm | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 2f67d9cd56..2291083a58 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -743,3 +743,6 @@ alertserver_queue 0 tentacle_service_watchdog 1 +# Enable (1) or disable (0) the parameter of mysql ssl certification (mysql_ssl_verify_server_cert) (enabled by default). + +verify_mysql_ssl_cert 1 \ No newline at end of file diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 9aae480433..5e3cba6527 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -1661,9 +1661,12 @@ sub set_ssl_opts($) { } # Enable SSL. - $SSL_OPTS = "mysql_ssl=1;mysql_ssl_optional=1;mysql_ssl_verify_server_cert=1"; + $SSL_OPTS = "mysql_ssl=1;mysql_ssl_optional=11"; # Set additional SSL options. + if (defined($pa_config->{'verify_mysql_ssl_cert'}) && $pa_config->{'verify_mysql_ssl_cert'} ne "") { + $SSL_OPTS .= ";mysql_ssl_verify_server_cert=$pa_config->{'verify_mysql_ssl_cert'}"; + } if (defined($pa_config->{'dbsslcapath'}) && $pa_config->{'dbsslcapath'} ne "") { $SSL_OPTS .= ";mysql_ssl_ca_path=" . $pa_config->{'dbsslcapath'}; } From 769a902b85ea8c9dcb3e3b8e4d9faee8dd2814c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Fri, 30 Sep 2022 11:03:33 +0200 Subject: [PATCH 02/27] Fix mistake --- 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 5e3cba6527..4ee5bb40a7 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -1661,7 +1661,7 @@ sub set_ssl_opts($) { } # Enable SSL. - $SSL_OPTS = "mysql_ssl=1;mysql_ssl_optional=11"; + $SSL_OPTS = "mysql_ssl=1;mysql_ssl_optional=1"; # Set additional SSL options. if (defined($pa_config->{'verify_mysql_ssl_cert'}) && $pa_config->{'verify_mysql_ssl_cert'} ne "") { From 8501e516e8a5735b711ff982ae5cfaedb3eebd71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Fri, 30 Sep 2022 11:04:36 +0200 Subject: [PATCH 03/27] Minor fix --- 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 4ee5bb40a7..a5b084f737 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -1665,7 +1665,7 @@ sub set_ssl_opts($) { # Set additional SSL options. if (defined($pa_config->{'verify_mysql_ssl_cert'}) && $pa_config->{'verify_mysql_ssl_cert'} ne "") { - $SSL_OPTS .= ";mysql_ssl_verify_server_cert=$pa_config->{'verify_mysql_ssl_cert'}"; + $SSL_OPTS .= ";mysql_ssl_verify_server_cert=" . $pa_config->{'verify_mysql_ssl_cert'}; } if (defined($pa_config->{'dbsslcapath'}) && $pa_config->{'dbsslcapath'} ne "") { $SSL_OPTS .= ";mysql_ssl_ca_path=" . $pa_config->{'dbsslcapath'}; From c6ce58d5f93bdefe8d65c389d41720ee7465b2df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Tue, 11 Oct 2022 11:02:42 +0200 Subject: [PATCH 04/27] Added feature for create event and notify where snmptrampd is stuck --- pandora_server/bin/pandora_server | 3 +++ pandora_server/lib/PandoraFMS/Core.pm | 37 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index ce091872e2..e6ec7ed6dc 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -453,6 +453,9 @@ sub pandora_server_tasks ($) { } } + # 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"}; diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index cf3c0df901..c9fcd714a0 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -215,6 +215,7 @@ our @EXPORT = qw( pandora_module_keep_alive_nd pandora_module_unknown pandora_output_password + pandora_snmptrapd_still_working pandora_planned_downtime pandora_planned_downtime_set_quiet_elements pandora_planned_downtime_unset_quiet_elements @@ -7191,6 +7192,42 @@ sub notification_get_groups { return @results; } +######################################################################## + +=head2 C<< pandora_snmptrapd_still_working (I<$pa_config>, I<$dbh>) >> +snmptrapd sometimes freezes and eventually its status needs to be checked. +=cut + +######################################################################## +sub pandora_snmptrapd_still_working ($$) { + my ($pa_config, $dbh) = @_; + + if ($pa_config->{'snmpserver'} eq '1') { + # Variable that defines the maximum time of delay between kksks. + my $timeMaxLapse = 360; + # Check last snmptrapd saved in DB. + my $lastTimestampSaved = get_db_value($dbh, 'SELECT UNIX_TIMESTAMP(timestamp) + FROM ttrap + ORDER BY timestamp DESC + LIMIT 1'); + # Read the last log file line. + use Tie::File; + my $snmptrapdFile = $pa_config->{'snmp_logfile'}; + tie my @snmptrapdFileComplete, 'Tie::File', $snmptrapdFile; + my $lastTimestampLogFile = $snmptrapdFileComplete[-1]; + my ($protocol, $date, $time) = split(/\[\*\*\]/, $lastTimestampLogFile, 4); + my ($hour, $min, $sec) = split(/:/, $time, 3); + my ($year, $month, $day) = split(/-/, $date, 3); + $lastTimestampLogFile = timelocal($sec, $min, $hour, $day, $month, $year); + logger($pa_config, 'lastTimestampSaved: '.$lastTimestampSaved); + logger($pa_config, 'lastTimestampLogFile: '.$lastTimestampLogFile); + if ($lastTimestampSaved ne $lastTimestampLogFile && $lastTimestampSaved ge ($lastTimestampLogFile + $timeMaxLapse)) { + my $lapseMessage = "snmptrapd service probably is stuck. Please check the status." + logger($pa_config, $lapseMessage, 1); + pandora_event ($pa_config, $lapseMessage, 0, 0, 4, 0, 0, 'system', 0, $dbh); + } + } +} # End of function declaration # End of defined Code From c726904ec142a31e2e81d0528bef41b1ef26d477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Tue, 11 Oct 2022 11:12:02 +0200 Subject: [PATCH 05/27] Fix --- pandora_server/lib/PandoraFMS/Core.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index c9fcd714a0..3023cf611d 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -7222,7 +7222,7 @@ sub pandora_snmptrapd_still_working ($$) { logger($pa_config, 'lastTimestampSaved: '.$lastTimestampSaved); logger($pa_config, 'lastTimestampLogFile: '.$lastTimestampLogFile); if ($lastTimestampSaved ne $lastTimestampLogFile && $lastTimestampSaved ge ($lastTimestampLogFile + $timeMaxLapse)) { - my $lapseMessage = "snmptrapd service probably is stuck. Please check the status." + my $lapseMessage = "snmptrapd service probably is stuck."; logger($pa_config, $lapseMessage, 1); pandora_event ($pa_config, $lapseMessage, 0, 0, 4, 0, 0, 'system', 0, $dbh); } From bfc1289ba60ff0351384e61e5b7367aea3bfd360 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 19 Oct 2022 13:59:16 +0200 Subject: [PATCH 06/27] #9105 Added collections satellite --- .../godmode/servers/modificar_server.php | 10 +- .../class/SatelliteCollection.class.php | 689 ++++++++++++++++++ 2 files changed, 698 insertions(+), 1 deletion(-) create mode 100644 pandora_console/include/class/SatelliteCollection.class.php diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index 34524c6aa7..17f2020d13 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -137,7 +137,13 @@ if (isset($_GET['server'])) { if ($server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) { $buttons['agent_editor'] = [ 'active' => false, - 'text' => ''.html_print_image('images/agent.png', true, ['title' => __('Advanced editor')]).'', + 'text' => ''.html_print_image('images/agent.png', true, ['title' => __('Manage agents')]).'', + + ]; + + $buttons['collections'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'', ]; } @@ -160,6 +166,8 @@ if (isset($_GET['server'])) { } } else if ($tab === 'agent_editor' && $server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) { $advanced_editor = 'agent_editor'; + } else if ($tab === 'collections' && $server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $advanced_editor = 'collections'; } enterprise_include('godmode/servers/server_disk_conf_editor.php'); diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php new file mode 100644 index 0000000000..34348fdc7a --- /dev/null +++ b/pandora_console/include/class/SatelliteCollection.class.php @@ -0,0 +1,689 @@ +ajaxController = $ajaxController; + // Capture all parameters before start. + $this->satellite_server = (int) get_parameter('server_remote'); + if ($this->satellite_server !== 0) { + $this->satellite_name = servers_get_name($this->satellite_server); + $this->satellite_config = (array) config_satellite_get_config_file($this->satellite_name); + } + } + + + /** + * Run view + * + * @return void + */ + public function run() + { + // Javascript. + ui_require_jquery_file('pandora'); + // CSS. + ui_require_css_file('wizard'); + ui_require_css_file('discovery'); + + $this->createBlock(); + + if (is_metaconsole() === true) { + // Only in case of Metaconsole, format the frame. + open_meta_frame(); + } + + // Datatables list. + try { + $columns = [ + 'name', + 'dir', + 'description', + 'actions', + ]; + + $column_names = [ + __('Name'), + __('Dir'), + __('Description'), + __('Actions'), + ]; + + $this->tableId = 'satellite_collections'; + + // Load datatables user interface. + ui_print_datatable( + [ + 'id' => $this->tableId, + 'class' => 'info_table', + 'style' => 'width: 100%', + 'columns' => $columns, + 'column_names' => $column_names, + 'ajax_url' => $this->ajaxController, + 'ajax_data' => [ + 'method' => 'draw', + 'server_remote' => $this->satellite_server, + ], + 'ajax_postprocces' => 'process_datatables_item(item)', + 'no_sortable_columns' => [ + 0, + 1, + 2, + 3, + ], + 'search_button_class' => 'sub filter float-right', + 'form' => [ + 'inputs' => [ + [ + 'label' => __('Search'), + 'type' => 'text', + 'name' => 'filter_search', + 'size' => 12, + ], + ], + ], + ] + ); + } catch (Exception $e) { + echo $e->getMessage(); + } + + if (is_metaconsole() === true) { + // Close the frame. + close_meta_frame(); + } + + echo ''; + echo ''; + + // Load own javascript file. + echo $this->loadJS(); + } + + + /** + * Get the data for draw the table. + * + * @return void. + */ + public function draw() + { + global $config; + + // Init data. + $data = []; + // Count of total records. + $count = 0; + // Catch post parameters. + $start = get_parameter('start', 0); + $length = get_parameter('length', $config['block_size']); + $order = get_datatable_order(true); + $filters = get_parameter('filter', []); + + try { + ob_start(); + + // Gets all collections (database). + $collections = collection_get_collections(null, $filters['filter_search']); + if (empty($collections) === false) { + $data = $collections; + } + + // All satellite conf collections. + foreach ($this->satellite_config as $line) { + $regex = '/^file_collection\s(\S+)/m'; + + if (preg_match($regex, $line, $matches, PREG_OFFSET_CAPTURE, 0) > 0) { + $key = array_search($matches[1][0], array_column($data, 'short_name')); + if ($key !== false) { + $data[$key]['delete'] = true; + } + } + } + + if (empty($data) === false) { + $data = array_reduce( + $data, + function ($carry, $item) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = (object) $item; + + $delete = (int) isset($tmp->delete); + + $tmp->dir = $tmp->short_name; + + $tmp->actions = ''; + $tmp->actions .= html_print_image( + ($delete === 0) ? 'images/add.png' : 'images/cross.png', + true, + [ + 'border' => '0', + 'class' => 'action_button_img mrgn_lft_05em invert_filter', + 'onclick' => ($delete === 0) + ? 'add_collection(\''.$tmp->short_name.'\')' + : 'delete_collection(\''.$tmp->short_name.'\')', + ] + ); + + $carry[] = $tmp; + return $carry; + } + ); + } + + if (empty($data) === true) { + $total = 0; + $data = []; + } else { + $total = count($data); + $data = array_slice($data, $start, $length, false); + } + + echo json_encode( + [ + 'data' => $data, + 'recordsTotal' => $total, + 'recordsFiltered' => $total, + ] + ); + // Capture output. + $response = ob_get_clean(); + } catch (Exception $e) { + echo json_encode(['error' => $e->getMessage()]); + exit; + } + + // If not valid, show error with issue. + json_decode($response); + if (json_last_error() === JSON_ERROR_NONE) { + // If valid dump. + echo $response; + } else { + echo json_encode( + ['error' => $response] + ); + } + + exit; + } + + + /** + * Add collection to satellite conf. + * + * @return void + */ + public function addCollection() + { + $short_name = get_parameter('short_name'); + + if ($this->parseSatelliteConf('add', $short_name) === false) { + $this->ajaxMsg('error', __('Error adding collection')); + } else { + $this->ajaxMsg('result', _('Collection '.$short_name.' added.')); + } + + exit; + } + + + /** + * Delete collection to satellite conf. + * + * @return void + */ + public function deleteCollection() + { + $short_name = get_parameter('short_name'); + + if ($this->parseSatelliteConf('delete', $short_name) === false) { + $this->ajaxMsg('error', __('Error deleting collection')); + } else { + $this->ajaxMsg('result', _('Collection '.$short_name.' deleted.')); + } + + exit; + } + + + /** + * Parse satellite configuration . + * + * @param string $action Action to perform (add, delete). + * @param string $short_name Short name. + * + * @return boolean + */ + private function parseSatelliteConf(string $action, string $short_name) + { + switch ($action) { + case 'delete': + $pos = preg_grep('/^file_collection '.$short_name.'/', $this->satellite_config); + if (empty($pos) === false) { + $key_pos = 0; + foreach ($pos as $key => $value) { + $key_pos = $key; + break; + } + + unset($this->satellite_config[$key_pos]); + } + + $conf = implode('', $this->satellite_config); + break; + + default: + case 'add': + $pos = preg_grep('/^file_collection/', $this->satellite_config); + if (empty($pos) === false) { + $string_collection = 'file_collection '.$short_name."\n"; + + $key_pos = array_keys($pos)[(count($pos) - 1)]; + $array1 = array_slice($this->satellite_config, 0, ($key_pos + 1)); + $array2 = array_slice($this->satellite_config, ($key_pos + 1)); + $array_merge = array_merge($array1, [$string_collection], $array2); + $this->satellite_config = $array_merge; + + // Check config. + if (empty($this->satellite_config) === true) { + return false; + } + } else { + $pos = preg_grep('/^\#\sFile\scollections/', $this->satellite_config); + $string_collection = 'file_collection '.$short_name."\n"; + + $key_pos = 0; + foreach ($pos as $key => $value) { + $key_pos = $key; + break; + } + + $key_pos++; + + $array1 = array_slice($this->satellite_config, 0, $key_pos); + $array2 = array_slice($this->satellite_config, $key_pos); + // Add collection to conf. + $array_merge = array_merge($array1, [$string_collection], $array2); + $this->satellite_config = $array_merge; + + // Check config. + if (empty($this->satellite_config) === true) { + return false; + } + } + + $conf = implode('', $this->satellite_config); + break; + } + + return $this->saveAgent($conf); + } + + + /** + * Saves agent to satellite cofiguration file. + * + * @param string $new_conf Config file. + * + * @return boolean|void + */ + private function saveAgent(string $new_conf) + { + global $config; + + if (empty($new_conf) === true) { + return false; + } + + db_pandora_audit( + AUDIT_LOG_SYSTEM, + 'Update remote config for server '.$this->satellite_name + ); + + // Convert to config file encoding. + $encoding = config_satellite_get_encoding($new_conf); + if ($encoding !== false) { + $converted_server_config = mb_convert_encoding($new_conf, $encoding, 'UTF-8'); + if ($converted_server_config !== false) { + $new_conf = $converted_server_config; + } + } + + // Get filenames. + if ($this->satellite_server !== false) { + $files = config_satellite_get_satellite_config_filenames($this->satellite_name); + } else { + $files = []; + $files['conf'] = $config['remote_config'].'/conf/'.md5($this->satellite_name).'.srv.conf'; + $files['md5'] = $config['remote_config'].'/md5/'.md5($this->satellite_name).'.srv.md5'; + } + + // Save configuration. + $result = file_put_contents($files['conf'], $new_conf); + + if ($result === false) { + return false; + } + + // Save configuration md5. + $result = file_put_contents($files['md5'], md5($new_conf)); + } + + + /** + * Checks if target method is available to be called using AJAX. + * + * @param string $method Target method. + * + * @return boolean True allowed, false not. + */ + public function ajaxMethod(string $method) + { + return in_array($method, $this->AJAXMethods); + } + + + /** + * Minor function to dump json message as ajax response. + * + * @param string $type Type: result || error. + * @param string $msg Message. + * + * @return void + */ + private function ajaxMsg(string $type, string $msg) + { + if ($type === 'error') { + echo json_encode( + [ + $type => ui_print_error_message( + __($msg), + '', + true + ), + ] + ); + } else { + echo json_encode( + [ + $type => ui_print_success_message( + __($msg), + '', + true + ), + ] + ); + } + + exit; + } + + + /** + * Create file_collections blocks + * + * @return void + */ + public function createBlock() + { + $init = preg_grep('/^\#\sFile\scollections/', $this->satellite_config); + + if (empty($init) === true) { + $collection = "# File collections\n"; + + array_push($this->satellite_config, "\n"); + array_push($this->satellite_config, $collection); + array_push($this->satellite_config, "\n"); + + $conf = implode('', $this->satellite_config); + $this->saveAgent($conf); + } + } + + + /** + * Load Javascript code. + * + * @return string. + */ + public function loadJS() + { + // Nothing for this moment. + ob_start(); + + // Javascript content. + ?> + + Date: Fri, 28 Oct 2022 10:06:38 +0200 Subject: [PATCH 07/27] Fix --- pandora_server/lib/PandoraFMS/Core.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 3023cf611d..972aae2e6f 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -7204,7 +7204,7 @@ sub pandora_snmptrapd_still_working ($$) { if ($pa_config->{'snmpserver'} eq '1') { # Variable that defines the maximum time of delay between kksks. - my $timeMaxLapse = 360; + my $timeMaxLapse = 3600; # Check last snmptrapd saved in DB. my $lastTimestampSaved = get_db_value($dbh, 'SELECT UNIX_TIMESTAMP(timestamp) FROM ttrap @@ -7219,9 +7219,7 @@ sub pandora_snmptrapd_still_working ($$) { my ($hour, $min, $sec) = split(/:/, $time, 3); my ($year, $month, $day) = split(/-/, $date, 3); $lastTimestampLogFile = timelocal($sec, $min, $hour, $day, $month, $year); - logger($pa_config, 'lastTimestampSaved: '.$lastTimestampSaved); - logger($pa_config, 'lastTimestampLogFile: '.$lastTimestampLogFile); - if ($lastTimestampSaved ne $lastTimestampLogFile && $lastTimestampSaved ge ($lastTimestampLogFile + $timeMaxLapse)) { + if ($lastTimestampSaved ne $lastTimestampLogFile && $lastTimestampSaved gt ($lastTimestampLogFile + $timeMaxLapse)) { my $lapseMessage = "snmptrapd service probably is stuck."; logger($pa_config, $lapseMessage, 1); pandora_event ($pa_config, $lapseMessage, 0, 0, 4, 0, 0, 'system', 0, $dbh); From ccc27883f6adabe1c0d131f78eae3a53392fab46 Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 28 Oct 2022 10:52:52 +0200 Subject: [PATCH 08/27] Fix XSS vulnerability --- pandora_console/operation/agentes/pandora_networkmap.editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 41b8ed6a45..c03af62bf3 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -97,7 +97,7 @@ if ($edit_networkmap) { return; } - $name = io_safe_output($values['name']); + $name = io_safe_output_html($values['name']); // Id group of the map itself, not data source. $id_group_map = $values['id_group_map']; From 8ad0bbf89209c1a029330209d24cbef867b70cc5 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 31 Oct 2022 15:59:24 +0100 Subject: [PATCH 09/27] show historical traps in snmp console --- pandora_console/operation/snmpconsole/snmp_view.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index e68a6a16f2..9879feb4be 100755 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -671,8 +671,8 @@ $filter_resume['group_by'] = $group_by; $filter_resume['hours_ago'] = $hours_ago; $filter_resume['trap_type'] = $trap_types[$trap_type]; -$traps = db_get_all_rows_sql($sql); -$trapcount = (int) db_get_value_sql($sql_count); +$traps = db_get_all_rows_sql($sql, true); +$trapcount = (int) db_get_value_sql($sql_count, false, true); // No traps. if (empty($traps)) { From 8d34ef88c5d89a7b8ec6286d3e4f33a5b1503d1e Mon Sep 17 00:00:00 2001 From: "edu.corral" Date: Wed, 2 Nov 2022 09:19:15 +0100 Subject: [PATCH 10/27] ent 9722 expired licence notification --- pandora_console/include/class/ConsoleSupervisor.php | 5 ++--- pandora_console/include/functions_notifications.php | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 7b20d49a51..c1f2012499 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -679,7 +679,6 @@ class ConsoleSupervisor $max_age = 0; break; - case 'NOTIF.LICENSE.EXPIRATION': case 'NOTIF.FILES.ATTACHMENT': case 'NOTIF.FILES.DATAIN': case 'NOTIF.FILES.DATAIN.BADXML': @@ -846,7 +845,7 @@ class ConsoleSupervisor } // Expiry. - if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) { + if (($days_to_expiry <= 15) && ($days_to_expiry > 0) && (is_user_admin($config['id_user']))) { if ($config['license_mode'] == 1) { $title = __('License is about to expire'); $msg = 'Your license will expire in %d days. Please, contact our sales department.'; @@ -867,7 +866,7 @@ class ConsoleSupervisor 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license', ] ); - } else if ($days_to_expiry < 0) { + } else if (($days_to_expiry < 0) && (is_user_admin($config['id_user']))) { if ($config['license_mode'] == 1) { $title = __('Expired license'); $msg = __('Your license has expired. Please, contact our sales department.'); diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index b655115aed..a0cb16faa0 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -125,7 +125,6 @@ function notifications_get_subtypes(?string $source=null) $subtypes = [ 'System status' => [ 'NOTIF.LICENSE.LIMITED', - 'NOTIF.LICENSE.EXPIRATION', 'NOTIF.FILES.ATTACHMENT', 'NOTIF.FILES.DATAIN', 'NOTIF.FILES.DATAIN.BADXML', From d44760fd08bd10748b7a6d1114f5ca2a3f7e1bab Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 2 Nov 2022 09:41:07 +0100 Subject: [PATCH 11/27] #9731 Fixed idAgent --- .../operation/agentes/alerts_status.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 1e06abbcfc..df5299d8aa 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -122,7 +122,7 @@ if ($flag_alert == 1 && check_acl($config['id_user'], $id_group, 'AW')) { $idAgent = get_parameter_get('id_agente', 0); -// Show alerts for specific agent +// Show alerts for specific agent. if ($idAgent != 0) { $url = $url.'&id_agente='.$idAgent; @@ -179,7 +179,7 @@ if ($idAgent != 0) { ); $idGroup = $id_group; - // If there is no agent defined, it means that it cannot search for the secondary groups + // If there is no agent defined, it means that it cannot search for the secondary groups. $all_groups = [$id_group]; $print_agent = true; @@ -335,7 +335,9 @@ if ($free_search != '') { } - $alert_action = empty(alerts_get_alert_actions_filter()) === false ? alerts_get_alert_actions_filter() : ['' => __('No actions')]; + $alert_action = empty(alerts_get_alert_actions_filter()) === false + ? alerts_get_alert_actions_filter() + : ['' => __('No actions')]; ob_start(); @@ -352,7 +354,7 @@ if ($free_search != '') { 'ajax_url' => 'include/ajax/alert_list.ajax', 'ajax_data' => [ 'get_agent_alerts_datatable' => 1, - 'id_agent' => $id_agent, + 'id_agent' => $idAgent, 'url' => $url, 'agent_view_page' => true, 'all_groups' => $all_groups, @@ -395,7 +397,7 @@ if ($free_search != '') { 'ajax_url' => 'include/ajax/alert_list.ajax', 'ajax_data' => [ 'get_agent_alerts_datatable' => 1, - 'id_agent' => $id_agent, + 'id_agent' => $idAgent, 'url' => $url, ], 'drawCallback' => 'alerts_table_controls()', @@ -451,7 +453,7 @@ if ($free_search != '') { echo $html_content; } - // strict user hidden + // Strict user hidden. echo '