Merge branch 'develop' into ent-11807-security-hardening-console-informes

This commit is contained in:
Daniel Cebrian 2023-08-18 14:48:47 +02:00
commit 0696ca60da
48 changed files with 360 additions and 79 deletions

View File

@ -32,6 +32,7 @@ services:
PUBLICURL: ""
SLEEP: 5
RETRIES: 10
TZ: 'Europe/Madrid'
networks:
- pandora
ports:

View File

@ -10,6 +10,8 @@ ENV DBPORT=3306
ENV SLEEP=5
ENV RETRIES=1
ENV OPEN=1
ENV TZ='Europe/Madrid'
ENV LC_ALL=C

View File

@ -230,6 +230,10 @@ fi
echo "" > /opt/pandora/crontasks || touch /opt/pandora/crontasks
#set localtime
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/$TZ /etc/localtime
#install pandora packages
echo "-> Istalling pandorafms"
cd /opt/pandora

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.773-230817
Version: 7.0NG.773-230818
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.773-230817"
pandora_version="7.0NG.773-230818"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1031,7 +1031,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773';
use constant AGENT_BUILD => '230817';
use constant AGENT_BUILD => '230818';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773
%define release 230817
%define release 230818
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773
%define release 230817
%define release 230818
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773"
PI_BUILD="230817"
PI_BUILD="230818"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230817}
{230818}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.773 Build 230817")
#define PANDORA_VERSION ("7.0NG.773 Build 230818")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773(Build 230817))"
VALUE "ProductVersion", "(7.0NG.773(Build 230818))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.773-230817
Version: 7.0NG.773-230818
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.773-230817"
pandora_version="7.0NG.773-230818"
package_pear=0
package_pandora=1

View File

@ -4,4 +4,13 @@ ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
COMMIT;
UPDATE `twelcome_tip`
SET title = 'Scheduled downtimes',
url = 'https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes'
WHERE title = 'planned stops';
UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
COMMIT;

View File

@ -0,0 +1,81 @@
<?php
/**
* Static page to lock access to console
*
* @category Wizard
* @package Pandora FMS
* @subpackage Applications.VMware
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
ui_require_css_file('maintenance');
?>
<html>
<body>
<div class="responsive center padding-6">
<p>
<?php
if (is_metaconsole() === true) {
echo __('You cannot use this metaconsole until merging process is finished');
} else {
echo __('You cannot use this console until merging process is finished');
}
?>
</p>
<br>
<br>
<?php
html_print_image(
'images/pandora_tinylogo.png',
false,
['class' => 'responsive flex margn']
);
html_print_image(
'images/maintenance.png',
false,
[
'class' => 'responsive',
'width' => 800,
]
);
?>
<br>
<br>
<p><?php echo __('You will be automatically redirected when all tasks finish'); ?></p>
</div>
</body>
<script type="text/javascript">
$(document).ready(function() {
setTimeout(
function() {
location.reload();
},
10000
);
})
</script>
</html>

View File

@ -259,6 +259,8 @@ if (!empty($news)) {
$output_news .= '</div></div>';
} else {
$text = str_replace('<script', '&lt;script', $text);
$text = str_replace('</script', '&lt;/script', $text);
$output_news .= nl2br($text);
}

View File

@ -233,7 +233,6 @@ if ($adopt === false) {
}
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';

View File

@ -103,6 +103,7 @@ if ($create_profiles) {
$groups_id = get_parameter('groups_id', -1);
$users_id = get_parameter('users_id', -1);
$n_added = 0;
$msg_error = __('Profiles cannot be added');
if ($profiles_id == -1 || $groups_id == -1 || $users_id == -1) {
$result = false;
@ -155,6 +156,8 @@ if ($create_profiles) {
if ($return !== false) {
$n_added++;
}
} else {
$msg_error = __('The profile already exist on the user');
}
}
}
@ -182,7 +185,7 @@ if ($create_profiles) {
ui_print_result_message(
$n_added > 0,
__('Profiles added successfully').'('.$n_added.')',
__('Profiles cannot be added')
$msg_error
);
}

View File

@ -965,7 +965,6 @@ $table->data[19][0] = html_print_label_input_block(
);
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';

View File

@ -45,7 +45,6 @@ if (!$id && !isset($snmp_community)) {
}
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';

View File

@ -1280,8 +1280,7 @@ switch ($action) {
$discovery_tasklist = new DiscoveryTaskList();
$report_task_data = $discovery_tasklist->showListConsoleTask(true);
if (is_array($report_task_data) === true || strpos($report_task_data, 'class="nf"') === false) {
if (is_array($report_task_data) === true || (strpos($report_task_data, 'class="nf"') === false && $report_task_data !== -1)) {
$task_table = '<div class="mrgn_top_15px white_box">';
$task_table .= '<span class="white_table_graph_header">'.__('Report tasks');
$task_table .= ui_print_help_tip(__('To schedule a report, do it from the editing view of each report.'), true);
@ -1290,6 +1289,10 @@ switch ($action) {
$task_table .= '</div></div>';
echo $task_table;
} else {
if ($report_task_data === -1) {
$report_task_data = '';
}
ui_print_info_message($report_task_data.__('To schedule a report, do it from the editing view of each report.'));
}

View File

@ -189,7 +189,8 @@ $table->data[1][1] = html_print_label_input_block(
255,
true,
true
).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules'))
)
// .' '.($license['limit_mode'] == 0 ? __('agents') : __('modules'))
);
$table->data[2][0] = html_print_label_input_block(
@ -202,7 +203,8 @@ $table->data[2][0] = html_print_label_input_block(
255,
true,
true
).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules'))
)
// .' '.($license['limit_mode'] == 0 ? __('agents') : __('modules'))
);
$table->data[2][1] = html_print_label_input_block(
@ -215,7 +217,8 @@ $table->data[2][1] = html_print_label_input_block(
255,
true,
true
).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules'))
)
// .' '.($license['limit_mode'] == 0 ? __('agents') : __('modules'))
);
$table->data[3][0] = html_print_label_input_block(
@ -228,7 +231,8 @@ $table->data[3][0] = html_print_label_input_block(
255,
true,
true
).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules'))
)
// .' '.($license['limit_mode'] == 0 ? __('agents') : __('modules'))
);
$table->data[3][1] = html_print_label_input_block(
@ -325,6 +329,18 @@ if (enterprise_installed() || defined('DESTDIR')) {
],
true
);
$buttons .= html_print_button(
__('Show agent usage details'),
'agents_details',
false,
'show_agents_details_dialog()',
[
'fixed_id' => 'button-agents_details',
'icon' => 'next',
'mode' => 'secondary',
],
true
);
html_print_action_buttons(
$buttons
@ -369,3 +385,80 @@ if (enterprise_hook('print_activate_licence_dialog') == ENTERPRISE_NOT_HOOK) {
echo '</ul>';
echo '</div>';
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filter-table-adv';
$table->size = [];
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = [];
$table->colspan = [];
$table->data[0][0] = html_print_label_input_block(
__('Total Agents'),
html_print_input_text(
'total_agents',
$total_agents,
'',
30,
255,
true,
true
)
);
$table->data[0][1] = html_print_label_input_block(
__('Network & other devices'),
html_print_input_text(
'type_network',
$network_others,
'',
30,
255,
true,
true
)
);
$table->data[1][0] = html_print_label_input_block(
__('Workstations'),
html_print_input_text(
'type_workstation',
$workstations,
'',
30,
255,
true,
true
)
);
$table->data[1][1] = html_print_label_input_block(
__('Servers'),
html_print_input_text(
'type_server',
$servers,
'',
30,
255,
true,
true
)
);
$table->data[2][0] = html_print_label_input_block(
__('Show disabled agents'),
html_print_checkbox_switch(
'show_disabled_agents',
1,
1,
true,
false,
'show_disabled_agents()'
)
);
echo '<div id="agents_details_dialog" class="invisible left" title="'.__('Agents usage details').'">';
html_print_table($table);
echo '</div>';

View File

@ -575,7 +575,7 @@ class DiscoveryTaskList extends HTML
$recon_tasks = db_get_all_rows_sql(
sprintf(
'SELECT tasks.*, apps.section AS section, apps.short_name AS short_name
FROM trecon_task
FROM trecon_task tasks
LEFT JOIN tdiscovery_apps apps ON tasks.id_app = apps.id_app
WHERE id_group IN (%s) AND
(type IN (%s) OR section = "%s")',

View File

@ -809,7 +809,6 @@ class AgentWizard extends HTML
// Fill with SNMP versions allowed.
$fieldsVersions = [
'1' => '1',
'2' => '2',
'2c' => '2c',
'3' => '3',
];

View File

@ -1112,7 +1112,6 @@ class CredentialStore extends Wizard
'script' => 'showVersion()',
'fields' => [
'1' => __('1'),
'2' => __('2'),
'2c' => __('2c'),
'3' => __('3'),
],

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC230817';
$build_version = 'PC230818';
$pandora_version = 'v7.0NG.773';
// Do not overwrite default timezone set if defined.

View File

@ -793,7 +793,7 @@ function modules_create_agent_module(
// Encrypt passwords.
if (isset($values['plugin_pass']) === true) {
// Avoid two times encryption.
$plugin_pass = io_safe_output($values['plugin_pass']);
$plugin_pass = io_output_password($values['plugin_pass']);
$values['plugin_pass'] = io_input_password($plugin_pass);
}

View File

@ -782,7 +782,6 @@ function snmp_browser_print_container(
html_print_select(
[
'1' => 'v. 1',
'2' => 'v. 2',
'2c' => 'v. 2c',
'3' => 'v. 3',
],

View File

@ -226,6 +226,10 @@ class TopNEventByGroupWidget extends Widget
$values['legendPosition'] = $decoder['legendPosition'];
}
if (isset($decoder['show_total_data']) === true) {
$values['show_total_data'] = $decoder['show_total_data'];
}
return $values;
}
@ -329,6 +333,16 @@ class TopNEventByGroupWidget extends Widget
],
];
$inputs[] = [
'label' => __('Show total data'),
'arguments' => [
'type' => 'switch',
'name' => 'show_total_data',
'value' => $values['show_total_data'],
'return' => true,
],
];
return $inputs;
}
@ -347,6 +361,7 @@ class TopNEventByGroupWidget extends Widget
$values['maxHours'] = \get_parameter('maxHours', 0);
$values['groupId'] = \get_parameter('groupId', []);
$values['legendPosition'] = \get_parameter('legendPosition', 0);
$values['show_total_data'] = \get_parameter_switch('show_total_data', 0);
return $values;
}
@ -364,7 +379,7 @@ class TopNEventByGroupWidget extends Widget
$output = '';
$size = parent::getSize();
$show_total_data = (bool) $this->values['show_total_data'];
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
if (empty($this->values['groupId']) === true) {
@ -473,6 +488,7 @@ class TopNEventByGroupWidget extends Widget
} else {
$data_pie = [];
$labels = [];
$sum = 0;
foreach ($result as $row) {
if ($row['id_agente'] == 0) {
$name = __('System');
@ -494,7 +510,7 @@ class TopNEventByGroupWidget extends Widget
}
$name .= ' ('.$row['count'].')';
$sum += $row['count'];
$labels[] = io_safe_output($name);
$data_pie[] = $row['count'];
}
@ -524,17 +540,37 @@ class TopNEventByGroupWidget extends Widget
break;
}
$output .= pie_graph(
$data_pie,
[
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
]
);
if ($show_total_data === true) {
$output .= ring_graph(
$data_pie,
[
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'elements' => [
'center' => [
'text' => $sum,
'color' => '#2c3e50',
],
],
'labels' => $labels,
]
);
} else {
$output .= pie_graph(
$data_pie,
[
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
]
);
}
}
return $output;

View File

@ -1042,6 +1042,33 @@ if (isset($config['id_user']) === false) {
}
}
if ((bool) ($config['maintenance_mode'] ?? false) === true
&& is_user_admin($config['id_user']) === false
) {
// Show maintenance web-page. For non-admin users only.
include $config['homedir'].'/general/maintenance.php';
while (ob_get_length() > 0) {
ob_end_flush();
}
exit('</html>');
}
if ((bool) ($config['maintenance_mode'] ?? false) === true
&& $page !== 'advanced/command_center'
&& is_user_admin($config['id_user']) === true
) {
// Prevent access to metaconsole if not merged.
include 'general/admin_maintenance_mode.php';
while (ob_get_length() > 0) {
ob_end_flush();
}
exit('</html>');
}
// Enterprise support.
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
include_once ENTERPRISE_DIR.'/load_enterprise.php';

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.773';
$build = '230817';
$build = '230818';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -223,6 +223,14 @@ if ($loaded_filter['id_filter'] > 0) {
if (is_array($policies) === false) {
$policies = json_decode(io_safe_output($policies), true);
}
// Fav menu.
$fav_menu = [
'id_element' => $loaded_filter['id_filter'],
'url' => 'operation/agentes/estado_agente&pure=&load_filter=1&filter_id='.$loaded_filter['id_filter'],
'label' => $loaded_filter['id_name'],
'section' => 'Agente',
];
}
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
@ -267,7 +275,8 @@ ui_print_standard_header(
'link' => '',
'label' => __('Views'),
],
]
],
(empty($fav_menu) === true) ? [] : $fav_menu
);
if ((bool) $strict_user === false) {

View File

@ -250,6 +250,17 @@ try {
echo csv_format_delimiter(io_safe_output($custom_data));
break;
case 'timestamp':
$target_timezone = date_default_timezone_get();
$utimestamp = $row['utimestamp'];
$datetime = new DateTime("@{$utimestamp}");
$new_datetime_zone = new DateTimeZone($target_timezone);
$datetime->setTimezone($new_datetime_zone);
$formatted_date = $datetime->format('Y-m-d H:i:s');
echo csv_format_delimiter($formatted_date);
break;
default:
echo csv_format_delimiter(io_safe_output($row[$key]));
break;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773
%define release 230817
%define release 230818
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773
%define release 230817
%define release 230818
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773
%define release 230817
%define release 230818
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -2616,7 +2616,7 @@ INSERT INTO `twelcome_tip_file` (`twelcome_tip_file`,`filename`,`path`) VALUES (
INSERT INTO `twelcome_tip` (`id_lang`,`id_profile`,`title`,`text`,`url`,`enable`) VALUES ('en_GB',0,'Monitor&#x20;routes&#x20;from&#x20;one&#x20;IP&#x20;to&#x20;another','There&#x20;is&#x20;a&#x20;special&#x20;plugin&#x20;that&#x20;is&#x20;used&#x20;to&#x20;visually&#x20;monitor&#x20;the&#x20;routes&#x20;from&#x20;one&#x20;IP&#x20;to&#x20;another&#x20;in&#x20;a&#x20;visual&#x20;and&#x20;dynamic&#x20;way,&#x20;as&#x20;it&#x20;changes&#x20;over&#x20;time.','https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#monitorizacion_de_rutas',1);
SELECT @last_id := LAST_INSERT_ID();
INSERT INTO `twelcome_tip_file` (`twelcome_tip_file`,`filename`,`path`) VALUES (@last_id,'monitorizar_desde_ip.png','images/tips/');
INSERT INTO `twelcome_tip` (`id_lang`,`id_profile`,`title`,`text`,`url`,`enable`) VALUES ('en_GB',0,'planned&#x20;stops','It&#x20;is&#x20;possible&#x20;to&#x20;define,&#x20;at&#x20;the&#x20;agent&#x20;level&#x20;and&#x20;at&#x20;the&#x20;module&#x20;level,&#x20;periods&#x20;in&#x20;which&#x20;the&#x20;alerts&#x20;and/or&#x20;the&#x20;collected&#x20;data&#x20;are&#x20;ignored.&#x20;It&#x20;is&#x20;perfect&#x20;for&#x20;planning&#x20;service&#x20;stops&#x20;or&#x20;disconnection&#x20;of&#x20;monitored&#x20;systems.&#x20;It&#x20;also&#x20;affects&#x20;SLA&#x20;reporting,&#x20;preventing&#x20;those&#x20;time&#x20;intervals&#x20;from&#x20;being&#x20;taken&#x20;into&#x20;account.','https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#paradas_de_servicio_planificadas',1);
INSERT INTO `twelcome_tip` (`id_lang`,`id_profile`,`title`,`text`,`url`,`enable`) VALUES ('en_GB',0,'Scheduled&#x20;downtimes','It&#x20;is&#x20;possible&#x20;to&#x20;define,&#x20;at&#x20;the&#x20;agent&#x20;level&#x20;and&#x20;at&#x20;the&#x20;module&#x20;level,&#x20;periods&#x20;in&#x20;which&#x20;the&#x20;alerts&#x20;and/or&#x20;the&#x20;collected&#x20;data&#x20;are&#x20;ignored.&#x20;It&#x20;is&#x20;perfect&#x20;for&#x20;planning&#x20;service&#x20;stops&#x20;or&#x20;disconnection&#x20;of&#x20;monitored&#x20;systems.&#x20;It&#x20;also&#x20;affects&#x20;SLA&#x20;reporting,&#x20;preventing&#x20;those&#x20;time&#x20;intervals&#x20;from&#x20;being&#x20;taken&#x20;into&#x20;account.','https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes',1);
SELECT @last_id := LAST_INSERT_ID();
INSERT INTO `twelcome_tip_file` (`twelcome_tip_file`,`filename`,`path`) VALUES (@last_id,'paradas_planificadas.png','images/tips/');
INSERT INTO `twelcome_tip` (`id_lang`,`id_profile`,`title`,`text`,`url`,`enable`) VALUES ('en_GB',0,'Customize&#x20;alert&#x20;emails','Did&#x20;you&#x20;know&#x20;that&#x20;Pandora&#x20;alert&#x20;emails&#x20;can&#x20;be&#x20;customized?&#x20;You&#x20;only&#x20;have&#x20;to&#x20;edit&#x20;the&#x20;default&#x20;HTML&#x20;code&#x20;of&#x20;the&#x20;email&#x20;type&#x20;alert&#x20;actions.','https://pandorafms.com/manual/en/documentation/04_using/01_alerts#editing_an_action',1);

View File

@ -56,7 +56,7 @@ class JavaScript extends Renderer
var innerRadius = outerRadius - padding;
ctx.font = "30px ";
var sidePaddingCalculated = (92/100) * (innerRadius * 2)
var sidePaddingCalculated = (93/100) * (innerRadius * 2)
var stringWidth = ctx.measureText(txt).width;
var elementWidth = (innerRadius * 2) - sidePaddingCalculated;

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.773-230817
Version: 7.0NG.773-230818
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.773-230817"
pandora_version="7.0NG.773-230818"
package_cpan=0
package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773";
my $pandora_build = "230817";
my $pandora_build = "230818";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -1231,7 +1231,7 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
$field19 = defined($alert->{'field19'}) && $alert->{'field19'} ne "" ? $alert->{'field19'} : $action->{'field19'};
$field20 = defined($alert->{'field20'}) && $alert->{'field20'} ne "" ? $alert->{'field20'} : $action->{'field20'};
}
# Recovery fields, thanks to Kato Atsushi
if ($alert_mode == RECOVERED_ALERT) {
# Field 1 is a special case where [RECOVER] prefix is not added even when it is defined
@ -1587,11 +1587,11 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
my $period = $hours * 3600; # Hours to seconds
if($threshold == 0){
$params->{"other"} = $period . '%7C1%7C0%7C225%7C%7C14';
$cid = 'module_graph_' . $hours . 'h';
$cid = 'module_graph_' . (defined($module) && $module ne '' ? ($module . '_') : '') . $hours . 'h';
}
else{
$params->{"other"} = $period . '%7C1%7C1%7C225%7C%7C14';
$cid = 'module_graphth_' . $hours . 'h';
$cid = 'module_graphth_' . (defined($module) && $module ne '' ? ($module . '_') : '') . $hours . 'h';
}
if (defined($module)) {
@ -1689,7 +1689,7 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
. "Content-Location: " . $dataname . "\n\n"
. $base64_data . "\n";
}
if ($pa_config->{"mail_in_separate"} != 0){
foreach my $address (split (',', $field1)) {
# Remove blanks

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773";
my $pandora_build = "230817";
my $pandora_build = "230818";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.773
%define release 230817
%define release 230818
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773"
PI_BUILD="230817"
PI_BUILD="230818"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.773 Build 230817";
my $version = "7.0NG.773 Build 230818";
# Pandora server configuration
my %conf;
@ -146,7 +146,10 @@ sub pandora_purgedb ($$$) {
}
# Delete old data
if ($conf->{'_days_purge'} > 0) {
if (!defined($conf->{'_days_purge'})){
log_message ('PURGE', 'days_purge is not defined. Old data will not be deleted.');
}
elsif ($conf->{'_days_purge'} > 0) {
# Delete old numeric data
pandora_delete_old_module_data ($dbh, 'tagente_datos', $ulimit_access_timestamp, $ulimit_timestamp);
@ -164,9 +167,7 @@ sub pandora_purgedb ($$$) {
pandora_delete_old_tplanned_downtime(\%conf, $dbh, $h_conf);
# String data deletion
if (!defined($conf->{'_string_purge'})){
$conf->{'_string_purge'} = 7;
}
$conf->{'_string_purge'} //= 7;
if ($conf->{'_string_purge'} > 0) {
$ulimit_access_timestamp = time() - 86400;
@ -178,9 +179,8 @@ sub pandora_purgedb ($$$) {
}
# Delete event data
if (!defined($conf->{'_event_purge'})){
$conf->{'_event_purge'}= 10;
}
$conf->{'_event_purge'} //= 10;
if ($conf->{'_event_purge'} > 0) {
my $event_limit = time() - 86400 * $conf->{'_event_purge'};
@ -205,7 +205,7 @@ sub pandora_purgedb ($$$) {
}
# Delete audit data
$conf->{'_audit_purge'}= 7 if (!defined($conf->{'_audit_purge'}));
$conf->{'_audit_purge'} //= 7;
if ($conf->{'_audit_purge'} > 0) {
log_message ('PURGE', "Deleting old audit data (More than " . $conf->{'_audit_purge'} . " days).");
my $audit_limit = time() - 86400 * $conf->{'_audit_purge'};
@ -216,7 +216,8 @@ sub pandora_purgedb ($$$) {
}
# Delete SNMP trap data
$conf->{'_trap_purge'}= 7 if (!defined($conf->{'_trap_purge'}));
$conf->{'_trap_purge'} //= 7;
if ($conf->{'_trap_purge'} > 0) {
log_message ('PURGE', "Deleting old SNMP traps (More than " . $conf->{'_trap_purge'} . " days).");
@ -237,7 +238,8 @@ sub pandora_purgedb ($$$) {
enterprise_hook("pandora_purge_service_elements", [$dbh, $conf]);
# Delete GIS data
$conf->{'_gis_purge'}= 15 if (!defined($conf->{'_gis_purge'}));
$conf->{'_gis_purge'} //= 15;
if ($conf->{'_gis_purge'} > 0) {
log_message ('PURGE', "Deleting old GIS data (More than " . $conf->{'_gis_purge'} . " days).");
my $gis_limit = strftime ("%Y-%m-%d %H:%M:%S", localtime(time() - 86400 * $conf->{'_gis_purge'}));
@ -293,8 +295,6 @@ sub pandora_purgedb ($$$) {
log_message ('PURGE', "No agent access data.");
}
# Purge the reports
if (defined($conf->{'_enterprise_installed'}) && $conf->{'_enterprise_installed'} eq '1' &&
defined($conf->{'_metaconsole'}) && $conf->{'_metaconsole'} eq '1'){
@ -347,7 +347,10 @@ sub pandora_purgedb ($$$) {
# Delete old netflow data
if ($conf->{'_netflow_max_lifetime'} > 0) {
if (!defined($conf->{'_netflow_max_lifetime'})){
log_message ('PURGE', 'netflow_max_lifetime is not defined. Old netflow data will not be deleted.');
}
elsif ($conf->{'_netflow_max_lifetime'} > 0) {
log_message ('PURGE', "Deleting old netflow data.");
if (! defined ($conf->{'_netflow_path'}) || ! -d $conf->{'_netflow_path'}) {
log_message ('!', "Netflow data directory does not exist, skipping.");
@ -364,7 +367,10 @@ sub pandora_purgedb ($$$) {
}
# Delete old sflow data
if ($conf->{'_sflow_max_lifetime'} > 0) {
if (!defined($conf->{'_sflow_max_lifetime'})){
log_message ('PURGE', 'sflow_max_lifetime is not defined. Old sflow data will not be deleted.');
}
elsif ($conf->{'_sflow_max_lifetime'} > 0) {
log_message ('PURGE', "Deleting old sflow data.");
if (! defined ($conf->{'_sflow_path'}) || ! -d $conf->{'_sflow_path'}) {
log_message ('!', "sflow data directory does not exist, skipping.");
@ -384,7 +390,7 @@ sub pandora_purgedb ($$$) {
log_message ('PURGE', "Deleting old log data.");
if (defined($conf->{'_days_purge_old_information'}) && $conf->{'_days_purge_old_information'} > 0) {
log_message ('PURGE', 'Deleting log data older than ' . $conf->{'_days_purge_old_information'} . ' days.');
enterprise_hook ('pandora_purge_logs', [$dbh, $conf]);
enterprise_hook ('pandora_purge_logs', [$dbh, $conf]);
}
else {
log_message ('PURGE', 'days_purge_old_data is set to 0. Old log data will not be deleted.');
@ -401,7 +407,7 @@ sub pandora_purgedb ($$$) {
# Delete old special days
log_message ('PURGE', "Deleting old special days.");
if ($conf->{'_num_past_special_days'} > 0) {
if (defined($conf->{'_num_past_special_days'}) && $conf->{'_num_past_special_days'} > 0) {
log_message ('PURGE', 'Deleting special days older than ' . $conf->{'_num_past_special_days'} . ' days.');
if (${RDBMS} eq 'oracle') {
db_do ($dbh, "DELETE FROM talert_special_days
@ -419,7 +425,7 @@ sub pandora_purgedb ($$$) {
# Delete old messages
log_message ('PURGE', "Deleting old messages.");
if ($conf->{'_delete_old_messages'} > 0) {
if (defined($conf->{'_delete_old_messages'}) && $conf->{'_delete_old_messages'} > 0) {
my $message_limit = time() - 86400 * $conf->{'_delete_old_messages'};
db_do ($dbh, "DELETE FROM tmensajes WHERE timestamp < ?", $message_limit);
}

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.773 Build 230817";
my $version = "7.0NG.773 Build 230818";
# save program name for logging
my $progname = basename($0);
@ -5411,7 +5411,7 @@ sub cli_create_synthetic() {
my @module_data;
if (@ARGV[$#ARGV] == "use_alias") {
if (@ARGV[$#ARGV] eq "use_alias") {
@module_data = @ARGV[5..$#ARGV-1];
} else {
@module_data = @ARGV[5..$#ARGV];
@ -5531,7 +5531,7 @@ sub cli_create_synthetic() {
}
} else {
my $id_agent = int(get_agent_id($dbh,$agent_name));
if ($id_agent > 0) {
foreach my $i (0 .. $#module_data) {
my @split_data = split(',',$module_data[$i]);