Merge remote-tracking branch 'origin/develop' into ent-12019-api-2-0

This commit is contained in:
daniel 2024-01-25 08:20:11 +01:00
commit cb367985ba
47 changed files with 170 additions and 51 deletions

View File

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

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.775';
use constant AGENT_BUILD => '240123';
use constant AGENT_BUILD => '240125';
# 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.775
%define release 240123
%define release 240125
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240123
%define release 240125
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240123
%define release 240125
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240123
%define release 240125
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="240123"
PI_BUILD="240125"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{240123}
{240125}
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.775 Build 240123")
#define PANDORA_VERSION ("7.0NG.775 Build 240125")
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.775(Build 240123))"
VALUE "ProductVersion", "(7.0NG.775(Build 240125))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

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

View File

@ -283,8 +283,14 @@ function mainInsertData()
secondText: '<?php echo __('Second'); ?>',
currentText: '<?php echo __('Now'); ?>',
closeText: '<?php echo __('Close'); ?>'});
$("#text-date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('#text-data').datepicker ({
dateFormat: '<?php echo DATE_FORMAT_JS; ?>',
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
firstDay: "<?php echo $config['datepicker_first_day']; ?>",
});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
});

View File

@ -100,7 +100,7 @@ if ($initial && users_is_admin()) {
);
}
if (check_acl($config['id_user'], 0, 'AW')) {
if (check_acl($config['id_user'], 0, 'AW') && empty($sec2)) {
$welcome = !$initial;
try {
$welcome_window = new WelcomeWindow($welcome);

View File

@ -83,6 +83,23 @@ $table->data[3][] = html_print_label_input_block(
html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true)
);
$table->data[4][] = html_print_label_input_block(
__('Netflow interval').ui_print_help_tip(__('It is necessary to restart the server if the value is changed.'), true),
html_print_select(
[
'600' => __('10 min'),
'1800' => __('30 min'),
'3600' => __('60 min'),
],
'netflow_interval',
$config['netflow_interval'],
'',
'',
0,
true
)
);
$table->data[4][] = html_print_label_input_block(
__('Enable Sflow'),
html_print_checkbox_switch_extended(

View File

@ -1557,6 +1557,7 @@ if (empty($doubleAuthElementsContent) === false) {
$autorefresh_list_out = [];
if (is_metaconsole() === false || is_centralized() === true) {
$autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail';
$autorefresh_list_out['operation/agentes/ver_agente'] = 'Agent view';
$autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail';
$autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view';
$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map';

View File

@ -1335,6 +1335,15 @@ if ($perform_event_response === true) {
}
$command = $event_response['target'];
// Prevent OS command injection.
$prev_command = get_events_get_response_target($event_id, $event_response, $server_id);
if ($command !== $prev_command) {
echo __('unauthorized');
return;
}
$command_timeout = ($event_response !== false) ? $event_response['command_timeout'] : 90;
if (enterprise_installed() === true) {
if ($event_response !== false

View File

@ -26,7 +26,8 @@
* ============================================================================
*/
check_login();
require_once $config['homedir'].'/include/functions_inventory.php';
check_login();
if (is_ajax() === true) {
$id_agent = get_parameter('id_agent', '0');

View File

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

View File

@ -1624,6 +1624,10 @@ function config_update_config()
$error_update[] = __('Netflow max lifetime');
}
if (config_update_value('netflow_interval', (int) get_parameter('netflow_interval'), true) === false) {
$error_update[] = __('Netflow interval');
}
if (config_update_value('netflow_get_ip_hostname', (int) get_parameter('netflow_get_ip_hostname'), true) === false) {
$error_update[] = __('Name resolution for IP address');
}
@ -3060,6 +3064,10 @@ function config_process_config()
config_update_value('netflow_max_lifetime', '5');
}
if (!isset($config['netflow_interval'])) {
config_update_value('netflow_interval', 1800);
}
if (!isset($config['sflow_interval'])) {
config_update_value('sflow_interval', SECONDS_10MINUTES);
}

View File

@ -3804,7 +3804,7 @@ function events_get_response_target(
}
$event = db_get_row('tevento', 'id_evento', $event_id);
$target = io_safe_output($event_response['target']);
$target = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
// Replace parameters response.
if (isset($response_parameters) === true

View File

@ -2738,8 +2738,8 @@ function html_print_input_text_extended(
if ($hide_div_eye !== false) {
echo "<script>
$(document).ready (function () {
$('input[name=\"".$name."\"]').val(\"".$value."\")
$('input[name=\"".$name."\"]').val(\"".$value."\");
observerInputPassword('".$name."');
});
</script>";
@ -2756,9 +2756,11 @@ function html_print_input_text_extended(
];
foreach ($attrs as $attribute => $default) {
if (array_key_exists($attribute, $attributes)) {
if (array_key_exists($attribute, $attributes)
|| ($password === true && $attribute === 'value')
) {
continue;
} //end if
}
/*
* Remember, this next code have a $$ that for example there is a var as
@ -2768,7 +2770,7 @@ function html_print_input_text_extended(
*
*/
// Exact operator because we want to show "0" on the value
// Exact operator because we want to show "0" on the value.
if ($attribute !== '') {
$output .= $attribute.'="'.$$attribute.'" ';
} else if ($default != '') {
@ -2799,6 +2801,12 @@ function html_print_input_text_extended(
],
true
);
echo "<script>
$(document).ready (function () {
$('input[name=\"".$name."\"]').val(\"".$value.'");
});
</script>';
}
if (!$return) {

View File

@ -15969,8 +15969,8 @@ function reporting_translate_sla_status_for_graph($status)
*/
function reporting_header_table_for_pdf($title='', $description='')
{
$result_pdf = '<pagebreak>';
$result_pdf .= '<table class="header_table databox">';
// $result_pdf = '<pagebreak>';
$result_pdf = '<table class="header_table databox">';
$result_pdf .= '<thead class="header_tr"><tr>';
$result_pdf .= '<th class="th_first" colspan="2">';
$result_pdf .= $title;

View File

@ -569,3 +569,19 @@ div.container-filter-buttons {
.ui-dialog.modal-sound .ui-widget-header {
display: flex !important;
}
.responsive_button_sound_events {
margin-right: 25% !important;
}
@media (max-width: 1640px) {
.responsive_button_sound_events {
margin-right: 10% !important;
}
}
@media (max-width: 1420px) {
.responsive_button_sound_events {
margin-right: 10px !important;
}
}

View File

@ -776,6 +776,10 @@ select:-internal-list-box {
width: 80%;
}
.w85p {
width: 85%;
}
.w88p {
width: 88%;
}
@ -12116,6 +12120,10 @@ div.relative > div > div#ui-datepicker-div {
width: 400px;
}
.container-div-input-password {
display: block !important;
}
#message_dialog_connection {
height: auto !important;
}

View File

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

View File

@ -2951,8 +2951,8 @@ if (check_acl(
false,
'openSoundEventsDialog("'.$data_sound.'")',
[
'class' => 'responsive_button_sound_events',
'icon' => 'sound',
'style' => 'margin-right: 25% !important',
'minimize-arrow' => true,
'span_style' => 'width: 100%',
],

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.775
%define release 240123
%define release 240125
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.775
%define release 240123
%define release 240125
# 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.775
%define release 240123
%define release 240125
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -91,7 +91,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('sound_alert', 'include/sounds/air_shock_alarm.wav'),
('sound_critical', 'include/sounds/Star_Trek_emergency_simulation.wav'),
('sound_warning', 'include/sounds/negativebeep.wav'),
('netflow_interval', '3600'),
('netflow_interval', '1800'),
('netflow_daemon', '/usr/bin/nfcapd'),
('netflow_nfdump', '/usr/bin/nfdump'),
('netflow_max_resolution', '50'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.775-240123
Version: 7.0NG.775-240125
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.775-240123"
pandora_version="7.0NG.775-240125"
package_cpan=0
package_pandora=1

View File

@ -816,3 +816,5 @@ madeserver_autofit 7d
# Model sensitivity. A lower value triggers less anomalies (PANDORA FMS ENTERPRISE ONLY).
madeserver_sensitivity 0.1
# Encoding to use on mail subject (MIME-Header by default)
# mail_subject_encoding MIME-Header-ISO_2022_JP

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.775";
my $pandora_build = "240123";
my $pandora_build = "240125";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -140,7 +140,7 @@ sub pandora_get_sharedconfig ($$) {
# Netflow configuration options
$pa_config->{"activate_netflow"} = pandora_get_tconfig_token ($dbh, 'activate_netflow', 0);
$pa_config->{"netflow_path"} = pandora_get_tconfig_token ($dbh, 'netflow_path', '/var/spool/pandora/data_in/netflow');
$pa_config->{"netflow_interval"} = pandora_get_tconfig_token ($dbh, 'netflow_interval', 3600);
$pa_config->{"netflow_interval"} = pandora_get_tconfig_token ($dbh, 'netflow_interval', 1800);
$pa_config->{"netflow_daemon"} = pandora_get_tconfig_token ($dbh, 'netflow_daemon', '/usr/bin/nfcapd');
# Sflow configuration options
@ -589,6 +589,8 @@ sub pandora_load_config {
$pa_config->{"madeserver"} = 0; # 774.
$pa_config->{"mail_subject_encoding"} = 'MIME-Header'; # 776.
# Check for UID0
if ($pa_config->{"quiet"} != 0){
if ($> == 0){
@ -691,6 +693,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^mail_in_separate\s+([0-9]*)/i) {
$pa_config->{'mail_in_separate'}= clean_blank($1);
}
elsif ($parametro =~ m/^mail_subject_encoding\s(.*)/i) {
$pa_config->{'mail_subject_encoding'}= clean_blank($1);
}
elsif ($parametro =~ m/^snmp_logfile\s(.*)/i) {
$pa_config->{'snmp_logfile'}= clean_blank($1);
}

View File

@ -7191,10 +7191,18 @@ Puts all autodisable agents with all modules unknown on disabled mode
sub pandora_disable_autodisable_agents ($$) {
my ($pa_config, $dbh) = @_;
my $sql = 'SELECT id_agente FROM tagente
WHERE disabled=0 AND
tagente.unknown_count>0 AND
tagente.modo=2';
my $sql = 'SELECT id_agente
FROM (
SELECT tm.id_agente, count(*) as sync_modules, ta.unknown_count
FROM tagente_modulo tm
JOIN tagente ta ON ta.id_agente = tm.id_agente
WHERE ta.disabled = 0
AND NOT ((id_tipo_modulo >= 21 AND id_tipo_modulo <= 23) OR id_tipo_modulo = 100)
GROUP BY tm.id_agente
) AS subquery
WHERE subquery.unknown_count >= subquery.sync_modules;';
my @agents_autodisabled = get_db_rows ($dbh, $sql);
return if ($#agents_autodisabled < 0);

View File

@ -1533,7 +1533,7 @@ sub get_agent_addr_id ($$$) {
########################################################################
sub db_do ($$;@) {
my ($dbh, $query, @values) = @_;
#DBI->trace( 3, '/tmp/dbitrace.log' );
eval {
$dbh->do($query, undef, @values);

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

View File

@ -748,6 +748,7 @@ sub pandora_sendmail {
my $subject = $_[2];
my $message = $_[3];
my $content_type = $_[4];
my $encoding = $pa_config->{"mail_subject_encoding"} || 'MIME-Header';
$subject = decode_entities ($subject);
@ -758,7 +759,7 @@ sub pandora_sendmail {
my %mail = ( To => $to_address,
Message => $message,
Subject => encode('MIME-Header', $subject),
Subject => encode($encoding, $subject),
'X-Mailer' => $pa_config->{"rb_product_name"},
Smtp => $pa_config->{"mta_address"},
Port => $pa_config->{"mta_port"},

View File

@ -7,7 +7,7 @@
%define debug_package %{nil}
%define name pandorafms_server
%define version 7.0NG.775
%define release 240123
%define release 240125
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="240123"
PI_BUILD="240125"
MODE=$1
if [ $# -gt 1 ]; then
@ -191,7 +191,36 @@ install () {
esac
shift
done
# Alternative destdir has been selected
if [ ! -z "$DESTDIR" ]
then
# Files from previous installation were found
if [ -d "/usr/lib/perl5/PandoraFMS" ]
then
GREEN='\033[01;32m'
NONE='\033[0m'
echo -e -n "Files from a previous installation were found in ${GREEN}/usr/lib/perl5/PandoraFMS/${NONE}. "
read -p "That directory will be deleted in order to preserve integrity. Do you wish to proceed? (y/N): " USERAPPROVAL
if [ "${USERAPPROVAL,,}" = "y" ]; then
rm -rf "/usr/lib/perl5/PandoraFMS"
echo -e "Previous PandoraFMS directory deleted successfully"
else
echo -e -n "Files in ${GREEN}/usr/lib/perl5/PandoraFMS/${NONE} will not be deleted. This may cause issues. "
read -p "Do you want to proceed with the installation anyway? (y/N): " USERAPPROVAL
if [ "${USERAPPROVAL,,}" = "y" ]; then
echo "Proceeding with the installation anyway. This may cause problems in the future due to the existence of files from previous installations."
else
echo "Installation aborted. You chose not to proceed."
exit 1
fi
fi
fi
fi
if [ "$LINUX" = YES ]
then
echo "$DISTRO distribution detected"

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.775 Build 240123";
my $version = "7.0NG.775 Build 240125";
# 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.775 Build 240123";
my $version = "7.0NG.775 Build 240125";
# save program name for logging
my $progname = basename($0);

View File

@ -172,5 +172,5 @@ foreach my $k (keys %{$fields_values}){
# Get operation result
my $result = eval $operation;
if (defined($result)){
print $result . "\n";
print $result, "\n";
}