Merge remote-tracking branch 'origin/develop' into new-vc-line-element

This commit is contained in:
Daniel Barbero Martin 2020-01-29 08:20:11 +01:00
commit 3bd3ca00bf
28 changed files with 161 additions and 53 deletions

View File

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

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.742
%define release 200128
%define release 200129
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.742"
PI_BUILD="200128"
PI_BUILD="200129"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

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

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.742';
$build = '200128';
$build = '200129';
$banner = "v$version Build $build";
error_reporting(0);

View File

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

View File

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

View File

@ -507,21 +507,11 @@ async_recovery 1
# Required for some features like the module graphs macros.
# console_api_url: Api URL (http://localhost/pandora_console/include/api.php by default)
console_api_url http://localhost/pandora_console/include/api.php
# console_api_url http://localhost/pandora_console/include/api.php
# console_api_pass: Api pass
# console_api_pass 1234
# console_user: Console user name (admin by default)
console_user admin
# console_pass: Console password (pandora by default)
# To make sure console_api_url, console_api_pass, console_user and console_pass are properly configured run:
# curl "<console_api_url>?op=get&op2=test&apipass=<console_api_pass>&user=<console_user>&pass=<console_pass>"
# It should return a string similar to:
# OK,{VERSION},{BUILD}
console_pass pandora
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
#encryption_passphrase passphrase

View File

@ -21,6 +21,7 @@ use strict;
use warnings;
use POSIX qw(strftime);
use threads;
use Digest::MD5 qw(md5_hex);
# Default lib dir for RPM and DEB packages
use lib '/usr/lib/perl5';
@ -576,6 +577,139 @@ sub main() {
pandora_event (\%Config, "Warmup mode for events started.", 0, 0, 0, 0, 0, 'system', 0, $DBH);
}
# Only if console_api_url was not defined
if( !defined($Config{"console_api_url"}) ) {
my $console_api_url = pandora_get_tconfig_token ($DBH, 'public_url', '');
# If public_url is empty in database
if ( $console_api_url eq '' ) {
$console_api_url = 'http://localhost/pandora_console/';
logger(\%Config, "Assuming default path for API url: " . $console_api_url, 3);
}
$Config{"console_api_url"} = $console_api_url . 'include/api.php';
}
# Definition of configuration file
my $cfg_file = $Config{'pandora_path'};
my $cfg_file_output = $Config{'pandora_path'} . "_backup";
# Only if console_api_pass was not defined
if ( !defined($Config{"console_api_pass"}) ) {
my $console_api_pass = pandora_get_tconfig_token ($DBH, 'api_password', '');
# If api_password is empty in database
if ( $console_api_pass eq '' ) {
$console_api_pass = '1234';
db_process_update ($DBH, 'tconfig', {'value' => $console_api_pass}, {'token' => 'api_password'});
}
# Definition of console_api_pass in config
$Config{"console_api_pass"} = $console_api_pass;
# Watch if paramether is added or not (even if it is commented)
my $console_api_pass_control = undef;
if ( open (CFGin, "<$cfg_file") && open (CFGout, ">>$cfg_file_output") ) {
while(my $row = <CFGin>) {
if (chomp($row) =~ (m/^#\sconsole_api_pass\s(.*)/i)) {
$console_api_pass_control = 1;
print CFGout "\nconsole_api_pass " .$Config{"console_api_pass"} . "\n";
} else {
print CFGout "$row\n";
}
}
# Only if the parameter was not added
if ( !defined($console_api_pass_control) ) {
print CFGout "\n# console_api_pass: Console password\n";
print CFGout "console_api_pass " .$Config{"console_api_pass"} . "\n";
}
# Close both files
close (CFGin);
close (CFGout);
# Convert the output file in the original configuration file
rename $cfg_file_output, $cfg_file;
}
}
# Only if console_pass was not defined.
if ( !defined($Config{"console_pass"}) ){
# Randomized parametrization of console_pass.
if (open (CFG, ">>$cfg_file")) {
my $valid_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
my $num_char = 8;
my $randomized_string = '';
for (my $i = 0; $i < $num_char; $i++) {
$randomized_string .= substr($valid_chars, rand(length($valid_chars)), 1);
}
$Config{"console_pass"} = $randomized_string;
print CFG "\n# console_pass: Console password\n";
print CFG "# To make sure console_api_url, console_api_pass, console_user and console_pass are properly configured run:\n";
print CFG "# curl '<console_api_url>?op=get&op2=test&apipass=<console_api_pass>&user=<console_user>&pass=<console_pass>'\n";
print CFG "# It should return a string similar to:\n";
print CFG "# OK,{VERSION},{BUILD}\n";
print CFG "console_pass " .$Config{"console_pass"} . "\n";
close (CFG);
} else {
logger(\%Config, "[WARNING] Error with configuration file when define `console_pass`: $!", 3);
}
}
# Only if console_user was not defined
if ( !defined($Config{"console_user"}) ) {
my $pandora_uid = pandora_get_tconfig_token ($DBH, 'pandora_uid', '');
if ( $pandora_uid ne '' && $pandora_uid ne 'OFFLINE' ) {
$Config{"console_user"} = "internal_API_$pandora_uid";
} else {
$Config{"console_user"} = "internal_API";
}
# If user not exists in DB, is necessary to create it
if ( get_user_exists($DBH, $Config{"console_user"}) == -1 ) {
# Definition of API user parameters
my $api_user_parameters = {};
$api_user_parameters->{'id_user'} = $Config{"console_user"};
$api_user_parameters->{'password'} = md5_hex($Config{"console_pass"});
$api_user_parameters->{'comments'} = "Internal user, used for generating reports and email attachments";
$api_user_parameters->{'is_admin'} = 0;
$api_user_parameters->{'not_login'} = 1;
# Profile creation for API purpouses
my $api_profile_parameters = {};
$api_profile_parameters->{'id_usuario'} = $Config{"console_user"};
$api_profile_parameters->{'id_perfil'} = 1;
$api_profile_parameters->{'id_grupo'} = 0;
$api_profile_parameters->{'assigned_by'} = "system";
$api_profile_parameters->{'id_policy'} = 0;
# Insert in DB
my $res_tusuario = db_process_insert($DBH, 'id_user', 'tusuario', $api_user_parameters);
my $res_tusuario_perfil = db_process_insert($DBH, 'id_user', 'tusuario_perfil', $api_profile_parameters);
# If the user was inserted in DB, must write it in configuration file
if ( $res_tusuario_perfil > 0 ) {
if (open (CFG, ">>$cfg_file")) {
print CFG "\n# Console User (created for API use)\n";
print CFG "console_user " . $Config{"console_user"} . "\n";
close (CFG);
} else {
logger(\%Config, "Warning. Was not possible edit configuration file for add console user", 3);
}
} else {
logger(\%Config, "Warning. Was not possible creating console user for API.", 3);
}
}
}
# Testing API url
my $curl_execution = "'".$Config{'console_api_url'}."?op=get&op2=test&apipass=".$Config{"console_api_pass"}."&user=".$Config{"console_user"}."&pass=".$Config{"console_pass"}."'";
my $exe_testing_api = `curl $curl_execution`;
my @res_testing_api = split(',', $exe_testing_api);
if ( $res_testing_api[0] ne 'OK' ) {
logger(\%Config, "Warning! The server does not have access to the API, this can trigger problems in the generation of reports and graphs.", 1);
pandora_event (\%Config, "Server does not have access to the API", 0, 0, 0, 0, 0, 'system', 0, $DBH);
}
# Generate 'going up' events
foreach my $server (@Servers) {
$server->upEvent ();

View File

@ -563,21 +563,11 @@ async_recovery 1
# Required for some features like the module graphs macros.
# console_api_url: Api URL (http://localhost/pandora_console/include/api.php by default)
console_api_url http://localhost/pandora_console/include/api.php
# console_api_url http://localhost/pandora_console/include/api.php
# console_api_pass: Api pass
# console_api_pass 1234
# console_user: Console user name (admin by default)
console_user admin
# console_pass: Console password (pandora by default)
# To make sure console_api_url, console_api_pass, console_user and console_pass are properly configured run:
# curl "<console_api_url>?op=get&op2=test&apipass=<console_api_pass>&user=<console_user>&pass=<console_pass>"
# It should return a string similar to:
# OK,{VERSION},{BUILD}
console_pass pandora
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
#encryption_passphrase passphrase

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.742";
my $pandora_build = "200128";
my $pandora_build = "200129";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -453,12 +453,6 @@ sub pandora_load_config {
# Auto-recovery of asynchronous modules.
$pa_config->{"async_recovery"} = 1; # 5.1SP1
# Console API connection
$pa_config->{"console_api_url"} = 'http://localhost/pandora_console/include/api.php'; # 6.0
$pa_config->{"console_api_pass"} = ''; # 6.0
$pa_config->{"console_user"} = 'admin'; # 6.0
$pa_config->{"console_pass"} = 'pandora'; # 6.0
# Database password encryption passphrase
$pa_config->{"encryption_passphrase"} = ''; # 6.0

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.742";
my $pandora_build = "200128";
my $pandora_build = "200129";
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.742
%define release 200128
%define release 200129
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

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

View File

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