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

This commit is contained in:
Daniel Cebrian 2023-08-11 11:09:49 +02:00
commit 4c3432cf40
38 changed files with 100 additions and 54 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.772-230809 Version: 7.0NG.772-230811
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es> Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch BuildArch: x86_64
Requires(pre): shadow-utils Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel Requires(preun): chkconfig /bin/rm /usr/sbin/userdel

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.772" PI_VERSION="7.0NG.772"
PI_BUILD="230809" PI_BUILD="230811"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{230809} {230811}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.772-230809 Version: 7.0NG.772-230811
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

File diff suppressed because one or more lines are too long

View File

@ -1758,7 +1758,10 @@ if ($update_module) {
]; ];
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) { if ($id_module_type === 30 || $id_module_type === 31
|| $id_module_type === 32 || $id_module_type === 33
|| $id_module_type === 38
) {
$plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']); $plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']);
$values['plugin_parameter'] = ''; $values['plugin_parameter'] = '';
@ -1954,7 +1957,10 @@ if ($create_module) {
'warning_time' => $warning_time, 'warning_time' => $warning_time,
]; ];
if ($id_module_type === 30 || $id_module_type === 31 || $id_module_type === 32 || $id_module_type === 33) { if ($id_module_type === 30 || $id_module_type === 31
|| $id_module_type === 32 || $id_module_type === 33
|| $id_module_type === 38
) {
$plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']); $plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']);
$values['plugin_parameter'] = ''; $values['plugin_parameter'] = '';

View File

@ -407,8 +407,7 @@ if ($edit_module === true) {
$help_header = 'local_module'; $help_header = 'local_module';
} }
if ($id_module_type === 6 || $id_module_type === 7 if ($id_module_type === 6 || $id_module_type === 7) {
) {
$help_header = 'icmp_module_tab'; $help_header = 'icmp_module_tab';
} }
@ -420,7 +419,7 @@ if ($edit_module === true) {
$help_header = 'tcp_module_tab'; $help_header = 'tcp_module_tab';
} }
if ($id_module_type >= 30 && $id_module_type <= 33) { if (($id_module_type >= 30 && $id_module_type <= 33) || $id_module_type === 38) {
$help_header = 'webserver_module_tab'; $help_header = 'webserver_module_tab';
} }
} }

View File

@ -1927,7 +1927,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_div( ).html_print_div(
[ [
'class' => '', 'class' => '',
'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), 'content' => __('Interval').html_print_select($units, 'interval_unit', '', '', '', '', true, false, false, '', false, 'width: 100%'),
], ],
true true
).html_print_button( ).html_print_button(
@ -1975,7 +1975,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_button( ).html_print_button(
__('Delete'), __('Delete'),
'interval_del_btn', 'interval_del_btn',
empty($config['interval_values']), false,
'', '',
[ [
'mode' => 'link', 'mode' => 'link',
@ -2009,7 +2009,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_div( ).html_print_div(
[ [
'class' => '', 'class' => '',
'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), 'content' => __('Interval').html_print_select($units, 'module_interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'),
], ],
true true
).html_print_button( ).html_print_button(
@ -2316,9 +2316,15 @@ $(document).ready (function () {
// CUSTOM INTERVAL VALUES // CUSTOM INTERVAL VALUES
//------------------------------------------------------------------ //------------------------------------------------------------------
$("#button-interval_del_btn").click( function() { $("#button-interval_del_btn").click( function() {
var interval_selected = $('#intervals option:selected').val(); confirmDialog({
$('#hidden-interval_to_delete').val(interval_selected); title: "<?php echo __('Delete interval'); ?>",
$('#submit-update_button').trigger('click'); message: "<?php echo __('This action is not reversible. Are you sure'); ?>",
onAccept: function() {
var interval_selected = $('#intervals option:selected').val();
$('#hidden-interval_to_delete').val(interval_selected);
$('#button-update_button').trigger('click');
}
});
}); });
$("#button-interval_add_btn").click( function() { $("#button-interval_add_btn").click( function() {

View File

@ -65,8 +65,8 @@ if ($check_web) {
__('Agent Web monitoring created on welcome'), __('Agent Web monitoring created on welcome'),
]; ];
$id_agent = api_set_new_agent(0, '', $array_other, '', true); $id_agent = api_set_new_agent(0, '', $array_other, '', true, true);
if ($id_agent > 0) { if (is_integer($id_agent)) {
$module_name = get_parameter('module_name', 'Web_monitoring_module'); $module_name = get_parameter('module_name', 'Web_monitoring_module');
$text_to_search = get_parameter('text_to_search', ''); $text_to_search = get_parameter('text_to_search', '');
$url_goliat = get_parameter('url_goliat', 'https://pandorafms.com/en/'); $url_goliat = get_parameter('url_goliat', 'https://pandorafms.com/en/');
@ -76,7 +76,7 @@ if ($check_web) {
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy')); ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
} }
} else { } else {
ui_print_error_message(__('The Name is not valid for the modules.')); ui_print_error_message(__($id_agent));
} }
} else { } else {
ui_print_error_message(__('Web server is not enabled.')); ui_print_error_message(__('Web server is not enabled.'));
@ -110,8 +110,8 @@ if ($check_connectivity) {
__('Basic connectivity'), __('Basic connectivity'),
]; ];
$id_agent = api_set_new_agent(0, '', $array_other, '', true); $id_agent = api_set_new_agent(0, '', $array_other, '', true, true);
if ($id_agent > 0) { if (is_integer($id_agent)) {
$ip_target = get_parameter('ip_target', '127.0.0.1'); $ip_target = get_parameter('ip_target', '127.0.0.1');
$basic_network = create_module_basic_network($id_agent, $id_group, $ip_target); $basic_network = create_module_basic_network($id_agent, $id_group, $ip_target);
$latency_network = create_module_latency_network($id_agent, $id_group, $ip_target); $latency_network = create_module_latency_network($id_agent, $id_group, $ip_target);
@ -120,7 +120,7 @@ if ($check_connectivity) {
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy')); ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
} }
} else { } else {
ui_print_error_message(__('The Name is not valid for the modules.')); ui_print_error_message(__($id_agent));
} }
} else { } else {
ui_print_error_message(__('Web server is not enabled.')); ui_print_error_message(__('Web server is not enabled.'));

View File

@ -679,7 +679,7 @@ class WelcomeWindow extends Wizard
) )
); );
echo html_print_label_input_block( echo html_print_label_input_block(
__('Module group'), __('Agent group'),
html_print_select_from_sql( html_print_select_from_sql(
'SELECT * FROM tgrupo ORDER BY nombre', 'SELECT * FROM tgrupo ORDER BY nombre',
'id_group', 'id_group',

View File

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

View File

@ -1916,7 +1916,7 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
* *
* @param $thrash3 Don't use. * @param $thrash3 Don't use.
*/ */
function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false) function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false, $message=false)
{ {
global $config; global $config;
@ -2009,16 +2009,40 @@ function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false)
// Check if agent exists (BUG WC-50518-2). // Check if agent exists (BUG WC-50518-2).
if ($alias == '' && $alias_as_name === 0) { if ($alias == '' && $alias_as_name === 0) {
if ($message === true) {
return 'No agent alias specified';
}
returnError('No agent alias specified'); returnError('No agent alias specified');
} else if (agents_get_agent_id($nombre_agente)) { } else if (agents_get_agent_id($nombre_agente)) {
if ($message === true) {
return 'The agent name already exists in DB.';
}
returnError('The agent name already exists in DB.'); returnError('The agent name already exists in DB.');
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) { } else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
if ($message === true) {
return 'The group does not exist.';
}
returnError('The group does not exist.'); returnError('The group does not exist.');
} else if (group_allow_more_agents($grupo, true, 'create') === false) { } else if (group_allow_more_agents($grupo, true, 'create') === false) {
if ($message === true) {
return 'Agent cannot be created due to the maximum agent limit for this group';
}
returnError('Agent cannot be created due to the maximum agent limit for this group'); returnError('Agent cannot be created due to the maximum agent limit for this group');
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) { } else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
if ($message === true) {
return 'The OS does not exist.';
}
returnError('The OS does not exist.'); returnError('The OS does not exist.');
} else if ($server_name === false) { } else if ($server_name === false) {
if ($message === true) {
return 'The '.get_product_name().' Server does not exist.';
}
returnError('The '.get_product_name().' Server does not exist.'); returnError('The '.get_product_name().' Server does not exist.');
} else { } else {
if ($alias_as_name === 1) { if ($alias_as_name === 1) {

View File

@ -1489,6 +1489,15 @@ function config_update_config()
$interval_values_array = explode(',', $interval_values); $interval_values_array = explode(',', $interval_values);
if (in_array($new_interval, $interval_values_array) === false) { if (in_array($new_interval, $interval_values_array) === false) {
$interval_values_array[] = $new_interval; $interval_values_array[] = $new_interval;
// Get current periods.
$current_period = get_periods(false, false, true);
if (!isset($current_period[-1])) {
$new_current_period = array_keys($current_period);
$new_current_period = implode(',', $new_current_period);
// Add new periods to current.
array_push($interval_values_array, $new_current_period);
}
$interval_values = implode(',', $interval_values_array); $interval_values = implode(',', $interval_values_array);
} }
} }

View File

@ -2227,7 +2227,7 @@ function html_print_extended_select_for_time(
$nothing_value, $nothing_value,
false, false,
false, false,
false, true,
$class, $class,
$readonly, $readonly,
'font-size: xx-small;'.$select_style 'font-size: xx-small;'.$select_style

View File

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

View File

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

View File

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

View File

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

View File

@ -3474,6 +3474,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`cps` INT NOT NULL DEFAULT 0, `cps` INT NOT NULL DEFAULT 0,
`satellite_server` INT NOT NULL DEFAULT 0, `satellite_server` INT NOT NULL DEFAULT 0,
`fixed_ip` TINYINT NOT NULL DEFAULT 0, `fixed_ip` TINYINT NOT NULL DEFAULT 0,
`disabled_by_downtime` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id_agente`), PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)), KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`), KEY `direccion` (`direccion`),

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.772-230809 Version: 7.0NG.772-230811
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.772" PI_VERSION="7.0NG.772"
PI_BUILD="230809" PI_BUILD="230811"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
@ -315,6 +315,8 @@ install () {
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/trans chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/trans
mkdir $DESTDIR$PANDORA_SPOOL/data_in/commands 2> /dev/null mkdir $DESTDIR$PANDORA_SPOOL/data_in/commands 2> /dev/null
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/commands chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/commands
mkdir $DESTDIR$PANDORA_SPOOL/data_in/discovery 2> /dev/null
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/discovery
mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null
chown -R pandora:apache $DESTDIR$PANDORA_LOG 2> /dev/null chown -R pandora:apache $DESTDIR$PANDORA_LOG 2> /dev/null
chmod 2774 $DESTDIR$PANDORA_LOG 2> /dev/null chmod 2774 $DESTDIR$PANDORA_LOG 2> /dev/null

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.772 Build 230809"; my $version = "7.0NG.772 Build 230811";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

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

View File

@ -1095,7 +1095,7 @@ Protocol description and more info at: L<< https://pandorafms.com/manual/en/docu
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L Copyright (c) 2005-2023 Pandora FMS.
=cut =cut