Merge remote-tracking branch 'origin/develop' into ent-4755-base-de-datos-historico-revision

This commit is contained in:
fbsanchez 2021-02-01 15:38:19 +01:00
commit f4768b44fc
28 changed files with 111 additions and 63 deletions

View File

@ -88,7 +88,7 @@ check_root_permissions () {
}
## Main
echo 'Starting PandoraFMS Community deployment $S_VERSION'
echo "Starting PandoraFMS Community deployment ver. $S_VERSION"
# Centos Version
if [ ! "$(grep -i centos /etc/redhat-release)" ]; then
@ -103,7 +103,8 @@ echo -en "${cyan}Check Centos Version...${reset}"
check_cmd_status 'Error OS version, Centos 7 is expected'
# initialice logfile
execute_cmd "echo 'Starting community deployment #S_VERSION' > $LOGFILE" "All installer activity is logged on $LOGFILE"
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
echo "Community installer version: $S_VERSION" >> $LOGFILE
# Pre checks
# Root permisions
@ -268,23 +269,9 @@ execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant cli
# Disabling SELINUX and firewalld
setenforce 0
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/sysconfig/selinux
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
systemctl disable firewalld --now &>> $LOGFILE
cat > /etc/issue.net << EOF_banner
Welcome to Pandora FMS appliance on CentOS
------------------------------------------
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to http://"$1"/pandora_console to manage this server"}')
You can find more information at http://pandorafms.com
EOF_banner
rm -f /etc/issue
ln -s /etc/issue.net /etc/issue
execute_cmd "echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config" "Adding SSH banner"
#Configuring Database
execute_cmd "systemctl start mysqld" "Starting database engine"
@ -567,13 +554,32 @@ echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandor
systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent"
#SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
cat > /etc/issue.net << EOF_banner
Welcome to Pandora FMS appliance on CentOS
------------------------------------------
Go to Public http://$ipplublic/pandora_console$to to login web console
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')
You can find more information at http://pandorafms.com
EOF_banner
rm -f /etc/issue
ln -s /etc/issue.net /etc/issue
echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config
# Remove temporary files
execute_cmd "echo done" "Pandora FMS Community installed"
cd
execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files"
# Print nice finish message
GREEN='\033[01;32m'
NONE='\033[0m'
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
printf " -> Go to Public ${green}http://"$ipplublic"/pandora_console${reset} to manage this server"
ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n -> Go to Local "g"http://"$1"/pandora_console"n" to manage this server \n -> Use this credentials to login in the console "g"[ User: admin / Password: pandora ]"n" \n"}'

View File

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

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210128"
PI_BUILD="210201"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

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

View File

@ -13090,7 +13090,8 @@ function api_get_special_days($thrash1, $thrash2, $other, $thrash3)
$separator = $other['data'][0];
}
$filter = false;
$user_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM')));
$filter = "id_group IN ($user_groups)";
$special_days = @db_get_all_rows_filter('talert_special_days', $filter);
@ -13127,17 +13128,17 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3)
return;
}
if (!check_acl($config['id_user'], 0, 'LM')) {
returnError('forbidden', 'string');
return;
}
$special_day = $other['data'][0];
$same_day = $other['data'][1];
$description = $other['data'][2];
$idGroup = $other['data'][3];
$check_id_special_day = db_get_value('id', 'talert_special_days', 'date', $special_day);
if (!check_acl($config['id_user'], $idGroup, 'LM', true)) {
returnError('forbidden', 'string');
return;
}
$check_id_special_day = db_get_value_filter('id', 'talert_special_days', ['date' => $special_day, 'id_group' => $idGroup]);
if ($check_id_special_day) {
returnError('error_create_special_day', __('Error creating special day. Specified day already exists.'));
@ -13155,7 +13156,7 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3)
} else {
$group = groups_get_group_by_id($idGroup);
if ($group == false) {
if ($idGroup != 0 && $group == false) {
returnError('error_create_special_day', __('Error creating special day. Id_group doesn\'t exist.'));
return;
}
@ -13641,16 +13642,16 @@ function api_set_update_special_day($id_special_day, $thrash2, $other, $thrash3)
return;
}
if (!check_acl($config['id_user'], 0, 'LM')) {
returnError('forbidden', 'string');
return;
}
$special_day = $other['data'][0];
$same_day = $other['data'][1];
$description = $other['data'][2];
$idGroup = $other['data'][3];
if (!check_acl($config['id_user'], $idGroup, 'LM', true)) {
returnError('forbidden', 'string');
return;
}
if ($id_special_day == '') {
returnError('error_update_special_day', __('Error updating special day. Id cannot be left blank.'));
return;
@ -13663,6 +13664,13 @@ function api_set_update_special_day($id_special_day, $thrash2, $other, $thrash3)
return;
}
$id_group_org = db_get_value('id_group', 'talert_special_days', 'id', $id_special_day);
if (!check_acl($config['id_user'], $id_group_org, 'LM', true)) {
returnError('forbidden', 'string');
return;
}
if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $special_day)) {
returnError('error_update_special_day', __('Error updating special day. Invalid date format.'));
return;
@ -13725,6 +13733,12 @@ function api_set_delete_special_day($id_special_day, $thrash2, $thrash3, $thrash
return;
}
$id_group = db_get_value('id_group', 'talert_special_days', 'id', $id_special_day);
if (!check_acl($config['id_user'], $id_group, 'LM', true)) {
returnError('forbidden', 'string');
return;
}
$return = alerts_delete_alert_special_day($id_special_day);
if (is_error($return)) {

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.752';
$build = '210128';
$build = '210201';
$banner = "v$version Build $build";
error_reporting(0);
@ -346,14 +346,42 @@ function parse_mysqli_dump($connection, $url)
}
function random_name($size)
/**
* Generate a random password
*
* Admits a huge mount of ASCII chars.
*
* @param integer $size Size of the password returned.
*
* @return string $output
*/
function random_name(int $size)
{
$temp = '';
for ($a = 0; $a < $size; $a++) {
$temp = $temp.chr(rand(122, 97));
$output = '';
// Range pair of ASCII position for allow A-Z, a-z, 0-9 and special chars.
$rangeSeed = [
'48:57',
'65:90',
'97:122',
'40:47',
];
// Size of the password must be over range seed count.
$size = ($size >= count($rangeSeed)) ? $size : count($rangeSeed);
$auxIndex = 0;
for ($i = 0; $i < $size; $i++) {
$tmpSeedValues = explode(':', $rangeSeed[$auxIndex]);
$output = $output.chr(rand($tmpSeedValues[1], $tmpSeedValues[0]));
$auxIndex++;
if ($auxIndex >= 4) {
$auxIndex = 0;
}
}
return $temp;
// Remix the string for strong the password.
return str_shuffle($output);
}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.752
%define release 210128
%define release 210201
# 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.752
%define release 210128
%define release 210201
# 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.752
%define release 210128
%define release 210201
%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.752-210128
Version: 7.0NG.752-210201
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.752-210128"
pandora_version="7.0NG.752-210201"
package_cpan=0
package_pandora=1

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.752";
my $pandora_build = "210128";
my $pandora_build = "210201";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

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

View File

@ -2462,7 +2462,7 @@ sub p_decode_json {
if ($JSON::VERSION > 2.90) {
# Initialize JSON manager.
my $json = JSON->new->allow_nonref;
my $json = JSON->new->utf8->allow_nonref;
$decoded_data = $json->decode($data);
} else {
$decoded_data = decode_json($data);

View File

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

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210128"
PI_BUILD="210201"
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.752 PS210128";
my $version = "7.0NG.752 PS210201";
# 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.752 PS210128";
my $version = "7.0NG.752 PS210201";
# save program name for logging
my $progname = basename($0);