Merge remote-tracking branch 'origin/develop' into ent-9884-Carga-restauracion-de-filtros-en-la-vista-de-monitores

This commit is contained in:
alejandro.campos@artica.es 2023-02-06 14:02:39 +01:00
commit 1998829b85
41 changed files with 227 additions and 67 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.768-230201
Version: 7.0NG.768-230206
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.768-230201"
pandora_version="7.0NG.768-230206"
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

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_linux
%define version 7.0NG.768
%define release 230201
%define release 230206
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_linux
%define version 7.0NG.768
%define release 230201
%define release 230206
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.768"
PI_BUILD="230201"
PI_BUILD="230206"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230201}
{230206}
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.768 Build 230201")
#define PANDORA_VERSION ("7.0NG.768 Build 230206")
string pandora_path;
string pandora_dir;

View File

@ -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 230201))"
VALUE "ProductVersion", "(7.0NG.768(Build 230206))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.768-230201
Version: 7.0NG.768-230206
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.768-230201"
pandora_version="7.0NG.768-230206"
package_pear=0
package_pandora=1

View File

@ -103,6 +103,15 @@ function api_execute(
}
}
$url_protocol = parse_url($url)['scheme'];
if ($url_protocol !== 'http' && $url_protocol !== 'https') {
return [
'url' => $url,
'result' => '',
];
}
$curlObj = curl_init($url);
if (empty($data) === false) {
$url .= http_build_query($data);

View File

@ -1,5 +1,7 @@
START TRANSACTION;
ALTER TABLE `tserver` ADD COLUMN `server_keepalive_utimestamp` BIGINT NOT NULL DEFAULT 0;
CREATE TABLE IF NOT EXISTS `tsesion_filter` (
`id_filter` INT NOT NULL AUTO_INCREMENT,
`id_name` TEXT NULL,

View File

@ -1994,7 +1994,7 @@ if ($create_module) {
$agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit(
AUDIT_LOG_AGENT_MANAGEMENT,
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
"Added module '".db_escape_string_sql($name)."' for agent ".io_safe_output($agent['alias']),
false,
true,
io_json_mb_encode($values)

View File

@ -2143,6 +2143,12 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
}
break;
case 'dynamic_interval':
if ($value !== '-2') {
$values[$field] = $value;
}
break;
case 'plugin_pass':
if ($value != '') {
$values['plugin_pass'] = io_input_password($value);

View File

@ -865,6 +865,11 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
var id_layout_data = $("#active_id_layout_data").val();
var label = tinyMCE.activeEditor.getContent();
$("#hidden-label_" + id_layout_data).val(label);
},
buttons: {
Save: function() {
$(this).dialog("close");
}
}
});

View File

@ -230,9 +230,64 @@ if ($filemanager) {
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$base_url = 'index.php?sec=gservers&sec2=godmode/servers/plugin';
$setup_url = $base_url.'&filemanager=1&tab=Attachments';
$tab = get_parameter('tab', null);
$tabs = [
'list' => [
'text' => '<a href="'.$base_url.'">'.html_print_image(
'images/eye_show.png',
true,
[
'title' => __('Plugins'),
'class' => 'invert_filter',
]
).'</a>',
'active' => (bool) ($tab != 'Attachments'),
],
'options' => [
'text' => '<a href="'.$setup_url.'">'.html_print_image(
'images/collection.png',
true,
[
'title' => __('Attachments'),
'class' => 'invert_filter',
]
).'</a>',
'active' => (bool) ($tab == 'Attachments'),
],
];
if ($tab === 'Attachments') {
$helpHeader = '';
$titleHeader = __('Index of attachment/plugin');
} else {
$helpHeader = 'servers_ha_clusters_tab';
$titleHeader = __('Plug-ins registered on %s', get_product_name());
}
// Header.
ui_print_standard_header(
$titleHeader,
'images/gm_servers.png',
false,
$helpHeader,
false,
$tabs,
[
[
'link' => '',
'label' => __('Servers'),
],
[
'link' => '',
'label' => __('Plugins'),
],
]
);
$real_directory = realpath($config['homedir'].'/'.$directory);
echo '<h4>'.__('Index of %s', $directory).'</h4>';
$chunck_url = '&view='.$id_plugin;
if ($id_plugin == 0) {
@ -255,7 +310,7 @@ if ($filemanager) {
filemanager_file_explorer(
$real_directory,
$directory,
'index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$id_plugin,
'index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$id_plugin.'&tab=Attachments',
$fallback_directory,
true,
false,
@ -401,7 +456,7 @@ if (($create != '') || ($view != '')) {
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">';
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&tab=Attachments&id_plugin='.$form_id.'" class="bot">';
$data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true);
$data[1] .= '</a>';
$table->data['plugin_command'] = $data;
@ -597,15 +652,60 @@ if (($create != '') || ($view != '')) {
);
}
} else {
ui_print_page_header(
__(
'Plug-ins registered on %s',
get_product_name()
),
$base_url = 'index.php?sec=gservers&sec2=godmode/servers/plugin';
$setup_url = $base_url.'&filemanager=1&tab=Attachments';
$tab = get_parameter('tab', null);
$tabs = [
'list' => [
'text' => '<a href="'.$base_url.'">'.html_print_image(
'images/eye_show.png',
true,
[
'title' => __('Plugins'),
'class' => 'invert_filter',
]
).'</a>',
'active' => (bool) ($tab != 'Attachments'),
],
'options' => [
'text' => '<a href="'.$setup_url.'">'.html_print_image(
'images/collection.png',
true,
[
'title' => __('Attachments'),
'class' => 'invert_filter',
]
).'</a>',
'active' => (bool) ($tab == 'Attachments'),
],
];
if ($tab === 'Attachments') {
$helpHeader = '';
$titleHeader = __('Index of attachment/plugin');
} else {
$helpHeader = 'servers_ha_clusters_tab';
$titleHeader = __('Plug-ins registered on %s', get_product_name());
}
// Header.
ui_print_standard_header(
$titleHeader,
'images/gm_servers.png',
false,
'',
true
$helpHeader,
false,
$tabs,
[
[
'link' => '',
'label' => __('Servers'),
],
[
'link' => '',
'label' => __('Plugins'),
],
]
);
$management_allowed = is_management_allowed();

View File

@ -110,6 +110,12 @@ foreach ($servers as $server) {
];
$data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>';
$server_keepalive = time_w_fixed_tz($server['keepalive']);
if ($server['server_keepalive_utimestamp'] > 0) {
$server_keepalive = $server['server_keepalive_utimestamp'];
}
// Status.
$data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true);
if ($server['status'] == -1) {
@ -119,7 +125,7 @@ foreach ($servers as $server) {
true
);
} else if ((int) ($server['status'] === 0)
|| (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2)
|| (($date - $server_keepalive) > ($server['server_keepalive']) * 2)
) {
$data[1] = ui_print_status_image(
STATUS_SERVER_DOWN,

View File

@ -87,6 +87,20 @@ $create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/');
// Remove double dot in filename path.
$file_name = $_FILES['file']['name'];
$path_parts = explode('/', $file_name);
$stripped_parts = array_filter(
$path_parts,
function ($value) {
return $value !== '..';
}
);
$stripped_path = implode('/', $stripped_parts);
$_FILES['file']['name'] = $stripped_path;
if ($upload_file === true) {
upload_file(
$upload_file,

View File

@ -900,7 +900,7 @@ class CalendarManager
$id_group = get_parameter('id_group', null);
$day_code = get_parameter('day_code', null);
$id_calendar = get_parameter('id_calendar', null);
$description = get_parameter('description', null);
$description = io_safe_input(get_parameter('description', null));
$change = true;
if ($new === false
&& ($date === $specialDay->date()

View File

@ -659,15 +659,6 @@ class Diagnostics extends Wizard
{
global $config;
// Size BBDD.
$dbSizeSql = db_get_value_sql(
'SELECT ROUND(SUM(data_length+index_length)/1024/1024,3)
FROM information_schema.TABLES'
);
// Add unit size.
$dbSize = $dbSizeSql.' M';
$result = [
'error' => false,
'data' => [
@ -683,10 +674,6 @@ class Diagnostics extends Wizard
'name' => __('DB Schema Build'),
'value' => $config['db_scheme_build'],
],
'dbSize' => [
'name' => __('DB Size'),
'value' => $dbSize,
],
],
];

View File

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

View File

@ -139,8 +139,25 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
try {
$mimeContentType = mime_content_type($_FILES['file']['tmp_name']);
$fileExtension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
if (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true) {
$validFileExtension = true;
if (empty($fileExtension) === false) {
$filtered_types = array_filter(
$filterFilesType,
function ($value) use ($fileExtension) {
$mimeTypeExtensionName = explode('/', $value)[1];
return $mimeTypeExtensionName === $fileExtension;
}
);
if (empty($filtered_types) === true) {
$validFileExtension = false;
}
}
if ($validFileExtension === true && (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true)) {
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
} else {
$error_message = 'The uploaded file is not allowed. Only gif, png or jpg files can be uploaded.';

View File

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

View File

@ -524,7 +524,7 @@ if (is_ajax() === true) {
$tmp->ack_utimestamp_raw = strtotime($tmp->ack_utimestamp);
$tmp->ack_utimestamp = ui_print_timestamp(
(int) $tmp->ack_utimestamp,
(empty($tmp->ack_utimestamp) === true) ? 0 : $tmp->ack_utimestamp,
true
);
$tmp->timestamp = ui_print_timestamp(

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.768
%define release 230201
%define release 230206
# 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.768
%define release 230201
%define release 230206
# 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.768
%define release 230201
%define release 230206
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1158,6 +1158,7 @@ CREATE TABLE IF NOT EXISTS `tserver` (
`stat_utimestamp` BIGINT NOT NULL DEFAULT 0,
`exec_proxy` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`port` INT UNSIGNED NOT NULL DEFAULT 0,
`server_keepalive_utimestamp` BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id_server`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

View File

@ -140,7 +140,7 @@ $inputs[] = [
'type' => 'textarea',
'name' => 'description',
'required' => false,
'value' => $specialDay->description(),
'value' => io_safe_output($specialDay->description()),
'rows' => 50,
'columns' => 30,
],

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.768-230201
Version: 7.0NG.768-230206
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.768-230201"
pandora_version="7.0NG.768-230206"
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.768";
my $pandora_build = "230201";
my $pandora_build = "230206";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -118,7 +118,7 @@ use Tie::File;
use Time::Local;
use Time::HiRes qw(time);
eval "use POSIX::strftime::GNU;1" if ($^O =~ /win/i);
use POSIX qw(strftime);
use POSIX qw(strftime mktime);
use threads;
use threads::shared;
use JSON qw(decode_json encode_json);
@ -3173,16 +3173,20 @@ sub pandora_update_server ($$$$$$;$$$$) {
$version = $pa_config->{'version'} . ' (P) ' . $pa_config->{'build'} unless defined($version);
my $master = ($server_type == SATELLITESERVER) ? 0 : $pa_config->{'pandora_master'};
my ($year, $month, $day, $hour, $minute, $second) = split /[- :]/, $timestamp;
my $keepalive_utimestamp = mktime($second, $minute, $hour, $day, $month-1, $year-1900);
# First run
if ($server_id == 0) {
# Create an entry in tserver if needed
my $server = get_db_single_row ($dbh, 'SELECT id_server FROM tserver WHERE BINARY name = ? AND server_type = ?', $server_name, $server_type);
if (! defined ($server)) {
$server_id = db_insert ($dbh, 'id_server', 'INSERT INTO tserver (name, server_type, description, version, threads, queued_modules, server_keepalive)
VALUES (?, ?, ?, ?, ?, ?, ?)', $server_name, $server_type,
'Autocreated at startup', $version, $num_threads, $queue_size, $keepalive);
$server_id = db_insert ($dbh, 'id_server', 'INSERT INTO tserver (name, server_type, description, version, threads, queued_modules, server_keepalive, server_keepalive_utimestamp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)', $server_name, $server_type,
'Autocreated at startup', $version, $num_threads, $queue_size, $keepalive, $keepalive_utimestamp);
$server = get_db_single_row ($dbh, 'SELECT status FROM tserver WHERE id_server = ?', $server_id);
if (! defined ($server)) {
@ -3193,14 +3197,14 @@ sub pandora_update_server ($$$$$$;$$$$) {
$server_id = $server->{'id_server'};
}
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, laststart = ?, version = ?, threads = ?, queued_modules = ?, server_keepalive = ?
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, laststart = ?, version = ?, threads = ?, queued_modules = ?, server_keepalive = ?, server_keepalive_utimestamp = ?
WHERE id_server = ?',
1, $timestamp, $master, $timestamp, $version, $num_threads, $queue_size, $keepalive, $server_id);
1, $timestamp, $master, $timestamp, $version, $num_threads, $queue_size, $keepalive, $keepalive_utimestamp, $server_id);
return;
}
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, version = ?, threads = ?, queued_modules = ?, server_keepalive = ?
WHERE id_server = ?', $status, $timestamp, $master, $version, $num_threads, $queue_size, $keepalive, $server_id);
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, version = ?, threads = ?, queued_modules = ?, server_keepalive = ?, server_keepalive_utimestamp = ?
WHERE id_server = ?', $status, $timestamp, $master, $version, $num_threads, $queue_size, $keepalive, $keepalive_utimestamp, $server_id);
}
##########################################################################

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.768";
my $pandora_build = "230201";
my $pandora_build = "230206";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.768
%define release 230201
%define release 230206
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.768
%define release 230201
%define release 230206
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.768"
PI_BUILD="230201"
PI_BUILD="230206"
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.768 Build 230201";
my $version = "7.0NG.768 Build 230206";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.768 Build 230201";
my $version = "7.0NG.768 Build 230206";
# save program name for logging
my $progname = basename($0);

View File

@ -188,6 +188,16 @@ install () {
execute_cmd "ps --version" 'Checking dependencies: ps' "Error ps not found, please install procps"
execute_cmd "sudo --version" 'Checking dependencies: sudo' "Error sudo not found, please install sudo"
execute_cmd "perl -MIO::Compress::Zip -le 'pass'" 'Checking dependencies: perl IO::Compress' "Error perl IO::Compress not found, please install perl IO::Compress"
execute_cmd "perl -MGetopt::Std -le 'pass'" 'Checking dependencies: perl Getopt::Std' "Error perl IO::Compress not found, please install perl Getopt::Std"
execute_cmd "perl -MIO::Select -le 'pass'" 'Checking dependencies: perl IO::Select' "Error perl IO::Select not found, please install perl IO::Select"
execute_cmd "perl -MIO::Uncompress::Unzip -le 'pass'" 'Checking dependencies: perl IO::Uncompress::Unzip' "Error perl IO::Uncompress::Unzip not found, please install perl IO::Uncompress::Unzip"
execute_cmd "perl -Mthreads -le 'pass'" 'Checking dependencies: perl threads' "Error perl IO::Compress not found, please install perl threads"
execute_cmd "perl -MThread::Semaphore -le 'pass'" 'Checking dependencies: perl Thread::Semaphore' "Error perl Thread::Semaphore, please install perl Thread::Semaphore"
execute_cmd "perl -MPOSIX -le 'pass'" 'Checking dependencies: perl POSIX' "Error perl POSIX not found, please install perl POSIX"
execute_cmd "perl -MTime::HiRes -le 'pass'" 'Checking dependencies: perl Time::HiRes' "Error perl Time::HiRes not found, please install perl Time::HiRes"
execute_cmd "perl -MScalar::Util -le 'pass'" 'Checking dependencies: perl Scalar::Util' "Error perl Scalar::Util not found, please install perl Scalar::Util"
fi
# install tentacle
@ -351,8 +361,8 @@ uninstall () {
}
help () {
echo " --install To install Pandora FMS Servers on this system (You have to be root)"
echo " --uninstall To uninstall and remove Pandora FMS Servers on this System"
echo " --install To install Tentacle Server on this system (You have to be root)"
echo " --uninstall To uninstall and remove Tentacle Server on this System"
echo " "
echo " Additional second parameter (after --install) "
echo " "
@ -401,4 +411,3 @@ case "$MODE" in
*)
help
esac