Resolve merge issues

This commit is contained in:
Jose Gonzalez 2023-01-31 17:35:44 +01:00
commit 0363a90e1f
181 changed files with 30306 additions and 28426 deletions

View File

@ -24,7 +24,7 @@ cd $CODEHOME && tar zcvf $RPMHOME/SOURCES/pandorafms_server-$LOCAL_VERSION.tar.g
cd $CODEHOME/pandora_agents/shellscript && tar zcvf $RPMHOME/SOURCES/pandorafms_agent-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup linux || exit 1
# Unix agent
cd $CODEHOME/pandora_agents && tar zvcf $RPMHOME/SOURCES/pandorafms_agent_unix-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup --exclude NT4 --exclude Darwin/dmg unix || exit 1
cd $CODEHOME/pandora_agents && tar zvcf $RPMHOME/SOURCES/pandorafms_agent_linux-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup --exclude NT4 --exclude Darwin/dmg unix || exit 1
# Enterprise console
cd $PANDHOME_ENT/pandora_console && tar zcvf $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn enterprise/* || exit 1
@ -37,7 +37,7 @@ if [ "$1" == "nightly" ]; then
ln -s $RPMHOME/SOURCES/pandorafms_console-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_console-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_server-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_server-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_agent-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_agent-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_agent_unix-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_agent_unix-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_agent_linux-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_agent_linux-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_console_enterprise-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_server_enterprise-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_server_enterprise-$VERSION.tar.gz || exit 1
fi

View File

@ -142,7 +142,7 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset}
# Insatall pandora agent
$package_manager_cmd install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE
$package_manager_cmd install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm &>> $LOGFILE
echo -en "${cyan}Installing Pandora FMS agent...${reset}"
check_cmd_status 'Error installing Pandora FMS agent'
@ -151,8 +151,8 @@ fi
if [[ $OS_RELEASE == 'debian' ]]; then
execute_cmd "apt update" 'Updating repos'
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_unix_7.0NG.deb' 'Downloading Pandora FMS agent dependencies'
execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent'
execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_linux_7.0NG.deb' 'Downloading Pandora FMS agent dependencies'
execute_cmd 'apt install -y ./pandorafms.agent_linux_7.0NG.deb' 'Installing Pandora FMS agent'
fi
# Configuring Agente

View File

@ -285,11 +285,16 @@ server_dependencies=" \
java \
bind-utils \
whois \
cpanminus \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm"
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=" \
http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \
@ -410,17 +415,17 @@ execute_cmd "systemctl restart mysqld" "Configuring database engine"
if [ "$PANDORA_BETA" -eq '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_BETA" -ne '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/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"
execute_cmd "curl -LSs --output pandorafms_console-7.0NG.noarch.rpm ${PANDORA_CONSOLE_PACKAGE}" "Downloading Pandora FMS Console community"
execute_cmd "curl -LSs --output pandorafms_agent_unix-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community"
execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community"
# Install Pandora
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"

View File

@ -4,7 +4,7 @@
#######################################################
## Tested versions ##
# Centos 8.4, 8.5
# Rocky 8.4, 8.5
# Rocky 8.4, 8.5, 8.6, 8.7
# Almalinuz 8.4, 8.5
# RedHat 8.5
@ -14,24 +14,25 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='202209231'
S_VERSION='202301251'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=57
[ "$PHPVER" ] || PHPVER=8
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=57
[ "$PHPVER" ] || PHPVER=8
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$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")
[ "$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
# Ansi color code variables
@ -41,7 +42,6 @@ cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
@ -76,7 +76,7 @@ check_cmd_status () {
check_pre_pandora () {
echo -en "${cyan}Checking environment ... ${reset}"
rpm -qa | grep 'pandorafms_' &>> /dev/null && local fail=true
rpm -qa | grep -v "pandorawmic" | grep 'pandorafms_' &>> /dev/null && local fail=true
[ -d "$PANDORA_CONSOLE" ] && local fail=true
[ -f /usr/bin/pandora_server ] && local fail=true
@ -137,7 +137,10 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}"
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
echo -e $INSTALLING_VER
# Connectivity
check_repo_connection
@ -467,6 +470,8 @@ query_cache_size = 64M
query_cache_min_res_unit = 2k
query_cache_limit = 256K
#skip-log-bin
sql_mode=""
[mysqld_safe]
@ -477,6 +482,7 @@ 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
fi
execute_cmd "systemctl restart mysqld" "Configuring database engine"
@ -485,20 +491,27 @@ fi
export MYSQL_PWD=$DBPASS
#Define packages
if [ "$PANDORA_BETA" -eq '0' ] ; then
if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm"
elif [ "$PANDORA_BETA" -ne '0' ] ; then
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
fi
# if beta is enable
if [ "$PANDORA_BETA" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/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"
execute_cmd "curl -LSs --output pandorafms_console-7.0NG.noarch.rpm ${PANDORA_CONSOLE_PACKAGE}" "Downloading Pandora FMS Console community"
execute_cmd "curl -LSs --output pandorafms_agent_unix-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community"
execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community"
# Install Pandora
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"

View File

@ -16,7 +16,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy
S_VERSION='2022052501'
S_VERSION='202301251'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
@ -34,6 +34,8 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$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
# Ansi color code variables
red="\e[0;91m"
@ -134,7 +136,10 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}"
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
echo -e $INSTALLING_VER
# Connectivity
check_repo_connection
@ -272,14 +277,19 @@ echo -en "${cyan}Installing phantomjs...${reset}"
/usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs"
# create symlink for fping
rm -f /usr/sbin/fping &>> "$LOGFILE"
ln -s /usr/bin/fping /usr/sbin/fping &>> "$LOGFILE"
# Chrome
rm -f /usr/bin/chromium-browser &>> "$LOGFILE"
execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome"
execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "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 \
vmware_dependencies="\
lib32z1 \
lib32z1 \
build-essential \
uuid uuid-dev \
@ -350,16 +360,22 @@ systemctl stop apparmor &>> "$LOGFILE"
systemctl disable apparmor &>> "$LOGFILE"
#install mysql
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password password $DBROOTPASS") &>> "$LOGFILE"
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password_again password $DBROOTPASS") &>> "$LOGFILE"
echo -en "${cyan}Installing MySql Server...${reset}"
env DEBIAN_FRONTEND=noninteractive apt install -y mysql-server &>> "$LOGFILE"
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 &>> "$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 -en "${cyan}Creating Pandora FMS database...${reset}"
@ -399,11 +415,12 @@ 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
@ -417,14 +434,20 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin
#Define packages
if [ "$PANDORA_BETA" -eq '0' ] ; then
if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_agent_linux-7.0NG.tar.gz"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_unix-7.0NG.tar.gz"
elif [ "$PANDORA_BETA" -ne '0' ] ; then
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
fi
if [ "$PANDORA_BETA" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_unix-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
fi
# Downloading Pandora Packages
@ -432,7 +455,7 @@ cd $WORKDIR &>> "$LOGFILE"
curl -LSs --output pandorafms_console-7.0NG.tar.gz "${PANDORA_CONSOLE_PACKAGE}" &>> "$LOGFILE"
curl -LSs --output pandorafms_server-7.0NG.tar.gz "${PANDORA_SERVER_PACKAGE}" &>> "$LOGFILE"
curl -LSs --output pandorafms_agent_unix-7.0NG.tar.gz "${PANDORA_AGENT_PACKAGE}" &>> "$LOGFILE"
curl -LSs --output pandorafms_agent_linux-7.0NG.tar.gz "${PANDORA_AGENT_PACKAGE}" &>> "$LOGFILE"
# Install PandoraFMS Console
echo -en "${cyan}Installing PandoraFMS Console...${reset}"
@ -449,7 +472,7 @@ check_cmd_status "Error installing PandoraFMS Server"
#Install agent:
execute_cmd "apt install -y libyaml-tiny-perl perl coreutils wget curl unzip procps python3 python3-pip" "Installing PandoraFMS Agent Dependencies"
echo -en "${cyan}Installing PandoraFMS Agent...${reset}"
tar xvzf $WORKDIR/pandorafms_agent_unix-7.0NG.tar.gz &>> "$LOGFILE" && cd unix && ./pandora_agent_installer --install &>> $LOGFILE && cp -a tentacle_client /usr/local/bin/ &>> $LOGFILE && cd $WORKDIR
tar xvzf $WORKDIR/pandorafms_agent_linux-7.0NG.tar.gz &>> "$LOGFILE" && cd unix && ./pandora_agent_installer --install &>> $LOGFILE && cp -a tentacle_client /usr/local/bin/ &>> $LOGFILE && cd $WORKDIR
check_cmd_status "Error installing PandoraFMS Agent"
# Copy gotty utility

View File

@ -4,9 +4,9 @@ Release: 140223.sp3%{?dist}
Summary: Host/service/network agent for Pandora FMS monitoring system
License: GPLv2
Vendor: Artica <http://www.artica.es>
Source: http://code.pandorafms.com/static_download/pandorafms_agent_unix-5.0SP3.tar.gz
Source: http://code.pandorafms.com/static_download/pandorafms_agent_linux-5.0SP3.tar.gz
#Source: %{name}-%{version}.tar.gz
#Source0: http://code.pandorafms.com/static_download/pandorafms_agent_unix-5.0SP3.tar.gz
#Source0: http://code.pandorafms.com/static_download/pandorafms_agent_linux-5.0SP3.tar.gz
URL: http://pandorafms.com
Group: Applications/System
#Prefix: /usr/share

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, AIX version
# Version 7.0NG.768, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -114,7 +114,7 @@ echo "END"
echo "Make the package \"Pandorafms console\"."
dpkg-deb --build temp_package
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb
mv temp_package.deb pandorafms.agent_linux_$pandora_version.deb
echo "Delete the \"temp_package\" temp dir for job."
rm -rf temp_package

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, FreeBSD Version
# Version 7.0NG.768, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -207,6 +207,6 @@ module_end
module_plugin grep_log /var/log/auth.log Syslog sshd
# Plugin for inventory on the agent (Only Enterprise)
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, HP-UX Version
# Version 7.0NG.768, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, GNU/Linux
# Version 7.0NG.768, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -269,7 +269,7 @@ module_plugin grep_log /var/log/syslog Syslog ssh
#module_description Used memory in KB postprocessed to be in MB
#module_end
# Plugin for inventory on the agent (Only Enterprise)
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, GNU/Linux
# Version 7.0NG.768, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -31,14 +31,14 @@ Install procedure
Step 1 - Get the latest package and copy to /tmp, you can get the latest package at:
http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_unix-3.2.tar.gz/download
http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_linux-3.2.tar.gz/download
Note: You will get a special version of the launcher, you can get it from our SVN repository and replace the perl daemon launcher with this special version for OpenWRT. Just replace it after do the package install for the Unix/Perl generic agent.
Step 2 - Install it
cd /tmp
tar xvzf pandorafms_agent_unix-3.2.tar.gz
tar xvzf pandorafms_agent_linux-3.2.tar.gz
cd unix
./pandora_agent --install

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, Solaris Version
# Version 7.0NG.768, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.767
# Version 7.0NG.768
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version

View File

@ -1,7 +1,7 @@
#
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define name pandorafms_agent_linux
%define version 4.0
%define release 1

View File

@ -1,7 +1,7 @@
#
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define name pandorafms_agent_linux
%define version 4.0.1
%define release 1

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.767, AIX version
# Version 7.0NG.768, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.767
# Version 7.0NG.768
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.767, HPUX Version
# Version 7.0NG.768, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767
# Version 7.0NG.768
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net
@ -164,5 +164,5 @@ module_end
module_plugin grep_log /var/log/syslog Syslog ssh
# Plugin for inventory on the agent (Only Enterprise)
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767
# Version 7.0NG.768
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net
@ -379,6 +379,6 @@ module_end
#module_plugin grep_log /var/log/syslog Syslog ssh
# Plugin for inventory on the agent (Only Enterprise)
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767
# Version 7.0NG.768
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.767, Solaris version
# Version 7.0NG.768, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, AIX version
# Version 7.0NG.768, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.767-230110
Version: 7.0NG.768-230131
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.767-230110"
pandora_version="7.0NG.768-230131"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
@ -61,7 +61,7 @@ chmod 755 -R temp_package/DEBIAN
#cp -aRf * temp_package/usr/share/pandora_agent/
#but don't copy recursive the temp_package into temp_package
for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v NetBSD | grep -v HP-UX | grep -v SunOS | grep -v Darwin | grep -v OpenWRT | grep -v pandorafms.agent_unix | grep -v temp_package`
for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v NetBSD | grep -v HP-UX | grep -v SunOS | grep -v Darwin | grep -v OpenWRT | grep -v pandorafms.agent_linux | grep -v temp_package`
do
#if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ]
#then
@ -137,7 +137,7 @@ if [ "$USE_DOCKER_APP" == "1" ]; then
else
dpkg-deb --root-owner-group --build temp_package
fi
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb
mv temp_package.deb pandorafms.agent_linux_$pandora_version.deb
echo "Delete the \"temp_package\" temp dir for job."
rm -rf temp_package

View File

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.767"
VERSION="7.0NG.768"
fi
# Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.767" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.768" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.767" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.768" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" />
<script>
<![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.767</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.767 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.767</string>
<key>CFBundleVersion</key> <string>7.0NG.768</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.768 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.768</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, GNU/Linux
# Version 7.0NG.768, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, FreeBSD Version
# Version 7.0NG.768, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -272,7 +272,7 @@ module_plugin pandora_df_free
module_plugin grep_log /var/log/auth.log Syslog sshd
# Plugin for inventory on the agent (Only Enterprise)
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
# Log collection modules. Only for enterprise version, this will collect log files for forensic analysis.

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, HP-UX Version
# Version 7.0NG.768, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, GNU/Linux
# Version 7.0NG.768, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -269,7 +269,7 @@ module_plugin pandora_netusage
# Service autodiscovery plugin
module_plugin autodiscover --default
# Plugin for inventory on the agent (Only Enterprise)
# Plugin for inventory on the agent.
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
# Log collection modules. Only for enterprise version, this will collect log files for forensic analysis.

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, GNU/Linux
# Version 7.0NG.768, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, NetBSD Version
# Version 7.0NG.768, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -232,6 +232,6 @@ module_end
module_plugin grep_log /var/log/auth.log Syslog sshd
# Plugin for inventory on the agent (Only Enterprise)
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software

View File

@ -31,14 +31,14 @@ Install procedure
Step 1 - Get the latest package and copy to /tmp, you can get the latest package at:
http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_unix-3.2.tar.gz/download
http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_linux-3.2.tar.gz/download
Note: You will get a special version of the launcher, you can get it from our SVN repository and replace the perl daemon launcher with this special version for OpenWRT. Just replace it after do the package install for the Unix/Perl generic agent.
Step 2 - Install it
cd /tmp
tar xvzf pandorafms_agent_unix-3.2.tar.gz
tar xvzf pandorafms_agent_linux-3.2.tar.gz
cd unix
./pandora_agent --install

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.767, Solaris Version
# Version 7.0NG.768, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1014,8 +1014,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.767';
use constant AGENT_BUILD => '230110';
use constant AGENT_VERSION => '7.0NG.768';
use constant AGENT_BUILD => '230131';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -1,9 +1,9 @@
#
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.767
%define release 230110
%define name pandorafms_agent_linux
%define version 7.0NG.768
%define release 230131
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -1,9 +1,9 @@
#
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.767
%define release 230110
%define name pandorafms_agent_linux
%define version 7.0NG.768
%define release 230131
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.767"
PI_BUILD="230110"
PI_VERSION="7.0NG.768"
PI_BUILD="230131"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.767
# Version 7.0NG.768
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.767}
{Pandora FMS Windows Agent v7.0NG.768}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230110}
{230131}
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.767 Build 230110")
#define PANDORA_VERSION ("7.0NG.768 Build 230131")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.767(Build 230110))"
VALUE "ProductVersion", "(7.0NG.768(Build 230131))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.767-230110
Version: 7.0NG.768-230131
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.767-230110"
pandora_version="7.0NG.768-230131"
package_pear=0
package_pandora=1

View File

@ -1 +0,0 @@

View File

@ -1,67 +1,144 @@
<?php
/**
* Pandora FMS API Checker Extension.
*
* @category API
* @package Pandora FMS
* @subpackage Extensions
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org 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; 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.
function api_execute($url, $ip, $pandora_url, $apipass, $user, $password, $op, $op2, $id, $id2, $return_type, $other, $other_mode)
{
if (empty($url)) {
$url = 'http://'.$ip.$pandora_url.'/include/api.php';
// Begin.
$url .= '?';
$url .= 'apipass='.$apipass;
$url .= '&user='.$user;
$url .= '&pass='.$password;
$url .= '&op='.$op;
$url .= '&op2='.$op2;
if ($id !== '') {
$url .= '&id='.$id;
/**
* Api Execution.
*
* @param string $url Url.
* @param string $ip Ip.
* @param string $pandora_url Pandora_url.
* @param string $apipass Apipass.
* @param string $user User.
* @param string $password Password.
* @param string $op Op.
* @param string $op2 Op2.
* @param string $id Id.
* @param string $id2 Id2.
* @param string $return_type Return_type.
* @param string $other Other.
* @param string $other_mode Other_mode.
* @param string $token Token.
*
* @return array.
*/
function api_execute(
string $url,
string $ip,
string $pandora_url,
string $apipass,
string $user,
string $password,
string $op,
string $op2,
string $id='',
string $id2='',
string $return_type='',
string $other='',
string $other_mode='',
string $token=''
) {
$data = [];
if (empty($url) === true) {
$url = 'http://'.$ip.$pandora_url.'/include/api.php?';
if (empty($op) === false) {
$data['op'] = $op;
}
if ($id2 !== '') {
$url .= '&id2='.$id2;
if (empty($op2) === false) {
$data['op2'] = $op2;
}
if ($return_type !== '') {
$url .= '&return_type='.$return_type;
if (empty($id) === false) {
$data['id'] = $id;
}
if ($other !== '') {
$url .= '&other_mode='.$other_mode;
$url .= '&other='.$other;
if (empty($id2) === false) {
$data['id2'] = $id2;
}
if (empty($return_type) === false) {
$data['return_type'] = $return_type;
}
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['password'] = $password;
}
}
$curlObj = curl_init();
$curlObj = curl_init($url);
if (empty($data) === false) {
$url .= http_build_query($data);
}
// set the content type json
$headers = [
'Content-Type: application/json',
'Authorization: Bearer '.$token,
];
curl_setopt($curlObj, CURLOPT_URL, $url);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curlObj);
curl_close($curlObj);
$return = [
return [
'url' => $url,
'result' => $result,
];
return $return;
}
/**
* Perform API Checker
*
* @return void.
*/
function extension_api_checker()
{
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Profile Management'
@ -85,11 +162,12 @@ function extension_api_checker()
$return_type = io_safe_output(get_parameter('return_type', ''));
$other = io_safe_output(get_parameter('other', ''));
$other_mode = io_safe_output(get_parameter('other_mode', 'url_encode_separator_|'));
$token = get_parameter('token');
$api_execute = get_parameter('api_execute', 0);
$api_execute = (bool) get_parameter('api_execute', false);
$return_call_api = '';
if ($api_execute) {
if ($api_execute === true) {
$return_call_api = api_execute(
$url,
$ip,
@ -103,7 +181,8 @@ function extension_api_checker()
urlencode($id2),
$return_type,
urlencode($other),
$other_mode
$other_mode,
$token
);
}
@ -129,6 +208,11 @@ function extension_api_checker()
$row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true);
$table->data[] = $row;
$row = [];
$row[] = __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true);
$row[] = html_print_input_text('token', $token, '', 50, 255, true);
$table->data[] = $row;
$row = [];
$row[] = __('API Pass');
$row[] = html_print_input_password('apipass', $apipass, '', 50, 255, true);
@ -225,7 +309,7 @@ function extension_api_checker()
echo '</form>';
if ($api_execute) {
if ($api_execute === true) {
echo '<fieldset>';
echo '<legend>'.__('Result').'</legend>';
echo __('URL').'<br />';

View File

@ -1,66 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org 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; 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.
require_once __DIR__.'/../include/config.php';
require_once __DIR__.'/../include/auth/mysql.php';
require_once __DIR__.'/../include/functions.php';
require_once __DIR__.'/../include/functions_db.php';
/*
* Review if sample agent is active and deploys configuration for
* visual consoles if necessary
*/
global $config;
// Deployment of sample agent for visual consoles.
if ($config['sample_agent'] == 1 && !isset($config['sample_agent_deployed'])) {
$id_agente = db_get_sql('SELECT id_agente FROM tagente WHERE nombre = "Sample_Agent";');
$modules = db_get_all_rows_filter('tagente_modulo', ['id_agente' => $id_agente], 'id_agente_modulo');
$count_modules = count($modules);
// Update of layout 1 (Rack sample).
$images_rack_server = [
'rack_server_rack',
'rack_server',
'rack_switch',
'rack_firewall',
'rack_double_server',
'rack_frame',
'rack_pdu',
];
$query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE ';
for ($i = 0; $i < $count_modules; $i++) {
$query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' ';
}
$query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");';
db_process_sql($query);
// Update of layout 2 (Dashboard).
$query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE ';
$query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' ';
$query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);';
db_process_sql($query);
// This setting will avoid regenerate all the times the visual consoles.
config_update_value('sample_agent_deployed', 1);
}
extensions_add_main_function('sample_agent_deployment');

View File

@ -1685,5 +1685,10 @@ enterprise/operation/agentes/manage_transmap.php
enterprise/operation/agentes/manage_transmap_creation.php
enterprise/operation/agentes/manage_transmap_creation_phases_data.php
enterprise/operation/agentes/transactional_map.php
enterprise/godmode/agentes/inventory_manager.php
enterprise/operation/agentes/agent_inventory.php
enterprise/godmode/modules/manage_inventory_modules.php
enterprise/godmode/modules/manage_inventory_modules_form.php
enterprise/operation/inventory/inventory.php
include/test.js
include/web2image.js

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,25 @@
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tsesion_filter` (
`id_filter` INT NOT NULL AUTO_INCREMENT,
`id_name` TEXT NULL,
`text` TEXT NULL,
`period` TEXT NULL,
`ip` TEXT NULL,
`type` TEXT NULL,
`user` TEXT NULL,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `tusuario_perfil_user` ON `tusuario_perfil` (`id_usuario`);
CREATE INDEX `tusuario_perfil_group` ON `tusuario_perfil` (`id_grupo`);
CREATE INDEX `tusuario_perfil_profile` ON `tusuario_perfil` (`id_perfil`);
CREATE INDEX `tlayout_data_layout` ON `tlayout_data` (`id_layout`);
CREATE INDEX `taddress_agent_agent` ON `taddress_agent` (`id_agent`);
CREATE INDEX `ttag_name` ON `ttag` (name(15));
CREATE INDEX `tservice_element_service` ON `tservice_element` (`id_service`);
CREATE INDEX `tservice_element_agent` ON `tservice_element` (`id_agent`);
CREATE INDEX `tservice_element_am` ON `tservice_element` (`id_agente_modulo`);
CREATE INDEX `tagent_module_log_agent` ON `tagent_module_log` (`id_agent`);
COMMIT;

Binary file not shown.

Binary file not shown.

View File

@ -461,6 +461,21 @@ if ($id_agente) {
$templatetab['active'] = ($tab === 'template');
// Inventory.
$inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
'images/page_white_text.png',
true,
[
'title' => __('Inventory'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'inventory') {
$inventorytab['active'] = true;
} else {
$inventorytab['active'] = false;
}
$inventorytab = enterprise_hook('inventory_tab');
if ($inventorytab === ENTERPRISE_NOT_HOOK) {
$inventorytab = '';
@ -2347,6 +2362,10 @@ switch ($tab) {
include 'agent_wizard.php';
break;
case 'inventory':
include 'inventory_manager.php';
break;
default:
if (enterprise_hook('switch_agent_tab', [$tab])) {
// This will make sure that blank pages will have at least some

View File

@ -0,0 +1,263 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
// Load global variables
global $config;
// Check user credentials
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access agent manager'
);
include $config['homedir'].'/general/noaccess.php';
return;
}
global $direccion_agente, $id_agente, $id_os;
// include_once ($config['homedir'].'/'.ENTERPRISE_DIR.'/include/functions_policies.php');
require_once $config['homedir'].'/include/functions_ui.php';
// Initialize data
$add_inventory_module = (boolean) get_parameter('add_inventory_module');
$update_inventory_module = (boolean) get_parameter('update_inventory_module');
$delete_inventory_module = (int) get_parameter('delete_inventory_module');
$load_inventory_module = (int) get_parameter('load_inventory_module');
$force_inventory_module = (int) get_parameter('force_inventory_module');
$id_agent_module_inventory = (int) get_parameter('id_agent_module_inventory');
$id_module_inventory = (int) get_parameter('id_module_inventory');
$target = (string) get_parameter('target', '');
$username = (string) get_parameter('username');
$password = io_input_password((string) get_parameter('password'));
$interval = (int) get_parameter('interval');
$custom_fields = array_map(
function ($field) {
$field['secure'] = (bool) $field['secure'];
if ($field['secure']) {
$field['value'] = io_input_password($field['value']);
}
return $field;
},
get_parameter('custom_fields', [])
);
$custom_fields_enabled = (bool) get_parameter('custom_fields_enabled');
// Add inventory module to agent
if ($add_inventory_module) {
$if_exists = db_get_value_filter(
'id_agent_module_inventory',
'tagent_module_inventory',
[
'id_agente' => $id_agente,
'id_module_inventory' => $id_module_inventory,
]
);
if (!$if_exists) {
$values = [
'id_agente' => $id_agente,
'id_module_inventory' => $id_module_inventory,
'target' => $target,
'interval' => $interval,
'username' => $username,
'password' => $password,
'custom_fields' => $custom_fields_enabled && !empty($custom_fields) ? base64_encode(json_encode($custom_fields)) : '',
];
$result = db_process_sql_insert('tagent_module_inventory', $values);
if ($result) {
ui_print_success_message(__('Successfully added inventory module'));
} else {
ui_print_error_message(__('Error adding inventory module'));
}
} else {
ui_print_error_message(__('The inventory of the module already exists'));
}
// Remove inventory module from agent
} else if ($delete_inventory_module) {
$result = db_process_sql_delete(
'tagent_module_inventory',
['id_agent_module_inventory' => $delete_inventory_module]
);
if ($result) {
ui_print_success_message(__('Successfully deleted inventory module'));
} else {
ui_print_error_message(__('Error deleting inventory module'));
}
// Update inventory module
} else if ($force_inventory_module) {
$result = db_process_sql_update('tagent_module_inventory', ['flag' => 1], ['id_agent_module_inventory' => $force_inventory_module]);
if ($result) {
ui_print_success_message(__('Successfully forced inventory module'));
} else {
ui_print_error_message(__('Error forcing inventory module'));
}
// Update inventory module
} else if ($update_inventory_module) {
$values = [
'target' => $target,
'interval' => $interval,
'username' => $username,
'password' => $password,
'custom_fields' => $custom_fields_enabled && !empty($custom_fields) ? base64_encode(json_encode($custom_fields)) : '',
];
$result = db_process_sql_update('tagent_module_inventory', $values, ['id_agent_module_inventory' => $id_agent_module_inventory, 'id_agente' => $id_agente]);
if ($result) {
ui_print_success_message(__('Successfully updated inventory module'));
} else {
ui_print_error_message(__('Error updating inventory module'));
}
}
// Load inventory module data for updating
if ($load_inventory_module) {
$sql = 'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = '.$load_inventory_module;
$row = db_get_row_sql($sql);
if (!empty($row)) {
$id_agent_module_inventory = $row['id_agent_module_inventory'];
$id_module_inventory = $row['id_module_inventory'];
$target = $row['target'];
$interval = $row['interval'];
$username = $row['username'];
$password = io_output_password($row['password']);
$custom_fields = [];
if (!empty($row['custom_fields'])) {
try {
$custom_fields = array_map(
function ($field) {
if ($field['secure']) {
$field['value'] = io_output_password($field['value']);
}
return $field;
},
json_decode(base64_decode($row['custom_fields']), true)
);
$custom_fields_enabled = true;
} catch (Exception $e) {
}
}
} else {
ui_print_error_message(__('Inventory module error'));
include 'general/footer.php';
return;
}
} else {
$target = $direccion_agente;
$interval = (string) SECONDS_1HOUR;
$username = '';
$password = '';
$custom_fields_enabled = false;
$custom_fields = [];
}
// Inventory module configuration
$form_buttons = '';
if ($load_inventory_module) {
$form_buttons .= html_print_input_hidden('id_agent_module_inventory', $id_agent_module_inventory, true);
$form_buttons .= html_print_submit_button(__('Update'), 'update_inventory_module', false, 'class="sub next"', true);
} else {
$form_buttons .= html_print_submit_button(__('Add'), 'add_inventory_module', false, 'class="sub next"', true);
}
echo ui_get_inventory_module_add_form(
'index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente,
$form_buttons,
$load_inventory_module,
$id_os,
$target,
$interval,
$username,
$password,
$custom_fields_enabled,
$custom_fields
);
// Inventory module list
$sql = sprintf(
'SELECT *
FROM tmodule_inventory, tagent_module_inventory
WHERE tagent_module_inventory.id_agente = %d
AND tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory
ORDER BY name',
$id_agente
);
$result = db_process_sql($sql);
if (db_get_num_rows($sql) == 0) {
echo '&nbsp;</td></tr><tr><td>';
} else {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->data = [];
$table->head = [];
$table->styleTable = 'margin-top: 20px;';
$table->head[0] = "<span title='".__('Policy')."'>".__('P.').'</span>';
$table->head[1] = __('Name');
$table->head[2] = __('Description');
$table->head[3] = __('Target');
$table->head[4] = __('Interval');
$table->head[5] = __('Actions');
$table->align = [];
$table->align[5] = 'left';
foreach ($result as $row) {
$data = [];
$sql = sprintf('SELECT id_policy FROM tpolicy_modules_inventory WHERE id = %d', $row['id_policy_module_inventory']);
$id_policy = db_get_value_sql($sql);
if ($id_policy) {
$policy = policies_get_policy($id_policy);
$data[0] = '<a href="index.php?sec=gmodules&sec2='.ENTERPRISE_DIR.'/godmode/policies/policies&id='.$id_policy.'">';
$data[0] .= html_print_image('images/policies_mc.png', true, ['border' => '0', 'title' => $policy['name']]);
$data[0] .= '</a>';
} else {
$data[0] = '';
}
$data[1] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&load_inventory_module='.$row['id_module_inventory'].'">'.$row['name'].'</a>';
$data[2] = $row['description'];
$data[3] = $row['target'];
$data[4] = human_time_description_raw($row['interval']);
// Delete module
$data[5] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&delete_inventory_module='.$row['id_agent_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[5] .= html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'invert_filter']);
$data[5] .= '</b></a>&nbsp;&nbsp;';
// Update module
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&load_inventory_module='.$row['id_module_inventory'].'">';
$data[5] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']);
$data[5] .= '</b></a>&nbsp;&nbsp;';
// Force refresh module
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&force_inventory_module='.$row['id_agent_module_inventory'].'">';
$data[5] .= html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force'), 'class' => 'invert_filter']).'</b></a>';
array_push($table->data, $data);
}
html_print_table($table);
}

View File

@ -1352,4 +1352,60 @@ if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === tr
window.location = window.location + "&checked=true";
}
}
function get_children_modules(multiple, id_module, url) {
var selected_modules = [];
if(typeof(id_module) === 'undefined' && multiple === true) {
$("input[id^='checkbox-id_delete']:checked").each(function () {
selected_modules.push(this.value);
});
} else {
selected_modules = [id_module];
}
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
data: {
page: 'include/ajax/module',
get_children_modules: true,
parent_modulues: JSON.parse(JSON.stringify(selected_modules)),
},
success: function (data) {
delete_module_warning(data, multiple, id_module, url);
}
});
}
function delete_module_warning(children, multiple, id_module, url) {
var message = '<?php echo __('Are you sure?'); ?>';
var ret = false;
if(children != false) {
message += '<br><strong>' + '<?php echo __('This module has children modules.The following modules will also be deleted: '); ?>' + '</strong><ul>';
$.each(children, function (key, value) {
message += '<li>' + value['nombre'] + '</li>';
});
message += '</ul>';
}
confirmDialog({
title: "<?php echo __('Delete module'); ?>",
message: message,
onAccept: function() {
if(multiple === true) {
$("#form_multiple_delete").submit();
return true;
} else {
window.location.href = url;
}
}
});
return true;
}
</script>

View File

@ -389,7 +389,7 @@ $data[1] = html_print_input_text(
$data[2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
$data[3] = html_print_input_password(
'snmp3_auth_pass',
$snmp3_auth_pass,
'',
'',
15,
60,
@ -411,7 +411,7 @@ $data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_pr
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
$data[3] = html_print_input_password(
'snmp3_privacy_pass',
$snmp3_privacy_pass,
'',
'',
15,
60,
@ -730,6 +730,12 @@ $(document).ready (function () {
$("#text-custom_ip_target").hide();
}
});
// Add input password values with js to hide it in browser inspector.
$('#password-snmp3_auth_pass').val('<?php echo $snmp3_auth_pass; ?>');
$('#password-snmp3_privacy_pass').val('<?php echo $snmp3_privacy_pass; ?>');
observerInputPassword();
});

View File

@ -85,6 +85,8 @@ $table_simple->rowstyle['macro_field'] = 'display:none';
push_table_simple($data, 'macro_field');
$password_fields = [];
// If there are $macros, we create the form fields
if (!empty($macros)) {
$macros = json_decode($macros, true);
@ -102,7 +104,8 @@ if (!empty($macros)) {
}
if ($m_hide) {
$data[1] = html_print_input_password($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
$data[1] = html_print_input_password($m['macro'], '', '', 100, 1024, true);
array_push($password_fields, $m);
} else {
$data[1] = html_print_input_text(
$m['macro'],
@ -125,6 +128,17 @@ if (!empty($macros)) {
}
}
// Add input password values with js to hide it in browser inspector.
foreach ($password_fields as $k => $p) {
echo "
<script>
$(document).ready(() => {
$('input[name=\"".$p['macro']."\"]').val('".$p['value']."');
});
</script>
";
}
?>
<script type="text/javascript">
function changePluginSelect() {
@ -140,4 +154,8 @@ if (!empty($macros)) {
forced_title_callback();
}
$(document).ready(function () {
observerInputPassword();
});
</script>

View File

@ -116,7 +116,7 @@ $data[1] = html_print_input_text(
$data[2] = __('Password');
$data[3] = html_print_input_password(
'plugin_pass',
$plugin_pass,
'',
'',
15,
60,
@ -191,6 +191,11 @@ $(document).ready (function () {
$("#text-custom_ip_target").hide();
}
});
// Add input password values with js to hide it in browser inspector.
$('#password-plugin_pass').val('<?php echo $plugin_pass; ?>');
observerInputPassword();
});
</script>

View File

@ -290,7 +290,7 @@ $search_text = (string) get_parameter('search_text');
$date_from = (string) get_parameter('date_from');
$date_to = (string) get_parameter('date_to');
$execution_type = (string) get_parameter('execution_type');
$show_archived = (bool) get_parameter('archived');
$show_archived = (bool) get_parameter_switch('archived', false);
$agent_id = (int) get_parameter('agent_id');
$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
$module_id = (int) get_parameter('module_name_hidden');
@ -313,12 +313,20 @@ $table_form = new StdClass();
$table_form->class = 'databox filters';
$table_form->width = '100%';
$table_form->rowstyle = [];
$table_form->cellstyle[0] = ['width: 100px;'];
$table_form->cellstyle[1] = ['width: 100px;'];
$table_form->cellstyle[1][2] = 'display: flex; align-items: center;';
$table_form->cellstyle[2] = ['width: 100px;'];
$table_form->cellstyle[3] = ['text-align: right;'];
$table_form->colspan[3][0] = 3;
$table_form->data = [];
$row = [];
// Search text.
$row[] = __('Search').'&nbsp;'.html_print_input_text(
$row[] = __('Search');
$row[] = html_print_input_text(
'search_text',
$search_text,
'',
@ -356,7 +364,8 @@ $execution_type_fields = [
'periodically' => __('Periodically'),
'cron' => __('Cron'),
];
$row[] = __('Execution type').'&nbsp;'.html_print_select(
$row[] = __('Execution type');
$row[] = html_print_select(
$execution_type_fields,
'execution_type',
$execution_type,
@ -368,11 +377,11 @@ $row[] = __('Execution type').'&nbsp;'.html_print_select(
false
);
// Show past downtimes.
$row[] = __('Show past downtimes').'&nbsp;'.html_print_checkbox(
'archived',
1,
$show_archived,
true
$row[] = __('Show past downtimes').'&nbsp;&nbsp;&nbsp;&nbsp;'.html_print_switch(
[
'name' => 'archived',
'value' => $show_archived,
]
);
$table_form->data[] = $row;
@ -388,8 +397,8 @@ $params['return'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$agent_input = __('Agent').'&nbsp;'.ui_print_agent_autocomplete_input($params);
$row[] = $agent_input;
$row[] = __('Agent');
$row[] = ui_print_agent_autocomplete_input($params);
// Module.
$row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules(
@ -402,6 +411,10 @@ $row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules(
true
);
$table_form->data[] = $row;
$row = [];
$row[] = html_print_submit_button(
__('Search'),
'search',

View File

@ -109,6 +109,8 @@ if ($id) {
$text_agent = '';
}
}
$server_id = ($filter['server_id'] ?? '');
} else {
$id_group = '';
$id_group_filter = '';
@ -134,6 +136,7 @@ if ($id) {
$filter_only_alert = '';
$search_secondary_groups = 0;
$search_recursive_groups = 0;
$server_id = '';
}
if ($update || $create) {
@ -183,6 +186,12 @@ if ($update || $create) {
$custom_data = get_parameter('custom_data', '');
$custom_data_filter_type = get_parameter('custom_data_filter_type', '');
$server_id = '';
if (is_metaconsole() === true) {
$servers_array = get_parameter('server_id', []);
$server_id = implode(',', $servers_array);
}
$values = [
'id_name' => $id_name,
'id_group_filter' => $id_group_filter,
@ -212,6 +221,7 @@ if ($update || $create) {
'search_recursive_groups' => $search_recursive_groups,
'custom_data' => $custom_data,
'custom_data_filter_type' => $custom_data_filter_type,
'server_id' => $server_id,
];
$severity = explode(',', $severity);
@ -708,6 +718,55 @@ if (is_metaconsole()) {
);
}
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
if (is_array($servers) === true) {
$servers = array_reduce(
$servers,
function ($carry, $item) {
$carry[$item['id']] = $item['server_name'];
return $carry;
}
);
} else {
$servers = [];
}
$servers[0] = __('Metaconsola');
if ($server_id === '') {
$server_id = array_keys($servers);
} else {
if (is_array($server_id) === false) {
if (is_numeric($server_id) === true) {
if ($server_id !== 0) {
$server_id = [$server_id];
} else {
$server_id = array_keys($servers);
}
} else {
$server_id = explode(',', $server_id);
}
}
}
$table->data[29][0] = '<b>'.__('Server').'</b>';
$table->data[29][1] = html_print_select(
$servers,
'server_id[]',
$server_id,
'',
'',
0,
true,
true,
true,
'',
false,
'height: 60px;'
);
}
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&pure='.$config['pure'].'">';
html_print_table($table);

View File

@ -550,7 +550,22 @@ $table->data['form_agents_3'][3] = html_print_select(
$table->data['edit0'][0] = __('Dynamic Interval');
$table->data['edit0'][1] = html_print_extended_select_for_time('dynamic_interval', '', '', 'None', '0', 10, true, 'width:150px', false);
$table->data['edit0'][1] = html_print_extended_select_for_time(
'dynamic_interval',
-2,
'',
'None',
'0',
10,
true,
'width:150px',
false,
'',
false,
false,
'',
true
);
$table->data['edit0'][2] = '<table width="100%"><tr><td><em>'.__('Dynamic Min.').'</em></td>';
$table->data['edit0'][2] .= '<td align="right">'.html_print_input_text('dynamic_min', '', '', 10, 255, true).'</td></tr>';
$table->data['edit0'][2] .= '<tr><td><em>'.__('Dynamic Max.').'</em></td>';

View File

@ -181,7 +181,9 @@ if ($access_console_node === true) {
$sub2['godmode/modules/manage_network_components']['id'] = 'Network components';
$sub['templates']['sub2'] = $sub2;
enterprise_hook('inventory_submenu');
$sub['godmode/modules/manage_inventory_modules']['text'] = __('Inventory modules');
$sub['godmode/modules/manage_inventory_modules']['id'] = 'Inventory modules';
enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu');
}

View File

@ -0,0 +1,393 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
// Load global variables
global $config;
// Check user credentials.
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Inventory Module Management'
);
include 'general/noaccess.php';
return;
}
require_once $config['homedir'].'/include/functions_inventory.php';
enterprise_include_once('include/functions_metaconsole.php');
$management_allowed = is_management_allowed();
// Header.
if (is_metaconsole() === true) {
$sec = 'advanced';
enterprise_include_once('meta/include/functions_components_meta.php');
enterprise_hook('open_meta_frame');
components_meta_print_header();
if ($management_allowed === false) {
ui_print_warning_message(__('To manage inventory plugin you must activate centralized management'));
}
} else {
$sec = 'gmodules';
ui_print_page_header(
__('Module management').' &raquo; '.__('Inventory modules'),
'images/page_white_text.png',
false,
'',
true
);
if ($management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/modules/manage_inventory_modules'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This console is not manager of this environment, please manage this feature from centralized manager console. Go to %s to manage it.',
$url
)
);
}
}
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
if ($is_windows) {
ui_print_error_message(__('Not supported in Windows systems'));
}
// Initialize variables.
$offset = (int) get_parameter('offset');
$create_module_inventory = (bool) get_parameter('create_module_inventory');
$update_module_inventory = (bool) get_parameter('update_module_inventory');
$delete_inventory_module = (int) get_parameter('delete_inventory_module');
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
$id_module_inventory = (int) get_parameter('id_module_inventory');
$name = (string) get_parameter('name');
$description = (string) get_parameter('description');
$id_os = (int) get_parameter('id_os');
if ($id_os == 0) {
$id_os = 'NULL';
}
$interpreter = (string) get_parameter('interpreter');
$script_mode = (string) get_parameter('script_mode');
$code = (string) get_parameter('code');
$code = base64_encode(str_replace("\r", '', html_entity_decode($code, ENT_QUOTES)));
$format = (string) get_parameter('format');
$block_mode = (int) get_parameter('block_mode', 0);
$script_path = (string) get_parameter('script_path');
// Create inventory module.
if ($create_module_inventory === true) {
$values = [
'name' => $name,
'description' => $description,
'id_os' => $id_os,
'interpreter' => $interpreter,
'code' => $code,
'data_format' => $format,
'block_mode' => $block_mode,
'script_mode' => $script_mode,
'script_path' => $script_path,
];
$result = (bool) inventory_create_inventory_module($values);
$auditMessage = ((bool) $result === true) ? sprintf('Create inventory module #%s', $result) : 'Fail try to create inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
$auditMessage
);
ui_print_result_message(
(bool) $result,
__('Successfully created inventory module'),
__('Error creating inventory module')
);
// Update inventory module.
} else if ($update_module_inventory === true) {
$values = [
'name' => $name,
'description' => $description,
'id_os' => $id_os,
'interpreter' => $interpreter,
'code' => $code,
'data_format' => $format,
'block_mode' => $block_mode,
'script_mode' => $script_mode,
'script_path' => $script_path,
];
$result = inventory_update_inventory_module($id_module_inventory, $values);
$auditMessage = ((bool) $result === true) ? 'Update inventory module' : 'Fail try to update inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $id_module_inventory)
);
ui_print_result_message(
(bool) $result,
__('Successfully updated inventory module'),
__('Error updating inventory module')
);
// Delete inventory module.
} else if ((bool) $delete_inventory_module === true) {
$result = db_process_sql_delete(
'tmodule_inventory',
['id_module_inventory' => $delete_inventory_module]
);
$auditMessage = ((bool) $result === true) ? 'Delete inventory module' : 'Fail try to delete inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $id_module_inventory)
);
ui_print_result_message(
(bool) $result,
__('Successfully deleted inventory module'),
__('Error deleting inventory module')
);
if (is_metaconsole() === true) {
$setups = db_get_all_rows_in_table('tmetaconsole_setup');
foreach ($setups as $key => $setup) {
if (metaconsole_connect($setup) == NOERR) {
$result = db_process_sql_delete(
'tmodule_inventory',
['id_module_inventory' => $delete_inventory_module]
);
$auditMessage = ((bool) $result === true) ? 'Delete inventory module' : 'Fail try to delete inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $id_module_inventory)
);
ui_print_result_message(
(bool) $result,
$setup['server_name'].': '.__('Successfully deleted inventory module'),
$setup['server_name'].': '.__('Error deleting inventory module')
);
}
metaconsole_restore_db();
}
}
} else if ($multiple_delete) {
$ids = (array) get_parameter('delete_multiple', []);
foreach ($ids as $id) {
$result = db_process_sql_delete('tmodule_inventory', ['id_module_inventory' => $id]);
if ($result === false) {
break;
}
}
if ($result !== false) {
$result = true;
} else {
$result = false;
}
$str_ids = implode(',', $ids);
$auditMessage = ($result === true) ? 'Multiple delete inventory module' : 'Fail try to delete inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s :%s', $auditMessage, $str_ids)
);
ui_print_result_message(
$result,
__('Successfully multiple deleted'),
__('Not deleted. Error deleting multiple data')
);
$id = 0;
if (is_metaconsole()) {
$setups = db_get_all_rows_in_table('tmetaconsole_setup');
foreach ($setups as $key => $setup) {
if (metaconsole_connect($setup) == NOERR) {
foreach ($ids as $id) {
$result_node = db_process_sql_delete('tmodule_inventory', ['id_module_inventory' => $id]);
if ($result_node === false) {
break;
}
}
if ($result_node !== false) {
$result_node = true;
} else {
$result_node = false;
}
$str_ids = implode(',', $ids);
$auditMessage = ($result_node === true) ? 'Multiple delete inventory module' : 'Fail try to delete inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s :%s', $auditMessage, $str_ids)
);
ui_print_result_message(
$result_node,
$setup['server_name'].': '.__('Successfully multiple deleted'),
$setup['server_name'].': '.__('Not deleted. Error deleting multiple data')
);
}
metaconsole_restore_db();
}
}
}
$total_modules = db_get_sql('SELECT COUNT(*) FROM tmodule_inventory');
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->size = [];
$table->size[0] = '140px';
$table->align = [];
$table->align[2] = 'left';
$table->align[4] = 'left';
$table->data = [];
$table->head = [];
$table->head[0] = __('Name');
$table->head[1] = __('Description');
$table->head[2] = __('OS');
$table->head[3] = __('Interpreter');
if ($management_allowed === true) {
$table->head[4] = __('Action').html_print_checkbox('all_delete', 0, false, true, false);
}
$result = inventory_get_modules_list($offset);
if ($result === false) {
ui_print_info_message(['no_close' => true, 'message' => __('No inventory modules defined') ]);
} else {
$status = '';
$begin = true;
while ($row = array_shift($result)) {
$data = [];
$begin = false;
if ($management_allowed === true) {
$data[0] = '<strong><a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form&id_module_inventory='.$row['id_module_inventory'].'">'.$row['name'].'</a></strong>';
} else {
$data[0] = '<strong>'.$row['name'].'</strong>';
}
$data[1] = $row['description'];
if ($row['os_name'] == null) {
$data[2] = html_print_image('images/agent.png', true, ['border' => '0', 'alt' => __('Agent'), 'title' => __('Agent'), 'height' => '18', 'class' => 'invert_filter']);
} else {
$data[2] = ui_print_os_icon($row['id_os'], false, true);
}
if ($row['interpreter'] == '') {
$data[3] = __('Local module');
} else {
$data[3] = __('Remote/Local');
}
if ($management_allowed === true) {
// Update module.
$data[4] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form&id_module_inventory='.$row['id_module_inventory'].'">';
$data[4] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']).'</b></a>';
// Delete module.
$data[4] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules&delete_inventory_module='.$row['id_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'invert_filter']);
$data[4] .= '</b></a>&nbsp;&nbsp;';
$data[4] .= html_print_checkbox_extended('delete_multiple[]', $row['id_module_inventory'], false, false, '', 'class="check_delete"', true);
}
array_push($table->data, $data);
}
echo "<form method='post' action='index.php?sec=".$sec."&sec2=godmode/modules/manage_inventory_modules'>";
html_print_input_hidden('multiple_delete', 1);
ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset);
html_print_table($table);
ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset, 0, false, 'offset', true, 'pagination-bottom');
echo "<div class='pdd_l_5px float-right'>";
if ($management_allowed === true) {
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
}
echo '</div>';
echo '</form>';
}
if ($management_allowed === true) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form">';
echo '<div class="float-right mrgn_btn_15px">';
html_print_input_hidden('create_module_inventory', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
}
if (is_metaconsole() === true) {
enterprise_hook('close_meta_frame');
echo '<div id="deploy_messages" class="invisible">';
echo '<span>'.__(
'The configurations of inventory modules from the nodes have been unified.
From this point on, changes to the inventory scripts must be made through this screen.'
).'</br></br>'.__('You can find more information at:')."<a href='https://pandorafms.com/manual'>https://pandorafms.com/manual</a>".'</span>';
echo '</div>';
}
?>
<script type="text/javascript">
$( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function() {
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
}
else {
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
});
});
</script>

View File

@ -0,0 +1,206 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
// Load global variables
global $config;
// Check user credentials
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Inventory Module Management'
);
include 'general/noaccess.php';
return;
}
// Header
if (defined('METACONSOLE')) {
$sec = 'advanced';
enterprise_include_once('meta/include/functions_components_meta.php');
enterprise_hook('open_meta_frame');
components_meta_print_header();
} else {
$sec = 'gmodules';
ui_print_page_header(
__('Module management').' » '.__('Inventory modules'),
'images/op_inventory.png',
false,
'',
true
);
}
// Header
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
if ($is_windows) {
ui_print_error_message(__('Not supported in Windows systems'));
}
// Initialize variables
$id_module_inventory = (int) get_parameter('id_module_inventory');
$script_mode = 1;
// Updating
if ($id_module_inventory) {
$row = db_get_row(
'tmodule_inventory',
'id_module_inventory',
$id_module_inventory
);
if (!empty($row)) {
$name = $row['name'];
$description = $row['description'];
$id_os = $row['id_os'];
$interpreter = $row['interpreter'];
$code = $row['code'];
$data_format = $row['data_format'];
$block_mode = $row['block_mode'];
$script_path = $row['script_path'];
$script_mode = $row['script_mode'];
} else {
ui_print_error_message(__('Inventory module error'));
include 'general/footer.php';
return;
}
// New module
} else {
$name = '';
$description = '';
$id_os = 1;
$interpreter = '';
$code = '';
$data_format = '';
$block_mode = 0;
}
if ($id_os == null) {
$disabled = true;
} else {
$disabled = false;
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->data = [];
$table->data[0][0] = '<strong>'.__('Name').'</strong>';
$table->data[0][1] = html_print_input_text('name', $name, '', 45, 100, true, $disabled);
$table->data[1][0] = '<strong>'.__('Description').'</strong>';
$table->data[1][1] = html_print_input_text('description', $description, '', 60, 500, true);
$table->data[2][0] = '<strong>'.__('OS').'</strong>';
$table->data[2][1] = html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os ORDER BY name',
'id_os',
$id_os,
'',
'',
'',
$return = true
);
$table->data[3][0] = '<strong>'.__('Interpreter').'</strong>';
$table->data[3][1] = html_print_input_text('interpreter', $interpreter, '', 25, 100, true);
$table->data[3][1] .= ui_print_help_tip(__('Left blank for the LOCAL inventory modules'), true);
$table->data['block_mode'][0] = '<strong>'.__('Block Mode').'</strong>';
$table->data['block_mode'][1] = html_print_checkbox('block_mode', 1, $block_mode, true);
$table->data[4][0] = '<strong>'.__('Format').'</strong>';
$table->data[4][0] .= ui_print_help_tip(__('separate fields with ').SEPARATOR_COLUMN, true);
$table->data[4][1] = html_print_input_text('format', $data_format, '', 50, 100, true);
$table->data[5][0] = '<strong>'.__('Script mode').'</strong>';
$table->data[5][0] .= ui_print_help_tip(__(''), true);
$table->data[5][1] = __('Use script');
$table->data[5][1] .= html_print_radio_button(
'script_mode',
1,
'',
$script_mode,
true
).'&nbsp;&nbsp;';
$table->data[5][1] .= '&nbsp&nbsp&nbsp&nbsp'.__('Use inline code');
$table->data[5][1] .= html_print_radio_button(
'script_mode',
2,
'',
$script_mode,
true
).'&nbsp;&nbsp;';
$table->data[6][0] = '<strong>'.__('Script path').'</strong>';
$table->data[6][1] = html_print_input_text('script_path', $script_path, '', 50, 1000, true);
$table->data[7][0] = '<strong>'.__('Code').'</strong>';
$table->data[7][0] .= ui_print_help_tip(__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, true);
$table->data[7][1] = html_print_textarea('code', 25, 80, base64_decode($code), '', true);
echo '<form name="inventorymodule" id="inventorymodule_form" method="post"
action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules">';
html_print_table($table);
if ($id_module_inventory) {
html_print_input_hidden('update_module_inventory', 1);
html_print_input_hidden('id_module_inventory', $id_module_inventory);
} else {
html_print_input_hidden('create_module_inventory', 1);
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id_module_inventory) {
html_print_submit_button(__('Update'), 'submit', false, 'class="sub next"');
} else {
html_print_submit_button(__('Create'), 'submit', false, 'class="sub upd"');
}
echo '</div>';
echo '</form>';
if (defined('METACONSOLE')) {
enterprise_hook('close_meta_frame');
}
?>
<script type="text/javascript">
$(document).ready (function () {
var mode = <?php echo $script_mode; ?>;
if (mode == 1) {
$('#table1-6').show();
$('#table1-7').hide();
} else {
$('#table1-7').show();
$('#table1-6').hide();
}
$('input[type=radio][name=script_mode]').change(function() {
if (this.value == 1) {
$('#table1-6').show();
$('#table1-7').hide();
}
else if (this.value == 2) {
$('#table1-7').show();
$('#table1-6').hide();
}
});
});
</script>

View File

@ -177,7 +177,7 @@ switch ($activeTab) {
$background_color = (string) get_parameter('background_color');
$width = (int) get_parameter('width');
$height = (int) get_parameter('height');
$visualConsoleName = (string) get_parameter('name');
$visualConsoleName = io_safe_input((string) get_parameter('name'));
$is_favourite = (int) get_parameter('is_favourite_sent');
$auto_adjust = (int) get_parameter('auto_adjust_sent');

View File

@ -350,6 +350,87 @@ $table->data[$i++][1] = html_print_textarea(
true
);
// Inventory changes blacklist.
$table->data[$i][0] = __('Inventory changes blacklist');
$inventory_changes_blacklist_id = get_parameter(
'inventory_changes_blacklist',
$config['inventory_changes_blacklist']
);
if (!is_array($inventory_changes_blacklist_id)) {
$inventory_changes_blacklist_id = explode(
',',
$inventory_changes_blacklist_id
);
}
$inventory_modules = db_get_all_rows_sql(
'SELECT mi.id_module_inventory, mi.name module_inventory_name, os.name os_name
FROM tmodule_inventory mi, tconfig_os os
WHERE os.id_os = mi.id_os'
);
$inventory_changes_blacklist = [];
$inventory_changes_blacklist_out = [];
foreach ($inventory_modules as $inventory_module) {
if (in_array($inventory_module['id_module_inventory'], $inventory_changes_blacklist_id)) {
$inventory_changes_blacklist[$inventory_module['id_module_inventory']] = $inventory_module['module_inventory_name'].' ('.$inventory_module['os_name'].')';
} else {
$inventory_changes_blacklist_out[$inventory_module['id_module_inventory']] = $inventory_module['module_inventory_name'].' ('.$inventory_module['os_name'].')';
}
}
$select_out = html_print_select(
$inventory_changes_blacklist_out,
'inventory_changes_blacklist_out[]',
'',
'',
'',
'',
true,
true,
true,
'',
false,
'width:200px'
);
$arrows = ' ';
$select_in = html_print_select(
$inventory_changes_blacklist,
'inventory_changes_blacklist[]',
'',
'',
'',
'',
true,
true,
true,
'',
false,
'width:200px'
);
$table_ichanges = '<table>
<tr>
<td>'.__('Out of black list').'</td>
<td></td>
<td>'.__('In black list').'</td>
</tr>
<tr>
<td>'.$select_out.'</td>
<td>
<a href="javascript:">'.html_print_image('images/darrowright.png', true, ['id' => 'right_iblacklist', 'alt' => __('Push selected modules into blacklist'), 'title' => __('Push selected modules into blacklist'), 'class' => 'invert_filter']).'</a>
<br><br>
<a href="javascript:">'.html_print_image('images/darrowleft.png', true, ['id' => 'left_iblacklist', 'alt' => __('Pop selected modules out of blacklist'), 'title' => __('Pop selected modules out of blacklist'), 'class' => 'invert_filter']).'</a>
</td>
<td>'.$select_in.'</td>
</tr>
</table>';
$table->data[$i++][1] = $table_ichanges;
$table->data[$i][0] = __('Referer security');
$table->data[$i++][1] = html_print_checkbox_switch(
'referer_security',
@ -834,5 +915,64 @@ $(document).ready (function () {
})
$('#button-email_test').click(perform_email_test);
$("#right_iblacklist").click (function () {
jQuery.each($("select[name='inventory_changes_blacklist_out[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();
if (imodule_name != <?php echo "'".__('None')."'"; ?>) {
id_imodule = $(value).attr('value');
$("select[name='inventory_changes_blacklist[]']")
.append(
$("<option></option>")
.val(id_imodule)
.html('<i>' + imodule_name + '</i>')
);
$("#inventory_changes_blacklist_out")
.find("option[value='" + id_imodule + "']").remove();
$("#inventory_changes_blacklist")
.find("option[value='']").remove();
if($("#inventory_changes_blacklist_out option").length == 0) {
$("select[name='inventory_changes_blacklist_out[]']")
.append(
$("<option></option>")
.val('')
.html('<i><?php echo __('None'); ?></i>')
);
}
}
});
});
$("#left_iblacklist").click (function () {
jQuery.each($("select[name='inventory_changes_blacklist[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();
if (imodule_name != <?php echo "'".__('None')."'"; ?>) {
id_imodule = $(value).attr('value');
$("select[name='inventory_changes_blacklist_out[]']")
.append(
$("<option></option>")
.val(id_imodule)
.html('<i>' + imodule_name + '</i>')
);
$("#inventory_changes_blacklist")
.find("option[value='" + id_imodule + "']").remove();
$("#inventory_changes_blacklist_out")
.find("option[value='']").remove();
if($("#inventory_changes_blacklist option").length == 0) {
$("select[name='inventory_changes_blacklist[]']")
.append(
$("<option></option>")
.val('')
.html('<i><?php echo __('None'); ?></i>')
);
}
}
});
});
$("#submit-update_button").click(function () {
$('#inventory_changes_blacklist option').map(function(){
$(this).prop('selected', true);
});
});
});
</script>

View File

@ -42,10 +42,7 @@ require_once $config['homedir'].'/include/functions_visual_map.php';
require_once $config['homedir'].'/include/functions_custom_fields.php';
enterprise_include_once('include/functions_profile.php');
$meta = false;
if (enterprise_installed() && defined('METACONSOLE')) {
$meta = true;
}
$meta = is_metaconsole();
$isFunctionSkins = enterprise_include_once('include/functions_skins.php');
@ -55,12 +52,11 @@ if (ENTERPRISE_NOT_HOOK !== enterprise_include('include/functions_policies.php')
$enterprise_include = true;
}
if ($enterprise_include) {
if ($enterprise_include === true) {
enterprise_include_once('meta/include/functions_users_meta.php');
}
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
date_default_timezone_set('UTC');
include 'include/javascript/timezonepicker/includes/parser.inc';
@ -110,13 +106,13 @@ if (!is_metaconsole()) {
// This defines the working user. Beware with this, old code get confusses
// and operates with current logged user (dangerous).
$id = get_parameter('id', get_parameter('id_user', ''));
// ID given as parameter
// ID given as parameter.
$pure = get_parameter('pure', 0);
$user_info = get_user_info($id);
$is_err = false;
if (! check_acl($config['id_user'], 0, 'UM')) {
if ((bool) check_acl($config['id_user'], 0, 'UM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access User Management'
@ -126,11 +122,11 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
return;
}
if (is_ajax()) {
if (is_ajax() === true) {
$delete_profile = (bool) get_parameter('delete_profile');
$get_user_profile = (bool) get_parameter('get_user_profile');
if ($delete_profile) {
if ($delete_profile === true) {
$id2 = (string) get_parameter('id_user');
$id_up = (int) get_parameter('id_user_profile');
@ -160,7 +156,7 @@ if (is_ajax()) {
if ($has_profile === false && $user_is_global_admin === false) {
$result = delete_user($id2);
if ($result) {
if ($result === true) {
db_pandora_audit(
AUDIT_LOG_USER_MANAGEMENT,
__('Deleted user %s', io_safe_output($id_user))
@ -173,30 +169,34 @@ if (is_ajax()) {
__('There was a problem deleting the user')
);
// Delete the user in all the consoles
if (defined('METACONSOLE')) {
// Delete the user in all the consoles.
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
// Connect to the remote console
// Connect to the remote console.
metaconsole_connect($server);
// Delete the user
// Delete the user.
$result = delete_user($id_user);
if ($result) {
if ($result === true) {
db_pandora_audit(
AUDIT_LOG_USER_MANAGEMENT,
__('Deleted user %s from metaconsole', io_safe_output($id_user))
);
}
// Restore the db connection
// Restore the db connection.
metaconsole_restore_db();
// Log to the metaconsole too
if ($result) {
// Log to the metaconsole too.
if ($result === true) {
db_pandora_audit(
AUDIT_LOG_USER_MANAGEMENT,
__('Deleted user %s from %s', io_safe_input($id_user), io_safe_input($server['server_name']))
__(
'Deleted user %s from %s',
io_safe_input($id_user),
io_safe_input($server['server_name'])
)
);
}
@ -272,14 +272,8 @@ enterprise_hook('open_meta_frame');
$tab = get_parameter('tab', 'user');
if ($id) {
$header_title = ' &raquo; '.__('Update user');
} else {
$header_title = ' &raquo; '.__('Create user');
}
// Header
if ($meta) {
// Header.
if (is_metaconsole() === true) {
user_meta_print_header();
$sec = 'advanced';
} else {
@ -310,19 +304,34 @@ if ($meta) {
$buttons[$tab]['active'] = true;
ui_print_page_header(
__('User detail editor').$header_title,
ui_print_standard_header(
(empty($id) === false) ? __('Update user') : __('Create user'),
'images/gm_users.png',
false,
'',
true,
$buttons
$buttons,
[
[
'link' => '',
'label' => __('Profiles'),
],
[
'link' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list'),
'label' => __('Manage users'),
],
[
'link' => '',
'label' => __('User Detail Editor'),
],
]
);
$sec = 'gusuarios';
}
if ($config['user_can_update_info']) {
if ((bool) $config['user_can_update_info'] === true) {
$view_mode = false;
} else {
$view_mode = true;
@ -332,17 +341,18 @@ $new_user = (bool) get_parameter('new_user');
$create_user = (bool) get_parameter('create_user');
$add_profile = (bool) get_parameter('add_profile');
$update_user = (bool) get_parameter('update_user');
$renewAPIToken = (bool) get_parameter('renewAPIToken');
$status = get_parameter('status', -1);
$json_profile = get_parameter('json_profile', '');
// Reset status var if current action is not update_user
if ($new_user || $create_user || $add_profile
|| $delete_profile || $update_user
// Reset status var if current action is not update_user.
if ($new_user === true || $create_user === true || $add_profile === true
|| $delete_profile === true || $update_user === true
) {
$status = -1;
}
if ($new_user && $config['admin_can_add_user']) {
if ($new_user === true && (bool) $config['admin_can_add_user'] === true) {
$user_info = [];
$id = '';
$user_info['fullname'] = '';
@ -366,28 +376,30 @@ if ($new_user && $config['admin_can_add_user']) {
$user_info['section'] = '';
$user_info['data_section'] = '';
// This attributes are inherited from global configuration
// This attributes are inherited from global configuration.
$user_info['block_size'] = $config['block_size'];
if (enterprise_installed() && is_metaconsole() === true) {
if (enterprise_installed() === true && is_metaconsole() === true) {
$user_info['metaconsole_agents_manager'] = 0;
$user_info['metaconsole_access_node'] = 0;
}
if ($config['ehorus_user_level_conf']) {
if ((bool) $config['ehorus_user_level_conf'] === true) {
$user_info['ehorus_user_level_user'] = '';
$user_info['ehorus_user_level_pass'] = '';
$user_info['ehorus_user_level_enabled'] = true;
}
}
if ($create_user) {
if (! $config['admin_can_add_user']) {
ui_print_error_message(__('The current authentication scheme doesn\'t support creating users on %s', get_product_name()));
if ($create_user === true) {
if ((bool) $config['admin_can_add_user'] === false) {
ui_print_error_message(
__('The current authentication scheme doesn\'t support creating users on %s', get_product_name())
);
return;
}
if (html_print_csrf_error()) {
if (html_print_csrf_error() === true) {
return;
}
@ -468,6 +480,8 @@ if ($create_user) {
}
}
// Generate new API token.
$values['api_token'] = api_token_generate();
if (empty($id) === true) {
ui_print_error_message(__('User ID cannot be empty'));
@ -659,7 +673,7 @@ if ($create_user) {
}
if ($update_user) {
if (html_print_csrf_error()) {
if (html_print_csrf_error() === true) {
return;
}
@ -678,6 +692,9 @@ if ($update_user) {
$values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
// API Token information.
$apiTokenRenewed = (bool) get_parameter('renewAPIToken');
$values['api_token'] = ($apiTokenRenewed === true) ? api_token_generate() : users_get_API_token($values['id_user']);
if (users_is_admin() === false && (bool) $values['is_admin'] !== false) {
db_pandora_audit(
@ -689,7 +706,7 @@ if ($update_user) {
exit;
}
// eHorus user level conf.
// Ehorus user level conf.
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
@ -868,7 +885,7 @@ if ($update_user) {
ui_print_result_message(
$res1,
__('User info successfully updated'),
($apiTokenRenewed === true) ? __('You have generated a new API Token.') : __('User info successfully updated'),
__('Error updating user info (no change?)')
);
}
@ -904,7 +921,7 @@ if ($update_user) {
$user_info = $values;
}
if ($status != -1) {
if ((int) $status !== -1) {
ui_print_result_message(
$status,
__('User info successfully updated'),
@ -1029,6 +1046,48 @@ if (!$new_user) {
$user_id .= '<span>'.$id.'</span>';
$user_id .= html_print_input_hidden('id_user', $id, true);
$user_id .= '</div>';
$user_id .= '<div class="label_select_simple"><p class="edit_user_labels">'.__('API Token').'</p>';
$user_id .= html_print_anchor(
[
'onClick' => sprintf(
'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')',
__('Warning'),
__('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'),
'user_profile_form',
),
'content' => html_print_image(
'images/icono-refrescar.png',
true,
[
'class' => 'renew_api_token_image clickable',
'title' => __('Renew API Token'),
]
),
'class' => 'renew_api_token_link',
],
true
);
$user_id .= html_print_anchor(
[
'onClick' => sprintf(
'javascript:showAPIToken(\'%s\', \'%s\')',
__('API Token'),
base64_encode(__('Your API Token is:').'&nbsp;<br><span class="font_12pt bolder">'.users_get_API_token($id).'</span><br>&nbsp;'.__('Please, avoid share this string with others.')),
),
'content' => html_print_image(
'images/eye_show.png',
true,
[
'class' => 'renew_api_token_image clickable',
'title' => __('Show API Token'),
]
),
'class' => 'renew_api_token_link',
],
true
);
$user_id .= '</div>';
} else {
$user_id = '<div class="label_select_simple">'.html_print_input_text_extended(
'id_user',
@ -1047,7 +1106,7 @@ if (!$new_user) {
).'</div>';
}
if (is_user_admin($id)) {
if (is_user_admin($id) === true) {
$avatar = html_print_image(
'images/people_1.png',
true,
@ -1294,11 +1353,8 @@ $values = [
'Alert detail' => __('Alert detail'),
'External link' => __('External link'),
'Other' => __('Other'),
'Dashboard' => __('Dashboard'),
];
if (!is_metaconsole()) {
$values['Dashboard'] = __('Dashboard');
}
$home_screen .= html_print_select(
$values,
@ -1313,7 +1369,14 @@ $home_screen .= html_print_select(
).'</div>';
$dashboards = Manager::getDashboards(-1, -1);
$dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$id_usr
);
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];
@ -1444,7 +1507,6 @@ $session_time .= html_print_input_text(
'class="input_line_small"'
).'</div>';
$user_groups = implode(',', array_keys((users_get_groups($id, 'AR', $display_all_group))));
if (empty($user_groups) === false) {
@ -1573,7 +1635,7 @@ if (!$id) {
$user_id_create = $user_id;
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$access_or_pagination = $meta_access;
} else {
$access_or_pagination = $size_pagination;
@ -1589,14 +1651,14 @@ if ($id != '' && !$is_err) {
echo '<div id="user_form">
<div class="user_edit_first_row">
<div class="edit_user_info white_box">'.$div_user_info.'</div>
<div class="edit_user_info white_box">'.$div_user_info.'</div>
<div class="edit_user_autorefresh white_box"><p class="bolder">Extra info</p>'.$email.$phone.$not_login.$local_user.$session_time.'</div>
</div>
</div>
<div class="user_edit_second_row white_box">
<div class="edit_user_options">'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$double_authentication.'</div>
<div class="edit_user_timezone">'.$timezone;
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
echo '<div id="timezone-picker">
<img id="timezone-image" src="'.$local_file.'" width="'.$map_width.'" height="'.$map_height.'" usemap="#timezone-map" />
<img class="timezone-pin" src="include/javascript/timezonepicker/images/pin.png" class="pdd_t_4px" />
@ -1643,13 +1705,18 @@ if ($config['admin_can_add_user']) {
}
echo '</div>';
if ($new_user === true) {
html_print_input_hidden('json_profile', $json_profile);
}
html_print_input_hidden('json_profile', $json_profile);
echo '</form>';
profile_print_profile_table($id, io_safe_output($json_profile));
if ($is_err === true && $new_user === true) {
profile_print_profile_table($id, io_safe_output($json_profile), false, true);
} else {
profile_print_profile_table($id, io_safe_output($json_profile));
}
echo '<br />';
@ -1875,6 +1942,8 @@ $(document).ready (function () {
});
$('input:image[name="del"]').click(function (e) {
if($(json_profile).length > 0) return;
if (!confirm ('Are you sure?')) return;
e.preventDefault();
var rows = $("#table_profiles tr").length;
if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') {

View File

@ -344,6 +344,7 @@ if ($delete_user === true) {
$result = delete_user($id_user);
if ($result) {
delete_session_user($id_user);
db_pandora_audit(
AUDIT_LOG_USER_MANAGEMENT,
__('Deleted user %s', io_safe_output($id_user))

View File

@ -1288,6 +1288,37 @@ class HostDevices extends Wizard
],
],
[
'label' => '<b>'.__('Security level').'</b>',
'arguments' => [
'name' => 'snmp_security_level',
'type' => 'select',
'fields' => [
'noAuthNoPriv' => __('Not auth and not privacy method'),
'authNoPriv' => __('Auth and not privacy method'),
'authPriv' => __('Auth and privacy method'),
],
'selected' => $this->task['snmp_security_level'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Auth method').'</b>',
'arguments' => [
'name' => 'snmp_auth_method',
'type' => 'select',
'fields' => [
'MD5' => __('MD5'),
'SHA' => __('SHA'),
],
'selected' => $this->task['snmp_auth_method'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip(
__(
@ -1335,38 +1366,6 @@ class HostDevices extends Wizard
],
],
[
'label' => '<b>'.__('Auth method').'</b>',
'arguments' => [
'name' => 'snmp_auth_method',
'type' => 'select',
'fields' => [
'MD5' => __('MD5'),
'SHA' => __('SHA'),
],
'selected' => $this->task['snmp_auth_method'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Security level').'</b>',
'arguments' => [
'name' => 'snmp_security_level',
'type' => 'select',
'fields' => [
'noAuthNoPriv' => __('Not auth and not privacy method'),
'authNoPriv' => __('Auth and not privacy method'),
'authPriv' => __('Auth and privacy method'),
],
'selected' => $this->task['snmp_security_level'],
'size' => 15,
'return' => true,
],
],
],
];

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 KiB

View File

@ -721,7 +721,7 @@ if ($get_agent_alerts_datatable === true) {
}
break;
case 'lastFired':
case 'last_fired':
switch ($sort) {
case 'asc':
$selectLastFiredasc = $selected;

View File

@ -0,0 +1,457 @@
<?php
/**
* Manage AJAX response for event pages.
*
* @category Ajax
* @package Pandora FMS
* @subpackage Events
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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.
global $config;
enterprise_include_once('include/functions_audit.php');
// Check access.
check_login();
if (! check_acl($config['id_user'], 0, 'ER')
&& ! check_acl($config['id_user'], 0, 'EW')
&& ! check_acl($config['id_user'], 0, 'EM')
) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access event viewer'
);
include 'general/noaccess.php';
return;
}
$save_filter_modal = get_parameter('save_filter_modal', 0);
$load_filter_modal = get_parameter('load_filter_modal', 0);
$get_filter_values = get_parameter('get_filter_values', 0);
$update_log_filter = get_parameter('update_log_filter', 0);
$save_log_filter = get_parameter('save_log_filter', 0);
$recover_aduit_log_select = get_parameter('recover_aduit_log_select', 0);
// Saves an event filter.
if ($save_log_filter) {
$values = [];
$values['id_name'] = get_parameter('id_name');
$values['text'] = get_parameter('text', '');
$values['period'] = get_parameter('period', '');
$values['ip'] = get_parameter('ip', '');
$values['type'] = get_parameter('type', -1);
$values['user'] = get_parameter('user', -1);
$exists = (bool) db_get_value_filter(
'id_filter',
'tsesion_filter',
['id_name' => $values['id_name']]
);
if ($exists) {
echo 'duplicate';
} else {
$result = db_process_sql_insert('tsesion_filter', $values);
if ($result === false) {
echo 'error';
} else {
echo $result;
}
}
}
if ($recover_aduit_log_select) {
echo json_encode(audit_get_audit_filter_select());
}
if ($update_log_filter) {
$values = [];
$id = get_parameter('id');
$values['text'] = get_parameter('text', '');
$values['period'] = get_parameter('period', '');
$values['ip'] = get_parameter('ip', '');
$values['type'] = get_parameter('type', -1);
$values['user'] = get_parameter('user', -1);
$result = db_process_sql_update(
'tsesion_filter',
$values,
['id_filter' => $id]
);
if ($result === false) {
echo 'error';
} else {
echo 'ok';
}
}
if ($get_filter_values) {
$id_filter = get_parameter('id');
$event_filter = audit_get_audit_log_filter($id_filter);
echo json_encode($event_filter);
}
if ($load_filter_modal) {
$filters = audit_get_audit_filter_select();
$user_groups_array = users_get_groups_for_select(
$config['id_user'],
$access,
true,
true,
false
);
echo '<div id="load-filter-select" class="load-filter-modal">';
$table = new StdClass;
$table->id = 'load_filter_form';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->class = 'databox';
if (is_metaconsole()) {
$table->cellspacing = 0;
$table->cellpadding = 0;
$table->class = 'databox filters';
}
$table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
$filter_id_width = '200px';
if (is_metaconsole()) {
$filter_id_width = '150px';
}
$data = [];
$table->rowid[3] = 'update_filter_row1';
$data[0] = __('Load filter').$jump;
$data[0] .= html_print_select(
$filters,
'filter_id',
'',
'',
__('None'),
0,
true,
false,
true,
'',
false,
'margin-left:5px; width:'.$filter_id_width.';'
);
$data[1] = html_print_submit_button(
__('Load filter'),
'load_filter',
false,
'class="sub upd" onclick="load_filter_values()"',
true
);
$data[1] .= html_print_input_hidden('load_filter', 1, true);
$table->data[] = $data;
$table->rowclass[] = '';
html_print_table($table);
echo '</div>';
?>
<script type="text/javascript">
function show_filter() {
$("#load-filter-select").dialog({
resizable: true,
draggable: true,
modal: false,
closeOnEscape: true,
width: 450
});
}
function load_filter_values() {
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
dataType: 'json',
data: {
page: 'include/ajax/audit_log',
get_filter_values: 1,
"id" : $('#filter_id :selected').val()
},
success: function(data) {
var options = "";
$.each(data,function(i,value){
if (i == 'text'){
$("#text-filter_text").val(value);
}
if (i == 'period'){
$("#text-filter_period").val(value);
}
if (i == 'ip'){
$("#text-filter_ip").val(value);
}
if (i == 'type'){
$("#filter_type").val(value).change();
}
if (i == 'user'){
$("#filter_user").val(value).change();
}
});
}
});
// Close dialog.
$("#load-filter-select").dialog('close');
}
$(document).ready (function() {
show_filter();
})
</script>
<?php
return;
}
if ($save_filter_modal) {
echo '<div id="save-filter-select" style="width:350px;">';
if (check_acl($config['id_user'], 0, 'EW') === 1 || check_acl($config['id_user'], 0, 'EM') === 1) {
echo '<div id="info_box"></div>';
$table = new StdClass;
$table->id = 'save_filter_form';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->class = 'databox';
if (is_metaconsole()) {
$table->class = 'databox filters';
$table->cellspacing = 0;
$table->cellpadding = 0;
}
$table->styleTable = 'font-weight: bold; text-align:left;';
if (!is_metaconsole()) {
$table->style[0] = 'width: 50%; width:50%;';
}
$data = [];
$table->rowid[0] = 'update_save_selector';
$data[0] = html_print_radio_button(
'filter_mode',
'new',
__('New filter'),
true,
true
);
$data[1] = html_print_radio_button(
'filter_mode',
'update',
__('Update filter'),
false,
true
);
$table->data[] = $data;
$table->rowclass[] = '';
$data = [];
$table->rowid[1] = 'save_filter_row1';
$data[0] = __('Filter name').$jump;
$data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
$data[1] = html_print_submit_button(
__('Save filter'),
'save_filter',
false,
'class="sub wand" onclick="save_new_filter();"',
true
);
$table->data[] = $data;
$table->rowclass[] = '';
$data = [];
$table->rowid[2] = 'save_filter_row2';
$table->data[] = $data;
$table->rowclass[] = '';
$data = [];
$table->rowid[3] = 'update_filter_row1';
$data[0] = __('Overwrite filter').$jump;
$_filters_update = audit_get_audit_filter_select();
$data[0] .= html_print_select(
$_filters_update,
'overwrite_filter',
'',
'',
'',
0,
true
);
$data[1] = html_print_submit_button(
__('Update filter'),
'update_filter',
false,
'class="sub upd" onclick="save_update_filter();"',
true
);
$table->data[] = $data;
$table->rowclass[] = '';
html_print_table($table);
} else {
include 'general/noaccess.php';
}
echo '</div>';
?>
<script type="text/javascript">
function show_save_filter() {
$('#save_filter_row1').show();
$('#save_filter_row2').show();
$('#update_filter_row1').hide();
// Filter save mode selector
$("[name='filter_mode']").click(function() {
if ($(this).val() == 'new') {
$('#save_filter_row1').show();
$('#save_filter_row2').show();
$('#submit-save_filter').show();
$('#update_filter_row1').hide();
}
else {
$('#save_filter_row1').hide();
$('#save_filter_row2').hide();
$('#update_filter_row1').show();
$('#submit-save_filter').hide();
}
});
$("#save-filter-select").dialog({
resizable: true,
draggable: true,
modal: false,
closeOnEscape: true
});
}
function save_new_filter() {
// If the filter name is blank show error
if ($('#text-id_name').val() == '') {
$('#info_box').html("<h3 class='error'><?php echo __('Filter name cannot be left blank'); ?></h3>");
return false;
}
var id_filter_save;
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
{
"page" : "include/ajax/audit_log",
"save_log_filter" : 1,
"id_name" : $("#text-id_name").val(),
"text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(),
"ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(),
},
function (data) {
$("#info_box").hide();
if (data == 'error') {
$("#info_box").filter(function(i, item) {
if ($(item).data('type_info_box') == "error_create_filter") {
return true;
}
else
return false;
}).show();
} else if (data == 'duplicate') {
$('#info_box').html("<h3 class='error'><?php echo __('Filter name already on use'); ?></h3>");
$('#info_box').show();
} else {
// Close dialog.
$("#save-filter-select").dialog('close');
}
}
);
}
// This updates an event filter
function save_update_filter() {
var id_filter_update = $("#overwrite_filter").val();
var name_filter_update = $("#overwrite_filter option[value='"+id_filter_update+"']").text();
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
{"page" : "include/ajax/audit_log",
"update_log_filter" : 1,
"id" : $("#overwrite_filter :selected").val(),
"text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(),
"ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(),
},
function (data) {
$(".info_box").hide();
if (data == 'ok') {
$(".info_box").filter(function(i, item) {
if ($(item).data('type_info_box') == "success_update_filter") {
return true;
}
else
return false;
}).show();
}
else {
$(".info_box").filter(function(i, item) {
if ($(item).data('type_info_box') == "error_create_filter") {
return true;
}
else
return false;
}).show();
}
});
// Close dialog
$('.ui-dialog-titlebar-close').trigger('click');
return false;
}
$(document).ready(function (){
show_save_filter();
});
</script>
<?php
return;
}

View File

@ -1523,9 +1523,37 @@ if ($change_status === true) {
}
if ($get_Acknowledged === true) {
$event_id = get_parameter('event_id');
echo events_page_general_acknowledged($event_id);
return;
$event_id = (int) get_parameter('event_id', 0);
$server_id = (int) get_parameter('server_id', 0);
$return = '';
try {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node = new Node($server_id);
$node->connect();
}
echo events_page_general_acknowledged($event_id);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
$return = false;
} finally {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
}
return $return;
}
if ($change_owner === true) {

View File

@ -340,7 +340,7 @@ if (is_ajax() === true) {
// Group.
$secondary_groups = '';
$secondary = agents_get_secondary_groups($data['id_agente']);
$secondary = enterprise_hook('agents_get_secondary_groups', [$data['id_agente']]);
if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) {
$secondary_groups = implode(', ', $secondary['for_select']);
$secondary_groups = ', '.$secondary_groups;
@ -353,19 +353,26 @@ if (is_ajax() === true) {
// Events.
echo '<div class="div-dialog">';
echo graph_graphic_agentevents(
$id,
100,
40,
SECONDS_1DAY,
'',
true,
false,
false,
1
$result_graph_event = enterprise_hook(
'graph_graphic_agentevents',
[
$id,
100,
40,
SECONDS_1DAY,
'',
true,
false,
false,
1,
]
);
echo '</div>';
if ($result_graph_event !== -1) {
echo '<div class="div-dialog">';
echo $result_graph_event;
echo '</div>';
}
break;
}
}

View File

@ -61,6 +61,8 @@ if (check_login()) {
0
);
$get_children_modules = (bool) get_parameter('get_children_modules', false);
$get_data_dataMatrix = (bool) get_parameter(
'get_data_dataMatrix',
0
@ -1656,4 +1658,36 @@ if (check_login()) {
return;
}
if ($get_children_modules === true) {
$parent_modules = get_parameter('parent_modulues', false);
$children_selected = [];
if ($parent_modules === false) {
$children_selected = false;
} else {
foreach ($parent_modules as $parent) {
$child_modules = get_children_module($parent_modules, ['nombre', 'id_agente_modulo'], true);
if ((bool) $child_modules === false) {
continue;
}
foreach ($child_modules as $child) {
$module_exist = in_array($child['id_agente_modulo'], $parent_modules);
$child_exist = in_array($child, $children_selected);
if ($module_exist === false && $child_exist === false) {
array_push($children_selected, $child);
}
}
}
}
if (empty($children_selected) === true) {
$children_selected = false;
}
echo json_encode($children_selected);
return;
}
}

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org 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
@ -69,9 +69,6 @@ $id2 = get_parameter('id2');
$otherSerialize = get_parameter('other');
$otherMode = get_parameter('other_mode', 'url_encode');
$returnType = get_parameter('return_type', 'string');
$api_password = get_parameter('apipass', '');
$password = get_parameter('pass', '');
$user = get_parameter('user', '');
$info = get_parameter('info', '');
$raw_decode = (bool) get_parameter('raw_decode', false);
@ -84,6 +81,21 @@ $apiPassword = io_output_password(
)
);
$apiTokenValid = false;
// Try getting bearer token from header.
// TODO. Getting token from url will be removed.
$apiToken = (string) getBearerToken();
if (empty($apiToken) === true) {
// Legacy user/pass token.
// TODO. Revome in future.
$api_password = get_parameter('apipass', '');
$user = get_parameter('user', '');
$password = get_parameter('pass', '');
} else {
$apiTokenValid = (bool) api_token_check($apiToken);
}
$correctLogin = false;
$no_login_msg = '';
@ -94,8 +106,8 @@ ob_clean();
// Special call without checks to retrieve version and build of the Pandora FMS
// This info is avalable from the web console without login
// Don't change the format, it is parsed by applications.
if ($info == 'version') {
if (!$config['MR']) {
if ($info === 'version') {
if ((bool) $config['MR'] === false) {
$config['MR'] = 0;
}
@ -105,6 +117,7 @@ if ($info == 'version') {
if (empty($apiPassword) === true
|| (empty($apiPassword) === false && $api_password === $apiPassword)
|| $apiTokenValid === true
) {
if (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true
@ -118,7 +131,14 @@ if (empty($apiPassword) === true
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) {
// External access.
$user_in_db = process_user_login($user, $password, true);
// Token is valid. Bypass the credentials.
if ($apiTokenValid === true) {
$credentials = db_get_row('tusuario', 'api_token', $apiToken);
$user = $credentials['id_user'];
$password = $credentials['password'];
}
$user_in_db = process_user_login($user, $password, true, $apiTokenValid);
if ($user_in_db !== false) {
$config['id_usuario'] = $user_in_db;
// Compat.
@ -144,19 +164,19 @@ if (empty($apiPassword) === true
$no_login_msg = 'Incorrect given API password';
}
if ($correctLogin) {
if ($correctLogin === true) {
if (($op !== 'get') && ($op !== 'set') && ($op !== 'help')) {
returnError('no_set_no_get_no_help', $returnType);
} else {
$function_name = '';
// Check if is an extension function and get the function name.
if ($op2 == 'extension') {
if ($op2 === 'extension') {
$extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR.'/'.$ext_name.'/'.$ext_name.'.api.php';
// The extension API file must exist and the extension must be
// enabled.
if (file_exists($extension_api_url)
&& !in_array($ext_name, extensions_get_disabled_extensions())
if (file_exists($extension_api_url) === true
&& in_array($ext_name, extensions_get_disabled_extensions()) === false
) {
include_once $extension_api_url;
$function_name = 'apiextension_'.$op.'_'.$ext_function;
@ -164,7 +184,7 @@ if ($correctLogin) {
} else {
$function_name = 'api_'.$op.'_'.$op2;
if ($op == 'set' && $id) {
if ($op === 'set' && $id) {
switch ($op2) {
case 'update_agent':
case 'add_module_in_conf':
@ -173,7 +193,7 @@ if ($correctLogin) {
$agent = agents_locate_agent($id);
if ($agent !== false) {
$id_os = $agent['id_os'];
if ($id_os == 100) {
if ((int) $id_os === 100) {
returnError(
'not_allowed_operation_cluster',
$returnType

View File

@ -94,7 +94,7 @@ $config['admin_can_make_admin'] = true;
* @return mixed False in case of error or invalid credentials, the username in
* case it's correct.
*/
function process_user_login($login, $pass, $api=false)
function process_user_login($login, $pass, $api=false, $passAlreadyEncrypted=false)
{
global $config;
@ -130,10 +130,10 @@ function process_user_login($login, $pass, $api=false)
if ($config['fallback_local_auth']
|| is_user_admin($login)
|| $local_user === true
|| strtolower($config['auth']) == 'mysql'
|| strtolower($config['auth']) === 'mysql'
|| (bool) $user_not_login === true
) {
return process_user_login_local($login, $pass, $api);
return process_user_login_local($login, $pass, $api, $passAlreadyEncrypted);
} else {
return false;
}
@ -144,12 +144,11 @@ function process_user_login($login, $pass, $api=false)
}
function process_user_login_local($login, $pass, $api=false)
function process_user_login_local($login, $pass, $api=false, $passAlreadyEncrypted=false)
{
global $config, $mysql_cache;
// Connect to Database.
if (!$api) {
if ((bool) $api === false) {
$sql = sprintf(
"SELECT `id_user`, `password`
FROM `tusuario`
@ -169,13 +168,17 @@ function process_user_login_local($login, $pass, $api=false)
$row = db_get_row_sql($sql);
// Perform password check whether it is MD5-hashed (old hashing) or Bcrypt-hashed.
if (strlen($row['password']) === 32) {
// MD5.
$credentials_check = $row !== false && $row['password'] !== md5('') && $row['password'] == md5($pass);
if ($passAlreadyEncrypted) {
$credentials_check = $pass === $row['password'];
} else {
// Bcrypt.
$credentials_check = password_verify($pass, $row['password']);
// Perform password check whether it is MD5-hashed (old hashing) or Bcrypt-hashed.
if (strlen($row['password']) === 32) {
// MD5.
$credentials_check = $row !== false && $row['password'] !== md5('') && $row['password'] == md5($pass);
} else {
// Bcrypt.
$credentials_check = password_verify($pass, $row['password']);
}
}
if ($credentials_check === true) {
@ -184,10 +187,10 @@ function process_user_login_local($login, $pass, $api=false)
// is not case sensitive)
// We get DB nick to put in PHP Session variable,
// to avoid problems with case-sensitive usernames.
// Thanks to David Muñiz for Bug discovery :)
// Thanks to David Muñiz for Bug discovery :).
$filter = ['id_usuario' => $login];
$user_profile = db_get_row_filter('tusuario_perfil', $filter);
if (!users_is_admin($login) && !$user_profile) {
if ((bool) users_is_admin($login) === false && (bool) $user_profile === false) {
$mysql_cache['auth_error'] = 'User does not have any profile';
$config['auth_error'] = 'User does not have any profile';
return false;
@ -200,7 +203,7 @@ function process_user_login_local($login, $pass, $api=false)
return $row['id_user'];
} else {
if (!user_can_login($login)) {
if (user_can_login($login) === false) {
$mysql_cache['auth_error'] = 'User only can use the API.';
$config['auth_error'] = 'User only can use the API.';
} else {

View File

@ -846,6 +846,7 @@ class AgentWizard extends HTML
html_print_div(
[
'class' => 'white_box',
'style' => 'padding: 20px',
'content' => $this->printForm(
[
'form' => $form,
@ -2726,7 +2727,7 @@ class AgentWizard extends HTML
'action' => $this->sectionUrl,
'id' => 'form-filter-interfaces',
'method' => 'POST',
'class' => 'modal flex flex-row searchbox',
'class' => 'modal searchbox',
'extra' => '',
];
@ -5479,6 +5480,19 @@ class AgentWizard extends HTML
*/
private function getInterfacesModulesx64(array $data=[])
{
$equivalencies_x86 = [
'ifHCInOctets' => 'ifInOctets',
'ifHCOutOctets' => 'ifOutOctets',
'ifHCInUcastPkts' => 'ifInUcastPkts',
'ifHCOutUcastPkts' => 'ifOutUcastPkts',
'ifHCInNUcastPkts' => 'ifInNUcastPkts',
'ifHCOutNUcastPkts' => 'ifOutNUcastPkts',
];
foreach ($equivalencies_x86 as $key => $equivalencie) {
$this->defaultSNMPValues[$key] = $this->defaultSNMPValues[$equivalencie];
}
$moduleDescription = '';
$name = '';
$value = '1';

View File

@ -156,6 +156,26 @@ class AuditLog extends HTML
open_meta_frame();
}
$buttons = [];
$buttons[] = [
'id' => 'load-filter',
'class' => 'float-left margin-right-2 margin-left-2 sub config',
'text' => __('Load filter'),
'onclick' => '',
];
$buttons[] = [
'id' => 'save-filter',
'class' => 'float-left margin-right-2 sub wand',
'text' => __('Save filter'),
'onclick' => '',
];
// Modal for save/load filters.
echo '<div id="save-modal-filter" style="display:none"></div>';
echo '<div id="load-modal-filter" style="display:none"></div>';
// Load datatables user interface.
ui_print_datatable(
[
@ -174,9 +194,10 @@ class AuditLog extends HTML
],
'search_button_class' => 'sub filter float-right',
'form' => [
'inputs' => [
'extra_buttons' => $buttons,
'inputs' => [
[
'label' => __('Search'),
'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true),
'type' => 'text',
'class' => 'w200px',
'id' => 'filter_text',
@ -211,7 +232,9 @@ class AuditLog extends HTML
'type' => 'select_from_sql',
'nothing' => __('All'),
'nothing_value' => '-1',
'sql' => 'SELECT id_user, id_user AS text FROM tusuario',
'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM"
AS id_user, "SYSTEM" AS text UNION SELECT "N/A"
AS id_user, "N/A" AS text',
'class' => 'mw250px',
'id' => 'filter_user',
'name' => 'filter_user',
@ -269,7 +292,10 @@ class AuditLog extends HTML
if (empty($this->filterText) === false) {
$filter .= sprintf(
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')",
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR id_usuario LIKE '%%%s%%' OR fecha LIKE '%%%s%%' OR ip_origen LIKE '%%%s%%')",
$this->filterText,
$this->filterText,
$this->filterText,
$this->filterText,
$this->filterText
);
@ -366,38 +392,149 @@ class AuditLog extends HTML
// Javascript content.
?>
<script type="text/javascript">
function format(d) {
var output = '';
<script type="text/javascript">
var loading = 0;
if (d.extendedInfo === '') {
output = "<?php echo __('There is no additional information to display'); ?>";
} else {
output = d.extendedInfo;
function format(d) {
var output = '';
if (d.extendedInfo === '') {
output = "<?php echo __('There is no additional information to display'); ?>";
} else {
output = d.extendedInfo;
}
return output;
}
return output;
}
$(document).ready(function() {
// Add event listener for opening and closing details
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
var tr = $(this).closest('tr');
var table = $("#<?php echo $this->tableId; ?>").DataTable();
var row = table.row(tr);
$(document).ready(function() {
// Add event listener for opening and closing details
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
var tr = $(this).closest('tr');
var table = $("#<?php echo $this->tableId; ?>").DataTable();
var row = table.row(tr);
if (row.child.isShown()) {
if (row.child.isShown()) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
} else {
// Open this row
row.child(format(row.data())).show();
tr.addClass('shown');
}
row.child.hide();
tr.removeClass('shown');
} else {
// Open this row
row.child(format(row.data())).show();
tr.addClass('shown');
}
$('#audit_logs').css('table-layout','fixed');
$('#audit_logs').css('width','95% !important');
});
$('#save-filter').click(function() {
if ($('#save-filter-select').length) {
$('#save-filter-select').dialog({
width: "20%",
maxWidth: "25%",
title: "<?php echo __('Save filter'); ?>"
});
$('#info_box').html("");
$('#text-id_name').val("");
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
dataType: 'json',
data: {
page: 'include/ajax/audit_log',
recover_aduit_log_select: 1
},
success: function(data) {
var options = "";
$.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>";
});
$('#overwrite_filter').html(options);
$('#overwrite_filter').select2();
}
});
} else {
if (loading == 0) {
loading = 1
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
data: {
page: 'include/ajax/audit_log',
save_filter_modal: 1,
current_filter: $('#latest_filter_id').val()
},
success: function(data) {
$('#save-modal-filter')
.empty()
.html(data);
loading = 0;
$('#save-filter-select').dialog({
width: "20%",
maxWidth: "25%",
title: "<?php echo __('Save filter'); ?>"
});
}
});
}
}
});
$('#save_filter_form-0-1, #radiobtn0002').click(function(){
$('#overwrite_filter').select2();
});
/* Filter management */
$('#load-filter').click(function (){
if($('#load-filter-select').length) {
$('#load-filter-select').dialog({width: "20%",
maxWidth: "25%",
title: "<?php echo __('Load filter'); ?>"
});
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
dataType: 'json',
data: {
page: 'include/ajax/audit_log',
recover_aduit_log_select: 1
},
success: function(data) {
var options = "";
$.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>";
});
$('#filter_id').html(options);
$('#filter_id').select2();
}
});
} else {
if (loading == 0) {
loading = 1
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
data: {
page: 'include/ajax/audit_log',
load_filter_modal: 1
},
success: function (data){
$('#load-modal-filter')
.empty()
.html(data);
loading = 0;
$('#load-filter-select').dialog({
width: "20%",
maxWidth: "25%",
title: "<?php echo __('Load filter'); ?>"
});
}
});
}
}
});
});
});
</script>
</script>
<?php
// EOF Javascript content.
return ob_get_clean();

View File

@ -606,15 +606,13 @@ class CustomNetScan extends Wizard
}
if (isset($this->page) === true && $this->page === 1) {
$name_ipam = 'IPAM Recon';
// Recon script.
$form['inputs'][] = [
'label' => __('Recon script'),
'arguments' => [
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_recon_script, name FROM trecon_script WHERE name <> "%s" ORDER BY name',
$name_ipam
'SELECT id_recon_script, name FROM trecon_script ORDER BY name'
),
'name' => 'id_recon_script',
'selected' => $this->task['id_recon_script'],

View File

@ -1276,11 +1276,16 @@ class Diagnostics extends Wizard
FROM tagente_datos'
);
$modulesDataCount = db_get_value_sql(
'SELECT count(*) * 300 FROM (SELECT * FROM tagente_datos GROUP BY id_agente_modulo) AS totalmodules'
);
$modulesDataCount = ($modulesDataCount >= 500000) ? $modulesDataCount : 500000;
$taMsg = __(
'The tagente_datos table contains too much data. A historical database is recommended.'
);
$taStatus = 0;
if ($agentDataCount <= 3000000) {
if ($agentDataCount <= $modulesDataCount) {
$taMsg = __(
'The tagente_datos table contains an acceptable amount of data.'
);

View File

@ -776,7 +776,7 @@ class NetworkMap
// Search.
if ($this->idTask) {
// Network map, based on discovery task.
return get_discovery_agents($this->idTask);
enterprise_hook('get_discovery_agents', [$this->idTask]);
}
if ($this->network) {
@ -1672,7 +1672,7 @@ class NetworkMap
if (isset($source_data['color'])) {
$item['color'] = $source_data['color'];
} else {
if (empty($node['status']) && empty($node['id_module']) && !empty($node['style']['id_networkmap'])) {
if (empty($node['style']['id_networkmap']) === false) {
$status_aux = get_status_color_networkmap_fictional_point($node['style']['id_networkmap']);
$item['color'] = $status_aux;
} else {

View File

@ -20,8 +20,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC230110';
$pandora_version = 'v7.0NG.767';
$build_version = 'PC230131';
$pandora_version = 'v7.0NG.768';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -805,6 +805,7 @@ define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
define('AUDIT_LOG_UMC', 'Warp Manager');
define('AUDIT_LOG_NMS_VIOLATION', 'NMS Violation');
// MIMEs.
define(

View File

@ -1,10 +1,17 @@
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.woff') format('woff');
src:
}
.terminal-main {
font-family: monospace;
font-size: 10pt;
}
#ehorus-client-container {
font-family: 'lato';
font-family: 'Lato', sans-serif;
font-weight: 400;
}
.glyphicon {

View File

@ -226,7 +226,7 @@ function format_numeric($number, $decimals=1)
global $config;
// Translate to float in case there are characters in the string so
// fmod doesn't throw a notice
// fmod doesn't throw a notice.
$number = (float) $number;
if ($number == 0) {
@ -234,10 +234,20 @@ function format_numeric($number, $decimals=1)
}
if (fmod($number, 1) > 0) {
return number_format($number, $decimals, $config['decimal_separator'], $config['thousand_separator']);
return number_format(
$number,
$decimals,
$config['decimal_separator'],
($config['thousand_separator'] ?? ',')
);
}
return number_format($number, 0, $config['decimal_separator'], $config['thousand_separator']);
return number_format(
$number,
0,
$config['decimal_separator'],
($config['thousand_separator'] ?? ',')
);
}
@ -6326,7 +6336,7 @@ function arrayOutputSorting($sort, $sortField)
/**
* Get dowload started cookie from js and set ready cokkie for download ready comntrol.
*
* @return
* @return void
*/
function setDownloadCookieToken()
{
@ -6342,3 +6352,48 @@ function setDownloadCookieToken()
);
}
}
/**
* Get header Authorization
* */
function getAuthorizationHeader()
{
$headers = null;
if (isset($_SERVER['Authorization'])) {
$headers = trim($_SERVER['Authorization']);
} else if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
// Nginx or fast CGI
$headers = trim($_SERVER['HTTP_AUTHORIZATION']);
} else if (function_exists('apache_request_headers')) {
$requestHeaders = apache_request_headers();
// Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
$requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders));
// print_r($requestHeaders);
if (isset($requestHeaders['Authorization'])) {
$headers = trim($requestHeaders['Authorization']);
}
}
return $headers;
}
/**
* Get access token from header
*
* @return array/false Token received, false in case thre is no token.
* */
function getBearerToken()
{
$headers = getAuthorizationHeader();
// HEADER: Get the access token from the header
if (!empty($headers)) {
if (preg_match('/Bearer\s(\S+)/', $headers, $matches)) {
return $matches[1];
}
}
return false;
}

View File

@ -1369,12 +1369,14 @@ function agents_get_group_agents(
'id_agente',
'alias',
'ta.id_tmetaconsole_setup AS id_server',
'ta.disabled',
];
} else {
$fields = [
'ta.id_tagente AS id_agente',
'alias',
'ta.id_tmetaconsole_setup AS id_server',
'ta.disabled',
];
}
} else {
@ -1383,6 +1385,7 @@ function agents_get_group_agents(
$fields = [
'id_agente',
'alias',
'disabled',
];
}
@ -1427,6 +1430,13 @@ function agents_get_group_agents(
$value = mb_strtoupper($row['alias'], 'UTF-8');
break;
case 'disabled':
$value = $row['alias'];
if ($row['disabled'] == 1) {
$value .= ' ('.__('Disabled').')';
}
break;
default:
$value = $row['alias'];
break;

View File

@ -14430,7 +14430,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
$height = (!empty($other) && isset($other['data'][3]) && $other['data'][3]) ? $other['data'][3] : 225;
// Graph width (optional).
$width = (!empty($other) && isset($other['data'][4]) && $other['data'][4]) ? $other['data'][4] : '';
$width = (!empty($other) && isset($other['data'][4]) && $other['data'][4]) ? $other['data'][4] : 600;
// If recive value its from mail call.
$graph_font_size = $other['data'][5];
@ -17648,3 +17648,20 @@ function api_set_send_report($thrash1, $thrash2, $other, $returnType)
returnData($returnType, $data, ';');
}
}
/**
* Check if token is correct.
*
* @param string $token Token for check.
*
* @return mixed Id of user. If returns 0 there is not valid token.
*/
function api_token_check(string $token)
{
if (empty($token) === true) {
return 0;
} else {
return db_get_value('id_user', 'tusuario', 'api_token', $token);
}
}

View File

@ -395,6 +395,11 @@ function config_update_config()
if (config_update_value('email_password', io_input_password(get_parameter('email_password')), true) === false) {
$error_update[] = __('Email password');
}
$inventory_changes_blacklist = get_parameter('inventory_changes_blacklist', []);
if (config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist), true) === false) {
$error_update[] = __('Inventory changes blacklist');
}
break;
case 'enterprise':
@ -458,11 +463,6 @@ function config_update_config()
if (config_update_value('sap_license', get_parameter('sap_license'), true) === false) {
$error_update[] = __('SAP/R3 Plugin Licence');
}
$inventory_changes_blacklist = get_parameter('inventory_changes_blacklist', []);
if (config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist), true) === false) {
$error_update[] = __('Inventory changes blacklist');
}
}
break;

View File

@ -496,9 +496,13 @@ function events_update_status($id_evento, $status, $filter=null)
// No groups option direct update.
$update_sql = sprintf(
'UPDATE tevento
SET estado = %d
SET estado = %d,
ack_utimestamp = %d,
id_usuario = "%s"
WHERE id_evento = %d',
$status,
time(),
$config['id_user'],
$id_evento
);
break;
@ -4739,7 +4743,7 @@ function events_page_general($event)
$data = [];
$data[0] = __('Owner');
if (empty($event['owner_user']) === true) {
if ($event['owner_user'] == -1) {
$data[1] = '<i>'.__('N/A').'</i>';
} else {
$user_owner = db_get_value(
@ -4804,14 +4808,15 @@ function events_page_general($event)
$data = [];
$table_general->rowid[7] = 'general_status';
$table_general->rowid[count($table_general->data)] = 'general_status';
$table_general->cellclass[count($table_general->data)][1] = 'general_status';
$data[0] = __('Status');
$data[1] = $event_st['title'];
$data[2] = html_print_image($event_st['img'], true);
$table_general->data[] = $data;
// If event is validated, show who and when acknowleded it.
$table_general->cellclass[8][1] = 'general_acknowleded';
$table_general->cellclass[count($table_general->data)][1] = 'general_acknowleded';
$data = [];
$data[0] = __('Acknowledged by');
@ -4832,7 +4837,17 @@ function events_page_general($event)
}
}
$data[1] = $user_ack.'&nbsp;(&nbsp;'.date($config['date_format'], $event['ack_utimestamp_raw']).'&nbsp;)&nbsp;';
$data[1] = $user_ack.'&nbsp;(&nbsp;';
if ($event['ack_utimestamp_raw'] !== false
&& $event['ack_utimestamp_raw'] !== 'false'
) {
$data[1] .= date(
$config['date_format'],
$event['ack_utimestamp_raw']
);
}
$data[1] .= '&nbsp;)&nbsp;';
} else {
$data[1] = '<i>'.__('N/A').'</i>';
}
@ -4939,9 +4954,9 @@ function events_page_general_acknowledged($event_id)
{
global $config;
$Acknowledged = '';
$event = db_get_all_rows_filter('tevento', 'id_evento', $event_id);
if ($event) {
$event = db_get_row('tevento', 'id_evento', $event_id);
hd($event['ack_utimestamp'], true);
if ($event !== false && $event['estado'] == 1) {
$user_ack = db_get_value(
'fullname',
'tusuario',
@ -4953,7 +4968,17 @@ function events_page_general_acknowledged($event_id)
$user_ack = $config['id_user'];
}
$Acknowledged = $user_ack.'&nbsp;(&nbsp;'.date($config['date_format'], $event['ack_utimestamp_raw']).'&nbsp;)&nbsp;';
$Acknowledged = $user_ack.'&nbsp;(&nbsp;';
if ($event['ack_utimestamp'] !== false
&& $event['ack_utimestamp'] !== 'false'
) {
$Acknowledged .= date(
$config['date_format'],
$event['ack_utimestamp']
);
}
$Acknowledged .= '&nbsp;)&nbsp;';
} else {
$Acknowledged = 'N/A';
}

View File

@ -3489,8 +3489,9 @@ function graph_custom_sql_graph(
$data_result = [];
}
$data = [];
$labels = [];
$data_bar = [];
$labels_pie = [];
$data_pie = [];
$count = 0;
$other = 0;
foreach ($data_result as $data_item) {

File diff suppressed because it is too large Load Diff

View File

@ -487,7 +487,7 @@ function menu_add_extras(&$menu)
$menu_extra['gusuarios']['sub']['godmode/users/configure_profile']['text'] = __('Configure profile');
$menu_extra['gmodules']['sub']['godmode/modules/manage_network_templates_form']['text'] = __('Module templates management');
$menu_extra['gmodules']['sub']['enterprise/godmode/modules/manage_inventory_modules_form']['text'] = __('Inventory modules management');
$menu_extra['gmodules']['sub']['godmode/modules/manage_inventory_modules_form']['text'] = __('Inventory modules management');
$menu_extra['gagente']['sub']['godmode/agentes/configurar_agente']['text'] = __('Agents management');
@ -508,6 +508,14 @@ function menu_add_extras(&$menu)
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard&action=wizard']['text'] = __('Templates wizard');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=template&action=list_template']['text'] = __('Templates');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&action=edit']['text'] = __('Edit custom reports');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=list_items&action=edit']['text'] = __('List items');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=item_editor&action=new']['text'] = __('Edit item');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard&action=edit']['text'] = __('Wizard');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard_sla&action=edit']['text'] = __('Wizard sla');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=global&action=edit']['text'] = __('Global custom reports');
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=advanced&action=edit']['text'] = __('Avanced options');
if ($config['activate_gis']) {
$menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps');
}
@ -811,6 +819,27 @@ if (is_ajax()) {
);
}
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms.png', false, false, false);
if (enterprise_installed() === false) {
if ($config['style'] === 'pandora_black') {
$image_about = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC;
} else if ($config['style'] === 'pandora') {
$image_about = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC;
}
} else {
if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) {
$config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC;
} else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) {
$config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC;
}
$image_about = 'images/custom_logo/'.$config['custom_logo'];
if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) {
$image_about = ENTERPRISE_DIR.'/'.$image_about;
}
}
$dialog = '
<div id="about-tabs" class="invisible overflow-hidden">
<ul>
@ -827,7 +856,7 @@ if (is_ajax()) {
<tbody>
<tr>
<th style="width: 40%;">
<img src="'.ui_get_full_url('/images/custom_logo/'.$config['custom_logo'], false, false, false).'" alt="logo" width="70%">
<img src="'.$image_about.'" alt="logo" width="70%">
</th>
<th style="width: 60%; text-align: left;">
<h1>'.$product_name.'</h1>

View File

@ -3112,7 +3112,7 @@ function modules_get_relations($params=[])
}
$distinct = '';
if (empty($params)) {
if (empty($params) || isset($params['distinct'])) {
$distinct = 'DISTINCT';
}
@ -3136,6 +3136,11 @@ function modules_get_relations($params=[])
);
}
$id_rt_filter = '';
if (isset($params['id_rt'])) {
$id_rt_filter = sprintf('AND tmr.id_rt = %d', $params['id_rt']);
}
$sql = sprintf(
'SELECT %s tmr.id, tmr.module_a, tmr.module_b,
tmr.disable_update, tmr.type
@ -3153,7 +3158,8 @@ function modules_get_relations($params=[])
$module_type,
$agent_filter,
$disabled_update_filter,
$modules_type_filter
$modules_type_filter,
$id_rt_filter
);
return db_get_all_rows_sql($sql);
@ -3986,16 +3992,28 @@ function recursive_get_dt_from_modules_tree(&$f_modules, $modules, $deep)
* Get the module data from a children
*
* @param integer $id_module Id module
* @param boolean $recursive Recursive children search.
* @return array Children module data
*/
function get_children_module($id_module)
function get_children_module($id_module, $fields=false, $recursion=false)
{
$children_module_data = db_get_all_rows_sql(
'SELECT *
FROM tagente_modulo
WHERE parent_module_id = '.$id_module
$children_module_data = db_get_all_rows_filter(
'tagente_modulo',
['parent_module_id' => $id_module],
$fields
);
if ($children_module_data !== false && $recursion === true) {
foreach ($children_module_data as $child) {
$niece = get_children_module($child['id_agente_modulo'], $fields, false);
if ((bool) $niece === false) {
continue;
} else {
$children_module_data = array_merge($children_module_data, $niece);
}
}
}
return $children_module_data;
}

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