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 ## Main
echo 'Starting PandoraFMS Community deployment $S_VERSION' echo "Starting PandoraFMS Community deployment ver. $S_VERSION"
# Centos Version # Centos Version
if [ ! "$(grep -i centos /etc/redhat-release)" ]; then 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' check_cmd_status 'Error OS version, Centos 7 is expected'
# initialice logfile # 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 # Pre checks
# Root permisions # Root permisions
@ -268,23 +269,9 @@ execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant cli
# Disabling SELINUX and firewalld # Disabling SELINUX and firewalld
setenforce 0 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 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 #Configuring Database
execute_cmd "systemctl start mysqld" "Starting database engine" 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 systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent" 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" execute_cmd "echo done" "Pandora FMS Community installed"
cd cd
execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files" execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files"
# Print nice finish message
GREEN='\033[01;32m' GREEN='\033[01;32m'
NONE='\033[0m' 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" 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"}' 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 package: pandorafms-agent-unix
Version: 7.0NG.752-210128 Version: 7.0NG.752-210201
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.752-210128" pandora_version="7.0NG.752-210201"
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

@ -1016,7 +1016,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.752'; 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 # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210128 %define release 210201
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.752" PI_VERSION="7.0NG.752"
PI_BUILD="210128" PI_BUILD="210201"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" 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" 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.752-210128 Version: 7.0NG.752-210201
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.752-210128" pandora_version="7.0NG.752-210201"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC210128'; $build_version = 'PC210201';
$pandora_version = 'v7.0NG.752'; $pandora_version = 'v7.0NG.752';
// Do not overwrite default timezone set if defined. // 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]; $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); $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; return;
} }
if (!check_acl($config['id_user'], 0, 'LM')) {
returnError('forbidden', 'string');
return;
}
$special_day = $other['data'][0]; $special_day = $other['data'][0];
$same_day = $other['data'][1]; $same_day = $other['data'][1];
$description = $other['data'][2]; $description = $other['data'][2];
$idGroup = $other['data'][3]; $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) { if ($check_id_special_day) {
returnError('error_create_special_day', __('Error creating special day. Specified day already exists.')); 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 { } else {
$group = groups_get_group_by_id($idGroup); $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.')); returnError('error_create_special_day', __('Error creating special day. Id_group doesn\'t exist.'));
return; return;
} }
@ -13641,16 +13642,16 @@ function api_set_update_special_day($id_special_day, $thrash2, $other, $thrash3)
return; return;
} }
if (!check_acl($config['id_user'], 0, 'LM')) {
returnError('forbidden', 'string');
return;
}
$special_day = $other['data'][0]; $special_day = $other['data'][0];
$same_day = $other['data'][1]; $same_day = $other['data'][1];
$description = $other['data'][2]; $description = $other['data'][2];
$idGroup = $other['data'][3]; $idGroup = $other['data'][3];
if (!check_acl($config['id_user'], $idGroup, 'LM', true)) {
returnError('forbidden', 'string');
return;
}
if ($id_special_day == '') { if ($id_special_day == '') {
returnError('error_update_special_day', __('Error updating special day. Id cannot be left blank.')); returnError('error_update_special_day', __('Error updating special day. Id cannot be left blank.'));
return; return;
@ -13663,6 +13664,13 @@ function api_set_update_special_day($id_special_day, $thrash2, $other, $thrash3)
return; 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)) { 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.')); returnError('error_update_special_day', __('Error updating special day. Invalid date format.'));
return; return;
@ -13725,6 +13733,12 @@ function api_set_delete_special_day($id_special_day, $thrash2, $thrash3, $thrash
return; 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); $return = alerts_delete_alert_special_day($id_special_day);
if (is_error($return)) { if (is_error($return)) {

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.752'; $version = '7.0NG.752';
$build = '210128'; $build = '210201';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); 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 = ''; $output = '';
for ($a = 0; $a < $size; $a++) {
$temp = $temp.chr(rand(122, 97)); // 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 name pandorafms_console
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210128 %define release 210201
# 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.752 %define version 7.0NG.752
%define release 210128 %define release 210201
# 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.752 %define version 7.0NG.752
%define release 210128 %define release 210201
%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

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

View File

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

View File

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

View File

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

View File

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

View File

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

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.752 PS210128"; my $version = "7.0NG.752 PS210201";
# 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.752 PS210128"; my $version = "7.0NG.752 PS210201";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);