Merge branch 'develop' into ent-13312-cambios-en-licencia-y-update-manager-para-version-777

This commit is contained in:
Daniel Maya 2024-05-14 14:02:19 +02:00
commit fd049264d4
248 changed files with 27319 additions and 19517 deletions

View File

@ -8,21 +8,21 @@ Pandora FMS gives you the agility to find and solve problems quickly, scaling th
### Support
For community support you can visit our forums at https://pandorafms.com/community/
For community support you can visit our forums at https://pandorafms.com/community/
Pandora FMS has a "commercial" solution, with different features, oriented to companies that do not want to spend time using open source solutions, but closed packaged products, with periodic updates and professional support. Its name is Pandora FMS Enterprise, and you can find more information about it at https://pandorafms.com.
### How to install Pandora FMS
Installing Pandora FMS from sources is a complex task. Please visit our wiki and follow all the steps described for a proper installation. https://pandorafms.com/manual/
Installing Pandora FMS from sources is a complex task. Please read the **extras/deploy/INSTALL.md** file follow all the steps described for a proper installation.
### What is Pandora FMS?
Pandora FMS is an open source monitoring application whose origin dates back to 2004. It integrates in the same application the monitoring of different infrastructure elements: networks, applications, servers, web, and other specific data sources such as logs, WMI, Netflow or SNMP traps.
Pandora FMS is an open source monitoring application whose origin dates back to 2004. It integrates in the same application the monitoring of different infrastructure elements: networks, applications, servers, web, and other specific data sources such as logs, WMI, Netflow or SNMP traps.
It allows you to supervise systems and applications of all types, through remote monitoring or with software agents installed on the equipment to be monitored.
It allows you to supervise systems and applications of all types, through remote monitoring or with software agents installed on the equipment to be monitored.
Pandora FMS monitors your hardware, software, your multilayer system and, of course, your operating system. Pandora FMS can detect if a network interface is down or the movement of the market value of any new NASDAQ technology. If desired, Pandora FMS can send an SMS message when your system or application fails or when the value of Tesla's stock drops below $180. Pandora FMS will adapt to your systems and requirements, because it has been designed to be open, modular, multiplatform and easy to customize.
Pandora FMS monitors your hardware, software, your multilayer system and, of course, your operating system. Pandora FMS can detect if a network interface is down or the movement of the market value of any new NASDAQ technology. If desired, Pandora FMS can send an SMS message when your system or application fails or when the value of Tesla's stock drops below \$180. Pandora FMS will adapt to your systems and requirements, because it has been designed to be open, modular, multiplatform and easy to customize.
Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
@ -44,15 +44,3 @@ Pandora FMS is a monitoring tool that not only measures if a parameter is right
- Very high capacity (Thousands of devices)
- Multitenant, several levels of ACL management.
### Screenshots
![screenshot 1](http://wolf359.artica.es/public_images/captura-pantalla-pandora3.png)
<br />
<br />
![screenshot 2](http://wolf359.artica.es/public_images/pandora6.0sp3-monitor-view.png)
<br />
<br />
![screenshot 3](http://wolf359.artica.es/public_images/pandora6.0sp3-agentview.png)
<br />
<br />
![screenshot 4](http://wolf359.artica.es/public_images/pandora6.0sp3-sample-visual-console.png)

View File

@ -0,0 +1,83 @@
![logo Pandora-FMS](https://user-images.githubusercontent.com/8567291/151817953-dc9c4c88-5f3c-459b-98a7-da0534930a2c.png)
### Installation from installation scrip
To install a new Pandora FMS instance, the easy and recommended way to do it is using the online installation tool.
Just download the correct script for your OS in extras/deploy-scripts/
The nomenclature for the corresponding OS scripts are:
- **pandora_deploy_community_gh.sh**: centos7 (to be deprecated)
- **pandora_deploy_community_el8_gh.sh**: rockylinux8, almalinux 8, RHEL8
- **pandora_deploy_community_el9_gh.sh**: rockylinux9, almalinux 9, RHEL9
- **pandora_deploy_community_ubuntu_2204_gh.sh**: Ubuntu Server 22.04
Once you download and copy the script to the home directory of your server, give it the correct permission to execute.
```
chmod +x pandora_deploy_community_el8_gh.sh
```
Then just run the script to start the installation process.
```
./pandora_deploy_community_el8_gh.sh
```
### Install Agent online scrip
To install a new Pandora FMS instance, the easy and recommended way to do it is using the online installation tool.
Just download the correct script for your OS in extras/deploy-scripts/
it will handle all the dependencies and configurations for you.
```
chmod +x pandora_agent_deploy_gh.sh
./pandora_agent_deploy_gh.sh
```
### Update Pandora FMS
The easiest and recommend way to update the environment is to use the update manager integrated in the Pandora FMS web console, just clicking in online update.
To update it manually, is possible to do it from the release packages
#### Update from RPM packages
For RHEL and RHEL compatible systems such as rockylinux or almalinux just download the rpms packages from release section and install it with the proper package manager such as yum or dnf.
For example.
```
dnf install ./pandorafms_agent_linux-7.0NG.772.noarch.rpm
dnf install ./pandorafms_console-7.0NG.772.noarch.rpm
dnf install ./pandorafms_server-7.0NG.772.x86_64.rpm
```
#### Update from Tarball packages
For Ubuntu Server systems the only path to update outside the update manager is the Tarball source code packages, it also compatible with RHEL compatible systems if you prefer to do it in such way.
##### Console
To update the condos you should download the tarball package, decompress it and then copy the pandora_console format to your Apache folder.
```
tar xvzf pandorafms_console-7.0NG.772.tar.gz
cp -R pandora_console /var/www/html/
```
##### Server
To update the server is similar just download the tarball package from release section, decompress it, move it to the pandora_server folder and execute the installation script.
```
tar xvfz pandorafms_server-7.0NG.772.tar.gz
cd pandora_server
./pandora_server_installer --install
```
##### Agent
To update the agent, similar just download the tarball package from release section, decompress it, move it to the pandora_server folder and execute the installation script.
```
tar xvzf pandorafms_agent_linux-7.0NG.tar.gz
cd unix
./pandora_agent_installer --install
```

View File

@ -1,374 +0,0 @@
#!/bin/bash
#######################################################
# PandoraFMS Community online installation script
#######################################################
## Tested versions ##
# Centos 8.4, 8.5
# Rocky 8.4, 8.5, 8.6, 8.7
# Almalinuz 8.4, 8.5
# RedHat 8.5
#Constants
S_VERSION='202302201'
LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=80
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
# Ansi color code variables
red="\e[0;91m"
green="\e[0;92m"
cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
echo -e "${cyan}$msg...${reset}"
$cmd &>> "$LOGFILE"
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$3" ] && echo "$3"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
exit 1
else
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
return 0
fi
}
check_cmd_status () {
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$1" ] && echo "$1"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
return 0
fi
}
check_root_permissions () {
echo -en "${cyan}Checking root account... ${reset}"
if [ "$(whoami)" != "root" ]; then
echo -e "${red}Fail${reset}"
echo "Please use a root account or sudo for installing Pandora FMS"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
fi
}
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
## Main
echo "Starting PandoraFMS External DB deployment EL8 ver. $S_VERSION"
if ! grep --version &>> $LOGFILE ; then echo 'Error grep is not detected on the system, grep tool is needed for installation.'; exit -1 ;fi
if ! sed --version &>> $LOGFILE ; then echo 'Error grep is not detected on the system, grep tool is needed for installation.'; exit -1 ;fi
# Centos Version
if [ ! "$(grep -Ei 'centos|rocky|Almalinux|Red Hat Enterprise' /etc/redhat-release)" ]; then
printf "\n ${red}Error this is not a Centos/Rocky/Almalinux Base system, this installer is compatible with RHEL/Almalinux/Centos/Rockylinux systems only${reset}\n"
exit 1
fi
echo -en "${cyan}Check Centos Version...${reset}"
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ]
check_cmd_status 'Error OS version, RHEL/Almalinux/Centos/Rockylinux 8+ is expected'
#Detect OS
os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
execute_cmd "echo $os_name" "OS detected: ${os_name}"
# initialice 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
check_root_permissions
# Systemd
execute_cmd "systemctl status" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
# Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Setting timezone
rm -rf /etc/localtime &>> "$LOGFILE"
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
# Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "dnf --version" 'Checking needed tools: dnf'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp"
## Extra steps on redhat envs
if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then
## In case REDHAT
# Check susbscription manager status:
echo -en "${cyan}Checking Red Hat Enterprise subscription... ${reset}"
subscription-manager list &>> "$LOGFILE"
subscription-manager status &>> "$LOGFILE"
check_cmd_status 'Error checking subscription status, make sure your server is activated and suscribed to Red Hat Enterprise repositories'
# Ckeck repolist
dnf repolist &>> "$LOGFILE"
echo -en "${cyan}Checking Red Hat Enterprise repolist... ${reset}"
dnf repolist | grep 'rhel-8-for-x86_64-baseos-rpms' &>> "$LOGFILE"
check_cmd_status 'Error checking repositories status, could try a subscription-manager attach command or contact sysadmin'
#install extra repos
extra_repos=" \
tar \
dnf-utils \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
execute_cmd "subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms" "Enabling subscription to codeready-builder"
else
# For alma/rocky/centos
extra_repos=" \
tar \
dnf-utils \
epel-release \
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
fi
#Installing wget
execute_cmd "dnf install -y wget" "Installing wget"
# Install percona Database
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
if [ "$MYVER" -eq '80' ] ; then
execute_cmd "percona-release setup ps80 -y" "Enabling mysql80 module"
execute_cmd "dnf install -y percona-server-server percona-xtrabackup-80" "Installing Percona Server 80"
fi
if [ "$MYVER" -ne '80' ] ; then
execute_cmd "dnf install -y Percona-Server-server-57 percona-xtrabackup-24" "Installing Percona Server 57"
fi
# Disabling SELINUX and firewalld
setenforce 0 &>> "$LOGFILE"
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
systemctl disable firewalld --now &>> "$LOGFILE"
# Adding standar cnf for initial setup.
cat > /etc/my.cnf << EO_CONFIG_TMP
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
EO_CONFIG_TMP
#Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysqld" "Starting database engine"
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
if [ "$MYVER" -eq '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
fi
if [ "$MYVER" -ne '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
fi
export MYSQL_PWD=$DBROOTPASS
echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
#Generating my.cnf
cat > /etc/my.cnf << EO_CONFIG_F
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
character-set-server=utf8
skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Mysql optimizations for Pandora FMS
# Please check the documentation in http://pandorafms.com for better results
max_allowed_packet = 64M
innodb_buffer_pool_size = $POOL_SIZE
innodb_lock_wait_timeout = 90
innodb_file_per_table
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M
innodb_log_buffer_size = 16M
innodb_io_capacity = 100
thread_cache_size = 8
thread_stack = 256K
max_connections = 100
key_buffer_size=4M
read_buffer_size=128K
read_rnd_buffer_size=128K
sort_buffer_size=128K
join_buffer_size=4M
query_cache_type = 1
query_cache_size = 64M
query_cache_min_res_unit = 2k
query_cache_limit = 256K
#skip-log-bin
sql_mode=""
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
EO_CONFIG_F
if [ "$MYVER" -eq '80' ] ; then
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf
sed -i -e "s/character-set-server=utf8/character-set-server=utf8mb4/g" /etc/my.cnf
fi
execute_cmd "systemctl restart mysqld" "Configuring database engine"
execute_cmd "systemctl enable mysqld --now" "Enabling Database service"
fi
export MYSQL_PWD=$DBPASS
# Kernel optimization
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
cat >> /etc/sysctl.conf <<EO_KO
# Pandora FMS Optimization
# default=5
net.ipv4.tcp_syn_retries = 3
# default=5
net.ipv4.tcp_synack_retries = 3
# default=1024
net.ipv4.tcp_max_syn_backlog = 65536
# default=124928
net.core.wmem_max = 8388608
# default=131071
net.core.rmem_max = 8388608
# default = 128
net.core.somaxconn = 1024
# default = 20480
net.core.optmem_max = 81920
EO_KO
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
fi
execute_cmd "echo done" "Percona server installed"
cd
execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files"

View File

@ -1,313 +0,0 @@
#!/bin/bash
##############################################################################################################
# PandoraFMS Community online installation script for Ubuntu 22.04
##############################################################################################################
## Tested versions ##
# Ubuntu 22.04.1
# Ubuntu 22.04.2
#avoid promps
export DEBIAN_FRONTEND=noninteractive
export NEEDRESTART_SUSPEND=1
#Constants
PANDORA_CONSOLE=/var/www/html/pandora_console
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy
S_VERSION='202302201'
LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
# Ansi color code variables
red="\e[0;91m"
green="\e[0;92m"
cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
echo -e "${cyan}$msg...${reset}"
$cmd &>> "$LOGFILE"
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$3" ] && echo "$3"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$WORKDIR" &>> "$LOGFILE"
exit 1
else
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
return 0
fi
}
check_cmd_status () {
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$1" ] && echo "$1"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$WORKDIR" &>> "$LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
return 0
fi
}
check_root_permissions () {
echo -en "${cyan}Checking root account... ${reset}"
if [ "$(whoami)" != "root" ]; then
echo -e "${red}Fail${reset}"
echo "Please use a root account or sudo for installing Pandora FMS"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
fi
}
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
## Main
echo "Starting PandoraFMS External DB deployment Ubuntu 22.04 ver. $S_VERSION"
if ! grep --version &>> $LOGFILE ; then echo 'Error grep is not detected on the system, grep tool is needed for installation.'; exit -1 ;fi
if ! sed --version &>> $LOGFILE ; then echo 'Error grep is not detected on the system, grep tool is needed for installation.'; exit -1 ;fi
# Ubuntu Version
if [ ! "$(grep -Ei 'Ubuntu' /etc/lsb-release)" ]; then
printf "\n ${red}Error this is not a Ubuntu system, this installer is compatible with Ubuntu systems only${reset}\n"
exit 1
fi
echo -en "${cyan}Check Ubuntu Version...${reset}"
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9][0-9].[0-9][0-9])"$/\1/p' /etc/os-release) == "22.04" ]
check_cmd_status 'Error OS version, Ubuntu 22.04 is expected'
#Detect OS
os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
execute_cmd "echo $os_name" "OS detected: ${os_name}"
# initialice 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
check_root_permissions
#Install awk, sed, grep if not present
execute_cmd "apt install -y gawk sed grep" 'Installing needed tools'
# Systemd
execute_cmd "systemctl --version" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
# Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Setting timezone
rm -rf /etc/localtime &>> "$LOGFILE"
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
# Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "apt --version" 'Checking needed tools: apt'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory
rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE"
execute_cmd "cd $WORKDIR" "Moving to workdir: $WORKDIR"
## Install utils
execute_cmd "apt update" "Updating repos"
execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https" "Installing utils"
# Disabling apparmor and ufw
systemctl stop ufw.service &>> "$LOGFILE"
systemctl disable ufw &>> "$LOGFILE"
systemctl stop apparmor &>> "$LOGFILE"
systemctl disable apparmor &>> "$LOGFILE"
#install mysql
execute_cmd "curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb" "Downloading Percona repository for MySQL8"
execute_cmd "apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb" "Installing Percona repository for MySQL8"
execute_cmd "percona-release setup ps80" "Configuring Percona repository for MySQL8"
echo -en "${cyan}Installing Percona Server for MySQL8...${reset}"
env DEBIAN_FRONTEND=noninteractive apt install -y percona-server-server percona-xtrabackup-80 &>> "$LOGFILE"
check_cmd_status "Error Installing MySql Server"
#Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysql" "Starting database engine"
echo """
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DBROOTPASS';
""" | mysql -uroot &>> "$LOGFILE"
export MYSQL_PWD=$DBROOTPASS
echo "INSTALL COMPONENT 'file://component_validate_password';" | mysql -uroot -P$DBPORT -h$DBHOST &>> "$LOGFILE"
echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST
fi
export MYSQL_PWD=$DBPASS
#Generating my.cnf
cat > /etc/mysql/my.cnf << EOF_DB
[mysqld]
datadir=/var/lib/mysql
user=mysql
character-set-server=utf8mb4
skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Mysql optimizations for Pandora FMS
# Please check the documentation in http://pandorafms.com for better results
max_allowed_packet = 64M
innodb_buffer_pool_size = $POOL_SIZE
innodb_lock_wait_timeout = 90
innodb_file_per_table
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M
innodb_log_buffer_size = 16M
innodb_io_capacity = 300
thread_cache_size = 8
thread_stack = 256K
max_connections = 100
key_buffer_size=4M
read_buffer_size=128K
read_rnd_buffer_size=128K
sort_buffer_size=128K
join_buffer_size=4M
skip-log-bin
sql_mode=""
log-error=/var/log/mysql/error.log
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
EOF_DB
execute_cmd "systemctl restart mysql" "Configuring and restarting database engine"
# Kernel optimization
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
cat >> /etc/sysctl.conf <<EO_KO
# Pandora FMS Optimization
# default=5
net.ipv4.tcp_syn_retries = 3
# default=5
net.ipv4.tcp_synack_retries = 3
# default=1024
net.ipv4.tcp_max_syn_backlog = 65536
# default=124928
net.core.wmem_max = 8388608
# default=131071
net.core.rmem_max = 8388608
# default = 128
net.core.somaxconn = 1024
# default = 20480
net.core.optmem_max = 81920
EO_KO
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
fi
# Remove temporary files
execute_cmd "echo done" "Percona server installed"
cd "$HOME"
execute_cmd "rm -rf $WORKDIR" "Removing temporary files"

View File

@ -184,14 +184,14 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset}
# Insatall pandora agent
[ "$PANDORA_AGENT_PACKAGE_EL" ] || PANDORA_AGENT_PACKAGE_EL="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
[ "$PANDORA_AGENT_PACKAGE_EL" ] || PANDORA_AGENT_PACKAGE_EL="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_agent_linux-7.0NG.772.noarch.rpm"
execute_cmd "$package_manager_cmd install -y ${PANDORA_AGENT_PACKAGE_EL}" 'Installing Pandora FMS agent package'
#[[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection"
fi
if [[ $OS_RELEASE == 'debian' ]]; then
[ "$PANDORA_AGENT_PACKAGE_UBUNTU" ] || PANDORA_AGENT_PACKAGE_UBUNTU='https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz'
[ "$PANDORA_AGENT_PACKAGE_UBUNTU" ] || PANDORA_AGENT_PACKAGE_UBUNTU='https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_agent_linux-7.0NG.772.tar.gz'
execute_cmd "apt update" 'Updating repos'
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
execute_cmd "curl --output pandorafms_agent_linux-7.0NG.tar.gz ${PANDORA_AGENT_PACKAGE_UBUNTU}" 'Downloading Pandora FMS agent package'

View File

@ -3,8 +3,8 @@
# PandoraFMS Community online installation script
#######################################################
## Tested versions ##
# Centos 8.4, 8.5
# Rocky 8.4, 8.5, 8.6, 8.7
# CentOS 8.4, 8.5
# Rockylinux 8.4, 8.5, 8.6, 8.7
# Almalinux 8.4, 8.5
# RedHat 8.5
@ -32,8 +32,7 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
#Check if possible to get os version
if [ ! -e /etc/os-release ]; then
@ -101,8 +100,7 @@ check_pre_pandora () {
}
check_repo_connection () {
execute_cmd "ping -c 2 firefly.pandorafms.com" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
execute_cmd "ping -c 2 github.com" "Checking Community repo"
}
check_root_permissions () {
@ -211,9 +209,7 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
INSTALLING_VER="${green}LTS version enable ${reset}"
echo -e $INSTALLING_VER
# Connectivity
@ -394,12 +390,8 @@ console_dependencies=" \
mod_ssl \
libzstd \
openldap-clients \
https://firefly.pandorafms.com/centos8/chromium-122.0.6261.128-1.el8.x86_64.rpm \
https://firefly.pandorafms.com/centos8/chromium-common-122.0.6261.128-1.el8.x86_64.rpm \
https://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
https://firefly.pandorafms.com/centos8/pandora_gotty-1.0-1.el8.x86_64.rpm \
https://firefly.pandorafms.com/centos8/pandorafms_made-0.1.0-1.el8.x86_64.rpm \
https://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm"
https://github.com/pandorafms/pandorafms/releases/download/tools/pandora_gotty-1.1-1.el8.x86_64.rpm \
chromium"
execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
@ -424,48 +416,8 @@ server_dependencies=" \
java \
bind-utils \
whois \
libnsl \
https://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm"
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# SDK VMware perl dependencies
vmware_dependencies=" \
perl-Net-HTTP \
perl-libwww-perl \
openssl-devel \
perl-Crypt-CBC \
perl-Bytes-Random-Secure \
perl-Crypt-Random-Seed \
perl-Math-Random-ISAAC \
perl-JSON \
perl-Crypt-SSLeay \
https://firefly.pandorafms.com/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm \
https://firefly.pandorafms.com/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm"
execute_cmd "dnf install -y $vmware_dependencies" "Installing SDK VMware perl dependencies"
# Instant client Oracle
oracle_dependencies=" \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant client"
#ipam dependencies
ipam_dependencies=" \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
perl(XML::Simple) \
perl(IO::Socket::INET6) \
perl(XML::Twig)"
execute_cmd "dnf install -y $ipam_dependencies" "Installing IPAM Instant client"
# MSSQL dependencies el8
execute_cmd "curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/mssql-release.repo" "Configuring Microsoft repositories"
execute_cmd "dnf remove unixODBC-utf16 unixODBC-utf16-devel" "Removing default unixODBC packages"
execute_cmd "env ACCEPT_EULA=Y dnf install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
#dnf config-manager --set-disable packages-microsoft-com-prod
libnsl "
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# Disabling SELINUX and firewalld
setenforce 0 &>> "$LOGFILE"
@ -568,23 +520,12 @@ EO_CONFIG_F
fi
export MYSQL_PWD=$DBPASS
#Define packages
if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
fi
# packages
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_server-7.0NG.772.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_console-7.0NG.772.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_agent_linux-7.0NG.772.noarch.rpm"
# if beta is enable
if [ "$PANDORA_BETA" -eq '1' ] ; then
PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm"
PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
fi
# Downloading Pandora Packages
execute_cmd "curl -LSs --output pandorafms_server-7.0NG.noarch.rpm ${PANDORA_SERVER_PACKAGE}" "Downloading Pandora FMS Server community"
@ -594,11 +535,6 @@ execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDOR
# Install Pandora
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"
# Copy gotty utility
execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
# Enable Services
execute_cmd "systemctl enable httpd --now" "Enabling HTTPD service"
execute_cmd "systemctl enable php-fpm --now" "Enabling PHP-FPM service"

View File

@ -30,8 +30,6 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
[ "$RHEL_CHECK_SUBSCRIPTION" ] || RHEL_CHECK_SUBSCRIPTION=1
#Check if possible to get os version
@ -97,8 +95,7 @@ check_pre_pandora () {
}
check_repo_connection () {
execute_cmd "ping -c 2 firefly.pandorafms.com" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
execute_cmd "ping -c 2 github.com" "Checking Community repo"
}
check_root_permissions () {
@ -207,9 +204,7 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
INSTALLING_VER="${green}LTS version enable ${reset}"
echo -e $INSTALLING_VER
# Connectivity
@ -386,10 +381,8 @@ console_dependencies=" \
mod_ssl \
libzstd \
openldap-clients \
https://firefly.pandorafms.com/centos8/chromium-122.0.6261.128-1.el8.x86_64.rpm \
https://firefly.pandorafms.com/centos8/chromium-common-122.0.6261.128-1.el8.x86_64.rpm \
https://firefly.pandorafms.com/centos8/pandora_gotty-1.0-1.el8.x86_64.rpm \
https://firefly.pandorafms.com/centos8/pandorafms_made-0.1.0-1.el8.x86_64.rpm "
https://github.com/pandorafms/pandorafms/releases/download/tools/pandora_gotty-1.1-1.el8.x86_64.rpm \
chromium "
execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
@ -416,9 +409,7 @@ server_dependencies=" \
bind-utils \
whois \
libnsl \
libxcrypt-compat \
https://firefly.pandorafms.com/pandorafms-el9/perl-Geo-IP-1.51-1.el9.x86_64.rpm \
https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm"
libxcrypt-compat "
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
#ipam dependencies
@ -521,23 +512,12 @@ EO_CONFIG_F
fi
export MYSQL_PWD=$DBPASS
#Define packages
if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
fi
# packages
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_server-7.0NG.772.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_console-7.0NG.772.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_agent_linux-7.0NG.772.noarch.rpm"
# if beta is enable
if [ "$PANDORA_BETA" -eq '1' ] ; then
PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm"
PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
fi
# Downloading Pandora Packages
execute_cmd "curl -LSs --output pandorafms_server-7.0NG.noarch.rpm ${PANDORA_SERVER_PACKAGE}" "Downloading Pandora FMS Server community"

View File

@ -3,7 +3,7 @@
# PandoraFMS Community online installation script
#######################################################
## Tested versions ##
# Centos 7.9
# CentOS 7.9
#Constants
PANDORA_CONSOLE=/var/www/html/pandora_console
@ -28,8 +28,6 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
#Check if possible to get os version
if [ ! -e /etc/os-release ]; then
@ -92,8 +90,7 @@ check_pre_pandora () {
}
check_repo_connection () {
execute_cmd "ping -c 2 firefly.pandorafms.com" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
execute_cmd "ping -c 2 github.com" "Checking Community repo"
}
check_root_permissions () {
@ -146,9 +143,7 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
INSTALLING_VER="${green}LTS version enable ${reset}"
echo -e $INSTALLING_VER
# Connectivity
@ -285,7 +280,7 @@ console_dependencies=" \
mod_ssl \
libzstd \
openldap-clients \
https://firefly.pandorafms.com/centos8/pandora_gotty-1.0-1.el8.x86_64.rpm \
https://github.com/pandorafms/pandorafms/releases/download/tools/pandora_gotty-1.1-1.el8.x86_64.rpm \
chromium"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
@ -311,33 +306,12 @@ server_dependencies=" \
java \
bind-utils \
whois \
cpanminus \
https://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.pandorafms.com/centos7/pandorawmic-1.0.0-1.x86_64.rpm"
cpanminus"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# install cpan dependencies
execute_cmd "cpanm -i Thread::Semaphore" "Installing Thread::Semaphore"
# SDK VMware perl dependencies
vmware_dependencies=" \
https://firefly.pandorafms.com/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \
perl-JSON \
perl-Archive-Zip \
openssl-devel \
perl-Crypt-CBC \
perl-Digest-SHA \
https://firefly.pandorafms.com/centos7/perl-Crypt-OpenSSL-AES-0.02-1.el7.x86_64.rpm"
execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies"
# Instant client Oracle
oracle_dependencies=" \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dependencies" "Installing Oracle Instant client"
#ipam dependencies
ipam_dependencies=" \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
@ -347,12 +321,6 @@ ipam_dependencies=" \
perl(XML::Twig)"
execute_cmd "yum install -y $ipam_dependencies" "Installing IPAM Instant client"
# MSSQL dependencies el7
execute_cmd "curl https://packages.microsoft.com/config/rhel/7/prod.repo -o /etc/yum.repos.d/mssql-release.repo" "Configuring Microsoft repositories"
execute_cmd "yum remove unixODBC-utf16 unixODBC-utf16-devel" "Removing default unixODBC packages"
execute_cmd "env ACCEPT_EULA=Y yum install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
#yum config-manager --set-disable packages-microsoft-com-prod
# Disabling SELINUX and firewalld
setenforce 0
@ -458,23 +426,10 @@ fi
export MYSQL_PWD=$DBPASS
#Define packages
#Define packages
if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
fi
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_server-7.0NG.772.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_console-7.0NG.772.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_agent_linux-7.0NG.772.noarch.rpm"
# if beta is enable
if [ "$PANDORA_BETA" -eq '1' ] ; then
PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm"
PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
fi
# Downloading Pandora Packages
execute_cmd "curl -LSs --output pandorafms_server-7.0NG.noarch.rpm ${PANDORA_SERVER_PACKAGE}" "Downloading Pandora FMS Server community"
@ -484,11 +439,6 @@ execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDOR
# Install Pandora
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
# Copy gotty utility
execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
# Enable Services
execute_cmd "systemctl enable mysqld --now" "Enabling Database service"
execute_cmd "systemctl enable httpd --now" "Enabling HTTPD service"

View File

@ -34,8 +34,6 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
#Check if possible to get os version
if [ ! -e /etc/os-release ]; then
@ -100,8 +98,7 @@ check_pre_pandora () {
}
check_repo_connection () {
execute_cmd "ping -c 2 firefly.pandorafms.com" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
execute_cmd "ping -c 2 github.com" "Checking Community repo"
}
check_root_permissions () {
@ -215,9 +212,7 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
INSTALLING_VER="${green}LTS version enable ${reset}"
echo -e $INSTALLING_VER
# Connectivity
@ -343,28 +338,16 @@ server_dependencies=" \
snmp-mibs-downloader \
snmptrapd \
libnsl2 \
make \
openjdk-8-jdk "
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
execute_cmd "installing_docker" "Installing Docker for debug"
# Installing pandora_gotty
execute_cmd "curl --output pandora_gotty.deb https://firefly.pandorafms.com/ubuntu/pandora_gotty_1.0.0.deb" "Downloading pandora_gotty"
execute_cmd "curl --output pandora_gotty.deb https://github.com/pandorafms/pandorafms/releases/download/tools/pandora_gotty_1.1.0.deb" "Downloading pandora_gotty"
execute_cmd "apt install -y ./pandora_gotty.deb" "Intalling pandora_gotty"
# Installing MADE
execute_cmd "curl --output pandora_made.deb https://firefly.pandorafms.com/ubuntu/pandorafms-made_0.1.0-2_amd64.deb" "Downloading pandora MADE"
execute_cmd "apt install -y ./pandora_made.deb" "Intalling pandora MADE"
# wmic and pandorawmic
execute_cmd "curl -O https://firefly.pandorafms.com/pandorafms/utils/bin/wmic" "Downloading wmic"
execute_cmd "curl -O https://firefly.pandorafms.com/pandorafms/utils/bin/pandorawmic" "Downloading pandorawmic"
echo -en "${cyan}Installing wmic and pandorawmic...${reset}"
chmod +x pandorawmic wmic &>> "$LOGFILE" && \
cp -a wmic /usr/bin/ &>> "$LOGFILE" && \
cp -a pandorawmic /usr/bin/ &>> "$LOGFILE"
check_cmd_status "Error Installing pandorawmic/wmic"
# create symlink for fping
rm -f /usr/sbin/fping &>> "$LOGFILE"
ln -s /usr/bin/fping /usr/sbin/fping &>> "$LOGFILE"
@ -376,40 +359,6 @@ execute_cmd "wget https://dl.google.com/linux/deb/pool/main/g/google-chrome-stab
execute_cmd "apt install -y ./${CHROME_VERSION}" "Intalling google chrome"
execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink"
# SDK VMware perl dependencies
vmware_dependencies="\
lib32z1 \
lib32z1 \
build-essential \
uuid uuid-dev \
libssl-dev \
perl-doc \
libxml-libxml-perl \
libcrypt-ssleay-perl \
libsoap-lite-perl \
libmodule-build-perl"
execute_cmd "apt install -y $vmware_dependencies" "Installing VMware SDK dependencies"
execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/VMware-vSphere-Perl-SDK-7.0.0-16453907.x86_64.tar.gz" "Downloading VMware SDK"
echo -en "${cyan}Installing VMware SDK...${reset}"
tar xvzf VMware-vSphere-Perl-SDK-7.0.0-16453907.x86_64.tar.gz &>> "$LOGFILE"
cd vmware-vsphere-cli-distrib/ &>> "$LOGFILE"
sed --follow-symlinks -i -e "s/[^#].*show_EULA().*/ #show_EULA();/g" vmware-install.pl &>> "$LOGFILE"
./vmware-install.pl --default &>> "$LOGFILE"
check_cmd_status "Error Installing VMware SDK"
execute_cmd "cpan Crypt::OpenSSL::AES" "Installing extra vmware dependencie"
cd $WORKDIR &>> "$LOGFILE"
# Instant client Oracle
execute_cmd "mkdir -p /opt/oracle" "Creating Oracle instant client directory /opt/oracle"
execute_cmd "wget https://download.oracle.com/otn_software/linux/instantclient/19800/instantclient-basic-linux.x64-19.8.0.0.0dbru.zip" "Downloading Oracle instant client"
execute_cmd "wget https://download.oracle.com/otn_software/linux/instantclient/19800/instantclient-sqlplus-linux.x64-19.8.0.0.0dbru.zip" "Downloading Oracle sqlplus"
echo -en "${cyan}Installing Oracle instant client...${reset}"
rm -fr /opt/oracle/* &>> "$LOGFILE"
unzip instantclient-basic-linux.x64-19.8.0.0.0dbru.zip -d /opt/oracle/ &>> "$LOGFILE"
unzip instantclient-sqlplus-linux.x64-19.8.0.0.0dbru.zip -d /opt/oracle/ &>> "$LOGFILE"
check_cmd_status "Error Installing Oracle instant client"
#Configuring env variables
cat >> /root/.profile << 'EOF_ENV'
@ -434,13 +383,6 @@ ipam_dependencies=" \
libnetaddr-ip-perl"
execute_cmd "apt install -y $ipam_dependencies" "Installing IPAM Dependencies"
# MSSQL dependencies el8
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc &>> "$LOGFILE"
curl -sSL https://packages.microsoft.com/config/ubuntu/20.04/prod.list | tee /etc/apt/sources.list.d/microsoft-prod.list &>> "$LOGFILE"
apt update &>> "$LOGFILE"
execute_cmd "env ACCEPT_EULA=Y apt install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
# Disabling apparmor and ufw
systemctl stop ufw.service &>> "$LOGFILE"
systemctl disable ufw &>> "$LOGFILE"
@ -523,21 +465,11 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin
#Define packages
if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz"
fi
if [ "$PANDORA_BETA" -eq '1' ] ; then
PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.tar.gz"
PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz"
fi
PANDORA_SERVER_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_server-7.0NG.772_x86_64.tar.gz"
PANDORA_CONSOLE_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_console-7.0NG.772.tar.gz"
PANDORA_AGENT_PACKAGE="https://github.com/pandorafms/pandorafms/releases/download/v772-LTS/pandorafms_agent_linux-7.0NG.772.tar.gz"
# Downloading Pandora Packages
cd $WORKDIR &>> "$LOGFILE"

View File

@ -38,9 +38,11 @@ mkdir -p %{buildroot}/usr/share/man/man1/
install -m 0755 pandora_agent %{buildroot}%{_bindir}/pandora_agent
install -m 0755 pandora_agent_exec %{buildroot}%{_bindir}/pandora_agent_exec
install -m 0755 tentacle_client %{buildroot}%{_bindir}/tentacle_client
install -m 0755 tentacle_server %{buildroot}%{_bindir}/tentacle_server
install -m 0755 pandora_agent_daemon %{buildroot}/etc/init.d/pandora_agent_daemon
install -m 0644 man/man1/pandora_agent.1.gz %{buildroot}/usr/share/man/man1/pandora_agent.1.gz
install -m 0644 man/man1/tentacle_client.1.gz %{buildroot}/usr/share/man/man1/tentacle_client.1.gz
install -m 0644 man/man1/tentacle_server.1.gz %{buildroot}/usr/share/man/man1/tentacle_server.1.gz
install -m 0600 Linux/pandora_agent.conf %{buildroot}/etc/pandora/pandora_agent.conf
install -d -m 0755 %{buildroot}/etc/pandora/plugins
install -d -m 0755 %{buildroot}/etc/pandora/collections
@ -81,6 +83,7 @@ fi
/usr/bin/pandora_agent
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/usr/bin/tentacle_server
/etc/init.d/pandora_agent_daemon
%defattr(-,pandora,root,770)
@ -96,6 +99,7 @@ fi
%doc
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
/usr/share/man/man1/tentacle_server.1.gz
%changelog
* Sun Feb 23 2014 Sancho Lerena <slerena at gmail.com> - 5.0

View File

@ -45,12 +45,14 @@ mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_server $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
# Checking old config file (if exists)
if [ -f /etc/pandora/pandora_agent.conf ] ; then
@ -113,6 +115,7 @@ rm -Rf /var/log/pandora/pandora_agent* 2> /dev/null
rm -Rf /usr/share/pandora_agent
rm -Rf /usr/share/man/man1/pandora_agent.1.gz
rm -Rf /usr/share/man/man1/tentacle_client.1.gz
rm -Rf /usr/share/man/man1/tentacle_server.1.gz
exit 0
%files
@ -125,6 +128,7 @@ exit 0
%defattr(755,pandora,root)
/usr/bin/tentacle_client
/usr/bin/tentacle_server
/etc/init.d/pandora_agent_daemon
%docdir %{prefix}/pandora_agents/docs
%{prefix}/pandora_agent
@ -132,4 +136,5 @@ exit 0
%defattr(644,pandora,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
/usr/share/man/man1/tentacle_server.1.gz

View File

@ -46,12 +46,14 @@ mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_server $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
# Checking old config file (if exists)
if [ -f /etc/pandora/pandora_agent.conf ] ; then
@ -115,6 +117,7 @@ rm -Rf /var/log/pandora/pandora_agent* 2> /dev/null
rm -Rf /usr/share/pandora_agent
rm -Rf /usr/share/man/man1/pandora_agent.1.gz
rm -Rf /usr/share/man/man1/tentacle_client.1.gz
rm -Rf /usr/share/man/man1/tentacle_server.1.gz
exit 0
%files
@ -127,6 +130,7 @@ exit 0
%defattr(755,pandora,root)
/usr/bin/tentacle_client
/usr/bin/tentacle_server
/etc/init.d/pandora_agent_daemon
%docdir %{prefix}/pandora_agents/docs
%{prefix}/pandora_agent
@ -134,4 +138,5 @@ exit 0
%defattr(644,pandora,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
/usr/share/man/man1/tentacle_server.1.gz

View File

@ -1757,12 +1757,6 @@ sub check_ssleay_version {
# Main
################################################################################
# Never run as root
if ($> == 0 && $^O ne 'MSWin32') {
print ("Error: for safety reasons $0 cannot be run with root privileges.\n");
exit 1;
}
# Parse command line options
parse_options ();

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.776-240426
Version: 7.0NG.776-240514
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.776-240426"
pandora_version="7.0NG.776-240514"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

Binary file not shown.

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.776';
use constant AGENT_BUILD => '240426';
use constant AGENT_BUILD => '240514';
# 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.776
%define release 240426
%define release 240514
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -53,11 +53,13 @@ mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_server $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
@ -164,9 +166,11 @@ exit 0
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/usr/bin/tentacle_server
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
/usr/share/man/man1/tentacle_server.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240426
%define release 240514
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
@ -55,11 +55,13 @@ mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_server $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
@ -161,9 +163,11 @@ exit 0
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/usr/bin/tentacle_server
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
/usr/share/man/man1/tentacle_server.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240426
%define release 240514
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
@ -55,11 +55,13 @@ mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_server $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
#cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
@ -150,8 +152,10 @@ exit 0
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/usr/bin/tentacle_server
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
/usr/share/man/man1/tentacle_server.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240426
%define release 240514
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
@ -53,11 +53,13 @@ mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_server $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
@ -159,9 +161,11 @@ exit 0
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/usr/bin/tentacle_server
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
/usr/share/man/man1/tentacle_server.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240426
%define release 240514
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -46,12 +46,14 @@ mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_server $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
@ -147,6 +149,7 @@ rm -Rf /var/log/pandora/pandora_agent* 2> /dev/null
rm -Rf /usr/share/pandora_agent
rm -Rf /usr/share/man/man1/pandora_agent.1.gz
rm -Rf /usr/share/man/man1/tentacle_client.1.gz
rm -Rf /usr/share/man/man1/tentacle_server.1.gz
exit 0
%postun
@ -165,6 +168,7 @@ rm -Rf /etc/logrotate.d/pandora_agent
%defattr(755,pandora,root)
/usr/bin/tentacle_client
/usr/bin/tentacle_server
/etc/init.d/pandora_agent_daemon
%docdir %{prefix}/pandora_agents/docs
%{prefix}/pandora_agent
@ -172,4 +176,5 @@ rm -Rf /etc/logrotate.d/pandora_agent
%defattr(644,pandora,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
/usr/share/man/man1/tentacle_server.1.gz

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.776"
PI_BUILD="240426"
PI_BUILD="240514"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1757,12 +1757,6 @@ sub check_ssleay_version {
# Main
################################################################################
# Never run as root
if ($> == 0 && $^O ne 'MSWin32') {
print ("Error: for safety reasons $0 cannot be run with root privileges.\n");
exit 1;
}
# Parse command line options
parse_options ();

View File

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

View File

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

View File

@ -75,23 +75,19 @@ if (empty($_REQUEST) === true) {
}
// Hash login process.
if (isset($_GET['loginhash']) === true) {
$loginhash_data = get_parameter('loginhash_data', '');
$loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
if ($config['loginhash_pwd'] != ''
&& $loginhash_data == md5(
$loginhash_user.io_output_password($config['loginhash_pwd'])
)
) {
db_logon($loginhash_user, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $loginhash_user;
$config['id_user'] = $loginhash_user;
if (isset($_POST['auth_token']) === true && (bool) $config['JWT_signature'] !== false) {
include_once $config['homedir'].'/include/class/JWTRepository.class.php';
$jwt = new JWTRepository($config['JWT_signature']);
if ($jwt->setToken($_POST['auth_token']) && $jwt->validate()) {
$id_user = $jwt->payload()->get('id_user');
db_logon($id_user, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $id_user;
$config['id_user'] = $id_user;
} else {
include_once 'general/login_page.php';
db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Loginhash failed',
'Login token failed',
'system'
);
while (ob_get_length() > 0) {

View File

@ -28,7 +28,9 @@
"php-di/php-di": "^7.0",
"zircote/swagger-php": "^4.8",
"doctrine/annotations": "^2.0",
"ramsey/uuid": "^4.7"
"ramsey/uuid": "^4.7",
"lcobucci/jwt": "^5.2",
"lcobucci/clock": "^3.2"
},
"repositories": {
"phpchartjs": {

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0d777bd9c0ca68c9ec0fe911e71b1b2a",
"content-hash": "c7549451bb31a635714731144a995123",
"packages": [
{
"name": "amphp/amp",
@ -1553,6 +1553,143 @@
},
"time": "2023-11-08T14:08:06+00:00"
},
{
"name": "lcobucci/clock",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/clock.git",
"reference": "6f28b826ea01306b07980cb8320ab30b966cd715"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/6f28b826ea01306b07980cb8320ab30b966cd715",
"reference": "6f28b826ea01306b07980cb8320ab30b966cd715",
"shasum": ""
},
"require": {
"php": "~8.2.0 || ~8.3.0",
"psr/clock": "^1.0"
},
"provide": {
"psr/clock-implementation": "1.0"
},
"require-dev": {
"infection/infection": "^0.27",
"lcobucci/coding-standard": "^11.0.0",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.25",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.13",
"phpstan/phpstan-strict-rules": "^1.5.1",
"phpunit/phpunit": "^10.2.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\Clock\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com"
}
],
"description": "Yet another clock abstraction",
"support": {
"issues": "https://github.com/lcobucci/clock/issues",
"source": "https://github.com/lcobucci/clock/tree/3.2.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2023-11-17T17:00:27+00:00"
},
{
"name": "lcobucci/jwt",
"version": "5.2.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/jwt.git",
"reference": "0ba88aed12c04bd2ed9924f500673f32b67a6211"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/jwt/zipball/0ba88aed12c04bd2ed9924f500673f32b67a6211",
"reference": "0ba88aed12c04bd2ed9924f500673f32b67a6211",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"ext-sodium": "*",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"psr/clock": "^1.0"
},
"require-dev": {
"infection/infection": "^0.27.0",
"lcobucci/clock": "^3.0",
"lcobucci/coding-standard": "^11.0",
"phpbench/phpbench": "^1.2.9",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5.0",
"phpunit/phpunit": "^10.2.6"
},
"suggest": {
"lcobucci/clock": ">= 3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com",
"role": "Developer"
}
],
"description": "A simple library to work with JSON Web Token and JSON Web Signature",
"keywords": [
"JWS",
"jwt"
],
"support": {
"issues": "https://github.com/lcobucci/jwt/issues",
"source": "https://github.com/lcobucci/jwt/tree/5.2.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2023-11-20T21:17:42+00:00"
},
{
"name": "monolog/monolog",
"version": "3.5.0",
@ -2307,6 +2444,54 @@
},
"time": "2021-02-03T23:26:27+00:00"
},
{
"name": "psr/clock",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/clock.git",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Psr\\Clock\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for reading the clock.",
"homepage": "https://github.com/php-fig/clock",
"keywords": [
"clock",
"now",
"psr",
"psr-20",
"time"
],
"support": {
"issues": "https://github.com/php-fig/clock/issues",
"source": "https://github.com/php-fig/clock/tree/1.0.0"
},
"time": "2022-11-25T14:36:26+00:00"
},
{
"name": "psr/container",
"version": "2.0.2",
@ -4338,5 +4523,5 @@
"platform-overrides": {
"php": "8.2"
},
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.2.0"
}

View File

@ -69,38 +69,41 @@ function api_execute(
if (empty($url) === true) {
$url = 'http://'.$ip.$pandora_url.'/include/api.php?';
} else {
$url_schema = parse_url($url);
$url = $url_schema['scheme'].'://'.$url_schema['host'].$pandora_url.'/include/api.php?';
}
if (empty($op) === false) {
$data['op'] = $op;
}
if (empty($op) === false) {
$data['op'] = $op;
}
if (empty($op2) === false) {
$data['op2'] = $op2;
}
if (empty($op2) === false) {
$data['op2'] = $op2;
}
if (empty($id) === false) {
$data['id'] = $id;
}
if (empty($id) === false) {
$data['id'] = $id;
}
if (empty($id2) === false) {
$data['id2'] = $id2;
}
if (empty($id2) === false) {
$data['id2'] = $id2;
}
if (empty($return_type) === false) {
$data['return_type'] = $return_type;
}
if (empty($return_type) === false) {
$data['return_type'] = $return_type;
}
if (empty($other) === false) {
$data['other_mode'] = $other_mode;
$data['other'] = $other;
}
if (empty($other) === false) {
$data['other_mode'] = $other_mode;
$data['other'] = $other;
}
// If token is not reported,use old method.
if (empty($token) === true) {
$data['apipass'] = $apipass;
$data['user'] = $user;
$data['pass'] = $password;
}
// If token is not reported,use old method.
if (empty($token) === true) {
$data['apipass'] = $apipass;
$data['user'] = $user;
$data['pass'] = $password;
}
$url_protocol = parse_url($url)['scheme'];

View File

@ -50,14 +50,7 @@ function extension_db_status()
}
ui_print_info_message(
" - " .
__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.') .
"<br>" .
" - " .
__('At the moment the checks is for MySQL/MariaDB.') .
"<br>" .
" - " .
__('User must have Select, Drop, Create and References privileges.')
' - '.__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.').'<br>'.' - '.__('At the moment the checks is for MySQL/MariaDB.').'<br>'.' - '.__('User must have Select, Drop, Create and References privileges.')
);
echo "<form method='post' class='max_floating_element_size'>";
@ -195,7 +188,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
try {
$query = "SELECT IF(EXISTS(SELECT 1 FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'), 'true', 'false') AS result";
if ($config['mysqli']) {
if ($config['mysqli']) {
$exist_db = mysqli_fetch_assoc(mysqli_query($connection_test, $query))['result'];
} else {
$exist_db = mysql_fetch_assoc(mysqli_query($connection_test, $query))['result'];
@ -204,7 +197,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
ui_print_error_message(__("There was a problem during verification of the existence of the `$db_name` table"));
return;
}
if ($exist_db == 'true') {
ui_print_error_message(__("The testing DB `$db_name` already exists"));
return;
@ -231,13 +224,13 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
if (check_ref_privileges($connection_test) == 0) {
drop_database($connection_test, $db_name);
ui_print_error_message(__("Unable to <b>create references</b> with the provided user please check its privileges"));
ui_print_error_message(__('Unable to <b>create references</b> with the provided user please check its privileges'));
return;
}
if (check_explain_privileges($connection_test) == 0) {
drop_database($connection_test, $db_name);
ui_print_error_message(__("Unable to <b>explain</b> with the provided user please check its privileges"));
ui_print_error_message(__('Unable to <b>explain</b> with the provided user please check its privileges'));
return;
}
@ -261,7 +254,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
if (!$install_tables) {
ui_print_error_message(__('Unsuccessful installed tables into the testing DB'));
return;
}
}
extension_db_check_tables_differences(
$connection_test,
@ -269,7 +262,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
$db_name,
$config['dbname']
);
drop_database($connection_test, $db_name);
}
@ -348,7 +341,7 @@ function extension_db_check_tables_differences(
if ($config['mysqli'] === true) {
mysqli_select_db($connection_test, $db_name_test);
$result = mysqli_query($connection_test, 'SHOW CREATE TABLE '.$table);
$create_query = mysqli_fetch_assoc($result)["Create Table"];
$create_query = mysqli_fetch_assoc($result)['Create Table'];
mysqli_free_result($result);
ui_print_info_message(
__('You can execute this SQL query for to fix.').'<br />'.'<pre>'.$create_query.'</pre>'
@ -356,7 +349,7 @@ function extension_db_check_tables_differences(
} else {
mysql_select_db($db_name_test, $connection_test);
$result = mysql_query('SHOW CREATE TABLE '.$table, $connection_test);
$create_query = mysqli_fetch_assoc($result)["Create Table"];
$create_query = mysqli_fetch_assoc($result)['Create Table'];
mysql_free_result($result);
ui_print_info_message(
__('You can execute this SQL query for to fix.').'<br />'.'<pre>'.$create_query.'</pre>'
@ -539,6 +532,7 @@ function extension_db_status_execute_sql_file($url, $connection)
} else {
$result = mysql_query($query, $connection);
}
if (!$result) {
echo mysqli_error($connection);
// Uncomment for debug
@ -563,19 +557,19 @@ function check_explain_privileges($connection)
global $config;
$has_privileges = 1;
$explain_check= "EXPLAIN tb1";
$explain_check = 'EXPLAIN tb1';
$create_tb1= "CREATE TABLE tb1 (
$create_tb1 = 'CREATE TABLE tb1 (
id INT AUTO_INCREMENT PRIMARY KEY
)";
)';
drop_database($connection, 'pandora_tmp_privilege_check');
try {
if ($config['mysqli']) {
mysqli_query($connection, "CREATE DATABASE `pandora_tmp_privilege_check`");
mysqli_query($connection, 'CREATE DATABASE `pandora_tmp_privilege_check`');
} else {
mysql_query("CREATE DATABASE `pandora_tmp_privilege_check`", $connection);
mysql_query('CREATE DATABASE `pandora_tmp_privilege_check`', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error creating the DB during reference check'));
@ -584,9 +578,9 @@ function check_explain_privileges($connection)
try {
if ($config['mysqli'] === true) {
mysqli_select_db($connection, "pandora_tmp_privilege_check");
mysqli_select_db($connection, 'pandora_tmp_privilege_check');
} else {
mysql_select_db("reference_check", $connection);
mysql_select_db('reference_check', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error selecting the DB during reference check'));
@ -600,8 +594,8 @@ function check_explain_privileges($connection)
$result = mysql_query($create_tb1, $connection);
}
if(!$result){
throw new Exception("Error on explain check: " . $connection->error);
if (!$result) {
throw new Exception('Error on explain check: '.$connection->error);
}
if ($config['mysqli'] === true) {
@ -610,10 +604,9 @@ function check_explain_privileges($connection)
$result = mysql_query($explain_check, $connection);
}
if(!$result){
throw new Exception("Error on explain check: " . $connection->error);
if (!$result) {
throw new Exception('Error on explain check: '.$connection->error);
}
} catch (Exception $e) {
$has_privileges = 0;
} finally {
@ -630,31 +623,31 @@ function check_drop_privileges($connection)
try {
if ($config['mysqli']) {
$create_db = mysqli_query($connection, "CREATE DATABASE IF NOT EXISTS`pandora_tmp_privilege_check`");
$create_db = mysqli_query($connection, 'CREATE DATABASE IF NOT EXISTS`pandora_tmp_privilege_check`');
} else {
$create_db = mysql_query("CREATE DATABASE IF NOT EXISTS `pandora_tmp_privilege_check`", $connection);
$create_db = mysql_query('CREATE DATABASE IF NOT EXISTS `pandora_tmp_privilege_check`', $connection);
}
} catch (Exception $e) {
$error_message = $e->getMessage();
}
if (!$create_db) {
if (stripos($error_message, "access denied for user") !== false) {
if (stripos($error_message, 'access denied for user') !== false) {
preg_match("/'.+?'\@'.+?'/", $error_message, $error_user);
$error_user = $error_user[0];
ui_print_error_message(__("Unable to <b>create databases</b> with the provided user please check its privileges"));
ui_print_error_message(__('Unable to <b>create databases</b> with the provided user please check its privileges'));
return 0;
}
ui_print_error_message(__('There was an error creating the DB during drop check'));
return 0;
}
try {
if ($config['mysqli'] === true) {
mysqli_select_db($connection, "pandora_tmp_privilege_check");
mysqli_select_db($connection, 'pandora_tmp_privilege_check');
} else {
mysql_select_db("reference_check", $connection);
mysql_select_db('reference_check', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error selecting the DB during drop check'));
@ -666,9 +659,7 @@ function check_drop_privileges($connection)
} catch (Exception $e) {
$has_privileges = 0;
ui_print_error_message(
__("Unable to <b>drop databases</b> with the provided user please check its privileges.") .
"<br>" .
__("Test databases may have been left over due to lack of drop privileges.")
__('Unable to <b>drop databases</b> with the provided user please check its privileges.').'<br>'.__('Test databases may have been left over due to lack of drop privileges.')
);
} finally {
return $has_privileges;
@ -683,21 +674,21 @@ function check_ref_privileges($connection)
drop_database($connection, 'pandora_tmp_privilege_check');
$create_tb1= "CREATE TABLE tb1 (
$create_tb1 = 'CREATE TABLE tb1 (
id INT AUTO_INCREMENT PRIMARY KEY
)";
)';
$create_tb2 = "CREATE TABLE tb2 (
$create_tb2 = 'CREATE TABLE tb2 (
id INT AUTO_INCREMENT PRIMARY KEY,
id_tb1 INT,
FOREIGN KEY (id_tb1) REFERENCES tb2(id)
)";
)';
try {
if ($config['mysqli']) {
mysqli_query($connection, "CREATE DATABASE `pandora_tmp_privilege_check`");
mysqli_query($connection, 'CREATE DATABASE `pandora_tmp_privilege_check`');
} else {
mysql_query("CREATE DATABASE `pandora_tmp_privilege_check`", $connection);
mysql_query('CREATE DATABASE `pandora_tmp_privilege_check`', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error creating the DB during reference check'));
@ -706,9 +697,9 @@ function check_ref_privileges($connection)
try {
if ($config['mysqli'] === true) {
mysqli_select_db($connection, "pandora_tmp_privilege_check");
mysqli_select_db($connection, 'pandora_tmp_privilege_check');
} else {
mysql_select_db("reference_check", $connection);
mysql_select_db('reference_check', $connection);
}
} catch (Exception $e) {
ui_print_error_message(__('There was an error selecting the DB during reference check'));
@ -722,8 +713,8 @@ function check_ref_privileges($connection)
$result = mysql_query($create_tb1, $connection);
}
if(!$result){
throw new Exception("Error on reference check: " . $connection->error);
if (!$result) {
throw new Exception('Error on reference check: '.$connection->error);
}
if ($config['mysqli'] === true) {
@ -732,10 +723,9 @@ function check_ref_privileges($connection)
$result = mysql_query($create_tb2, $connection);
}
if(!$result){
throw new Exception("Error on reference check: " . $connection->error);
if (!$result) {
throw new Exception('Error on reference check: '.$connection->error);
}
} catch (Exception $e) {
$has_privileges = 0;
} finally {

View File

@ -55,7 +55,7 @@ switch ($graph) {
if ($os == 'windows') {
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(httpd)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
} else {
$apache = exec("ps aux | grep apache2 | grep -v safe | grep -v grep && echo 1 || echo 0") == 1 ? "apache2" : "apache";
$apache = exec('ps aux | grep apache2 | grep -v safe | grep -v grep && echo 1 || echo 0') == 1 ? 'apache2' : 'apache';
$data = exec("ps aux | grep $apache | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'");
}
break;

View File

@ -1,4 +1,4 @@
pandorafms.vmware=3d1785e1baa07db0a40b9e47bb30472c
pandorafms.vmware=999bbda7bbcc313aee81d6816f8a5c0e
pandorafms.mysql=33d470c7492214d4b384ed307e81adf4
pandorafms.vmware=1deafce1d55d3574645d8b136104e9ad
pandorafms.mysql=ca7dd8b80a1a03a25eb0fb077818ad63

View File

@ -7,6 +7,7 @@ prepare stmt from @sqlstmt;
execute stmt;
DROP TABLE IF EXISTS tskin;
DROP TABLE IF EXISTS tnetwork_matrix;
ALTER TABLE tfavmenu_user CONVERT TO CHARACTER SET UTF8MB4;
ALTER TABLE tfiles_repo CONVERT TO CHARACTER SET UTF8MB4;
@ -15,6 +16,8 @@ ALTER TABLE tfiles_repo_group CONVERT TO CHARACTER SET UTF8MB4;
ALTER TABLE `tusuario`
ADD COLUMN `stop_lts_modal` TINYINT NOT NULL DEFAULT 0 AFTER `session_max_time_expire`;
ALTER TABLE `tlayout_template` ADD COLUMN `create_from` INT UNSIGNED NOT NULL DEFAULT 0;
-- START MIGRATION MSSQL --
SET @current_app_type = 12;
SET @short_name = 'pandorafms.mssql';
@ -7759,4 +7762,14 @@ SET @short_name = 'pandorafms.proxmox';
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
UPDATE `tdiscovery_apps_executions` SET `execution` = '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileProxmox_&#039;' WHERE `id_app` = @id_app;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('JWT_signature', 1);
DELETE FROM tconfig WHERE `token` = 'loginhash_pwd';
UPDATE `tdiscovery_apps` SET `version` = '1.5' WHERE `short_name` = 'pandorafms.vmware';
-- Delete Create incident from event, from tevent_response
DELETE FROM tevent_response WHERE name = 'Create&#x20;incident&#x20;from&#x20;event';
UPDATE tconfig_os SET `name` = 'Web&#x20;Server' WHERE `id_os` = 12;
COMMIT;

View File

@ -22,14 +22,18 @@ $msg = __(
$msg .= '<br><br>'.__("There are two types of graphs: The agent's automated graphs and the graphs the user customizes by using one or more modules to do so.");
$url_new = 'index.php?sec=reporting&sec2=godmode/reporting/graph_builder';
$button = '<form action="'.$url_new.'" method="post">
<input type="submit" class="button_task button_task_mini mrgn_0px_imp" value="'.__('Create custom graph').'" />
</form>';
$button = '';
echo ui_print_empty_view(
__('Create custom graph'),
$msg,
'custom-graph.svg',
$button
);
if (check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) {
$url_new = 'index.php?sec=reporting&sec2=godmode/reporting/graph_builder';
$button = '<form action="'.$url_new.'" method="post">
<input type="submit" class="button_task button_task_mini mrgn_0px_imp" value="'.__('Create custom graph').'" />
</form>';
}
echo ui_print_empty_view(
__('Create custom graph'),
$msg,
'custom-graph.svg',
$button
);

View File

@ -363,20 +363,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$display_counter = 'display:none';
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$header_setup .= '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general').'">';
$header_setup .= html_print_image(
'images/configuration@svg.svg',
true,
[
'alt' => __('Setup'),
'class' => 'bot invert_filter main_menu_icon',
'title' => __('Setup'),
]
);
$header_setup .= '</a></div>';
}
$header_autorefresh = '<div id="header_autorefresh">';
$header_autorefresh .= $autorefresh_link_open_img;
$header_autorefresh .= $autorefresh_img;
@ -391,6 +377,20 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_autorefresh_counter .= '</div>';
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$header_setup .= '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general').'">';
$header_setup .= html_print_image(
'images/configuration@svg.svg',
true,
[
'alt' => __('Setup'),
'class' => 'bot invert_filter main_menu_icon',
'title' => __('Setup'),
]
);
$header_setup .= '</a></div>';
}
$modal_box = '<div id="modal_help" class="invisible">
<div id="modal-feedback-form" class="invisible"></div>
<div id="msg-header" class="invisible"></div>

View File

@ -1065,6 +1065,7 @@ if ($update_agent) {
}
$field_values = [];
$update_custom_result = false;
foreach ($fields as $field) {
$field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
@ -1115,7 +1116,7 @@ if ($update_agent) {
);
if ($update_custom == 1) {
$update_custom_result = 1;
$update_custom_result = true;
}
}
}
@ -1157,6 +1158,7 @@ if ($update_agent) {
}
}
$agent_data = agents_get_agent($id_agente);
$values = [
'disabled' => $disabled,
'id_parent' => $id_parent,
@ -1184,6 +1186,14 @@ if ($update_agent) {
'vul_scan_enabled' => $vul_scan_enabled,
'ignore_unknown' => $ignore_unknown,
];
// Update change fix on ticket 13501 to no show errors when press button update with out change anything.
$update_change = false;
foreach ($values as $key => $value) {
if (isset($agent_data[$key]) === true && $agent_data[$key] !== $value) {
$update_agent = true;
break;
}
}
if (empty($repeated_name) === true) {
$values['nombre'] = $nombre_agente;
@ -1195,7 +1205,7 @@ if ($update_agent) {
}
$result = (bool) db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]);
if ($result === false && $update_custom_result == false) {
if ($result === false && $update_custom_result === false && $update_change === true) {
ui_print_error_message(
__('There was a problem updating the agent')
);

View File

@ -566,10 +566,10 @@ if ($search != '') {
if ($id != '') {
$aux = $id[0]['id_agent'];
$search_sql = sprintf(
' AND ( REPLACE(nombre, "&#x20;", " ") LIKE "%%%s%%"
OR REPLACE(alias, "&#x20;", " ") LIKE "%%%s%%"
OR REPLACE(comentarios, "&#x20;", " ") LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, "&#x20;", " ") LIKE "%%%s%%")
' AND ( nombre LIKE "%%%s%%"
OR alias LIKE "%%%s%%"
OR comentarios LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%")
OR tagente.id_agente = %d',
$search,
$search,
@ -591,10 +591,10 @@ if ($search != '') {
$search_sql .= ')';
} else {
$search_sql = sprintf(
' AND ( REPLACE(nombre, "&#x20;", " ")
LIKE "%%%s%%" OR REPLACE(alias, "&#x20;", " ")
LIKE "%%%s%%" OR REPLACE(comentarios, "&#x20;", " ") LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, "&#x20;", " ") LIKE "%%%s%%"))',
' AND ( nombre
LIKE "%%%s%%" OR alias
LIKE "%%%s%%" OR comentarios LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%"))',
$search,
$search,
$search,
@ -763,7 +763,7 @@ if ($agents !== false) {
$agent['id_agente']
);
$agentViewUrl = sprintf(
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s',
'index.php?sec=estado&sec2=godmode/agentes/configurar_agente&id_agente=%s',
$agent['id_agente']
);
$agentAlertUrl = sprintf(

View File

@ -906,7 +906,8 @@ $table->data[0][] = html_print_label_input_block(
false,
true,
'',
$disabled_in_execution
$disabled_in_execution,
'width: 100%;'
)
);
@ -939,8 +940,9 @@ $table->data[1][] = html_print_label_input_block(
true,
false,
true,
'',
$disabled_in_execution
'w100p',
$disabled_in_execution,
'width: 100%;'
).ui_print_input_placeholder(
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'),
true
@ -964,7 +966,8 @@ $table->data[2][] = html_print_label_input_block(
false,
true,
'',
$disabled_in_execution
$disabled_in_execution,
'width: 100%;'
)
);

View File

@ -294,10 +294,14 @@ $(document).ready (function () {
// configure your validation
$("form.add_alert_form").validate({
rules: {
id_agent_module: { valueNotEquals: "0" }
id_agent_module: { valueNotEquals: "0" },
template: { valueNotEquals: "0" },
id_agent: { valueNotEquals: "" },
},
messages: {
id_agent_module: { valueNotEquals: "Please select an item!" }
id_agent_module: { valueNotEquals: "<?php echo __('Please select an item'); ?>!"},
template: { valueNotEquals: "<?php echo __('Please select a templete'); ?>!"},
id_agent: { valueNotEquals: "<?php echo __('Please select an agent'); ?>!"},
}
});
$("select#template").change (function () {

View File

@ -220,7 +220,6 @@ if ($create_alert) {
if (is_metaconsole()) {
// Restore db connection.
metaconsole_restore_db();
echo '<script>window.location.assign("index.php?sec=estado&sec2=operation/agentes/alerts_status")</script>';
}
}

View File

@ -437,7 +437,7 @@ if ($is_management_allowed === true
$icon = (string) get_parameter('icon');
$id_parent = (int) get_parameter('id_parent');
$group_pass = (string) get_parameter('group_pass');
$alerts_disabled = (bool) get_parameter('alerts_disabled');
$alerts_disabled = (bool) get_parameter_switch('alerts_enabled', 0);
$custom_id = (string) get_parameter('custom_id');
$description = (string) get_parameter('description');
$contact = (string) get_parameter('contact');
@ -459,7 +459,7 @@ if ($is_management_allowed === true
'nombre' => $name,
'icon' => $icon,
'parent' => $id_parent,
'disabled' => $alerts_disabled,
'disabled' => !$alerts_disabled,
'custom_id' => $custom_id,
'description' => $description,
'contact' => $contact,
@ -493,7 +493,7 @@ if ($is_management_allowed === true && $update_group === true) {
$id_parent = (int) get_parameter('id_parent');
$description = (string) get_parameter('description');
$group_pass = (string) get_parameter('group_pass');
$alerts_enabled = (bool) get_parameter('alerts_enabled');
$alerts_enabled = (bool) get_parameter_switch('alerts_enabled', 0);
$custom_id = (string) get_parameter('custom_id');
$propagate = (bool) get_parameter('propagate');
$description = (string) get_parameter('description');
@ -1108,7 +1108,7 @@ if ($tab == 'tree') {
// Reporting_get_group_stats.
$table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
$table->data[$key][3] = ($group['disabled'] === '1') ? __('Disabled') : __('Enabled');
$table->data[$key][4] = $group['parent_name'];
$table->data[$key][5] = $group['description'];
if ($is_management_allowed === true) {

View File

@ -154,14 +154,16 @@ $table->data[0][1] = html_print_label_input_block(
echo '<span id ="none_text" class="invisible">'.__('None').'</span>';
echo "<form id='agentmodules' method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&add_module=1&edit_graph=1&id=".$id_graph."'>";
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters max_floating_element_size'>";
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters max_floating_element_size custom-graph-editor'>";
echo '<tr>';
echo '<td class="w50p pdd_50px" id="select_multiple_modules_filtered">'.html_print_input(
[
'type' => 'select_multiple_modules_filtered',
'uniqId' => 'modules',
'class' => 'flex flex-row',
'searchBar' => false,
'searchBar' => true,
'searchBarAgents' => false,
'searchBarModules' => true,
'placeholderAgents' => __('Search agent name'),
]
).'</td>';

View File

@ -481,7 +481,7 @@ if (!empty($graphs)) {
$ActionButtons[] = '</form>';
}
if (!empty($result_graphs)) {
if (!empty($result_graphs) && ($report_w || $report_m)) {
$ActionButtons[] = "<form method='post' id='form_delete' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
$ActionButtons[] = html_print_input_hidden('multiple_delete', 1, true);
$ActionButtons[] = html_print_submit_button(

View File

@ -1362,12 +1362,12 @@ $class = 'databox filters';
$result_select = [];
foreach ($os as $item) {
foreach ($os_list as $item) {
$result_select[$item['id_os']] = $item['name'];
}
html_print_select(
$os_list,
$result_select,
'os_selector',
$os_selector,
''
@ -1459,7 +1459,7 @@ $class = 'databox filters';
<td class="bolder">
<?php
echo __('Module').ui_print_help_tip(
__('Case insensitive regular expression or string for module name. For example: if you use this field with "Module exact match" enabled then this field has to be fulfilled with the literally string of the module name, if not you can use a regular expression. Example: %s will match: cpu_usage, vram usage in matchine 1.', '.*usage.*'),
__('Case insensitive regular expression or string for module name. For example: if you use this field with "Module exact match" enabled then this field has to be fulfilled with the literally string of the module name, if not you can use a regular expression. Example: %s will match: cpu_usage, vram usage in machine 1.', '.*usage.*'),
true
);
?>
@ -2318,7 +2318,9 @@ if (is_metaconsole() === true) {
$params['add_none_module'] = true;
$params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-id_agent';
$params['size'] = 40;
if ($meta) {
$params['size'] = 44;
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-server_id';
$params['metaconsole_enabled'] = true;
@ -2755,14 +2757,16 @@ if (is_metaconsole() === true) {
<td class="bolder"><?php echo __('Date'); ?></td>
<td class="mx180px">
<?php
$dates = enterprise_hook(
'inventory_get_dates',
[
$idAgentModule,
$idAgent,
$group,
]
);
if (isset($idAgent) === true) {
$dates = enterprise_hook(
'inventory_get_dates',
[
$idAgentModule,
$idAgent,
$group,
]
);
}
if ($dates === ENTERPRISE_NOT_HOOK) {
$dates = [];
@ -6645,26 +6649,6 @@ function create_custom_graph() {
$("#meta_target_servers").css('display', 'inline');
}
else {
var hash_data;
var params1 = [];
params1.push("get_metaconsole_hash_data=1");
params1.push("server_name=" + target_server);
params1.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(false, false, false, false).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
hash_data = data;
}
});
var server_url;
var params1 = [];
params1.push("get_metaconsole_server_url=1");
@ -6690,7 +6674,7 @@ function create_custom_graph() {
}
});
window.location.href = server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&create=Create graph" + hash_data;
redirectNode(server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&create=Create graph", "_self");
}
<?php
} else {
@ -6719,31 +6703,6 @@ function edit_custom_graph() {
id_server = agent_server_temp[1];
}
var hash_data;
var params1 = [];
params1.push("get_metaconsole_hash_data=1");
params1.push("server_name=" + id_server);
params1.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
hash_data = data;
}
});
var server_url;
var params1 = [];
params1.push("get_metaconsole_server_url=1");
@ -6769,7 +6728,7 @@ function edit_custom_graph() {
}
});
window.location.href = server_url + "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data;
redirectNode(server_url + "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph, "_self");
<?php
} else {
?>

View File

@ -870,7 +870,7 @@ switch ($action) {
// ui_pagination($total_reports, $url, $offset, $pagination);
$table = new stdClass();
$table->id = 'report_list';
$table->styleTable = 'margin: 0 10px;';
$table->styleTable = '';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;

View File

@ -260,9 +260,8 @@ $layoutSizeElements[] = html_print_button(
false,
'',
[
'icon' => 'cog',
'mode' => 'link',
'value' => 'modsize',
'class' => 'buttonButton mini',
],
true
);
@ -275,9 +274,8 @@ $layoutSizeElements[] = html_print_button(
false,
'',
[
'icon' => 'cog',
'mode' => 'link',
'value' => 'modsize',
'class' => 'buttonButton mini',
],
true
);
@ -287,7 +285,7 @@ $table->data[4][] = html_print_label_input_block(
__('Layout size'),
html_print_div(
[
'class' => 'flex flex-items-center',
'class' => 'flex flex-space-around w600px',
'content' => implode('', $layoutSizeElements),
],
true

View File

@ -121,6 +121,7 @@ if ($upload_file === true) {
MIME_TYPES['jpg'],
MIME_TYPES['png'],
MIME_TYPES['gif'],
MIME_TYPES['svg'],
]
);
}

View File

@ -219,7 +219,9 @@ echo '<div id="aux" class="invisible"></div>';
$('#aux').text('<?php echo __('Not deleted. Error deleting data'); ?>');
} else {
$('#aux').dialog('close');
location.reload();
let url = new URL(window.location.href);
url.searchParams.set('message', r.url_message)
window.location.href = url.href;
}
},
error: function(e) {

View File

@ -196,14 +196,20 @@ if (is_ajax() === true) {
$row['name'] = __('Admin LDAP password');
$row['control'] = html_print_input_password(
'ldap_admin_pass',
io_output_password($config['ldap_admin_pass']),
(empty(io_output_password($config['ldap_admin_pass'])) === false) ? '*****' : '',
$alt = '',
60,
100,
true,
false,
false,
'w400px-important'
'w400px-important',
'on',
false,
'',
true,
false,
true
);
$table->data['ldap_admin_pass'] = $row;
@ -356,14 +362,20 @@ if (is_ajax() === true) {
$row['name'] = __('Admin secondary LDAP password');
$row['control'] = html_print_input_password(
'ldap_admin_pass_secondary',
io_output_password($config['ldap_admin_pass_secondary']),
(empty(io_output_password($config['ldap_admin_pass_secondary'])) === false) ? '*****' : '',
$alt = '',
60,
100,
true,
false,
false,
'w400px-important'
'w400px-important',
'on',
false,
'',
true,
false,
true
);
$table->data['ldap_admin_pass_secondary'] = $row;
break;

View File

@ -267,18 +267,6 @@ $table->data[$i][] = html_print_label_input_block(
);
$table->data[$i++][] = html_print_label_input_block(
__('Auto login (hash) password'),
html_print_input_password(
'loginhash_pwd',
io_output_password($config['loginhash_pwd']),
'',
15,
15,
true
)
);
$table->data[$i][] = html_print_label_input_block(
__('Time source'),
html_print_select(
$sources,

View File

@ -160,6 +160,16 @@ class ManageExtensions extends HTML
public function run()
{
global $config;
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Manage disco packages'
);
include 'general/noaccess.php';
return;
}
// Load styles.
parent::run();
@ -278,52 +288,54 @@ class ManageExtensions extends HTML
$this->printHeader(true)
);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->size = [];
$table->size[0] = '80%';
$table->align[3] = 'right';
$table->data = [];
$table->data[0][0] = html_print_label_input_block(
__('Load DISCO'),
html_print_div(
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->size = [];
$table->size[0] = '80%';
$table->align[3] = 'right';
$table->data = [];
$table->data[0][0] = html_print_label_input_block(
__('Load DISCO'),
html_print_div(
[
'id' => 'upload_file',
'content' => html_print_input_file(
'file',
true,
['style' => 'width:100%']
),
'class' => 'mrgn_top_15px',
],
true
)
);
$table->data[0][3] = html_print_submit_button(
__('Upload DISCO'),
'upload_button',
false,
[
'id' => 'upload_file',
'content' => html_print_input_file(
'file',
true,
['style' => 'width:100%']
),
'class' => 'mrgn_top_15px',
'class' => 'sub ok float-right',
'icon' => 'next',
],
true
)
);
$table->data[0][3] = html_print_submit_button(
__('Upload DISCO'),
'upload_button',
false,
[
'class' => 'sub ok float-right',
'icon' => 'next',
],
true
);
);
echo '<form id="uploadExtension" enctype="multipart/form-data" action="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=magextensions" method="POST">';
html_print_input_hidden('upload_disco', 1);
html_print_table($table);
// Auxiliar div ant string for migrate modal.
$modal = '<div id="migrate_modal" class="invisible"></div>';
$modal .= '<div class="invisible" id="msg"></div>';
echo '<form id="uploadExtension" enctype="multipart/form-data" action="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=magextensions" method="POST">';
html_print_input_hidden('upload_disco', 1);
html_print_table($table);
// Auxiliar div ant string for migrate modal.
$modal = '<div id="migrate_modal" class="invisible"></div>';
$modal .= '<div class="invisible" id="msg"></div>';
echo $modal;
echo $modal;
echo '<div class="action-buttons w700px">';
echo '<div class="action-buttons w700px">';
echo '</div>';
echo '</form>';
echo '</div>';
echo '</form>';
}
echo '<script type="text/javascript">
var page = "'.$this->ajaxController.'";
@ -366,7 +378,7 @@ class ManageExtensions extends HTML
ui_print_datatable(
[
'id' => 'list_extensions',
'class' => 'info_table',
'class' => 'info_table discovery-list-extensions',
'style' => 'width: 99%',
'dom_elements' => 'plfti',
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
@ -723,39 +735,45 @@ class ManageExtensions extends HTML
$data[$key]['short_name'] = $row['short_name'];
$data[$key]['description'] = io_safe_output($row['description']);
$data[$key]['version'] = $row['version'];
$data[$key]['actions'] = '<form name="grupo" method="post" class="rowPair table_action_buttons" action="'.$this->url.'&action=delete">';
$data[$key]['actions'] .= html_print_input_image(
'button_delete',
'images/delete.svg',
'',
'',
true,
[
'onclick' => 'if (!confirm(\''.__('Deleting this application will also delete all the discovery tasks using it. Do you want to delete it?').'\')) return false;',
'class' => 'main_menu_icon invert_filter action_button_hidden',
'title' => 'Delete',
]
);
$data[$key]['actions'] .= html_print_input_hidden('short_name', $row['short_name'], true);
$data[$key]['actions'] .= '</form>';
if ($this->checkFolderConsole($row['short_name']) === true) {
$data[$key]['actions'] .= '<form name="grupo" method="post" class="rowPair table_action_buttons" action="'.$this->url.'&action=sync_server">';
$data[$key]['actions'] = '';
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$data[$key]['actions'] .= '<form name="grupo" method="post" class="rowPair table_action_buttons" action="'.$this->url.'&action=delete">';
$data[$key]['actions'] .= html_print_input_image(
'button_refresh',
'images/refresh@svg.svg',
'button_delete',
'images/delete.svg',
'',
'',
true,
[
'onclick' => 'if (!confirm(\''.__('Are you sure you want to reapply?').'\')) return false;',
'onclick' => 'if (!confirm(\''.__('Deleting this application will also delete all the discovery tasks using it. Do you want to delete it?').'\')) return false;',
'class' => 'main_menu_icon invert_filter action_button_hidden',
'title' => 'Refresh',
'title' => 'Delete',
]
);
$data[$key]['actions'] .= html_print_input_hidden('sync_action', 'refresh', true);
$data[$key]['actions'] .= html_print_input_hidden('short_name', $row['short_name'], true);
$data[$key]['actions'] .= '</form>';
}
if ($this->checkFolderConsole($row['short_name']) === true) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$data[$key]['actions'] .= '<form name="grupo" method="post" class="rowPair table_action_buttons" action="'.$this->url.'&action=sync_server">';
$data[$key]['actions'] .= html_print_input_image(
'button_refresh',
'images/refresh@svg.svg',
'',
'',
true,
[
'onclick' => 'if (!confirm(\''.__('Are you sure you want to reapply?').'\')) return false;',
'class' => 'main_menu_icon invert_filter action_button_hidden',
'title' => 'Refresh',
]
);
$data[$key]['actions'] .= html_print_input_hidden('sync_action', 'refresh', true);
$data[$key]['actions'] .= html_print_input_hidden('short_name', $row['short_name'], true);
$data[$key]['actions'] .= '</form>';
}
} else {
$data[$key]['actions'] .= html_print_image(
'images/error_red.png',

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>loop v2@svg</title>
<g id="loop-v2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" fill="#3F3F3F">
<path d="M20,10 C20,14.418278 16.418278,18 12,18 L11,18 L11,16 L12,16 C15.3137085,16 18,13.3137085 18,10 C18,6.92328108 15.6842046,4.38744515 12.7005882,4.04046651 L14,3 L12.7999684,2.03949706 C16.8426417,2.44086199 20,5.85171073 20,10 Z M9,2 L9,4 L8,4 C4.6862915,4 2,6.6862915 2,10 C2,13.0774099 4.31683558,15.6136938 7.30142194,15.9597669 L6,17 L7.19902859,17.9604033 C3.15683607,17.5585739 0,14.1479462 0,10 C0,5.581722 3.581722,2 8,2 L9,2 Z" id="Path-107" transform="translate(10, 10) scale(-1, -1) translate(-10, -10)"></path>
<polygon id="Path-106" points="8 0 8 6 12 3"></polygon>
<polygon id="Path-106" transform="translate(10, 17) scale(-1, 1) translate(-10, -17)" points="8 14 8 20 12 17"></polygon>
</g>
<path d="M0.292893219,0.292893219 C0.683417511,-0.0976310729 1.31658249,-0.0976310729 1.70710678,0.292893219 L1.79912396,0.384910402 C1.85821492,0.444001355 1.91326052,0.499046961 1.96703474,0.552821173 L2.08705149,0.672837932 C2.1271221,0.712908533 2.1676478,0.753434236 2.20979886,0.795585301 L2.38984567,0.975632111 C2.40603428,0.99182072 2.42257686,1.0083633 2.43951675,1.02530319 L2.94454935,1.53033579 C2.99669098,1.58247741 3.05180882,1.63759526 3.11024963,1.69603607 L4.94491536,3.5307018 C5.06686811,3.65265454 5.19457102,3.78035746 5.32837086,3.91415729 L5.97279454,4.55858098 L6.20710678,4.79289322 C6.53523178,5.12101822 6.84284897,5.42863541 7.13325424,5.71904068 L7.5563652,6.14215164 C7.62486954,6.21065598 7.69240112,6.27818756 7.75901146,6.3447979 L8.33502121,6.92080765 C8.39656754,6.98235397 8.45734711,7.04313354 8.51741142,7.10319786 L8.86962624,7.45541267 C8.92703552,7.51282196 8.98383255,7.56961899 9.04006882,7.62585525 L9.37116928,7.95695572 C9.4253685,8.01115494 9.47910996,8.06489639 9.53244514,8.11823158 L10.9113152,9.49710159 C11.0117027,9.59748917 11.1123192,9.69810562 11.2135765,9.79936295 L11.6749508,10.2607372 C11.7790577,10.3648441 11.8844234,10.4702099 11.99146,10.5772465 L12.4857933,11.0715797 C12.7117455,11.2975319 12.9468529,11.5326393 13.1944115,11.7801979 L14.4035942,12.9893806 C14.7690041,13.3547905 15.1615936,13.7473801 15.5878002,14.1735867 L17.2784931,15.8642796 C17.5881874,16.1739738 17.9127647,16.4985512 18.2536156,16.839402 L19.326379,17.9121655 L19.7071068,18.2928932 C20.0976311,18.6834175 20.0976311,19.3165825 19.7071068,19.7071068 C19.3165825,20.0976311 18.6834175,20.0976311 18.2928932,19.7071068 C18.163987,19.5782005 18.0370949,19.4513084 17.9121655,19.326379 L16.839402,18.2536156 C16.4985512,17.9127647 16.1739738,17.5881874 15.8642796,17.2784931 L14.1735867,15.5878002 C13.7473801,15.1615936 13.3547905,14.7690041 12.9893806,14.4035942 L11.7801979,13.1944115 C11.5326393,12.9468529 11.2975319,12.7117455 11.0715797,12.4857933 L10.5772465,11.99146 C10.4702099,11.8844234 10.3648441,11.7790577 10.2607372,11.6749508 L9.79936295,11.2135765 C9.69810562,11.1123192 9.59748917,11.0117027 9.49710159,10.9113152 L8.11823158,9.53244514 C8.06489639,9.47910996 8.01115494,9.4253685 7.95695572,9.37116928 L7.62585525,9.04006882 C7.56961899,8.98383255 7.51282196,8.92703552 7.45541267,8.86962624 L7.10319786,8.51741142 C7.04313354,8.45734711 6.98235397,8.39656754 6.92080765,8.33502121 L6.3447979,7.75901146 C6.27818756,7.69240112 6.21065598,7.62486954 6.14215164,7.5563652 L5.71904068,7.13325424 C5.42863541,6.84284897 5.12101822,6.53523178 4.79289322,6.20710678 C4.71310598,6.12731955 4.63501635,6.04922991 4.55858098,5.97279454 L3.91415729,5.32837086 C3.78035746,5.19457102 3.65265454,5.06686811 3.5307018,4.94491536 L1.69603607,3.11024963 C1.63759526,3.05180882 1.58247741,2.99669098 1.53033579,2.94454935 L1.02530319,2.43951675 C1.0083633,2.42257686 0.99182072,2.40603428 0.975632111,2.38984567 L0.795585301,2.20979886 C0.753434236,2.1676478 0.712908533,2.1271221 0.672837932,2.08705149 L0.552821173,1.96703474 C0.499046961,1.91326052 0.444001355,1.85821492 0.384910402,1.79912396 L0.292893219,1.70710678 C-0.0976310729,1.31658249 -0.0976310729,0.683417511 0.292893219,0.292893219 Z" id="Path-99" fill="#3F3F3F" fill-rule="nonzero"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -1,11 +1,13 @@
<svg>
<g id="zoom_default">
<g>
<g id="zoom_default">
<g>
<path fill="#999999" d="M29,21.915c0,3.895-3.189,7.086-7.087,7.086H7.087C3.191,29.001,0,25.812,0,21.915V7.088
C0,3.19,3.188,0,7.087,0h14.826C25.809,0,29,3.188,29,7.088V21.915z"/>
<g>
<path fill="#999999"
d="M29,21.915c0,3.895-3.189,7.086-7.087,7.086H7.087C3.191,29.001,0,25.812,0,21.915V7.088
C0,3.19,3.188,0,7.087,0h14.826C25.809,0,29,3.188,29,7.088V21.915z" />
</g>
</g>
<text transform="matrix(1 0 0 1 8.0737 21.2432)" fill="#FFFFFF" font-size="19" x="2" y="-3">
D</text>
</g>
<text transform="matrix(1 0 0 1 8.0737 21.2432)" fill="#FFFFFF" font-size="19">D</text>
</g>
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 381 B

View File

@ -328,23 +328,6 @@ if (check_login()) {
if (isset($array_nodes) && is_array($array_nodes)) {
$hash_array_nodes = [];
foreach ($array_nodes as $key => $server) {
$pwd = $server['auth_token'];
$auth_serialized = json_decode($pwd, true);
if (is_array($auth_serialized)) {
$pwd = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$user = $config['id_user'];
$user_rot13 = str_rot13($config['id_user']);
$hashdata = $user.$pwd;
$hashdata = md5($hashdata);
$url_hash = '&amp;loginhash=auto&amp;loginhash_data='.$hashdata.'&amp;loginhash_user='.$user_rot13;
$hash_array_nodes[$server['id']]['hashurl'] = $url_hash;
$hash_array_nodes[$server['id']]['server_url'] = $server['server_url'];
}
}
@ -355,7 +338,7 @@ if (check_login()) {
$image_status = agents_get_image_status($values['status']);
// Link nodes.
if (is_metaconsole() === true) {
$agent_link = '<a href="'.$hash_array_nodes[$values['id_tmetaconsole_setup']]['server_url'].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$values['id_tagente'].$hash_array_nodes[$values['id_tmetaconsole_setup']]['hashurl'].'">';
$agent_link = '<a href="#" onclick="redirectNode(\''.$hash_array_nodes[$values['id_tmetaconsole_setup']]['server_url'].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$values['id_tagente'].'\')">';
$agent_alias = ui_print_truncate_text(
$values['alias'],
'agent_small',

View File

@ -1205,9 +1205,11 @@ if ($get_response === true) {
if (empty($event_id) === false) {
try {
$target_metaconsole = '';
if (is_metaconsole() === true
&& $server_id > 0
) {
$target_metaconsole = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
$node = new Node($server_id);
$node->connect();
}
@ -1217,7 +1219,8 @@ if ($get_response === true) {
$event_response,
$response_parameters,
$server_id,
($server_id !== 0) ? $node->server_name() : 'Metaconsole'
($server_id !== 0) ? $node->server_name() : 'Metaconsole',
$target_metaconsole
);
} catch (\Exception $e) {
// Unexistent agent.
@ -2541,7 +2544,7 @@ if ($drawConsoleSound === true) {
true,
[
'title' => __('No alerts discovered'),
'class' => 'invert_filter',
'class' => '',
]
);
$output .= '<span class="text-discovered-alerts">';

View File

@ -55,6 +55,7 @@ if (check_login()) {
$get_id_tag = (bool) get_parameter('get_id_tag', 0);
$get_type = (bool) get_parameter('get_type', 0);
$list_modules = (bool) get_parameter('list_modules', 0);
$list_snmp_modules = (bool) get_parameter('list_snmp_modules', 0);
$get_agent_modules_json_by_name = (bool) get_parameter(
'get_agent_modules_json_by_name',
0
@ -1538,6 +1539,133 @@ if (check_login()) {
unset($table_data);
}
if ($list_snmp_modules) {
include_once $config['homedir'].'/include/functions_graph.php';
$agent = get_parameter('agent');
$id_agente = $agent;
$paginate_module = false;
if (isset($config['paginate_module']) === true) {
$paginate_module = (bool) $config['paginate_module'];
}
$network_interfaces_by_agents = agents_get_network_interfaces([$agent], false, $paginate_module, get_parameter('offset', 0));
$count_network_incerfaces = agents_get_network_interfaces([$agent], false, false, 0, true);
$network_interfaces = [];
if (empty($network_interfaces_by_agents) === false && empty($network_interfaces_by_agents[$id_agente]) === false) {
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
}
if (empty($network_interfaces) === false) {
$table_interface = new stdClass();
$table_interface->id = 'agent_interface_info';
$table_interface->class = 'info_table';
$table_interface->width = '100%';
$table_interface->style = [];
$table_interface->style['interface_event_graph'] = 'width: 35%;';
$table_interface->head = [];
$options = [
'class' => 'closed',
'style' => 'cursor:pointer;',
];
$table_interface->data = [];
$event_text_cont = 0;
foreach ($network_interfaces as $interface_name => $interface) {
if (empty($interface['traffic']) === false) {
$permission = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR');
if ($permission) {
$params = [
'interface_name' => $interface_name,
'agent_id' => $id_agente,
'traffic_module_in' => $interface['traffic']['in'],
'traffic_module_out' => $interface['traffic']['out'],
];
$params_json = json_encode($params);
$params_encoded = base64_encode($params_json);
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
$graph_link = "<a href=\"javascript:winopeng_var('operation/agentes/interface_traffic_graph_win.php?params=";
$graph_link .= $params_encoded."','";
$graph_link .= $win_handle."', 800, 480)\">";
$graph_link .= html_print_image(
'images/chart.png',
true,
[
'title' => __('Interface traffic'),
'class' => 'invert_filter',
]
).'</a>';
} else {
$graph_link = '';
}
} else {
$graph_link = '';
}
$content = [
'id_agent_module' => $interface['status_module_id'],
'id_group' => $id_group,
'period' => SECONDS_1DAY,
'time_from' => '00:00:00',
'time_to' => '00:00:00',
'sizeForTicks' => 250,
'height_graph' => 40,
[
['id_agent_module' => $interface['status_module_id']],
]
];
$e_graph = \reporting_module_histogram_graph(
['datetime' => time()],
$content
);
$sqlLast_contact = sprintf(
'
SELECT timestamp
FROM tagente_estado
WHERE id_agente_modulo = '.$interface['status_module_id']
);
$last_contact = db_get_all_rows_sql($sqlLast_contact);
$last_contact = array_shift($last_contact);
$last_contact = array_shift($last_contact);
$data = [];
$data['interface_name'] = '<strong>'.$interface_name.'</strong>';
$data['interface_status'] = $interface['status_image'];
$data['interface_graph'] = $graph_link;
$data['interface_ip'] = $interface['ip'];
$data['interface_mac'] = $interface['mac'];
$data['last_contact'] = __('Last contact: ').$last_contact;
$data['interface_event_graph'] = $e_graph['chart'];
$table_interface->data[] = $data;
}
if ($paginate_module === true) {
ui_pagination(
$count_network_incerfaces,
false,
0,
0,
false,
'offset',
true,
'',
'change_page_snmp(offset_param)',
[
'count' => '',
'offset' => 'offset_param',
]
);
}
html_print_table($table_interface);
}
}
if ($get_type === true) {
$id_module = (int) get_parameter('id_module');
$module = modules_get_agentmodule($id_module);

View File

@ -37,7 +37,7 @@ if ($change_label === '1') {
$label = get_parameter('label', '');
$source = get_parameter('source', 0);
$user = get_parameter('user', '');
$value = get_parameter('value', 0) ? 1 : 0;
$value = get_parameter('value', 0);
$user_info = get_user_info($config['id_user']);
if ((bool) $user_info['is_admin'] === false && $config['id_user'] !== $user) {
return false;

View File

@ -60,7 +60,12 @@ if ($method === 'deleteOS') {
) {
echo json_encode(['deleted' => false]);
} else {
echo json_encode(['deleted' => true]);
echo json_encode(
[
'deleted' => true,
'url_message' => 6,
]
);
}
}

View File

@ -37,7 +37,6 @@ $add_sla = get_parameter('add_sla', 0);
$add_general = get_parameter('add_general', 0);
$id = get_parameter('id', 0);
$truncate_text = get_parameter('truncate_text', 0);
$get_metaconsole_hash_data = get_parameter('get_metaconsole_hash_data', 0);
$get_metaconsole_server_url = get_parameter('get_metaconsole_server_url', 0);
$change_custom_fields_macros_report = (bool) get_parameter(
'change_custom_fields_macros_report',
@ -186,37 +185,6 @@ if ($truncate_text) {
return ui_print_truncate_text($text, GENERIC_SIZE_TEXT, true, false);
}
if ($get_metaconsole_hash_data) {
$server_name = get_parameter('server_name');
enterprise_include_once('include/functions_metaconsole.php');
$server = enterprise_hook('metaconsole_get_connection', [$server_name]);
// Bad data
if (empty($server)) {
echo '';
return;
}
// Deserialization of auth_token
$auth_serialized = json_decode($server['auth_token'], true);
$auth_token = '';
if (is_array($auth_serialized)) {
$auth_token = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$url_hash = metaconsole_get_servers_url_hash($server);
echo $url_hash;
return;
}
if ($get_metaconsole_server_url) {
$server_name = get_parameter('server_name');

View File

@ -145,6 +145,11 @@ if ($create_net_scan) {
}
if ($create_mail_alert) {
if ((bool) check_acl($config['id_user'], 0, 'LM') === false) {
ui_print_error_message(__('Unauthorized'));
return;
}
include_once '../functions_alerts.php';
$id_action = db_get_row_filter('talert_actions', ['name' => 'Email to '.$config['id_user']], 'id')['id'];
if (!$id_action) {

View File

@ -26,11 +26,14 @@
* ============================================================================
*/
global $config;
require_once $config['homedir'].'/include/class/JWTRepository.class.php';
$list_user_tokens = (bool) get_parameter('list_user_tokens');
$get_jwt_for_login = (bool) get_parameter('get_jwt_for_login', false);
// Tokens for api 2.0.
if ($list_user_tokens === true) {
global $config;
// Datatables offset, limit and order.
$filter = get_parameter('filter', []);
$page = (int) get_parameter('start', 0);
@ -162,3 +165,20 @@ if ($list_user_tokens === true) {
return;
}
// Token for JWT auth in metaconsole.
if ($get_jwt_for_login === true) {
if (is_metaconsole() === true
&& ((bool) users_is_admin($config['id_user']) === true || (bool) can_user_access_node() === true)
&& empty($config['JWT_signature']) === false
) {
$jwtRepository = new JWTRepository($config['JWT_signature']);
$token = $jwtRepository->create();
echo json_encode(['success' => true, 'data' => $token]);
} else {
echo json_encode(['success' => false, 'error' => 'User does not have permission or is not a metaconsole.']);
}
return;
}

View File

@ -4940,7 +4940,8 @@ class AgentWizard extends HTML
'.1.3.6.1.4.1.9.5.1.4.1.1.11.1',
$value
);
if ($valueTranslated === false && $value !== '_generic_') {
if ($valueTranslated === false) {
$duplexMismatchOID = null;
} else {
$duplexMismatchOID = '.1.3.6.1.4.1.9.5.1.4.1.1.10.1';

View File

@ -0,0 +1,225 @@
<?php
/**
* Class to JWT.
*
* @category Class
* @package Pandora FMS
* @subpackage Token
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
use Lcobucci\JWT\Configuration;
use Lcobucci\JWT\Encoding\JoseEncoder;
use Lcobucci\JWT\Signer\Hmac\Sha256;
use Lcobucci\JWT\Signer\Key\InMemory;
use Lcobucci\JWT\Token\Parser;
use Lcobucci\JWT\Validation\Constraint\SignedWith;
use Lcobucci\Clock\SystemClock;
use Lcobucci\JWT\Validation\Constraint\StrictValidAt;
enterprise_include_once('include/functions_metaconsole.php');
/**
* JWT Repository.
*/
final class JWTRepository
{
/**
* Allowed methods to be called using AJAX request.
*
* @var array
*/
public $AJAXMethods = ['create'];
/**
* Signature
*
* @var string
*/
private $signature;
/**
* Token
*
* @var Token
*/
private $token;
/**
* Constructor
*
* @param string $_signature Signature of JWT.
*/
public function __construct(string $_signature)
{
$this->signature = $_signature;
}
/**
* Checks if target method is available to be called using AJAX.
*
* @param string $method Target method.
*
* @return boolean True allowed, false not.
*/
public function ajaxMethod($method)
{
// Check access.
check_login();
return in_array($method, $this->AJAXMethods);
}
/**
* Create token
*
* @return string
*/
public function create(): string
{
global $config;
try {
$sha = new Sha256();
$configJWT = Configuration::forSymmetricSigner(
$sha,
InMemory::plainText($this->signature)
);
$now = new DateTimeImmutable();
$token = $configJWT->builder()->issuedAt($now)->canOnlyBeUsedAfter($now)->expiresAt($now->modify('+1 minute'))->withClaim('id_user', $config['id_user'])->getToken($configJWT->signer(), $configJWT->signingKey());
return $token->toString();
} catch (Exception $e) {
return '';
}
}
/**
* Validate a JWT, USE FIRST setToken().
*
* @return boolean
*/
public function validate():bool
{
try {
$sha = new Sha256();
$configJWT = Configuration::forSymmetricSigner(
$sha,
InMemory::plainText($this->signature)
);
$signed = new SignedWith($sha, InMemory::plainText($this->signature));
$now = new DateTimeZone('UTC');
$strictValid = new StrictValidAt(SystemClock::fromUTC());
$constraints = [
$signed,
$strictValid,
];
return $configJWT->validator()->validate($this->token, ...$constraints);
} catch (Exception $e) {
return false;
}
}
/**
* Get payload of token.
*
* @return object
*/
public function payload():object
{
return $this->token->claims();
}
/**
* Setting token.
*
* @param string $tokenString String token to setting.
*
* @return boolean
*/
public function setToken(string $tokenString):bool
{
try {
$encoder = new JoseEncoder();
$parser = new Parser($encoder);
$this->token = $parser->parse($tokenString);
return true;
} catch (Exception $e) {
return false;
}
}
/**
* Generate random signature.
*
* @return string
*/
public static function generateSignature(): string
{
return bin2hex(random_bytes(32));
}
/**
* Sync the signature with nodes for jwt.
*
* @param string|null $signature Signature to send nodes.
*
* @return void
*/
public static function syncSignatureWithNodes(?string $signature):void
{
if (function_exists('metaconsole_get_servers') === true
&& function_exists('metaconsole_push_conf_to_node') === true
) {
$sync_server = 0;
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
$ok_sync = metaconsole_push_conf_to_node(
$server,
[ 'JWT_signature' => $signature],
true
);
if ($ok_sync === true) {
$sync_server++;
}
}
if (is_array($servers) === true
&& count($servers) === $sync_server
&& count($servers) > 0
) {
config_update_value('JWT_signature', $signature, true);
}
}
}
}

View File

@ -85,6 +85,13 @@ class SnmpConsole extends HTML
*/
private $filter_free_search;
/**
* Filter alias.
*
* @var string
*/
private $filter_alias_search;
/**
* Filter status.
*
@ -135,7 +142,8 @@ class SnmpConsole extends HTML
int $filter_group_by,
int $filter_hours_ago,
int $filter_trap_type,
int $refr
int $refr,
string $filter_alias_search
) {
global $config;
@ -157,6 +165,7 @@ class SnmpConsole extends HTML
$this->filter_alert = $filter_alert;
$this->filter_severity = $filter_severity;
$this->filter_free_search = $filter_free_search;
$this->filter_alias_search = $filter_alias_search;
$this->filter_status = $filter_status;
$this->filter_group_by = $filter_group_by;
$this->filter_hours_ago = $filter_hours_ago;
@ -375,13 +384,21 @@ class SnmpConsole extends HTML
'style' => 'widht:100%',
],
[
'label' => __('Free search'),
'label' => __('Search').ui_print_help_tip(__('It will search through the contents of the raw trap, which does not include the agent name. You can search by the next values: IP, OID, Value, Text, Description, User ID and Source.'), true),
'type' => 'text',
'id' => 'filter_free_search',
'input_class' => 'filter_input_datatable',
'name' => 'filter_free_search',
'value' => $this->filter_free_search,
],
[
'label' => __('Search Alias').ui_print_help_tip(__('It will search by the agent alias. This option could make the system slower.'), true),
'type' => 'text',
'id' => 'filter_alias_search',
'input_class' => 'filter_input_datatable',
'name' => 'filter_alias_search',
'value' => $this->filter_alias_search,
],
[
'label' => __('Status'),
'type' => 'select',
@ -449,7 +466,7 @@ class SnmpConsole extends HTML
1000,
],
],
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar snmp-console-filter',
]
);
} catch (Exception $e) {
@ -521,7 +538,7 @@ class SnmpConsole extends HTML
$legend .= '<div style=" display : flex;align-items : center;">';
$legend .= html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).' - '.__('Delete');
$legend .= '</div>';
$legend .= '</div></div></td>';
$legend .= '</div></div></td></table>';
echo '<br>';
@ -554,10 +571,6 @@ class SnmpConsole extends HTML
$filters = get_parameter('filter', []);
// Build ranges.
if (empty($filters['filter_hours_ago']) === true) {
$filters['filter_hours_ago'] = 8;
}
$now_timestamp = time();
$interval_seconds = ($filters['filter_hours_ago'] * 3600);
$ago_timestamp = ($now_timestamp - $interval_seconds);
@ -577,118 +590,148 @@ class SnmpConsole extends HTML
ob_start();
$data = [];
$user_groups = users_get_groups($config['id_user'], 'AR', false);
$prea = array_keys($user_groups);
$ids = join(',', $prea);
$whereSubquery = '';
$sql = 'SELECT
*
FROM
ttrap
%s
WHERE 1=1
%s
ORDER BY
timestamp DESC
LIMIT %d, %d';
$user_in_group_wo_agents = db_get_value_sql('select count(DISTINCT(id_usuario)) from tusuario_perfil where id_usuario ="'.$config['id_user'].'" and id_perfil = 1 and id_grupo in (select id_grupo from tgrupo where id_grupo in ('.$ids.') and id_grupo not in (select id_grupo from tagente))');
if ($user_in_group_wo_agents == 0) {
$sql_count = 'SELECT
COUNT(`ttrap`.`id_trap`)
FROM
ttrap
%s
WHERE 1=1
%s';
if (users_is_admin() === false || users_can_manage_group_all('AR') === false) {
$user_groups = users_get_groups($config['id_user'], 'AR', false);
$rows = db_get_all_rows_filter(
'tagente',
['id_grupo' => array_keys($user_groups)],
['id_agente']
);
$id_agents = [];
foreach ($rows as $row) {
$id_agents[] = $row['id_agente'];
}
if (!empty($id_agents)) {
if (empty($id_agents) === false) {
$address_by_user_groups = agents_get_addresses($id_agents);
foreach ($address_by_user_groups as $i => $a) {
$address_by_user_groups[$i] = '"'.$a.'"';
}
}
} else {
$rows = db_get_all_rows_filter(
'tagente',
[],
['id_agente']
if (empty($address_by_user_groups) === true) {
$address_by_user_groups = [];
array_unshift($address_by_user_groups, '""');
}
$whereSubquery .= sprintf(
'AND (
`ttrap`.`source` IN (%s) OR
`ttrap`.`source`=""
)',
implode(',', $address_by_user_groups)
);
$id_agents = [];
foreach ($rows as $row) {
$id_agents[] = $row['id_agente'];
}
$all_address_agents = agents_get_addresses($id_agents);
foreach ($all_address_agents as $i => $a) {
$all_address_agents[$i] = '"'.$a.'"';
}
}
if (empty($address_by_user_groups)) {
$address_by_user_groups = [];
array_unshift($address_by_user_groups, '""');
if ($filters['filter_alias_search'] !== '') {
$sql_join = '
LEFT JOIN `tagente`
ON `tagente`.`direccion` = `ttrap`.`source`
LEFT JOIN `taddress_agent`
ON `tagente`.`id_agente` = `taddress_agent`.`id_agent`
LEFT JOIN `taddress`
ON `taddress_agent`.`id_a` = `taddress`.`id_a`
';
} else {
$sql_join = '';
}
if (empty($all_address_agents)) {
$all_address_agents = [];
array_unshift($all_address_agents, '""');
}
$sql = 'SELECT * FROM ttrap
WHERE (
`source` IN ('.implode(',', $address_by_user_groups).") OR
`source`='' OR
`source` NOT IN (".implode(',', $all_address_agents).')
)
%s
ORDER BY timestamp DESC
LIMIT %d,%d';
$whereSubquery = '';
if ($filters['filter_alert'] != -1) {
$whereSubquery .= ' AND alerted = '.$filters['filter_alert'];
$whereSubquery .= ' AND `ttrap`.`alerted` = '.$filters['filter_alert'];
}
$filters['filter_severity'] = (int) $filters['filter_severity'];
if ($filters['filter_severity'] != -1) {
// There are two special severity values aimed to match two different trap standard severities
// in database: warning/critical and critical/normal.
if ($filters['filter_severity'] !== EVENT_CRIT_OR_NORMAL
&& $filters['filter_severity'] !== EVENT_CRIT_WARNING_OR_CRITICAL
&& $filters['filter_severity'] !== EVENT_CRIT_NOT_NORMAL
if ($filters['filter_severity'] != EVENT_CRIT_OR_NORMAL
&& $filters['filter_severity'] != EVENT_CRIT_WARNING_OR_CRITICAL
) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND severity = '.$filters['filter_severity'];
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(`ttrap`.`alerted` = 0 AND `ttrap`.`severity` = '.$filters['filter_severity'].') OR
(`ttrap`.`alerted` = 1 AND `ttrap`.`priority` = '.$filters['filter_severity'].'))';
} else {
$whereSubquery .= ' AND (
(`ttrap`.`alerted` = 0 AND 1 = '.$filters['filter_severity'].') OR
(`ttrap`.`alerted` = 1 AND `ttrap`.`priority` = '.$filters['filter_severity'].'))';
}
} else if ($filters['filter_severity'] === EVENT_CRIT_WARNING_OR_CRITICAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_WARNING_OR_CRITICAL.')';
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(`ttrap`.`alerted` = 0 AND (`ttrap`.`severity` = '.EVENT_CRIT_WARNING.' OR `ttrap`.`severity` = '.EVENT_CRIT_CRITICAL.')) OR
(`ttrap`.`alerted` = 1 AND (`ttrap`.`priority` = '.EVENT_CRIT_WARNING.' OR `ttrap`.`priority` = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(`ttrap`.`alerted` = 1 AND (`ttrap`.`priority` = '.EVENT_CRIT_WARNING.' OR `ttrap`.`priority` = '.EVENT_CRIT_CRITICAL.')))';
}
} else if ($filters['filter_severity'] === EVENT_CRIT_OR_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_OR_NORMAL.')';
} else if ($filters['filter_severity'] === EVENT_CRIT_NOT_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_NOT_NORMAL.')';
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(`ttrap`.`alerted` = 0 AND (`ttrap`.`severity` = '.EVENT_CRIT_NORMAL.' OR `ttrap`.`severity` = '.EVENT_CRIT_CRITICAL.')) OR
(`ttrap`.`alerted` = 1 AND (`ttrap`.`priority` = '.EVENT_CRIT_NORMAL.' OR `ttrap`.`priority` = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(`ttrap`.`alerted` = 1 AND (`ttrap`.`priority` = '.EVENT_CRIT_NORMAL.' OR `ttrap`.`priority` = '.EVENT_CRIT_CRITICAL.')))';
}
}
}
if ($filters['filter_free_search'] !== '') {
$free_search_str = io_safe_output($filters['filter_free_search']);
$whereSubquery .= '
AND (source LIKE "%'.$free_search_str.'%" OR
oid LIKE "%'.$free_search_str.'%" OR
oid_custom LIKE "%'.$free_search_str.'%" OR
type_custom LIKE "%'.$free_search_str.'%" OR
value LIKE "%'.$free_search_str.'%" OR
value_custom LIKE "%'.$free_search_str.'%" OR
id_usuario LIKE "%'.$free_search_str.'%" OR
text LIKE "%'.$free_search_str.'%" OR
description LIKE "%'.$free_search_str.'%")';
AND (`ttrap`.`source` LIKE "%'.$free_search_str.'%" OR
`ttrap`.`oid` LIKE "%'.$free_search_str.'%" OR
`ttrap`.`oid_custom` LIKE "%'.$free_search_str.'%" OR
`ttrap`.`type_custom` LIKE "%'.$free_search_str.'%" OR
`ttrap`.`value` LIKE "%'.$free_search_str.'%" OR
`ttrap`.`value_custom` LIKE "%'.$free_search_str.'%" OR
`ttrap`.`id_usuario` LIKE "%'.$free_search_str.'%" OR
`ttrap`.`text` LIKE "%'.$free_search_str.'%" OR
`ttrap`.`description` LIKE "%'.$free_search_str.'%")';
}
if ($filters['filter_alias_search'] !== '') {
$alias_search = io_safe_output($filters['filter_alias_search']);
$whereSubquery .= '
AND `tagente`.`alias` LIKE "%'.$alias_search.'%"';
}
if ($filters['filter_status'] != -1) {
$whereSubquery .= ' AND status = '.$filters['filter_status'];
$whereSubquery .= ' AND `ttrap`.`status` = '.$filters['filter_status'];
}
if ($date_from_trap != '') {
if ($time_from_trap != '') {
$whereSubquery .= '
AND (utimestamp > '.$ago_timestamp.')
AND (`ttrap`.`utimestamp` > '.$ago_timestamp.')
';
} else {
$whereSubquery .= '
AND (UNIX_TIMESTAMP(timestamp) > UNIX_TIMESTAMP("'.$date_from_trap.' 23:59:59"))
AND (UNIX_TIMESTAMP(`ttrap`.`timestamp`) > UNIX_TIMESTAMP("'.$date_from_trap.' 23:59:59"))
';
}
}
@ -696,37 +739,31 @@ class SnmpConsole extends HTML
if ($date_to_trap != '') {
if ($time_to_trap) {
$whereSubquery .= '
AND (utimestamp < '.$now_timestamp.')
AND (`ttrap`.`utimestamp` < '.$now_timestamp.')
';
} else {
$whereSubquery .= '
AND (UNIX_TIMESTAMP(timestamp) < UNIX_TIMESTAMP("'.$date_to_trap.' 23:59:59"))
AND (UNIX_TIMESTAMP(`ttrap`.`timestamp`) < UNIX_TIMESTAMP("'.$date_to_trap.' 23:59:59"))
';
}
}
if ($filters['filter_trap_type'] == 5) {
$whereSubquery .= ' AND type NOT IN (0, 1, 2, 3, 4)';
$whereSubquery .= ' AND `ttrap`.`type` NOT IN (0, 1, 2, 3, 4)';
} else if ($filters['filter_trap_type'] != -1) {
$whereSubquery .= ' AND type = '.$filters['filter_trap_type'];
$whereSubquery .= ' AND `ttrap`.`type` = '.$filters['filter_trap_type'];
}
$where_without_group = '';
if ($filters['filter_group_by']) {
$where_without_group = $whereSubquery;
$whereSubquery .= ' GROUP BY source,oid';
$whereSubquery .= ' GROUP BY `ttrap`.`source`,`ttrap`.`oid`,`ttrap`.`id_trap`';
} else if ($filters['filter_alias_search'] !== '') {
$whereSubquery .= ' GROUP BY `ttrap`.`id_trap`';
}
$sql = sprintf($sql, $whereSubquery, $start, $length);
$sql_count = 'SELECT COUNT(id_trap) FROM ttrap
WHERE (
source IN ('.implode(',', $address_by_user_groups).") OR
source='' OR
source NOT IN (".implode(',', $all_address_agents).')
)
%s';
$sql_count = sprintf($sql_count, $whereSubquery);
$sql = sprintf($sql, $sql_join, $whereSubquery, $start, $length);
$sql_count = sprintf($sql_count, $sql_join, $whereSubquery);
$traps = db_get_all_rows_sql($sql, true);
$total = (int) db_get_value_sql($sql_count, false, false);
@ -778,7 +815,7 @@ class SnmpConsole extends HTML
// SNMP Agent.
$agent = agents_get_agent_with_ip($tmp->source);
if ($agent === false) {
$tmp->snmp_agent .= '<a class="'.$severity_class.' href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&new_agent=1&direccion='.$tmp->source.'" title="'.__('Create agent').'">'.$tmp->source.'</a>';
$tmp->snmp_agent .= '<a class="'.$severity_class.'" href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&new_agent=1&direccion='.$tmp->source.'" title="'.__('Create agent').'">'.$tmp->source.'</a>';
} else {
$tmp->snmp_agent .= '<div class="'.$severity_class.' snmp-div"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'" title="'.__('View agent details').'">';
$tmp->snmp_agent .= '<strong>'.$agent['alias'].ui_print_help_tip($tmp->source, true);
@ -819,7 +856,13 @@ class SnmpConsole extends HTML
// User ID.
$tmp->user_id = '<div class="'.$severity_class.' snmp-div">';
if (empty($status) === false) {
$tmp->user_id .= '<a href="index.php?sec=workspace&sec2=operation/users/user_edit&ver='.$tmp->id_usuario.'">'.substr($tmp->id_usuario, 0, 8).'</a>';
if (users_is_admin($config['id_user']) === true || check_acl($config['id_user'], 0, 'UM') === true) {
$url = ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user='.$tmp->id_usuario);
$tmp->user_id .= '<a href="'.$url.'">'.substr($tmp->id_usuario, 0, 8).'</a>';
} else {
$tmp->user_id .= substr($tmp->id_usuario, 0, 8);
}
if (!empty($tmp->id_usuario)) {
$tmp->user_id .= ui_print_help_tip(get_user_fullname($tmp->id_usuario), true);
}
@ -1129,25 +1172,42 @@ class SnmpConsole extends HTML
$whereSubquery .= ' AND alerted = '.$$alert;
}
$severity = (int) $severity;
if ($severity !== -1) {
if ($severity != -1) {
// There are two special severity values aimed to match two different trap standard severities
// in database: warning/critical and critical/normal.
if ($severity !== EVENT_CRIT_OR_NORMAL
&& $severity !== EVENT_CRIT_WARNING_OR_CRITICAL
&& $severity !== EVENT_CRIT_NOT_NORMAL
if ($severity != EVENT_CRIT_OR_NORMAL
&& $severity != EVENT_CRIT_WARNING_OR_CRITICAL
) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND severity = '.$severity;
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND severity = '.$severity.') OR
(alerted = 1 AND priority = '.$severity.'))';
} else {
$whereSubquery .= ' AND (
(alerted = 0 AND 1 = '.$severity.') OR
(alerted = 1 AND priority = '.$severity.'))';
}
} else if ($severity === EVENT_CRIT_WARNING_OR_CRITICAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_WARNING_OR_CRITICAL.')';
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
(alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
}
} else if ($severity === EVENT_CRIT_OR_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_OR_NORMAL.')';
} else if ($severity === EVENT_CRIT_NOT_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
$whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_NOT_NORMAL.')';
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
(alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
}
}
}

View File

@ -378,6 +378,8 @@ class WelcomeWindow extends Wizard
'class' => 'modal',
];
$output = '';
if (check_acl($config['id_user'], 0, 'PM')) {
$flag_um = false;
$flag_cm = false;
@ -590,6 +592,18 @@ class WelcomeWindow extends Wizard
if ($flag_um === false || $flag_cm === false || $flag_su === false || $flag_lv === false) {
$flag_task = true;
}
} else {
$output .= html_print_div(
[
'class' => 'flex-column-start welcome-message-no-pm',
'content' => '
<h2>'.__('Hi!').'</h2>
<p class="mrgn_btn_5px">'.__('It seems you are new to Pandora FMS.').'<br />
'.__('If you want to watch videos on how to use Pandora FMS, you can visit our ').'<a href="https://www.youtube.com/@PandoraFMS" target="_blank"><b>'.__('YouTube channel.').'</b></a></p>
<p class="mrgn_top_5px">'.__('Are you familiar with ').'<a href="https://pandorafms.com/es/producto/elearning/" target="_blank"><b>'.__('our eLearning system?').'</b></a>'.__(' It\'s completely free for PAO (Operation) and PAT (Administration) courses. Learn how to use Pandora FMS at your own pace.').'</p>',
],
true
);
}
// Task to do.
@ -610,12 +624,20 @@ class WelcomeWindow extends Wizard
],
];
$fields['load_demo_data'] = __('Load demo data');
$fields['wizard_agent'] = __('Agent installation wizard');
$fields['check_web'] = __('Create WEB monitoring');
$fields['check_connectivity'] = __('Create network monitoring');
$fields['check_net'] = __('Discover my network');
$fields['check_mail_alert'] = __('Create email alert');
if (users_is_admin() === true) {
$fields['load_demo_data'] = __('Load demo data');
}
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$fields['wizard_agent'] = __('Agent installation wizard');
$fields['check_web'] = __('Create WEB monitoring');
$fields['check_connectivity'] = __('Create network monitoring');
$fields['check_net'] = __('Discover my network');
}
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$fields['check_mail_alert'] = __('Create email alert');
}
$inputs[] = [
'wrapper' => 'div',
@ -649,10 +671,16 @@ class WelcomeWindow extends Wizard
],
];
$output = $this->printForm(
$output = html_print_div(
[
'form' => $form,
'inputs' => $inputs,
'content' => $output.$this->printForm(
[
'form' => $form,
'inputs' => $inputs,
],
true
),
'class' => 'column-left w50p',
],
true
);

View File

@ -22,7 +22,7 @@ use DI\ContainerBuilder;
/*
* Pandora build version and version
*/
$build_version = 'PC240426';
$build_version = 'PC240514';
$pandora_version = 'v7.0NG.776';
// Do not overwrite default timezone set if defined.
@ -185,6 +185,7 @@ if (session_status() === PHP_SESSION_NONE) {
config_process_config();
config_prepare_session();
config_prepare_jwt_signature();
if ((bool) $config['console_log_enabled'] === true) {
error_reporting(E_ALL ^ E_NOTICE);

View File

@ -258,6 +258,7 @@ define('VISUAL_MAP_STATUS_NORMAL', 0);
define('VISUAL_MAP_STATUS_WARNING', 2);
define('VISUAL_MAP_STATUS_UNKNOWN', 3);
define('VISUAL_MAP_STATUS_WARNING_ALERT', 10);
define('VISUAL_MAP_STATUS_LOOPING', 33);
// Wizard.
define('VISUAL_MAP_WIZARD_PARENTS_NONE', 0);
define('VISUAL_MAP_WIZARD_PARENTS_ITEM_MAP', 1);

View File

@ -1544,7 +1544,9 @@ function agents_get_modules(
$indexed=true,
$get_not_init_modules=true,
$force_tags=false,
$filter_include_sql=true
$filter_include_sql=true,
$pagination=false,
$offset=0,
) {
global $config;
@ -1717,7 +1719,17 @@ function agents_get_modules(
$sql_tags_join,
$where
);
$result = db_get_all_rows_sql($sql);
$limit = '';
if ($pagination === true && isset($config['paginate_module']) === true) {
if ($offset === 0) {
$limit = ' LIMIT '.$config['block_size'].' OFFSET 0';
} else {
$limit = ' LIMIT '.$config['block_size'].' OFFSET '.$offset;
}
}
$result = db_get_all_rows_sql($sql.$limit);
if (empty($result)) {
return [];
@ -3333,7 +3345,7 @@ function agents_update_gis(
*
* @return array A list of network interfaces information by agents.
*/
function agents_get_network_interfaces($agents=false, $agents_filter=false)
function agents_get_network_interfaces($agents=false, $agents_filter=false, $pagination=false, $offset=0, $count=false)
{
global $config;
@ -3432,8 +3444,17 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
$columns,
$filter,
true,
false
false,
false,
true,
$pagination,
$offset
);
if ($count === true) {
return (count($modules) ?? 0);
}
if (!empty($modules)) {
$interfaces = [];
@ -4755,7 +4776,10 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
'force_checks',
false,
'window.location.assign("'.$url.'&amp;flag_agent=1")',
[ 'mode' => 'link' ],
[
'mode' => 'link',
'class' => 'mrgn_lft_20px ',
],
true
);
}
@ -4934,7 +4958,7 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
$module_score = modules_get_agentmodule_id(io_safe_input('Hardening - Score'), $agent['id_agente']);
$hardening = '';
if (is_array($module_score) === true && key_exists('id_agente_modulo', $module_score) == true) {
$raw_data_score = modules_get_raw_data($module_score['id_agente_modulo'], 0, time());
$raw_data_score = modules_get_raw_data($module_score['id_agente_modulo'], 0, time(), false);
$hardening = format_numeric($raw_data_score[0]['datos'], 2);
$data = [];
$data[0] = '<b>'.__('Hardening').'</b>';

View File

@ -30,6 +30,7 @@
// Config functions.
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/functions.php';
require_once __DIR__.'/class/JWTRepository.class.php';
enterprise_include_once('include/functions_config.php');
use PandoraFMS\Core\DBMaintainer;
@ -207,10 +208,6 @@ function config_update_config()
$error_update[] = __('Chromium config directory');
}
if (config_update_value('loginhash_pwd', (string) get_parameter('loginhash_pwd'), true, true) === false) {
$error_update[] = __('Auto login (hash) password');
}
if (config_update_value('timesource', (string) get_parameter('timesource'), true) === false) {
$error_update[] = __('Time source');
}
@ -706,8 +703,10 @@ function config_update_config()
$error_update[] = __('Admin LDAP login');
}
if (config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'), true, true) === false) {
$error_update[] = __('Admin LDAP password');
if ((bool) get_parameter('ldap_admin_pass_password_changed', false) === true) {
if (config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'), true, true) === false) {
$error_update[] = __('Admin LDAP password');
}
}
if (config_update_value('ldap_search_timeout', (int) get_parameter('ldap_search_timeout', 5), true) === false) {
@ -742,8 +741,10 @@ function config_update_config()
$error_update[] = __('Admin secondary LDAP login');
}
if (config_update_value('ldap_admin_pass_secondary', get_parameter('ldap_admin_pass_secondary'), true, true) === false) {
$error_update[] = __('Admin secondary LDAP password');
if ((bool) get_parameter('ldap_admin_pass_secondary_password_changed', false) === true) {
if (config_update_value('ldap_admin_pass_secondary', get_parameter('ldap_admin_pass_secondary'), true, true) === false) {
$error_update[] = __('Admin LDAP password secondary');
}
}
if (config_update_value('fallback_local_auth', get_parameter('fallback_local_auth'), true) === false) {
@ -2224,10 +2225,6 @@ function config_process_config()
config_update_value('events_per_query', 5000);
}
if (!isset($config['loginhash_pwd'])) {
config_update_value('loginhash_pwd', (rand(0, 1000) * rand(0, 1000)).'pandorahash', false, true);
}
if (!isset($config['trap2agent'])) {
config_update_value('trap2agent', 0);
}
@ -2491,6 +2488,10 @@ function config_process_config()
config_update_value('number_modules_queue', 500);
}
if (!isset($config['JWT_signature'])) {
config_update_value('JWT_signature', 1);
}
if (!isset($config['eastern_eggs_disabled'])) {
config_update_value('eastern_eggs_disabled', 1);
}
@ -4224,3 +4225,13 @@ function config_prepare_session()
ini_set('post_max_size', $config['max_file_size']);
ini_set('upload_max_filesize', $config['max_file_size']);
}
function config_prepare_jwt_signature()
{
global $config;
if (is_metaconsole() === true && $config['JWT_signature'] == 1) {
$signature = JWTRepository::generateSignature();
JWTRepository::syncSignatureWithNodes($signature);
}
}

View File

@ -989,3 +989,54 @@ function cron_list_table()
ui_print_info_message(['no_close' => true, 'message' => __('There are no jobs') ]);
}
}
/**
* GetNextExecutionCron give string and return datetime with the date of the next execution
*
* @param string $cron String with cron.
*
* @return DateTime Datetime with the next execution.
*/
function GetNextExecutionCron($cron)
{
// Split cron.
$cronsplit = preg_split('/\s+/', $cron);
// Set dates to use.
$current_day = new DateTime();
$next_execution = new DateTime();
// Monthly schedule.
if ($cronsplit[2] !== '*') {
$next_execution->setDate($current_day->format('Y'), $current_day->format('m'), $cronsplit[2]);
$next_execution->setTime($cronsplit[1], $cronsplit[0]);
if ($next_execution->format('Y-m-d H:i') <= $current_day->format('Y-m-d H:i')) {
$next_execution->setDate($current_day->format('Y'), ($current_day->format('m') + 1), $cronsplit[2]);
}
return $next_execution;
}
// Weekly schedule.
if ($cronsplit[4] !== '*') {
$next_execution->setISODate($current_day->format('Y'), $current_day->format('W'), $cronsplit[4]);
$next_execution->setTime($cronsplit[1], $cronsplit[0]);
if ($next_execution->format('Y-m-d H:i') <= $current_day->format('Y-m-d H:i')) {
$next_execution->setISODate($current_day->format('Y'), ($current_day->format('W') + 1), $cronsplit[4]);
}
return $next_execution;
}
// Daily schedule.
if ($cronsplit[2] === '*' && $cronsplit[3] === '*' && $cronsplit[4] === '*') {
$next_execution->setTime($cronsplit[1], $cronsplit[0]);
if ($next_execution->format('Y-m-d H:i') <= $current_day->format('Y-m-d H:i')) {
$next_execution->setDate($current_day->format('Y'), $current_day->format('m'), ($current_day->format('d') + 1));
}
return $next_execution;
}
return $next_execution;
}

View File

@ -3838,7 +3838,8 @@ function events_get_response_target(
array $event_response,
?array $response_parameters=null,
?int $server_id=0,
?string $server_name=''
?string $server_name='',
?string $target_metaconsole=''
) {
global $config;
@ -3852,6 +3853,9 @@ function events_get_response_target(
$event = db_get_row('tevento', 'id_evento', $event_id);
$target = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
if (empty($target) === true && $target_metaconsole !== '') {
$target = io_safe_output($target_metaconsole);
}
// Replace parameters response.
if (isset($response_parameters) === true
@ -4393,12 +4397,9 @@ function events_page_details($event, $server_id=0)
global $config;
// If metaconsole switch to node to get details and custom fields.
$hashstring = '';
$serverstring = '';
if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id);
$hashdata = metaconsole_get_server_hashdata($server);
$hashstring = '&amp;loginhash=auto&loginhash_data='.$hashdata.'&loginhash_user='.str_rot13($config['id_user']);
$serverstring = $server['server_url'].'/';
if (metaconsole_connect($server) !== NOERR) {
@ -4439,28 +4440,7 @@ function events_page_details($event, $server_id=0)
true
).ui_print_help_tip(__('This agent belongs to metaconsole, is not possible display it'), true);
} else if (can_user_access_node() && is_metaconsole()) {
// Workaround to pass login hash data in POST body instead of directly in the URL.
parse_str($hashstring, $url_hash_array);
$redirection_form = "<form id='agent-redirection' method='POST' action='".$serverstring.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event['id_agente']."'>";
$redirection_form .= html_print_input_hidden(
'loginhash',
$url_hash_array['loginhash'],
true
);
$redirection_form .= html_print_input_hidden(
'loginhash_data',
$url_hash_array['loginhash_data'],
true
);
$redirection_form .= html_print_input_hidden(
'loginhash_user',
$url_hash_array['loginhash_user'],
true
);
$redirection_form .= '</form>';
$data[1] = $redirection_form;
$data[1] .= "<a target=_blank onclick='event.preventDefault(); document.getElementById(\"agent-redirection\").submit();' href='#'>";
$data[1] = '<a target=_blank onclick="redirectNode(\''.$serverstring.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event['id_agente'].'\')" href="#">';
$data[1] .= '<b>'.$agent['alias'].'</b>';
$data[1] .= '</a>';
} else if (can_user_access_node()) {
@ -4471,7 +4451,7 @@ function events_page_details($event, $server_id=0)
'',
false,
$serverstring,
$hashstring,
'',
$agent['alias']
);
} else {
@ -4604,7 +4584,7 @@ function events_page_details($event, $server_id=0)
'id_mg',
$id_module_group
);
$data[1] = '<a href="'.$serverstring.'index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;status=-1&amp;modulegroup='.$id_module_group.$hashstring.'">';
$data[1] = '<a href="#" onclick="redirectNode(\''.$serverstring.'index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;status=-1&amp;modulegroup='.$id_module_group.'\')">';
$data[1] .= $module_group;
$data[1] .= '</a>';
}
@ -4670,7 +4650,7 @@ function events_page_details($event, $server_id=0)
if ($event['id_alert_am'] != 0) {
$data = [];
$data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Source').'</div>';
$data[1] = '<a href="'.$serverstring.'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event['id_agente'].'&amp;tab=alert'.$hashstring.'">';
$data[1] = '<a href="#" onclick="redirectNode(\''.$serverstring.'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event['id_agente'].'&amp;tab=alert\')">';
$standby = db_get_value('standby', 'talert_template_modules', 'id', $event['id_alert_am']);
if (!$standby) {
$data[1] .= html_print_image(
@ -6094,9 +6074,11 @@ function get_events_get_response_target(
$response_parameters=[]
) {
try {
$target_metaconsole = '';
if (is_metaconsole() === true
&& $server_id > 0
) {
$target_metaconsole = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
$node = new Node($server_id);
$node->connect();
}
@ -6106,7 +6088,8 @@ function get_events_get_response_target(
$event_response,
$response_parameters,
$server_id,
($server_id !== 0) ? $node->server_name() : 'Metaconsole'
($server_id !== 0) ? $node->server_name() : 'Metaconsole',
$target_metaconsole
);
} catch (\Exception $e) {
// Unexistent agent.

View File

@ -120,6 +120,19 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
$upload_zip = (bool) get_parameter('upload_zip');
}
// Validate file size vs collection_max_size token.
if ($_FILES['file']['size'] > (int) $config['collection_max_size']) {
$upload_file = false;
$config['filemanager']['message'] = ui_print_error_message(
__(
'File of collection is bigger than the limit (%s bytes)',
$config['collection_max_size'],
'',
true
)
);
}
// Upload file.
if ($upload_file === true) {
if (isset($_FILES['file']) === true && empty($_FILES['file']['name']) === false) {
@ -1032,7 +1045,7 @@ function filemanager_file_explorer(
false,
'show_form_create_folder()',
[
'class' => 'margin-right-2 invert_filter secondary',
'class' => 'margin-right-2 primary buttonButton',
'icon' => 'create_directory',
],
true,
@ -1047,7 +1060,7 @@ function filemanager_file_explorer(
false,
'show_create_text_file()',
[
'class' => 'margin-right-2 invert_filter secondary',
'class' => 'margin-right-2 primary buttonButton',
'icon' => 'create_file',
],
true,
@ -1061,7 +1074,7 @@ function filemanager_file_explorer(
false,
'show_upload_file()',
[
'class' => 'margin-right-2 invert_filter secondary',
'class' => 'margin-right-2 primary buttonButton',
'icon' => 'upload_file',
],
true,

View File

@ -134,11 +134,14 @@ function forecast_projection_graph(
// 3.1 Standard deviation for X: sqrt((Sum(Xi²)/Obs) - (avg X)²)
// 3.2 Standard deviation for Y: sqrt((Sum(Yi²)/Obs) - (avg Y)²)
// Linear correlation coefficient:
// Agent interval could be zero, 300 is the predefined
// Agent interval could be zero, 300 is the predefined.
if ($sum_obs == 0) {
$agent_interval = SECONDS_5MINUTES;
} else {
$agent_interval = ($sum_diff_dates / $sum_obs);
if ($agent_interval < 60) {
$agent_interval = SECONDS_1MINUTE;
}
}
// Could be a inverse correlation coefficient
@ -170,7 +173,7 @@ function forecast_projection_graph(
$a = 0;
}
// Data inicialization
// Data inicialization.
$output_data = [];
if ($prediction_period != false) {
$limit_timestamp = ($last_timestamp + $prediction_period);
@ -199,50 +202,54 @@ function forecast_projection_graph(
$time_format = 'M d';
}
// Aplying linear regression to module data in order to do the prediction
$idx = 0;
// Create data in graph format like
while ($in_range) {
$now = time();
try {
// Aplying linear regression to module data in order to do the prediction.
$idx = 0;
// Create data in graph format like.
while ($in_range) {
$now = time();
// Check that exec time is not greater than half max exec server time
if ($max_exec_time != false) {
if (($begin_time + ($max_exec_time / 2)) < $now) {
return false;
}
}
$timestamp_f = ($current_ts * 1000);
if ($csv) {
$output_data[$idx]['date'] = $current_ts;
$output_data[$idx]['data'] = ($a + ($b * $current_ts));
} else {
$output_data[$idx][0] = $timestamp_f;
$output_data[$idx][1] = ($a + ($b * $current_ts));
}
// Using this function for prediction_date
if ($prediction_period == false) {
// These statements stop the prediction when interval is greater than 2 years
if (($current_ts - $last_timestamp) >= 94608000
|| $max_value == $min_value
) {
return false;
// Check that exec time is not greater than half max exec server time.
if ($max_exec_time != false) {
if (($begin_time + ($max_exec_time / 2)) < $now) {
return false;
}
}
// Found it
if (($max_value >= $output_data[$idx][1])
&& ($min_value <= $output_data[$idx][0])
) {
return ($current_ts + ($sum_diff_dates * $agent_interval));
}
} else if ($current_ts > $limit_timestamp) {
$in_range = false;
}
$timestamp_f = ($current_ts * 1000);
$current_ts = ($current_ts + $agent_interval);
$idx++;
if ($csv) {
$output_data[$idx]['date'] = $current_ts;
$output_data[$idx]['data'] = ($a + ($b * $current_ts));
} else {
$output_data[$idx][0] = $timestamp_f;
$output_data[$idx][1] = ($a + ($b * $current_ts));
}
// Using this function for prediction_date.
if ($prediction_period == false) {
// These statements stop the prediction when interval is greater than 2 years.
if (($current_ts - $last_timestamp) >= 94608000
|| $max_value == $min_value
) {
return false;
}
// Found it.
if (($max_value >= $output_data[$idx][1])
&& ($min_value <= $output_data[$idx][0])
) {
return ($current_ts + ($sum_diff_dates * $agent_interval));
}
} else if ($current_ts > $limit_timestamp) {
$in_range = false;
}
$current_ts = ($current_ts + $agent_interval);
$idx++;
}
} catch (\Exception $e) {
return false;
}
return $output_data;

View File

@ -3509,7 +3509,7 @@ function graph_custom_sql_graph(
}
if ((int) $ttl === 2) {
$options['dataLabel'] = ['display' => 'auto'];
$options['dataLabel'] = ['display' => true];
if ($layout !== false && is_array($layout) === true) {
$options['layout'] = $layout;

View File

@ -2662,7 +2662,20 @@ function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
$tdata[1] = '<a class="big_data" href="'.$urls['total_agents'].'">'.$tdata[1].'</a>';
if ($data['total_agents'] > 500 && !enterprise_installed()) {
$tdata[2] = "<div id='agentsmodal' class='publienterprise' title='".__('Enterprise version not installed')."'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[2] = "<div id='agentsmodal' class='publienterprise' title='Community version' >";
$tdata[2] .= html_print_image(
'images/alert_enterprise.png',
true,
[
'title' => __('Enterprise version not installed'),
'class' => 'img_help'
],
false,
false,
false,
true
);
$tdata[2] .= '</div>';
}
$tdata[3] = html_print_image('images/module.png', true, ['title' => __('Monitor checks'), 'class' => 'invert_filter'], false, false, false, true);
@ -2676,7 +2689,20 @@ function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
*/
if ($data['total_agents']) {
if (($data['monitor_total'] / $data['total_agents'] > 100) && !enterprise_installed()) {
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' ><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' >";
$tdata[5] .= html_print_image(
'images/alert_enterprise.png',
true,
[
'title' => __('Enterprise version not installed'),
'class' => 'img_help'
],
false,
false,
false,
true
);
$tdata[5] .= '</div>';
}
}
@ -2728,7 +2754,20 @@ function tactical_groups_get_stats_alerts($id_groups, $data='')
*/
if ($data['monitor_alerts'] > $data['total_agents'] && !enterprise_installed()) {
$tdata[2] = "<div id='alertagentmodal' class='publienterprise' title='Community version' ><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[2] = "<div id='alertagentmodal' class='publienterprise' title='Community version' >";
$tdata[2] .= html_print_image(
'images/alert_enterprise.png',
true,
[
'title' => __('Enterprise version not installed'),
'class' => 'img_help'
],
false,
false,
false,
true
);
$tdata[2] .= '</div>';
}
$tdata[3] = html_print_image(

View File

@ -1686,34 +1686,56 @@ function html_print_select_multiple_modules_filtered(array $data):string
);
$output .= '</div>';
$agent_class = '';
if (empty($data['searchBar']) === false && $data['searchBar'] === true) {
$output .= '<div>';
$output .= '<div class="agents-modules-multiple-search-bar">';
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'name' => 'agent-searchBar-'.$uniqId,
'onKeyUp' => 'searchAgent(\''.$uniqId.'\')',
'placeholder' => __('Type to search agents'),
'return' => true,
]
);
if (isset($data['searchBarAgents']) === false) {
$data['searchBarAgents'] = true;
}
$output .= '</div>';
if (isset($data['searchBarModules']) === false) {
$data['searchBarModules'] = true;
}
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'name' => 'module-searchBar-'.$uniqId,
'onKeyUp' => 'searchModule(\''.$uniqId.'\')',
'return' => true,
'placeholder' => __('Type to search modules'),
]
);
if ($data['searchBarAgents'] === true) {
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'label_class' => 'font-title-font',
'label' => __('Filter agent'),
'name' => 'agent-searchBar-'.$uniqId,
'onKeyUp' => 'searchAgent(\''.$uniqId.'\')',
'placeholder' => __('Type to search agents'),
'return' => true,
]
);
$output .= '</div>';
$output .= '</div>';
} else {
$agent_class = 'custom-graph-editor-agents-module-filter';
$output .= '<div></div>';
}
if ($data['searchBarModules'] === true) {
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'label_class' => 'font-title-font',
'label' => __('Filter module'),
'name' => 'module-searchBar-'.$uniqId,
'onKeyUp' => 'searchModule(\''.$uniqId.'\')',
'return' => true,
'placeholder' => __('Type to search modules'),
]
);
$output .= '</div>';
} else {
$output .= '<div></div>';
}
$output .= '</div>';
}
@ -1770,6 +1792,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'input_class' => $agent_class,
]
);
} else {
@ -1786,6 +1809,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'input_class' => $agent_class,
]
);
}
@ -1929,7 +1953,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'nothing' => __('All'),
'nothing_value' => 0,
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
]
);
$output .= '</div>';
@ -1965,7 +1989,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'id' => 'filtered-module-show-common-modules-'.$uniqId,
'return' => true,
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
]
);
@ -2053,7 +2077,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'truncate_size' => 300,
]
@ -2070,7 +2094,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'truncate_size' => 300,
]
@ -2211,7 +2235,7 @@ function html_print_select_from_sql(
foreach ($result as $row) {
$id = array_shift($row);
$value = array_shift($row);
$fields[$id] = $value;
$fields[$id] = io_safe_output($value);
}
return html_print_select(
@ -3466,13 +3490,19 @@ function html_print_anchor(
*
* The element will have an id like: "password-$name"
*
* @param string $name Input name.
* @param string $value Input value.
* @param string $alt Alternative HTML string (optional).
* @param integer $size Size of the input (optional).
* @param integer $maxlength Maximum length allowed (optional).
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
* @param boolean $disabled Disable the button (optional, button enabled by default).
* @param string $name Input name.
* @param string $value Input value.
* @param string $alt Alternative HTML string (optional).
* @param integer $size Size of the input (optional).
* @param integer $maxlength Maximum length allowed (optional).
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
* @param boolean $disabled Disable the button (optional, button enabled by default).
* @param boolean $required Whether the input is required (optional, not required by default).
* @param string $class Additional CSS classes for the input (optional).
* @param string $autocomplete Autocomplete attribute value (optional, off by default).
* @param boolean $hide_div_eye Whether to hide the div with the eye icon (optional, false by default).
* @param string $div_class Additional CSS classes for the div (optional).
* @param boolean $not_show_value Whether to not show the value in the input (optional, false by default), FOR USE THIS VALUE YOU NEED CONTROL THE INPUT 'password_changed'.
*
* @return string HTML code if return parameter is true.
*/
@ -3488,7 +3518,8 @@ function html_print_input_password(
$class='',
$autocomplete='off',
$hide_div_eye=false,
$div_class=''
$div_class='',
$not_show_value=false,
) {
if ($maxlength == 0) {
$maxlength = 255;
@ -3519,7 +3550,40 @@ function html_print_input_password(
}
}
return '<div class="relative container-div-input-password '.$div_class.'">'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'</div>';
$extra_output = '';
if ($not_show_value === true) {
$unique_id = 'flag_password_'.uniqid();
$extra_output = html_print_input_hidden($name.'_password_changed', 0, true, false, false, $unique_id);
$attr['class'] .= ' bg-image-none';
$extra_output .= '<script>
$("#show-hide-password-'.$name.'").hide();
const exist_'.$unique_id.' = '.((empty($value) === false) ? 'true' : 'false').';
$("#password-'.$name.'").on("focus", function(e) {
if ($("#'.$unique_id.'").val() === "0") {
$(this).val("");
}
});
$("#password-'.$name.'").on("focusout", function(e) {
if ($("#'.$unique_id.'").val() === "0" && $(this).val() === "" && exist_'.$unique_id.' === true) {
$(this).val("*****");
}
});
$("#password-'.$name.'").on("keyup", function(e) {
$("#'.$unique_id.'").val(1);
if ($(this).val() === "") {
$(this).addClass("bg-image-none");
$("#show-hide-password-'.$name.'").hide();
} else {
$(this).removeClass("bg-image-none");
$("#show-hide-password-'.$name.'").show();
}
});
</script>';
}
return '<div class="relative container-div-input-password '.$div_class.'">'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'</div>'.$extra_output;
}
@ -7878,6 +7942,7 @@ function html_print_select_date_range(
$date_format_js='yy/mm/dd',
$time_format_js='HH:mm:ss',
$id='',
$units_selected='1',
) {
global $config;
@ -8072,7 +8137,7 @@ function html_print_select_date_range(
$output .= html_print_select(
$units,
$name.'_units',
'1',
$units_selected,
'',
'',
0,

View File

@ -418,12 +418,10 @@ function inventory_get_data(
// Setting for link the agent with the proper server.
if (is_metaconsole() === true && empty($node) === false) {
$loginHash = metaconsole_get_servers_url_hash($node);
$urlToAgent = sprintf(
'%sindex.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s%s',
'%sindex.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s',
$node['server_url'],
$row['id_agente'],
$loginHash
$row['id_agente']
);
} else {
$urlToAgent = sprintf(
@ -440,8 +438,9 @@ function inventory_get_data(
$table->data[$rowTable][0] = html_print_anchor(
[
'href' => $urlToAgent,
'href' => (is_metaconsole() === true) ? '#' : $urlToAgent,
'content' => '<strong>'.$agent_name.'</strong>',
'onClick' => (is_metaconsole() === true) ? 'redirectNode(\''.$urlToAgent.'\')' : '',
],
true
);
@ -1196,7 +1195,7 @@ function get_inventory_basic_info_sql($params, $count=false)
$result = 0;
}
}
return $result;
}

View File

@ -171,7 +171,7 @@ function menu_print_menu(&$menu)
$sec2 = 'godmode/users/token_list';
} else if ($sec2 === 'godmode/servers/modificar_server' && check_acl($config['id_user'], 0, 'AW') && (bool) check_acl($config['id_user'], 0, 'PM') === false) {
$sec2 = 'enterprise/godmode/servers/list_satellite';
}else if ($sec2 === 'enterprise/godmode/snmpconsole/snmp_trap_editor_form') {
} else if ($sec2 === 'enterprise/godmode/snmpconsole/snmp_trap_editor_form') {
$sec2 = 'enterprise/godmode/snmpconsole/snmp_trap_editor';
} else {
$sec2 = (string) get_parameter('sec2');

View File

@ -1148,12 +1148,12 @@ function modules_get_table_data(?int $id_agent_module, ?int $id_type)
}
function modules_get_raw_data($id_agent_module, $date_init, $date_end)
function modules_get_raw_data($id_agent_module, $date_init, $date_end, $search_in_history_db=true)
{
$table = modules_get_table_data($id_agent_module, null);
$datelimit = ($date_init - $date_end);
$search_in_history_db = db_search_in_history_db($datelimit);
$search_in_history_db = (($search_in_history_db === true) ? db_search_in_history_db($datelimit) : false);
$data = db_get_all_rows_sql(
'

View File

@ -1570,8 +1570,12 @@ function netflow_draw_item(
);
// Theme.
$theme = $config['style'];
$text_color = ($theme !== 'pandora_black') ? '#333' : '#fff';
$user_info = get_user_info($config['id_user']);
if (isset($user_info['id_skin']) === true && (int) $user_info['id_skin'] === 2) {
$text_color = '#ffffff';
} else {
$text_color = '#333333';
}
$graph_output = pie_graph(
$pie_data,

View File

@ -773,13 +773,11 @@ function networkmap_create_agent_node(
if (empty($server_data) === true) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = '';
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
// Set node status.
@ -870,7 +868,7 @@ function networkmap_create_agent_node(
}
if (can_user_access_node()) {
$url_node_link = ', URL="'.$console_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].$url_hash.'"';
$url_node_link = ', URL="'.$console_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"';
} else {
$url_node_link = '';
}

View File

@ -680,7 +680,7 @@ function notifications_set_user_label_status($source, $user, $label, $value)
}
$exists = db_process_sql(sprintf('SELECT * FROM tnotification_source_user WHERE id_user = "%s" AND id_source = "%s"', $user, $source));
if (empty($exists['enabled']) && empty($exists['also_mail'])) {
if (empty($exists[0]['enabled']) && empty($exists[0]['also_mail'])) {
$sql = sprintf('DELETE FROM tnotification_source_user WHERE id_user = "%s" AND id_source = "%s"', $user, $source);
db_process_sql($sql);
$exists = false;

View File

@ -961,7 +961,7 @@ function planned_downtimes_items($filter)
function delete_planned_downtimes($filter)
{
$downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'execute');
$downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'executed');
if ($downtime_execute) {
$return = __("This scheduled downtime are executed now. Can't delete in this moment.");

View File

@ -3177,7 +3177,7 @@ function reporting_modules_inventory($report, $content)
$module_row_data[$i]['id_tag'][] = $row['tags'];
}
if (array_key_exists('id_group', $row) === true) {
if (array_key_exists('group_id', $row) === true) {
$module_row_data[$i]['group_id'][] = $row['group_id'];
}
@ -3817,10 +3817,18 @@ function reporting_end_of_life($report, $content)
$return['data'] = [];
$external_source = json_decode(
$content['external_source'],
true
);
if (isset($content['external_source']) === true && $content['external_source'] !== 'null') {
$external_source = json_decode(
$content['external_source'],
true
);
} else {
$external_source = [
'end_of_life_date' => $content['end_of_life_date'],
'os_selector' => $content['os_selector'],
'os_version' => $content['os_version'],
];
}
$servers_ids = [0];
@ -3856,26 +3864,38 @@ function reporting_end_of_life($report, $content)
);
$es_os_version = $external_source['os_version'];
$os_selector_name = db_get_value('name', 'tconfig_os', 'id_os', (int) $external_source['os_selector']);
$es_limit_eol_datetime = DateTime::createFromFormat('Y/m/d', $external_source['end_of_life_date']);
// Post-process returned agents to filter agents using correctly formatted fields.
$agents_tmp = [];
foreach ($agents as $idx => $agent) {
if (empty($agent['os_version']) === true) {
$agent['os_version'] = '.*';
}
// Must perform this query and subsequent operations in each iteration (note this is costly) since OS version field may contain HTML entities in BD and decoding can't be fully handled with mysql methods when doing a REGEXP.
$result_end_of_life = db_get_value_sql('SELECT end_of_support FROM tconfig_os_version WHERE "'.io_safe_output($agent['os_version']).'" REGEXP version AND "'.io_safe_output($agent['name']).'" REGEXP product');
$result_end_of_life = db_get_value_sql('SELECT end_of_support FROM tconfig_os_version');
$agent_eol_datetime = DateTime::createFromFormat('Y/m/d', $result_end_of_life);
if ((preg_match('/'.$es_os_version.'/i', $agent['os_version']) || $es_os_version === '') && $result_end_of_life !== false && ($es_limit_eol_datetime === false || $es_limit_eol_datetime >= $agent_eol_datetime)) {
if ((preg_match('/'.$es_os_version.'/i', $agent['os_version']) || $es_os_version === '')
&& $os_selector_name === io_safe_output($agent['name'])
&& $result_end_of_life !== false
&& ($es_limit_eol_datetime === false || $es_limit_eol_datetime >= $agent_eol_datetime)
) {
// Agent matches an existing OS version.
$agents[$idx]['end_of_life'] = $result_end_of_life;
$agents_tmp[] = $agents[$idx];
} else {
// Set agent to be filtered out.
$agents[$idx] = null;
}
}
if ($agents !== false) {
$agents = array_filter($agents);
// TODO:
if ($agents_tmp !== false) {
$agents = $agents_tmp;
}
if (is_metaconsole() === true) {
@ -6128,7 +6148,7 @@ function reporting_alert_get_fired($id_agent_module, $id_alert_template_module,
$datelimit = ($datetime - $period);
$empty = '----------------------------';
$empty = '';
if (empty($firedTimes)) {
$firedTimes = [];
$firedTimes[0]['timestamp'] = $empty;
@ -6192,7 +6212,7 @@ function reporting_alert_report_group($report, $content)
$agent_modules = alerts_get_agent_modules(
$content['id_group'],
(((string) $content['id_group'] === '0') ? true : $content['recursion'])
(((string) $content['id_group'] === '0') ? true : (bool) $content['recursion'])
);
if (empty($alerts)) {
@ -6429,7 +6449,7 @@ function reporting_alert_report_agent($report, $content)
$data_action[$naction]['name'] = $action['name'];
$fired = $action['fired'];
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)) {
$data_action[$naction]['fired'] = '----------------------------';
$data_action[$naction]['fired'] = '';
} else {
$data_action[$naction]['fired'] = $fired;
}
@ -6441,7 +6461,7 @@ function reporting_alert_report_agent($report, $content)
$data_action[$naction]['name'] = $action['name'];
$fired = $action['fired'];
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)) {
$data_action[$naction]['fired'] = '----------------------------';
$data_action[$naction]['fired'] = '';
} else {
$data_action[$naction]['fired'] = $fired;
}
@ -6453,7 +6473,7 @@ function reporting_alert_report_agent($report, $content)
$data_action[$naction]['name'] = $action['name'];
$fired = $action['fired'];
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)) {
$data_action[$naction]['fired'] = '----------------------------';
$data_action[$naction]['fired'] = '';
} else {
$data_action[$naction]['fired'] = $fired;
}
@ -6604,7 +6624,7 @@ function reporting_alert_report_module($report, $content)
$data_action[$naction]['name'] = $action['name'];
$fired = $action['fired'];
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)) {
$data_action[$naction]['fired'] = '----------------------------';
$data_action[$naction]['fired'] = '';
} else {
$data_action[$naction]['fired'] = $fired;
}
@ -6616,7 +6636,7 @@ function reporting_alert_report_module($report, $content)
$data_action[$naction]['name'] = $action['name'];
$fired = $action['fired'];
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)) {
$data_action[$naction]['fired'] = '----------------------------';
$data_action[$naction]['fired'] = '';
} else {
$data_action[$naction]['fired'] = $fired;
}
@ -6628,7 +6648,7 @@ function reporting_alert_report_module($report, $content)
$data_action[$naction]['name'] = $action['name'];
$fired = $action['fired'];
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)) {
$data_action[$naction]['fired'] = '----------------------------';
$data_action[$naction]['fired'] = '';
} else {
$data_action[$naction]['fired'] = $fired;
}
@ -6692,6 +6712,7 @@ function reporting_sql_graph(
switch ($type_sql_graph) {
case 'sql_graph_hbar':
default:
$layout = ['padding' => ['right' => '40']];
$return['type'] = 'sql_graph_hbar';
break;

View File

@ -1712,7 +1712,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$table1->head[3] = __('Name');
$table1->head[4] = __('Agent');
$table1->head[5] = __('Severity');
$table1->head[6] = __('Val. by');
$table1->head[6] = __('Validated by');
$table1->head[7] = __('Timestamp');
} else {
$table1->head[0] = __('Status');
@ -1720,7 +1720,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$table1->head[2] = __('Name');
$table1->head[3] = __('Agent');
$table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by');
$table1->head[5] = __('Validated by');
$table1->head[6] = __('Timestamp');
}
@ -1801,7 +1801,11 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
'id_user',
$event['id_usuario']
);
$data[] = io_safe_output($user_name);
if (isset($event['id_usuario']) === true && empty($event['id_usuario']) === false) {
$data[] = io_safe_output($user_name).' ('.$event['id_usuario'].')';
} else {
$data[] = '';
}
}
if ($item['show_summary_group']) {
@ -3845,7 +3849,7 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->head[2] = __('Name');
$table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by');
$table1->head[5] = __('Validated by');
$table1->head[6] = __('Timestamp');
if ((bool) $item['show_custom_data'] === true) {
$table1->head[7] = __('Custom data');
@ -3904,7 +3908,11 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$data[] = '<i>'.__('System').'</i>';
} else {
$user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['validated_by']);
$data[] = io_safe_output($user_name);
if (isset($event['id_usuario']) === true && empty($event['id_usuario']) === false) {
$data[] = io_safe_output($user_name).' ('.$event['id_usuario'].')';
} else {
$data[] = '';
}
}
if ($item['show_summary_group']) {
@ -4107,7 +4115,7 @@ function reporting_html_historical_data($table, $item, $pdf=0)
// Center every row
foreach ($table1->data[0] as $k => $v) {
for ($i = 0; $i < count($table1->data); $i++){
for ($i = 0; $i < count($table1->data); $i++) {
$table1->cellstyle[$i][$k] = 'text-align: center;';
}
}
@ -4190,7 +4198,7 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
// Center every row
foreach ($table1->data[0] as $k => $v) {
for ($i = 0; $i < count($table1->data); $i++){
for ($i = 0; $i < count($table1->data); $i++) {
$table1->cellstyle[$i][$k] = 'text-align: center;';
}
}
@ -6435,7 +6443,7 @@ function reporting_html_sql($table, $item, $pdf=0)
// Center every row
foreach ($table2->data[0] as $k => $v) {
for ($i = 0; $i < count($table2->data); $i++){
for ($i = 0; $i < count($table2->data); $i++) {
$table2->cellstyle[$i][$k] = 'text-align: center;';
}
}
@ -7886,6 +7894,12 @@ function reporting_html_ncm_list($table, $item, $pdf=0)
*/
function reporting_html_ncm_backups($table, $item, $pdf=0)
{
global $config;
if ($config['style'] === 'pandora_black') {
ui_require_css_file('pandora_black');
}
ui_require_css_file('diff2html.min');
ui_require_css_file('highlight.min');
ui_require_css_file('highlight/vs.min');

View File

@ -965,88 +965,88 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Permissions report'),
'name' => __('Permissions report'),
];
}
$types['ncm_backups'] = [
'optgroup' => __('NCM'),
'name' => __('NCM configuration changes'),
];
$types['ncm'] = [
'optgroup' => __('NCM'),
'name' => __('NCM devices list'),
];
if (enterprise_installed() === true) {
$types['top_n_agents_sh'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N agents with the worst score'),
$types['ncm_backups'] = [
'optgroup' => __('NCM'),
'name' => __('NCM configuration changes'),
];
$types['top_n_checks_failed'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N most frequent failed checks'),
$types['ncm'] = [
'optgroup' => __('NCM'),
'name' => __('NCM devices list'),
];
$types['top_n_categories_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N checks failed by category'),
];
if (enterprise_installed() === true) {
$types['top_n_agents_sh'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N agents with the worst score'),
];
$types['vul_by_cat'] = [
'optgroup' => __('Security hardening'),
'name' => __('Vulnerabilities by category'),
];
$types['top_n_checks_failed'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N most frequent failed checks'),
];
$types['list_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('List of checks'),
];
$types['top_n_categories_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N checks failed by category'),
];
$types['scoring'] = [
'optgroup' => __('Security hardening'),
'name' => __('Scoring by date'),
];
$types['vul_by_cat'] = [
'optgroup' => __('Security hardening'),
'name' => __('Vulnerabilities by category'),
];
$types['evolution'] = [
'optgroup' => __('Security hardening'),
'name' => __('Evolution'),
];
$types['list_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('List of checks'),
];
$types['vuls_severity_graph'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Severity graph bar'),
];
$types['scoring'] = [
'optgroup' => __('Security hardening'),
'name' => __('Scoring by date'),
];
$types['vuls_attack_complexity'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Attack complexity doughnut chart'),
];
$types['evolution'] = [
'optgroup' => __('Security hardening'),
'name' => __('Evolution'),
];
$types['vuls_by_packages'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('By packages in pie chart'),
];
$types['vuls_severity_graph'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Severity graph bar'),
];
$types['vuls_by_agent'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Detailed security report'),
];
$types['vuls_attack_complexity'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Attack complexity doughnut chart'),
];
$types['vuls_info_agent'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Vulnerabilities of agent'),
];
$types['vuls_by_packages'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('By packages in pie chart'),
];
$types['top_n_agents_vuls'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Top-N agents with more risk'),
];
$types['vuls_by_agent'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Detailed security report'),
];
$types['top_n_vuls_count'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Top-N common vulnerabilities'),
];
$types['vuls_info_agent'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Vulnerabilities of agent'),
];
$types['top_n_agents_vuls'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Top-N agents with more risk'),
];
$types['top_n_vuls_count'] = [
'optgroup' => __('Vulnerabilities'),
'name' => __('Top-N common vulnerabilities'),
];
}
}
return $types;

View File

@ -1588,7 +1588,12 @@ function snmp_browser_create_modules_snmp(
enterprise_include_once('include/functions_policies.php');
foreach ($id_target as $policy) {
$ids[] = policies_create_module($oid['oid'], $policy, 2, $values);
$exist = db_get_row_filter('tpolicy_modules', ['name' => $oid['oid'], 'id_policy' => $policy], '*');
if ($exist !== false) {
$ids[] = false;
} else {
$ids[] = policies_create_module($oid['oid'], $policy, 2, $values);
}
}
}
}

View File

@ -18,13 +18,11 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = ui_get_full_url('/');
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
include_once $config['homedir'].'/include/functions_agents.php';
@ -69,10 +67,11 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
$row['title'] = __('Name');
$row['data'] = html_print_anchor(
[
'href' => $console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash,
'href' => '#',
'title' => __('Click here for view this module'),
'class' => 'font_11',
'content' => $cellName,
'onClick' => 'redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'\');',
],
true
);
@ -325,45 +324,9 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
echo '<div class="actions_treeview flex flex-evenly">';
if (is_metaconsole() === true) {
echo "<form id='module-table-redirection' method='POST' action='".$console_url."index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module'>";
parse_str($url_hash, $url_hash_array);
html_print_input_hidden(
'id_agente',
$module['id_agente'],
false
);
html_print_input_hidden(
'edit_module',
1,
false
);
html_print_input_hidden(
'id_agent_module',
$module['id_agente_modulo'],
false
);
html_print_input_hidden(
'loginhash',
$url_hash_array['loginhash'],
false
);
html_print_input_hidden(
'loginhash_data',
$url_hash_array['loginhash_data'],
false
);
html_print_input_hidden(
'loginhash_user',
$url_hash_array['loginhash_user'],
false
);
echo '</form>';
echo "<a target=_blank onclick='event.preventDefault(); document.getElementById(\"module-table-redirection\").submit();' href='#'>";
echo '<a target=_blank onclick="redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&edit_module=1&id_agente='.$module['id_agente'].'&id_agent_module='.$module['id_agente_modulo'].'\')" href="#">';
} else {
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash.'">';
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'">';
}
html_print_submit_button(
@ -399,13 +362,11 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false)
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = '';
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
$user_access_node = can_user_access_node();
@ -512,7 +473,7 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false)
__('Go to alerts edition'),
'upd_button',
false,
'window.location.assign("'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'")',
'redirectNode("'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.'")',
['icon' => 'alert'],
true
),
@ -533,15 +494,11 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
global $config;
if (empty($server_data)) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = ui_get_full_url('/');
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
include_once $config['homedir'].'/include/functions_agents.php';
@ -623,15 +580,6 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$cellName = ((bool) $agent['disabled'] === true) ? '<em>' : '';
if (is_metaconsole() === true) {
$pwd = $server_data['auth_token'];
// Create HASH login info.
$user = $config['id_user'];
// Extract auth token from serialized field.
$pwd_deserialiced = json_decode($pwd, true);
$hashdata = $user.$pwd_deserialiced['auth_token'];
$hashdata = md5($hashdata);
if ((bool) $grants_on_node === true && (bool) $user_access_node !== false) {
$urlAgent = $server_data['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'];
} else {
@ -657,7 +605,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
'title' => __('Click here for view this agent'),
'class' => 'font_11',
'content' => $cellName,
'onClick' => "sendHash('".$urlAgent."')",
'onClick' => "redirectNode('".$urlAgent."')",
],
true
);
@ -998,7 +946,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$cluster = PandoraFMS\Cluster::loadFromAgentId(
$agent['id_agente']
);
$buttons_act .= '<a target=_blank href="'.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'">';
$buttons_act .= '<a target=_blank href="#" onclick="redirectNode(\''.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'\')">';
$buttons_act .= html_print_submit_button(
__('Go to cluster edition'),
'upd_button',
@ -1007,7 +955,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
true
);
} else {
$buttons_act .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'&tab=module&show_dialog_create=1">';
$buttons_act .= '<a target=_blank href="#" onclick="redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&show_dialog_create=1\')">';
$buttons_act .= html_print_submit_button(
__('Go to module creation'),
'upd_button',
@ -1016,7 +964,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
true
);
$buttons_act .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'">';
$buttons_act .= '<a target=_blank href="#" onclick="redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'\')">';
$buttons_act .= html_print_submit_button(
__('Go to agent edition'),
'upd_button',
@ -1038,11 +986,6 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
echo "
<script>
function sendHash(url) {
window.open(url+'&loginhash=auto&loginhash_data=".$hashdata.'&loginhash_user='.str_rot13(($user ?? ''))."', '_blank');
}
$('.max-graph-tree-view').ready(function() {
widthGraph();
});

View File

@ -1164,16 +1164,10 @@ function ui_format_alert_row(
global $config;
if (!isset($alert['server_data'])) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = '';
} else {
$server_data = $alert['server_data'];
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
$actionText = '';
@ -1444,13 +1438,13 @@ function ui_format_alert_row(
if (is_metaconsole() === true) {
// Do not show link if user cannot access node
if ((bool) can_user_access_node() === true) {
$hashdata = metaconsole_get_server_hashdata($server);
$url = $server['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&amp;loginhash=auto&loginhash_data='.$hashdata.'&loginhash_user='.str_rot13($config['id_user']).'&id_agente='.$agente['id_agente'];
$url = $server['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&amp;&id_agente='.$agente['id_agente'];
$data[$index['agent_name']] .= html_print_anchor(
[
'href' => $url,
'href' => '#',
'content' => '<span class="bolder" title="'.$agente['nombre'].'">'.$agente['alias'].'</span>',
'target' => '_blank',
'onClick' => 'redirectNode(\''.$url.'\');',
],
true
);
@ -2954,14 +2948,14 @@ function ui_print_help_tip(
$text_title = (strlen($text) >= 60) ? substr($text, 0, 60).'...' : $text;
$id = random_int(1, 99999);
$output = '<div id="div_tip_'.$id.'" class="tip" style="'.$style.'" >';
$output = '<div id="div_tip_'.$id.'" class="tip" style="'.$style.'" onclick="open_tip('.$id.')">';
$output .= '<div id="tip_dialog_'.$id.'" class="invisible margin-15" data-title="'.__('Help').'"><span class="font_13px">'.io_safe_output($text).'</span></div>';
$output .= html_print_image(
$img,
true,
[
'title' => $text_title,
'class' => $blink === true ? 'blink' : '',
'title' => io_safe_output($text_title),
'class' => ($blink === true) ? 'blink' : '',
'style' => 'width: 16px; height: 16px;',
],
false,
@ -5873,7 +5867,7 @@ function ui_print_agent_autocomplete_input($parameters)
$hidden_input_idagent_value = $parameters['hidden_input_idagent_value'];
}
$size = 30;
$size = 100;
// Default value.
if (isset($parameters['size'])) {
$size = $parameters['size'];
@ -6299,14 +6293,14 @@ function ui_print_agent_autocomplete_input($parameters)
$javascript_function_change .= '
function setInputBackground(inputId, image) {
$("#"+inputId)
.attr("style", "background-image: url(\'"+image+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
.attr("style", "background-image: url(\'"+image+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
}
$(document).ready(function () {
$("#'.$input_id.'").focusout(function (e) {
setTimeout(() => {
let iconImage = "'.$icon_image.'";
$("#'.$input_id.'").attr("style", "background-image: url(\'"+iconImage+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
$("#'.$input_id.'").attr("style", "background-image: url(\'"+iconImage+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
}, 100);
});
});
@ -6580,7 +6574,7 @@ function ui_print_agent_autocomplete_input($parameters)
if (select_item_click) {
select_item_click = 0;
$("#'.$input_id.'")
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
return;
} else {
// Clear selectbox if item is not selected.
@ -6595,7 +6589,7 @@ function ui_print_agent_autocomplete_input($parameters)
//Set loading
$("#'.$input_id.'")
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
var term = input_value; //Word to search
'.$javascript_change_ajax_params_text.'
@ -6612,7 +6606,7 @@ function ui_print_agent_autocomplete_input($parameters)
success: function (data) {
if (data.length < 2) {
//Set icon
$("#'.$input_id.'").attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$inputStyles.'");
$("#'.$input_id.'").attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$inputStyles.'");
return;
}
@ -6662,7 +6656,7 @@ function ui_print_agent_autocomplete_input($parameters)
//Set icon
$("#'.$input_id.'")
.attr("style", "background: url(\"'.$icon_image.'\") 97% center no-repeat; background-size: 20px; width:100%; '.$inputStyles.'")
.attr("style", "background: url(\"'.$icon_image.'\") 97% center no-repeat; background-size: 20px; width:'.$size.'%; '.$inputStyles.'")
return;
}
});
@ -6681,7 +6675,7 @@ function ui_print_agent_autocomplete_input($parameters)
}
$attrs = [];
$attrs['style'] = 'background-image: url('.$icon_image.'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:100%; '.$text_color.' '.$inputStyles.'';
$attrs['style'] = 'background-image: url('.$icon_image.'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; width:'.$size.'%; '.$text_color.' '.$inputStyles.'';
if (!$disabled_javascript_on_blur_function) {
$attrs['onblur'] = $javascript_on_blur_function_name.'()';

View File

@ -1664,7 +1664,7 @@ function visual_map_print_item(
echo '<div id="'.$id.'" class="'.$class.'" '.'style="z-index: '.$z_index.';'.'position: absolute; '.'top: '.$top.'px; '.'left: '.$left.'px;'.'display: inline-block; '.$sizeStyle.'">';
if ($link) {
echo "<a href=\"$url\">";
echo '<a href="#" onClick="redirectNode(\''.$url.'\')">';
}
// for clean link text from bbdd only edit_visualmap
@ -3221,6 +3221,10 @@ function visual_map_get_image_status_element($layoutData, $status=false)
$img .= '_warning.png';
break;
case 33:
$img = 'images/broken_loop.svg';
break;
case 3:
// Unknown.
default:
@ -3886,10 +3890,28 @@ function visual_map_translate_module_status($module_status)
*
* @return integer The status of the given layout.
*/
function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
{
function visual_map_get_layout_status(
$layout_id,
$status_data=[],
$depth=0,
$exclude_recursive=[],
&$num_elements_by_status=[
VISUAL_MAP_STATUS_CRITICAL_BAD => 0,
VISUAL_MAP_STATUS_CRITICAL_ALERT => 0,
VISUAL_MAP_STATUS_NORMAL => 0,
VISUAL_MAP_STATUS_WARNING => 0,
VISUAL_MAP_STATUS_UNKNOWN => 0,
VISUAL_MAP_STATUS_WARNING_ALERT => 0,
VISUAL_MAP_STATUS_LOOPING => 0,
]
) {
global $config;
if (in_array($layout_id, $exclude_recursive) === true) {
return VISUAL_MAP_STATUS_LOOPING;
}
$exclude_recursive[] = $layout_id;
// TODO: Implement this limit into the setup.
if ($depth > 10) {
return VISUAL_MAP_STATUS_UNKNOWN;
@ -3951,15 +3973,6 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
sort_by_column($valid_layout_items, 'id_metaconsole');
}
$num_elements_by_status = [
VISUAL_MAP_STATUS_CRITICAL_BAD => 0,
VISUAL_MAP_STATUS_CRITICAL_ALERT => 0,
VISUAL_MAP_STATUS_NORMAL => 0,
VISUAL_MAP_STATUS_WARNING => 0,
VISUAL_MAP_STATUS_UNKNOWN => 0,
VISUAL_MAP_STATUS_WARNING_ALERT => 0,
];
$meta_connected_to = null;
foreach ($valid_layout_items as $layout_item_data) {
@ -4018,7 +4031,9 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
$status = visual_map_get_layout_status(
$layout_item_data['id_layout_linked'],
$layout_item_data,
($depth + 1)
($depth + 1),
$exclude_recursive,
$num_elements_by_status
);
} else if (!empty($layout_item_data['id_agente_modulo'])) {
// Module.
@ -4085,6 +4100,10 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
if (isset($status_data['linked_layout_status_type']) === true) {
// Status calculation.
if (isset($num_elements_by_status[VISUAL_MAP_STATUS_LOOPING]) === true && empty($num_elements_by_status[VISUAL_MAP_STATUS_LOOPING]) === false) {
return VISUAL_MAP_STATUS_LOOPING;
}
switch ($status_data['linked_layout_status_type']) {
default:
case 'default':

View File

@ -12,12 +12,11 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Clippy
*/
function clippy_agent_module_interval()
{
$return_tours = [];

View File

@ -12,12 +12,11 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Clippy
*/
function clippy_data_configuration_module()
{
$return_tours = [];

View File

@ -1,4 +1,6 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
@ -26,8 +28,6 @@
* GNU General Public License for more details.
* ============================================================================
*/
function clippy_modules_not_learning_mode()
{
$return_tours = [];

File diff suppressed because it is too large Load Diff

View File

@ -216,7 +216,7 @@ $(document).ready(function() {
});
$("#ok_buttom").click(function() {
$("#license_error_msg_dialog").dialog("close");
$(".ui-dialog-content").dialog("close");
});
}
}

View File

@ -211,7 +211,7 @@ function fmAgentChange(uniqId) {
}
// eslint-disable-next-line no-unused-vars
function fmModuleChange(uniqId, isMeta) {
function fmModuleChange(uniqId, isMeta, valueID = false) {
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
var idAgents = $("#filtered-module-agents-" + uniqId).val();
var commonSelectorType = $(
@ -253,7 +253,7 @@ function fmModuleChange(uniqId, isMeta) {
.html(value["nombre"]);
} else {
option
.attr("value", id)
.attr("value", valueID === false ? value : id)
.attr("title", value)
.html(value);
}

Some files were not shown because too many files have changed in this diff Show More