Fixed merge

This commit is contained in:
Jose Gonzalez 2021-03-09 12:56:59 +01:00
commit f0dd360786
275 changed files with 9453 additions and 3361 deletions

12
.gitignore vendored
View File

@ -1 +1,11 @@
pandora_console/attachment/agents
.vstags
MYMETA.json
MYMETA.yml
.vscode
.vscode*
.vstags
**/blib
**/PandoraFMS-Enterprise/Makefile
**/PandoraFMS-Enterprise/pm_to_blib
**/pandora_console/attachment/cache
**/pandora_console/attachment/agents

View File

@ -0,0 +1,585 @@
#!/bin/bash
# define variables
PANDORA_CONSOLE=/var/www/html/pandora_console
CONSOLE_PATH=/var/www/html/pandora_console
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_SERVER_BIN=/usr/bin/pandora_server
PANDORA_HA_BIN=/usr/bin/pandora_ha
PANDORA_TABLES_MIN=160
DBHOST=127.0.0.1
DBNAME=pandora
DBUSER=pandora
DBPASS=pandora
DBPORT=3306
S_VERSION='2021012801'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# Ansi color code variables
red="\e[0;91m"
green="\e[0;92m"
bold="\e[1m"
cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
echo -e "${cyan}$msg...${reset}"
$cmd &>> $LOGFILE
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$3" ] && echo "$3"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf $HOME/pandora_deploy_tmp &>> $LOGFILE
exit 1
else
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
return 0
fi
}
check_cmd_status () {
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$1" ] && echo "$1"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE
exit 1
else
echo -e "${green}OK${reset}"
return 0
fi
}
check_pre_pandora () {
export MYSQL_PWD=$DBPASS
echo -en "${cyan}Checking environment ... ${reset}"
rpm -qa | grep pandora &>> /dev/null && local fail=true
[ -d "$CONSOLE_PATH" ] && local fail=true
[ -f /usr/bin/pandora_server ] && local fail=true
echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
[ ! $fail ]
check_cmd_status 'Error there is a current Pandora FMS installation on this node, please remove it to execute a clean install'
}
check_repo_connection () {
execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
execute_cmd "ping -c 2 support.artica.es" "Checking Enterprise repo"
}
check_root_permissions () {
echo -en "${cyan}Checking root account... ${reset}"
if [ "$(whoami)" != "root" ]; then
echo -e "${red}Fail${reset}"
echo "Please use a root account or sudo for installing PandoraFMS"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
fi
}
## Main
echo "Starting PandoraFMS Community deployment ver. $S_VERSION"
# Centos Version
if [ ! "$(grep -i centos /etc/redhat-release)" ]; then
printf "${red}Error this is not a Centos Base system, this installer is compatible with Centos systems only${reset}\n"
exit 1
fi
execute_cmd "grep -i centos /etc/redhat-release" "Checking Centos" 'Error This is not a Centos Base system'
echo -en "${cyan}Check Centos Version...${reset}"
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9])"$/\1/p' /etc/os-release) -eq '7' ]
check_cmd_status 'Error OS version, Centos 7 is expected'
# initialice logfile
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
echo "Community installer version: $S_VERSION" >> $LOGFILE
# Pre checks
# Root permisions
check_root_permissions
# Pre installed pandora
check_pre_pandora
# Connectivity
check_repo_connection
# Systemd
execute_cmd "systemctl status" "Cheking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
# Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "yum --version" 'Checking needed tools: yum'
# Creating working directory
rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE
mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE
execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp"
#Installing wget
execute_cmd "yum install -y wget" "Installing wget"
#Installing extra repositiries
extra_repos=" \
tar \
yum-utils \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
http://rpms.remirepo.net/enterprise/remi-release-7.rpm \
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP"
# Install percona Database
[ -f /etc/resolv.conf ] && rm -rf /etc/my.cnf
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
# Console dependencies
console_dependencies=" \
php \
postfix \
php-mcrypt \
php-cli \
php-gd \
php-curl \
php-session \
php-mysqlnd \
php-ldap \
php-zip \
php-zlib \
php-fileinfo \
php-gettext \
php-snmp \
php-mbstring \
php-pecl-zip \
php-xmlrpc \
libxslt \
wget \
php-xml \
httpd \
mod_php \
atk \
avahi-libs \
cairo \
cups-libs \
fribidi \
gd \
gdk-pixbuf2 \
ghostscript \
graphite2 \
graphviz \
gtk2 \
harfbuzz \
hicolor-icon-theme \
hwdata \
jasper-libs \
lcms2 \
libICE \
libSM \
libXaw \
libXcomposite \
libXcursor \
libXdamage \
libXext \
libXfixes \
libXft \
libXi \
libXinerama \
libXmu \
libXrandr \
libXrender \
libXt \
libXxf86vm \
libcroco \
libdrm \
libfontenc \
libglvnd \
libglvnd-egl \
libglvnd-glx \
libpciaccess \
librsvg2 \
libthai \
libtool-ltdl \
libwayland-client \
libwayland-server \
libxshmfence \
mesa-libEGL \
mesa-libGL \
mesa-libgbm \
mesa-libglapi \
pango \
pixman \
xorg-x11-fonts-75dpi \
xorg-x11-fonts-misc \
poppler-data \
php-yaml \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
server_dependencies=" \
perl \
vim \
fping \
perl-IO-Compress \
nmap \
sudo \
perl-Time-HiRes \
nfdump \
net-snmp-utils \
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# SDK VMware perl dependencies
vmware_dependencies=" \
http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \
perl-JSON \
perl-Archive-Zip \
openssl-devel \
perl-Crypt-CBC \
perl-Digest-SHA \
http://firefly.artica.es/centos7/perl-Crypt-OpenSSL-AES-0.02-1.el7.x86_64.rpm"
execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies"
# Instant client Oracle
oracle_dependencier=" \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant client"
# Disabling SELINUX and firewalld
setenforce 0
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
systemctl disable firewalld --now &>> $LOGFILE
#Configuring Database
execute_cmd "systemctl start mysqld" "Starting database engine"
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
echo """
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora');
""" | mysql --connect-expired-password -uroot
export MYSQL_PWD=$DBPASS
echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.'
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
#Generating my.cnf
POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
cat > /etc/my.cnf << EO_CONFIG_F
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
character-set-server=utf8
skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Mysql optimizations for Pandora FMS
# Please check the documentation in http://pandorafms.com for better results
max_allowed_packet = 64M
innodb_buffer_pool_size = $POOL_SIZE
innodb_lock_wait_timeout = 90
innodb_file_per_table
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M
innodb_log_buffer_size = 16M
innodb_io_capacity = 100
thread_cache_size = 8
thread_stack = 256K
max_connections = 100
key_buffer_size=4M
read_buffer_size=128K
read_rnd_buffer_size=128K
sort_buffer_size=128K
join_buffer_size=4M
query_cache_type = 1
query_cache_size = 64M
query_cache_min_res_unit = 2k
query_cache_limit = 256K
sql_mode=""
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
EO_CONFIG_F
execute_cmd "systemctl restart mysqld" "Configuring database engine"
# Downloading Pandora Packages
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community"
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community"
execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community"
# Install Pandora
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
# Copy gotty utility
execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
# Enable Services
execute_cmd "systemctl enable mysqld --now" "Enabling Database service"
execute_cmd "systemctl enable httpd --now" "Enabling HTTPD service"
# Populate Database
echo -en "${cyan}Loading pandoradb.sql to $DBNAME database...${reset}"
mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql &>> $LOGFILE
check_cmd_status 'Error Loading database schema'
echo -en "${cyan}Loading pandoradb_data.sql to $DBNAME database...${reset}"
mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql &>> $LOGFILE
check_cmd_status 'Error Loading database schema data'
# Configure console
cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F
<?php
\$config["dbtype"] = "mysql";
\$config["dbname"]="$DBNAME";
\$config["dbuser"]="$DBUSER";
\$config["dbpass"]="$DBPASS";
\$config["dbhost"]="localhost";
\$config["homedir"]="$PANDORA_CONSOLE";
\$config["homeurl"]="/pandora_console";
error_reporting(0);
\$ownDir = dirname(__FILE__) . '/';
include (\$ownDir . "config_process.php");
EO_CONFIG_F
cat > /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
EO_CONFIG_F
# Add ws proxy options to apache.
cat >> /etc/httpd/conf.modules.d/00-proxy.conf << 'EO_HTTPD_MOD'
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
EO_HTTPD_MOD
cat >> /etc/httpd/conf.d/wstunnel.conf << 'EO_HTTPD_WSTUNNEL'
ProxyRequests Off
<Proxy *>
Require all granted
</Proxy>
ProxyPass /ws ws://127.0.0.1:8080
ProxyPassReverse /ws ws://127.0.0.1:8080
EO_HTTPD_WSTUNNEL
# Temporal quitar htaccess
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess
# Fixing console permissions
chmod 600 $CONSOLE_PATH/include/config.php
chown apache. $CONSOLE_PATH/include/config.php
mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done
# Prepare php.ini
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 500M/g" /etc/php.ini
cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
EOF_INDEX
execute_cmd "systemctl restart httpd" "Restarting httpd after configuration"
# prepare snmptrapd
cat > /etc/snmp/snmptrapd.conf << EOF
authCommunity log public
disableAuthorization yes
EOF
# Prepare Server conf
sed -i -e "s/^dbhost.*/dbhost $DBHOST/g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
# Set Oracle environment for pandora_server
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
#!/bin/bash
VERSION=19.8
export PATH=$PATH:$HOME/bin:/usr/lib/oracle/$VERSION/client64/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib
export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
EOF_ENV
# Kernel optimization
cat >> /etc/sysctl.conf <<EO_KO
# Pandora FMS Optimization
# default=5
net.ipv4.tcp_syn_retries = 3
# default=5
net.ipv4.tcp_synack_retries = 3
# default=1024
net.ipv4.tcp_max_syn_backlog = 65536
# default=124928
net.core.wmem_max = 8388608
# default=131071
net.core.rmem_max = 8388608
# default = 128
net.core.somaxconn = 1024
# default = 20480
net.core.optmem_max = 81920
EO_KO
execute_cmd "sysctl --system" "Applying Kernel optimization"
# Fix pandora_server.{log,error} permissions to allow Console check them
chown pandora:apache /var/log/pandora
chmod g+s /var/log/pandora
cat > /etc/logrotate.d/pandora_server <<EO_LR
/var/log/pandora/pandora_server.log
/var/log/pandora/web_socket.log
/var/log/pandora/pandora_server.error {
su root apache
weekly
missingok
size 300000
rotate 3
maxage 90
compress
notifempty
copytruncate
create 660 pandora apache
}
/var/log/pandora/pandora_snmptrap.log {
su root apache
weekly
missingok
size 500000
rotate 1
maxage 30
notifempty
copytruncate
create 660 pandora apache
}
EO_LR
cat > /etc/logrotate.d/pandora_agent <<EO_LRA
/var/log/pandora/pandora_agent.log {
su root apache
weekly
missingok
size 300000
rotate 3
maxage 90
compress
notifempty
copytruncate
}
EO_LRA
chmod 0644 /etc/logrotate.d/pandora_server
chmod 0644 /etc/logrotate.d/pandora_agent
# Add websocket engine start script.
mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/
chmod +x /etc/init.d/pandora_websocket_engine
# Start Websocket engine
/etc/init.d/pandora_websocket_engine start &>> $LOGFILE
# Configure websocket to be started at start.
systemctl enable pandora_websocket_engine &>> $LOGFILE
# Enable pandora ha service
systemctl enable pandora_server --now &>> $LOGFILE
execute_cmd "systemctl start pandora_server" "Starting Pandora FMS Server"
# starting tentacle server
systemctl enable tentacle_serverd &>> $LOGFILE
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
# Enabling condole cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent
systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent"
#SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
cat > /etc/issue.net << EOF_banner
Welcome to Pandora FMS appliance on CentOS
------------------------------------------
Go to Public http://$ipplublic/pandora_console$to to login web console
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')
You can find more information at http://pandorafms.com
EOF_banner
rm -f /etc/issue
ln -s /etc/issue.net /etc/issue
echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config
# Remove temporary files
execute_cmd "echo done" "Pandora FMS Community installed"
cd
execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files"
# Print nice finish message
GREEN='\033[01;32m'
NONE='\033[0m'
printf " -> Go to Public ${green}http://"$ipplublic"/pandora_console${reset} to manage this server"
ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n -> Go to Local "g"http://"$1"/pandora_console"n" to manage this server \n -> Use this credentials to login in the console "g"[ User: admin / Password: pandora ]"n" \n"}'

View File

@ -9,7 +9,7 @@ RUN dnf install -y --setopt=tsflags=nodocs \
http://rpms.remirepo.net/enterprise/remi-release-8.rpm
RUN dnf module reset -y php && dnf module install -y php:remi-7.3
RUN dnf config-manager --set-enabled PowerTools
RUN dnf config-manager --set-enabled powertools
# Install console
RUN dnf install -y --setopt=tsflags=nodocs \
@ -88,7 +88,7 @@ RUN dnf install -y --setopt=tsflags=nodocs \
xorg-x11-fonts-75dpi \
xorg-x11-fonts-misc \
poppler-data \
php-yaml; yum clean all
php-yaml
RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/
# not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts
@ -242,16 +242,31 @@ RUN dnf install -y --setopt=tsflags=nodocs \
perl-DBD-MySQL \
perl-DBI \
initscripts \
vim \
fping \
perl-IO-Compress \
perl-Time-HiRes \
perl-Math-Complex \
libnsl \
mysql \
java \
net-snmp-utils \
net-tools \
nmap-ncat \
nmap \
net-snmp-utils \
sudo \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm
http://firefly.artica.es/centos8/wmi-1.3.14-4.el7.art.x86_64.rpm
# install utils
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
# SDK VMware perl dependencies
RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm
# Instant client Oracle
RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm
RUN dnf install -y supervisor crontabs mysql http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
EXPOSE 80 443 41121 162/udp

View File

@ -64,6 +64,7 @@ wget $oconsoleurl
wget $oserverurl
if [ "$BASEBUILD" == 1 ] ; then
docker pull centos:8
# Open Base image
echo "building Base el8 image"
cd $DOCKER_PATH/base
@ -71,9 +72,12 @@ if [ "$BASEBUILD" == 1 ] ; then
echo "Taging Open stack el8 latest image before upload"
docker tag $OBASE_IMAGE:$VERSION $OBASE_IMAGE:latest
echo -e ">>>> \n"
else
docker pull pandorafms/pandorafms-open-base-el8
fi
if [ "$DBBUILD" == 1 ] ; then
docker pull percona:5.7
# Percona image
echo "building Percona image"
cd $OPEN/extras/docker/percona

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.751, AIX version
# Version 7.0NG.752, AIX 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.751, FreeBSD Version
# Version 7.0NG.752, FreeBSD 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.751, HP-UX Version
# Version 7.0NG.752, 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.751, GNU/Linux
# Version 7.0NG.752, 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.751, GNU/Linux
# Version 7.0NG.752, 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.751, Solaris Version
# Version 7.0NG.752, 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.751
# Version 7.0NG.752
# 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,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.751, AIX version
# Version 7.0NG.752, 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.751
# Version 7.0NG.752
# 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.751, HPUX Version
# Version 7.0NG.752, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.751
# Version 7.0NG.752
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.751
# Version 7.0NG.752
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.751
# Version 7.0NG.752
# 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.751, Solaris version
# Version 7.0NG.752, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.751, AIX version
# Version 7.0NG.752, 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.751-210115
Version: 7.0NG.752-210309
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.751-210115"
pandora_version="7.0NG.752-210309"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -24,7 +24,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.751"
VERSION="7.0NG.752"
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.751" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.752" 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.751" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.752" 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.751</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.751 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.751</string>
<key>CFBundleVersion</key> <string>7.0NG.752</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.752 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.752</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.751, GNU/Linux
# Version 7.0NG.752, 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.751, FreeBSD Version
# Version 7.0NG.752, FreeBSD 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.751, HP-UX Version
# Version 7.0NG.752, 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.751, GNU/Linux
# Version 7.0NG.752, 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.751, GNU/Linux
# Version 7.0NG.752, 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.751, NetBSD Version
# Version 7.0NG.752, NetBSD 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.751, Solaris Version
# Version 7.0NG.752, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

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

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.751
%define release 210115
%define version 7.0NG.752
%define release 210309
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.751
%define release 210115
%define version 7.0NG.752
%define release 210309
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -62,8 +62,9 @@ cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUI
rm -Rf $RPM_BUILD_ROOT
%pre
if [ "`id pandora | grep uid | wc -l`" = 0 ]
if [ "`id pandora 2>/dev/null | grep uid | wc -l`" = 0 ]
then
echo "User pandora does not exist. Creating it..."
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
fi
@ -105,10 +106,15 @@ then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
chkconfig pandora_agent_daemon on
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service || chkconfig pandora_agent_daemon on
else
chkconfig pandora_agent_daemon on
fi
if [ "$?" -gt 0 ]
then
echo "There was a problem configuring pandora_agent_daemon service to run on boot. Please enable it manually."
fi
if [ "$1" -gt 1 ]

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.751"
PI_BUILD="210115"
PI_VERSION="7.0NG.752"
PI_BUILD="210309"
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.751
# Version 7.0NG.752
# 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.751}
{Pandora FMS Windows Agent v7.0NG.752}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210115}
{210309}
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.751(Build 210115)")
#define PANDORA_VERSION ("7.0NG.752(Build 210309)")
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.751(Build 210115))"
VALUE "ProductVersion", "(7.0NG.752(Build 210309))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

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

View File

@ -80,9 +80,8 @@ if (isset($_GET['loginhash']) === true) {
} else {
include_once 'general/login_page.php';
db_pandora_audit('Logon Failed (loginhash', '', 'system');
while (@ob_end_flush()) {
// Dumping...
continue;
while (ob_get_length() > 0) {
ob_end_flush();
}
exit('</html>');
@ -149,7 +148,9 @@ if (__PAN_XHPROF__ === 1) {
}
if ($config['force_instant_logout'] === true) {
if (isset($config['force_instant_logout']) === true
&& $config['force_instant_logout'] === true
) {
// Force user logout.
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
@ -169,7 +170,6 @@ if ($config['force_instant_logout'] === true) {
}
while (@ob_end_flush()) {
// Dumping...
continue;
while (ob_get_length() > 0) {
ob_end_flush();
}

View File

@ -94,12 +94,23 @@ function quickShell()
config_update_value('gotty_ssh_port', 8081);
}
// Context to allow self-signed certs.
$context = stream_context_create(
[
'http' => [ 'method' => 'GET'],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]
);
// Username. Retrieve from form.
if (empty($username) === true) {
// No username provided, ask for it.
$wiz = new Wizard();
$test = file_get_contents($ws_url);
$test = file_get_contents($ws_url, false, $context);
if ($test === false) {
ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
$wiz->printForm(
@ -197,8 +208,9 @@ function quickShell()
return;
}
// If rediretion is enabled, we will try to connect to http:// or https:// endpoint.
$test = get_headers($ws_url);
// If rediretion is enabled, we will try to connect using
// http:// or https:// endpoint.
$test = get_headers($ws_url, null, $context);
if ($test === false) {
if (empty($wiz) === true) {
$wiz = new Wizard();

View File

@ -36,27 +36,50 @@ function users_extension_main_god($god=true)
// Header
ui_print_page_header(__('Users connected'), $image, false, '', $god);
// Get user conected last 5 minutes
// Get groups user has permission
$group_um = users_get_groups_UM($config['id_user']);
// Is admin or has group permissions all.
$groups = implode(',', array_keys($group_um, 1));
// Get user conected last 5 minutes.Show only those on which the user has permission.
switch ($config['dbtype']) {
case 'mysql':
$sql = 'SELECT id_user, last_connect
FROM tusuario
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
ORDER BY last_connect DESC';
$sql = sprintf(
'SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
AND tusuario_perfil.id_grupo IN (%s)
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
GROUP BY tusuario.id_user
ORDER BY last_connect DESC',
$groups
);
break;
case 'postgresql':
$sql = "SELECT id_user, last_connect
FROM tusuario
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
ORDER BY last_connect DESC';
$sql = sprintf(
"SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
AND tusuario_perfil.id_grupo IN (%s)
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
GROUP BY tusuario.id_user
ORDER BY last_connect DESC',
$groups
);
break;
case 'oracle':
$sql = "SELECT id_user, last_connect
FROM tusuario
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
ORDER BY last_connect DESC';
$sql = sprintf(
"SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
AND tusuario_perfil.id_grupo IN (%s)
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
GROUP BY tusuario.id_user
ORDER BY last_connect DESC',
$groups
);
break;
}
@ -75,13 +98,45 @@ function users_extension_main_god($god=true)
$table->head = [];
$table->head[0] = __('User');
$table->head[1] = __('Date');
$table->head[1] = __('IP');
$table->head[2] = __('Last login');
$table->head[3] = __('Last contact');
$rowPair = true;
$iterator = 0;
// Get data
foreach ($rows as $row) {
// Get data of user's last login.
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$last_login_data = db_get_row_sql(
sprintf(
"SELECT ip_origen, utimestamp
FROM tsesion
WHERE id_usuario = '%s'
AND descripcion = '".io_safe_input('Logged in')."'
ORDER BY fecha DESC",
$row['id_user']
)
);
break;
case 'oracle':
$last_login_data = db_get_row_sql(
sprintf(
"SELECT ip_origen, utimestamp
FROM tsesion
WHERE id_usuario = '%s'
AND to_char(descripcion) = '".io_safe_input('Logged in')."'
ORDER BY fecha DESC",
$row['id_user']
)
);
break;
}
if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair';
} else {
@ -93,7 +148,9 @@ function users_extension_main_god($god=true)
$data = [];
$data[0] = '<a href="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user&amp;id='.$row['id_user'].'">'.$row['id_user'].'</a>';
$data[1] = date($config['date_format'], $row['last_connect']);
$data[1] = $last_login_data['ip_origin'];
$data[2] = date($config['date_format'], $last_login_data['utimestamp']);
$data[3] = date($config['date_format'], $row['last_connect']);
array_push($table->data, $data);
}
@ -102,7 +159,6 @@ function users_extension_main_god($god=true)
}
extensions_add_godmode_menu_option(__('Users connected'), 'UM', 'gusuarios', 'users/icon.png', 'v1r1');
extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', '', 'UM');
extensions_add_godmode_function('users_extension_main_god');

View File

@ -1,5 +1,6 @@
operation/servers/recon_view.php
operation/users/webchat.php
operation/events/event_statistics.php
include/javascript/webchat.js
attachment/pandora_chat.log.json.txt
attachment/pandora_chat.user_list.json.txt
@ -68,4 +69,6 @@ enterprise/extensions/ipam/include/javascript/ipam.js
enterprise/extensions/ipam/include/javascript/IpamMapController.js
enterprise/extensions/ipam/ipam_action.php
enterprise/extensions/ipam.php
enterprise/extensions/ipam
enterprise/extensions/ipam
enterprise/extensions/disabled/visual_console_manager.php
enterprise/extensions/visual_console_manager.php

View File

@ -85,33 +85,7 @@ SET @insert_name = 'IPAM Recon';
SET @insert_description = 'This script is used to automatically detect network hosts availability and name, used as Recon Custom Script in the recon task. Parameters used are:\n\n* custom_field1 = network. i.e.: 192.168.100.0/24\n* custom_field2 = associated IPAM network id. i.e.: 4. Please do not change this value, it is assigned automatically in IPAM management.\n\nSee documentation for more information.';
SET @insert_script = '/usr/share/pandora_server/util/recon_scripts/IPAMrecon.pl';
SET @insert_macros = '{"1":{"macro":"_field1_","desc":"Network","help":"i.e.:&#x20;192.168.100.0/24","value":"","hide":""}}';
INSERT IGNORE INTO trecon_script (`id_recon_script`,`type`, `name`, `description`, `script`, `macros`)
SELECT `id_recon_script`,`type`, `name`, `description`, `script`, `macros` FROM (
SELECT `id_recon_script`,`type`, `name`, `description`, `script`, `macros` FROM `trecon_script` WHERE `name` = @insert_name
UNION
SELECT (SELECT max(`id_recon_script`)+1 FROM `trecon_script`) AS `id_recon_script`,
@insert_type as `type`,
@insert_name as `name`,
@insert_description as `description`,
@insert_script as `script`,
@insert_macros as `macros`
) t limit 1;
ALTER TABLE `tipam_ip` ADD COLUMN `leased` tinyint(2) DEFAULT '0';
ALTER TABLE `tipam_ip` ADD COLUMN `leased_expiration` bigint(20) DEFAULT '0';
ALTER TABLE `tipam_ip` ADD COLUMN `mac_address` varchar(20) DEFAULT NULL;
ALTER TABLE `tipam_ip` ADD COLUMN `leased_mode` tinyint(2) DEFAULT '0';
ALTER TABLE `tipam_network` ADD COLUMN `monitoring` tinyint(2) default '0';
ALTER TABLE `tipam_network` ADD COLUMN `id_group` mediumint(8) unsigned NULL default '0';
ALTER TABLE `tipam_network` ADD COLUMN `lightweight_mode` tinyint(2) default '0';
ALTER TABLE `tipam_network` ADD COLUMN `name_network` varchar(255) default '';
INSERT IGNORE INTO trecon_script (`id_recon_script`,`type`, `name`, `description`, `script`, `macros`) SELECT `id_recon_script`,`type`, `name`, `description`, `script`, `macros` FROM (SELECT `id_recon_script`,`type`, `name`, `description`, `script`, `macros` FROM `trecon_script` WHERE `name` = @insert_name UNION SELECT (SELECT max(`id_recon_script`)+1 FROM `trecon_script`) AS `id_recon_script`, @insert_type as `type`, @insert_name as `name`, @insert_description as `description`, @insert_script as `script`, @insert_macros as `macros`) t limit 1;
DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
@ -131,6 +105,25 @@ ADD COLUMN `field16` TEXT NOT NULL AFTER `field15`
,ADD COLUMN `field19_recovery` TEXT NOT NULL AFTER `field18_recovery`
,ADD COLUMN `field20_recovery` TEXT NOT NULL AFTER `field19_recovery`;
UPDATE `trecon_script` SET `description`='Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x20;&lt;custom_field4&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;Password&#x0d;&#x0a;*&#x20;custom_field4&#x20;=&#x20;Additional&#x20;parameters&#x20;i.e.:&#x20;-D&#x20;LAN_2_0' WHERE `name`='IPMI&#x20;Recon';
ALTER TABLE `trecon_task` MODIFY COLUMN `review_mode` TINYINT(1) UNSIGNED DEFAULT 1;
DELETE FROM `tuser_task` WHERE id = 6;
UPDATE `tuser_task` SET `parameters`='a:4:{i:0;a:6:{s:11:"description";s:28:"Report pending to be created";s:5:"table";s:7:"treport";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:2:{s:11:"description";s:426:"Save to disk in path<a href="javascript:" class="tip" style="" ><img src="http://172.16.0.2/pandora_console/images/tip_help.png" data-title="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" data-use_title_for_force_title="1" class="forced_title" alt="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" /></a>";s:4:"type";s:6:"string";}i:2;a:2:{s:11:"description";s:16:"File nane prefix";s:4:"type";s:6:"string";}i:3;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE `id`=3;
UPDATE `tuser_task_scheduled` SET
`args` = REPLACE (`args`, 'a:3', 'a:5'),
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"PDF";s:15:"first_execution"')
WHERE `id_user_task` = 3;
UPDATE `tuser_task_scheduled` SET
`id_user_task` = 3,
`args` = REPLACE (`args`, 'a:3', 'a:5'),
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"XML";s:15:"first_execution"')
WHERE `id_user_task` = 6;
ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
COMMIT;

View File

@ -0,0 +1,8 @@
START TRANSACTION;
ALTER TABLE `tinventory_alert` ADD COLUMN `alert_groups` TEXT NOT NULL;
UPDATE `tinventory_alert` t1 INNER JOIN `tinventory_alert` t2 ON t1.id = t2.id SET t1.alert_groups = t2.id_group;
ALTER TABLE `tnotification_source` ADD COLUMN `subtype_blacklist` TEXT;
COMMIT;

View File

@ -363,6 +363,7 @@ CREATE TABLE IF NOT EXISTS `tinventory_alert`(
`last_fired` text NOT NULL default '',
`disable_event` tinyint(1) UNSIGNED default 0,
`enabled` tinyint(1) UNSIGNED default 1,
`alert_groups` text NOT NULL default '',
PRIMARY KEY (`id`),
FOREIGN KEY (`id_module_inventory`) REFERENCES tmodule_inventory(`id_module_inventory`)
ON DELETE CASCADE ON UPDATE CASCADE
@ -1402,6 +1403,7 @@ ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT '';
-- Table `ttag`
-- ---------------------------------------------------------------------
ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
-- ---------------------------------------------------------------------
-- Table `tconfig`
@ -1409,13 +1411,13 @@ ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 42);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 44);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', 750);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', 752);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@ -2391,6 +2393,7 @@ CREATE TABLE `tnotification_source` (
`enabled` int(1) DEFAULT NULL,
`user_editable` int(1) DEFAULT NULL,
`also_mail` int(1) DEFAULT NULL,
`subtype_blacklist` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -2525,6 +2528,20 @@ ALTER TABLE `tnetflow_filter` MODIFY COLUMN `router_ip` text NOT NULL;
-- ----------------------------------------------------------------------
UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";
INSERT IGNORE INTO tuser_task VALUES (8, 'cron_task_generate_csv_log', 'a:1:{i:0;a:2:{s:11:"description";s:14:"Send to e-mail";s:4:"type";s:4:"text";}}', 'Send csv log');
UPDATE `tuser_task` SET `parameters`='a:4:{i:0;a:6:{s:11:"description";s:28:"Report pending to be created";s:5:"table";s:7:"treport";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:2:{s:11:"description";s:426:"Save to disk in path<a href="javascript:" class="tip" style="" ><img src="http://172.16.0.2/pandora_console/images/tip_help.png" data-title="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" data-use_title_for_force_title="1" class="forced_title" alt="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" /></a>";s:4:"type";s:6:"string";}i:2;a:2:{s:11:"description";s:16:"File nane prefix";s:4:"type";s:6:"string";}i:3;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE `id`=3;
DELETE FROM `tuser_task` WHERE id = 6;
-- Migrate old tasks
UPDATE `tuser_task_scheduled` SET
`args` = REPLACE (`args`, 'a:3', 'a:5'),
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"PDF";s:15:"first_execution"')
WHERE `id_user_task` = 3;
UPDATE `tuser_task_scheduled` SET
`id_user_task` = 3,
`args` = REPLACE (`args`, 'a:3', 'a:5'),
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"XML";s:15:"first_execution"')
WHERE `id_user_task` = 6;
-- ----------------------------------------------------------------------
-- ADD message in table 'tnews'
@ -2683,6 +2700,7 @@ CREATE TABLE `tremote_command_target` (
-- Table `trecon_script`
-- ---------------------------------------------------------------------
ALTER TABLE `trecon_script` ADD COLUMN `type` int(11) NOT NULL DEFAULT '0';
UPDATE `trecon_script` SET `description`='Specific&#x20;Pandora&#x20;FMS&#x20;Intel&#x20;DCM&#x20;Discovery&#x20;&#40;c&#41;&#x20;Artica&#x20;ST&#x20;2011&#x20;&lt;info@artica.es&gt;&#x0d;&#x0a;&#x0d;&#x0a;Usage:&#x20;./ipmi-recon.pl&#x20;&lt;task_id&gt;&#x20;&lt;group_id&gt;&#x20;&lt;custom_field1&gt;&#x20;&lt;custom_field2&gt;&#x20;&lt;custom_field3&gt;&#x20;&lt;custom_field4&gt;&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;Network&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;Username&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;Password&#x0d;&#x0a;*&#x20;custom_field4&#x20;=&#x20;Additional&#x20;parameters&#x20;i.e.:&#x20;-D&#x20;LAN_2_0' WHERE `name`='IPMI&#x20;Recon';
-- ---------------------------------------------------------------------
-- Table `tusuario_perfil`
@ -3967,4 +3985,5 @@ SELECT `id_recon_script`,`type`, `name`, `description`, `script`, `macros` FROM
DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';

View File

@ -1404,6 +1404,10 @@ if ($update_module || $create_module) {
$each_ff = (int) get_parameter('each_ff', $module['each_ff']);
$ff_timeout = (int) get_parameter('ff_timeout');
$unit = (string) get_parameter('unit');
if ($unit === '0') {
$unit = '';
}
$id_tag = (array) get_parameter('id_tag_selected');
$serialize_ops = (string) get_parameter('serialize_ops');
$critical_instructions = (string) get_parameter('critical_instructions');
@ -1570,24 +1574,43 @@ if ($update_module) {
'module_macros' => $module_macros,
];
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
$plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']);
if (preg_match('/http_auth_user/m', $values['plugin_parameter'])) {
$http_user_conf = true;
}
$values['plugin_parameter'] = '';
if (preg_match('/http_auth_pass/m', $values['plugin_parameter'])) {
$http_pass_conf = true;
}
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
if (!$http_user_conf || !$http_pass_conf) {
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
$plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']);
$values['plugin_parameter'] = '';
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
if ($http_user_conf) {
continue;
}
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
if ($http_pass) {
if ($http_user_pass) {
continue;
}
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;';
} else {
$values['plugin_parameter'] .= $value.'&#x0a;';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;';
} else {
$values['plugin_parameter'] .= $value.'&#x0a;';
}
}
}

View File

@ -567,12 +567,12 @@ if ($agents !== false) {
$url = ui_get_full_url(
$url.'&op=update&id='.$cluster->id()
);
echo '<a href="'.$url.'">'.$agent['alias'].'</a>';
echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
}
} else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</span>'.'</a>';
}
echo '</strong>';

View File

@ -548,17 +548,17 @@ $table_advanced->data[0][4] = html_print_input_text(
$classdisabledBecauseInPolicy
);
// $table_advanced->colspan[1][4] = 3;
// $table_advanced->data[0][4] = html_print_extended_select_for_unit(
// 'unit',
// $unit,
// '',
// '',
// '0',
// false,
// true,
// false,
// false
// );
$table_advanced->data[0][4] = html_print_extended_select_for_unit(
'unit',
$unit,
'',
'none',
'0',
false,
true,
false,
false
);
$table_advanced->colspan[0][4] = 3;
$module_id_policy_module = 0;

View File

@ -70,7 +70,6 @@ ui_print_page_header(
// Recursion group filter.
$recursion = get_parameter('recursion', $_POST['recursion']);
// Initialize data.
$id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name');
@ -143,16 +142,29 @@ $user_groups_ad = array_keys(
users_get_groups($config['id_user'], $access)
);
// Check AD permission on downtime.
$downtime_group = db_get_value(
'id_group',
'tplanned_downtime',
'id',
$id_downtime
);
if ($id_downtime > 0) {
if (!check_acl_restricted_all($config['id_user'], $downtime_group, 'AW')
&& !check_acl_restricted_all($config['id_user'], $downtime_group, 'AD')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access downtime scheduler'
);
include 'general/noaccess.php';
return;
}
}
// INSERT A NEW DOWNTIME_AGENT ASSOCIATION.
if ($insert_downtime_agent === 1) {
// Check AD permission on downtime.
$downtime_group = db_get_value(
'id_group',
'tplanned_downtime',
'id',
$id_downtime
);
if ($downtime_group === false
|| !in_array($downtime_group, $user_groups_ad)
) {
@ -167,7 +179,12 @@ if ($insert_downtime_agent === 1) {
$agents = (array) get_parameter('id_agents');
$module_names = (array) get_parameter('module');
$all_modules = (empty($module_names) || ($module_names[0] === '0'));
$all_modules = ($modules_selection_mode === 'all' && (empty($module_names) || (int) $modules[0] === 0));
$all_common_modules = ($modules_selection_mode === 'common' && (empty($module_names) || (int) $modules[0] === 0));
if ($all_common_modules === true) {
$module_names = explode(',', get_parameter('all_common_modules'));
}
// 'Is running' check.
$is_running = (bool) db_get_value(
@ -181,9 +198,15 @@ if ($insert_downtime_agent === 1) {
__('This elements cannot be modified while the downtime is being executed')
);
} else {
// If is selected 'Any', get all the agents.
if (count($agents) === 1 && (int) $agents[0] === -2) {
$all_agents = get_parameter('all_agents');
$agents = explode(',', $all_agents);
}
foreach ($agents as $agent_id) {
// Check module belongs to the agent.
if ($modules_selection_mode == 'all') {
if ($modules_selection_mode == 'all' && $all_modules === false) {
$check = false;
foreach ($module_names as $module_name) {
$check_module = modules_get_agentmodule_id(
@ -644,11 +667,20 @@ $table->data[0][1] = html_print_input_text(
true,
$disabled_in_execution
);
$return_all_group = false;
if (users_can_manage_group_all('AW') === true
|| users_can_manage_group_all('AD') === true
) {
$return_all_group = true;
}
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false,
$access,
true,
$return_all_group,
'id_group',
$id_group,
'',
@ -896,33 +928,7 @@ if ($id_downtime > 0) {
}
}
$sql = sprintf(
'SELECT tagente.id_agente, tagente.alias
FROM tagente
WHERE tagente.id_agente NOT IN (
SELECT tagente.id_agente
FROM tagente, tplanned_downtime_agents
WHERE tplanned_downtime_agents.id_agent = tagente.id_agente
AND tplanned_downtime_agents.id_downtime = %d
) AND disabled = 0 %s
AND tagente.id_grupo IN (%s)
ORDER BY tagente.nombre',
$id_downtime,
$filter_cond,
$id_groups_str
);
$agents = db_get_all_rows_sql($sql);
if (empty($agents)) {
$agents = [];
}
$agent_ids = extract_column($agents, 'id_agente');
$agent_names = extract_column($agents, 'alias');
$agents = array_combine($agent_ids, $agent_names);
if ($agents === false) {
$agents = [];
}
$agents = get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str);
$disabled_add_button = false;
if (empty($agents) || $disabled_in_execution) {
@ -940,7 +946,7 @@ if ($id_downtime > 0) {
// Show available agents to include into downtime
echo '<h4>'.__('Available agents').':</h4>';
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
html_print_input_hidden('all_agents', implode(',', array_keys($agents)));
echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;');
if ($type_downtime != 'quiet') {
@ -949,6 +955,7 @@ if ($id_downtime > 0) {
echo '<div id="available_modules_selection_mode" style="padding-top:20px">';
}
html_print_input_hidden('all_common_modules', '');
echo html_print_select(
[
'common' => __('Show common modules'),

View File

@ -476,22 +476,42 @@ else {
if (in_array($downtime['id_group'], $groupsAD)) {
// Stop button
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
$data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
) {
$data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
} else {
$data['stop'] = html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
}
} else {
$data['stop'] = '';
}
// Edit & delete buttons.
if ($downtime['executed'] == 0) {
// Edit.
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
// Delete.
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
) {
// Edit.
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
// Delete.
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
} else {
$data['edit'] = '';
$data['delete'] = '';
}
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
// Edit.
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
// Delete.
$data['delete'] = __('N/A');
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
) {
// Edit.
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
// Delete.
$data['delete'] = __('N/A');
} else {
$data['edit'] = '';
$data['delete'] = '';
}
} else {
$data['edit'] = '';
$data['delete'] = '';

View File

@ -77,6 +77,15 @@ if ($copy_action) {
$al_action = alerts_get_alert_action($id);
if (!check_acl_restricted_all($config['id_user'], $al_action['id_group'], 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
if ($al_action !== false) {
// If user tries to copy an action with group=ALL.
if ($al_action['id_group'] == 0) {
@ -144,6 +153,15 @@ if ($delete_action) {
$al_action = alerts_get_alert_action($id);
if (!check_acl_restricted_all($config['id_user'], $al_action['id_group'], 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
if ($al_action !== false) {
// If user tries to delete an action with group=ALL.
if ($al_action['id_group'] == 0) {
@ -236,11 +254,18 @@ $table_filter->data[0][1] = html_print_input_text(
255,
true
);
$return_all_group = false;
if (users_can_manage_group_all('LM') === true) {
$return_all_group = true;
}
$table_filter->data[0][2] = __('Group');
$table_filter->data[0][3] = html_print_select_groups(
$config['id_user'],
'LM',
true,
$return_all_group,
'group_search',
$group_search,
'',
@ -370,7 +395,12 @@ foreach ($actions as $action) {
$data = [];
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
if (check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
} else {
$data[0] = $action['name'];
}
$data[1] = $action['command_name'];
$data[2] = ui_print_group_icon($action['id_group'], true).'&nbsp;';
if (!alerts_validate_command_to_action($action['id_group'], $action['command_group'])) {
@ -384,8 +414,11 @@ foreach ($actions as $action) {
);
}
$data[3] = '';
$data[4] = '';
if (is_central_policies_on_node() === false
&& check_acl($config['id_user'], $action['id_group'], 'LM')
&& check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')
) {
$table->cellclass[] = [
3 => 'action_buttons',

View File

@ -556,7 +556,9 @@ foreach ($commands as $command) {
$data = [];
$data['name'] = '<span style="font-size: 7.5pt">';
if (! $command['internal']) {
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if (!$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
$data['name'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'.$command['name'].'</a>';
} else {
$data['name'] .= $command['name'];
@ -580,7 +582,9 @@ foreach ($commands as $command) {
);
$data['action'] = '';
$table->cellclass[]['action'] = 'action_buttons';
if ($is_central_policies_on_node === false && !$command['internal']) {
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_central_policies_on_node === false && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
$data['action'] = '<span style="display: inline-flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>';

View File

@ -123,11 +123,15 @@ $form_filter .= "</td style='font-weight: bold;'>";
$form_filter .= '</tr>';
$form_filter .= '<tr>';
$form_filter .= "<td style='font-weight: bold;'>".__('Enabled / Disabled').'</td><td>';
$form_filter .= "<td style='font-weight: bold;'>".__('Status').'</td><td>';
$ed_list = [];
$ed_list[0] = __('Enabled');
$ed_list[1] = __('Disabled');
$form_filter .= html_print_select($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true);
$alert_status_filter = [];
$alert_status_filter['all_enabled'] = __('All (Enabled)');
$alert_status_filter['all'] = __('All');
$alert_status_filter['fired'] = __('Fired');
$alert_status_filter['notfired'] = __('Not fired');
$alert_status_filter['disabled'] = __('Disabled');
$form_filter .= html_print_select($alert_status_filter, 'status_alert', $status_alert, '', '', '', true);
$form_filter .= "</td><td style='font-weight: bold;'>".__('Standby').'</td><td>';
$sb_list = [];
$sb_list[1] = __('Standby on');
@ -144,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_
$form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false);
$form_filter .= '</td></tr>';
if (defined('METACONSOLE')) {
$form_filter .= '<tr>';
$form_filter .= "<td colspan='6' align='right'>";
@ -174,8 +179,15 @@ $simple_alerts = [];
$total = 0;
$where = '';
if ($searchFlag) {
if ($status_alert === 'fired') {
$where .= ' AND talert_template_modules.times_fired > 0';
}
if ($status_alert === 'notfired') {
$where .= ' AND talert_template_modules.times_fired = 0';
}
if ($priority != -1 && $priority != '') {
$where .= ' AND id_alert_template IN (SELECT id FROM talert_templates WHERE priority = '.$priority.')';
}
@ -206,8 +218,12 @@ if ($searchFlag) {
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
}
if ($enabledisable != -1 && $enabledisable != '') {
$where .= ' AND talert_template_modules.disabled ='.$enabledisable;
if ($status_alert === 'disabled') {
$where .= ' AND talert_template_modules.disabled = 1';
}
if ($status_alert === 'all_enabled') {
$where .= ' AND talert_template_modules.disabled = 0';
}
if ($standby != -1 && $standby != '') {
@ -385,7 +401,7 @@ switch ($sortField) {
break;
}
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group;
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert;
$sort_params = '&sort_field='.$sortField.'&sort='.$sort;
if ($id_agente) {

View File

@ -65,6 +65,7 @@ $searchType = get_parameter('search_type', '');
$priority = get_parameter('priority', '');
$searchFlag = get_parameter('search', 0);
$enabledisable = get_parameter('enabledisable', '');
$status_alert = get_parameter('status_alert', '');
$standby = get_parameter('standby', '');
$pure = get_parameter('pure', 0);
$ag_group = get_parameter('ag_group', 0);

View File

@ -401,13 +401,17 @@ foreach ($templates as $template) {
$data = [];
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$template['id'].'&pure='.$pure.'">'.$template['name'].'</a>';
if (check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$template['id'].'&pure='.$pure.'">'.$template['name'].'</a>';
} else {
$data[0] = $template['name'];
}
$data[1] = ui_print_group_icon($template['id_group'], true);
$data[3] = alerts_get_alert_templates_type_name($template['type']);
if (is_central_policies_on_node() === false
&& check_acl($config['id_user'], $template['id_group'], 'LM')
&& check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')
) {
$table->cellclass[][4] = 'action_buttons';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">';

View File

@ -101,6 +101,15 @@ if ($id) {
$group = $action['id_group'];
$action_threshold = $action['action_threshold'];
if (!check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
}
// Hidden div with help hint to fill with javascript.
@ -168,10 +177,16 @@ $table->data[1][0] = __('Group');
$own_info = get_user_info($config['id_user']);
$return_all_group = false;
if (users_can_manage_group_all('LW') === true) {
$return_all_group = true;
}
$table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups(
false,
'LW',
true,
$return_all_group,
'group',
$group,
'',

View File

@ -48,15 +48,18 @@ if (is_metaconsole() === true) {
);
}
if ($update_command) {
$id = (int) get_parameter('id');
if ($id > 0) {
$alert = alerts_get_alert_command($id);
if ($alert['internal']) {
if ($alert['internal'] || !check_acl_restricted_all($config['id_user'], $alert['id_group'], 'LM')) {
db_pandora_audit('ACL Violation', 'Trying to access Alert Management');
include 'general/noaccess.php';
exit;
}
}
if ($update_command) {
$alert = alerts_get_alert_command($id);
$name = (string) get_parameter('name');
$command = (string) get_parameter('command');
@ -216,12 +219,18 @@ $table->data['command'][1] = html_print_textarea(
$is_central_policies_on_node
);
$return_all_group = false;
if (users_can_manage_group_all('LM') === true) {
$return_all_group = true;
}
$table->colspan['group'][1] = 3;
$table->data['group'][0] = __('Group');
$table->data['group'][1] = '<div class="w250px inline">'.html_print_select_groups(
false,
'LM',
true,
$return_all_group,
'id_group',
$id_group,
false,

View File

@ -55,6 +55,15 @@ if (defined('METACONSOLE')) {
if ($a_template !== false) {
// If user tries to duplicate/edit a template with group=ALL
if ($a_template['id_group'] == 0) {
if (users_can_manage_group_all('LM') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
@ -1091,18 +1100,18 @@ if ($step == 2) {
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Group');
$groups = users_get_groups();
$own_info = get_user_info($config['id_user']);
// Only display group "All" if user is administrator or has "PM" privileges.
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$display_all_group = true;
} else {
$display_all_group = false;
$return_all_group = false;
if (users_can_manage_group_all('LM') === true) {
$return_all_group = true;
}
$table->data[0][1] .= '&nbsp;';
$table->data[0][1] .= '<div class="w250px inline">'.html_print_select_groups(
false,
'AR',
$display_all_group,
$return_all_group,
'id_group',
$id_group,
'',
@ -1422,7 +1431,11 @@ if ($step == 2) {
case "unknown":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-example").show ();
if ($("#text-min_alerts").val() > 0 ) {
unknown = <?php echo "'".__('The alert would fire when the module is in unknown status. Warning: unknown_updates of pandora_server.conf must be equal to 1')."'"; ?>;
}
/* Show example */
$("span#example").empty ().append (unknown);
break;

View File

@ -40,7 +40,15 @@ $strict_user = db_get_value(
);
if ($id) {
$permission = events_check_event_filter_group($id);
$restrict_all_group = false;
if (!users_can_manage_group_all('EW') === true
&& !users_can_manage_group_all('EM') === true
) {
$restrict_all_group = true;
}
$permission = events_check_event_filter_group($id, $restrict_all_group);
if (!$permission) {
// User doesn't have permissions to see this filter
include 'general/noaccess.php';
@ -276,12 +284,18 @@ $table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
$strict_user
).'</div>';
$return_all_group = false;
if (users_can_manage_group_all('AR') === true) {
$return_all_group = true;
}
$table->data[2][0] = '<b>'.__('Group').'</b>';
$display_all_group = (users_is_admin() || users_can_manage_group_all('AR'));
$table->data[2][1] = '<div class="w250px">'.html_print_select_groups(
$config['id_user'],
'AR',
$display_all_group,
$return_all_group,
'id_group',
$id_group,
'',

View File

@ -35,6 +35,19 @@ $multiple_delete = (bool) get_parameter('multiple_delete', 0);
if ($delete) {
$id = (int) get_parameter('id');
$filter_group = (int) db_get_value('id_group', 'tevent_filter', 'id_filter', $id);
if (!check_acl_restricted_all($config['id_user'], $filter_group, 'EW')
&& !check_acl_restricted_all($config['id_user'], $filter_group, 'EM')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access events filter editor'
);
include 'general/noaccess.php';
return;
}
$id_filter = db_get_value('id_filter', 'tevent_filter', 'id_filter', $id);
if ($id_filter === false) {
@ -151,13 +164,27 @@ foreach ($filters as $filter) {
$data = [];
$data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true);
$data[1] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&id='.$filter['id_filter'].'&pure='.$config['pure'].'">'.$filter['id_name'].'</a>';
if (!check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EW')
&& !check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EM')
) {
$data[1] = $filter['id_name'];
} else {
$data[1] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&id='.$filter['id_filter'].'&pure='.$config['pure'].'">'.$filter['id_name'].'</a>';
}
$data[2] = ui_print_group_icon($filter['id_group_filter'], true);
$data[3] = events_get_event_types($filter['event_type']);
$data[4] = events_get_status($filter['status']);
$data[5] = events_get_severity_types($filter['severity']);
$table->cellclass[][6] = 'action_buttons';
$data[6] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'href='index.php?sec=geventos&sec2=godmode/events/events&section=filter&delete=1&id=".$filter['id_filter'].'&offset=0&pure='.$config['pure']."'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
$data[6] = '';
if (check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EW')
|| check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EM')
) {
$table->cellclass[][6] = 'action_buttons';
$data[6] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'href='index.php?sec=geventos&sec2=godmode/events/events&section=filter&delete=1&id=".$filter['id_filter'].'&offset=0&pure='.$config['pure']."'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
}
array_push($table->data, $data);
}

View File

@ -39,6 +39,16 @@ $event_response_id = get_parameter('id_response', 0);
if ($event_response_id > 0) {
$event_response = db_get_row('tevent_response', 'id', $event_response_id);
// ACL check for event response edition.
if (!check_acl_restricted_all($config['id_user'], $event_response['id_group'], 'PM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Group Management'
);
include 'general/noaccess.php';
return;
}
} else {
$event_response = [];
$event_response['name'] = '';
@ -84,8 +94,14 @@ $data[1] = html_print_input_text(
);
$data[1] .= html_print_input_hidden('id_response', $event_response['id'], true);
$return_all_group = false;
if (users_can_manage_group_all('PM') === true) {
$return_all_group = true;
}
$data[2] = __('Group');
$data[3] = html_print_select_groups(false, 'PM', true, 'id_group', $event_response['id_group'], '', '', '', true);
$data[3] = html_print_select_groups(false, 'PM', $return_all_group, 'id_group', $event_response['id_group'], '', '', '', true);
$table->data[0] = $data;
$data = [];

View File

@ -55,6 +55,10 @@ $table->head[3] = __('Actions');
$table->data = [];
foreach ($event_responses as $response) {
if (!check_acl_restricted_all($config['id_user'], $response['id_group'], 'PM')) {
continue;
}
$data = [];
$data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>';
$data[1] = $response['description'];

View File

@ -30,6 +30,14 @@ require_once 'include/functions_gis.php';
$idMap = (int) get_parameter('map_id', 0);
$action = get_parameter('action', 'new_map');
$gis_map_group = db_get_value('group_id', 'tgis_map', 'id_tgis_map', $idMap);
if ($idMap > 0 && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW') && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW')) {
db_pandora_audit('ACL Violation', 'Trying to access map builder');
include 'general/noaccess.php';
return;
}
$sec2 = get_parameter_get('sec2');
$sec2 = safe_url_extraclean($sec2);
@ -453,14 +461,37 @@ $table->data[1][1] = "<table style='padding:0px;' class='no-class' border='0' id
</tr> ".gis_add_conection_maps_in_form($map_connection_list).'
</table>';
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'MM')) {
$display_all_group = true;
} else {
$display_all_group = false;
$return_all_group = false;
if (users_can_manage_group_all('MM') === true) {
$return_all_group = true;
}
$table->data[2][0] = __('Group');
$table->data[2][1] = html_print_select_groups(false, 'IW', $display_all_group, 'map_group_id', $map_group_id, '', '', '', true);
$table->data[2][1] = html_print_select_groups(
false,
'IW',
$return_all_group,
'map_group_id',
$map_group_id,
'',
'',
'',
true,
false,
true,
'',
false,
false,
false,
false,
'id_grupo',
false,
false,
false,
'250px'
);
$table->data[3][0] = __('Default zoom');
$table->data[3][1] = html_print_input_text('map_zoom_level', $map_zoom_level, '', 2, 4, true).html_print_input_hidden('map_levels_zoom', $map_levels_zoom, true);

View File

@ -251,7 +251,16 @@ if (is_ajax()) {
$tab = (string) get_parameter('tab', 'groups');
if ($tab != 'credbox' && ! check_acl($config['id_user'], 0, 'PM')) {
if ($tab != 'credbox' && ! check_acl(
$config['id_user'],
0,
'PM'
) && ! check_acl(
$config['id_user'],
0,
'AW'
)
) {
db_pandora_audit(
'ACL Violation',
'Trying to access Group Management'

View File

@ -1,17 +1,32 @@
<?php
/**
* View for Add actions alerts in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -195,9 +210,6 @@ $table->data[1][0] .= '</span>';
$table->data[1][1] = html_print_select([], 'id_agents[]', 0, false, __('Any'), '', true, true);
$table->data[2][0] = __('Alert templates');
$table->data[2][0] .= '<span id="template_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$table->data[2][1] = html_print_select([], 'id_alert_templates[]', '', '', '', '', true, true, true, '', $alert_templates == 0);
$table->data[2][2] = __('When select agents');
$table->data[2][2] .= '<br>';
@ -251,36 +263,20 @@ $agents_with_templates_json = json_encode($agents_with_templates_json);
echo "<input type='hidden' id='hidden-agents_with_templates' value='$agents_with_templates_json'>";
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('add', 1);
html_print_submit_button(__('Add'), 'go', false, 'class="sub add"');
echo '</div>';
attachActionButton('add', 'create', $table->width);
echo '</form>';
echo '<h3 class="error invisible" id="message"> </h3>';
ui_require_javascript_file('massive_operations');
ui_require_jquery_file('form');
ui_require_jquery_file('pandora.controls');
?>
<script type="text/javascript">
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
$(document).ready (function () {
$("#form_alerts").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $("#form_alerts").serializeArray().length;
var count_parameters =
get_parameters_count + post_parameters_count;
if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
return false;
}
});
update_alerts();
@ -319,7 +315,7 @@ $(document).ready (function () {
jQuery.each ($("#id_agents option:selected"), function (i, val) {
idAgents.push($(val).val());
});
$("#template_loading").show();
showSpinner();
var $select_template = $("#id_alert_templates").disable ();
@ -340,7 +336,7 @@ $(document).ready (function () {
}
$("#id_alert_templates").append (options);
$("#template_loading").hide ();
hideSpinner();
$select_template.enable ();
},
"json"

View File

@ -278,10 +278,8 @@ $table->data[2][3] = '';
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('add', 1);
html_print_submit_button(__('Add'), 'go', false, 'class="sub add"');
echo '</div>';
attachActionButton('add', 'add', $table->width);
echo '</form>';
// TODO: Change to iu_print_error system.
@ -299,7 +297,7 @@ ui_require_jquery_file('pandora.controls');
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
$(document).ready (function () {
$("#form_alerts").submit(function() {
/* $("#form_alerts").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $("#form_alerts").serializeArray().length;
@ -311,7 +309,7 @@ $(document).ready (function () {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
return false;
}
});
}); */
$("#checkbox-recursion").click(function () {
$("#id_group").trigger("change");
@ -321,7 +319,7 @@ $(document).ready (function () {
$("#id_group").change (function () {
var $select = $("#id_agents").enable ();
$("#agent_loading").show ();
showSpinner();
$("option", $select).remove ();
jQuery.post ("ajax.php",
@ -340,7 +338,7 @@ $(document).ready (function () {
options += "<option value=\""+id+"\">"+value+"</option>";
});
$("#id_agents").append (options);
$("#agent_loading").hide ();
hideSpinner();
$select.enable ();
},
"json"

View File

@ -1,20 +1,34 @@
<?php
/**
* View for Add profiles in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (!check_acl($config['id_user'], 0, 'UM')) {
db_pandora_audit(
'ACL Violation',
@ -219,14 +233,14 @@ $data[2] .= html_print_select(
'width: 100%'
);
// Waiting spinner.
ui_print_spinner(__('Loading'));
array_push($table->data, $data);
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('create_profiles', 1);
html_print_submit_button(__('Create'), 'go', false, 'class="sub add"');
echo '</div>';
attachActionButton('create_profiles', 'update', $table->width);
echo '</form>';

View File

@ -1,17 +1,32 @@
<?php
/**
* View for copy modules in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -294,22 +309,17 @@ echo '<legend><span>'.__('To agent(s)').'</span></legend>';
html_print_table($table);
echo '</fieldset>';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
attachActionButton('do_operation', 'copy', $table->width);
html_print_input_hidden('do_operation', 1);
html_print_submit_button(__('Copy'), 'go', false, 'class="sub wand"');
echo '</div>';
echo '</form>';
echo '<h3 class="error invisible" id="message">&nbsp;</h3>';
// Load JS files.
ui_require_javascript_file('pandora_modules');
ui_require_jquery_file('form');
ui_require_jquery_file('pandora.controls');
?>
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var module_alerts;
@ -514,7 +524,7 @@ $(document).ready (function () {
});
$("#manage_config_form").submit (function () {
var get_parameters_count = window.location.href.slice(
/* var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $("#manage_config_form").serializeArray().length;
@ -522,9 +532,13 @@ $(document).ready (function () {
get_parameters_count + post_parameters_count;
if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
alert("
<?php
// echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.');
?>
");
return false;
}
} */

View File

@ -1,17 +1,32 @@
<?php
/**
* View for delete action alerts in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -270,10 +285,8 @@ $agents_with_templates_json = json_encode($agents_with_templates_json);
echo "<input type='hidden' id='hidden-agents_with_templates' value='".$agents_with_templates_json."'>";
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('delete', 1);
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
attachActionButton('delete', 'delete', $table->width);
echo '</form>';
echo '<h3 class="error invisible" id="message"></h3>';

View File

@ -1,17 +1,32 @@
<?php
/**
* View for delete agents in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -186,11 +201,8 @@ $table->data[2][1] = html_print_select(
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
html_print_table($table);
if (!is_central_policies_on_node()) {
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('delete', 1);
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
if (is_central_policies_on_node() === false) {
attachActionButton('delete', 'delete', $table->width);
}
echo '</form>';
@ -202,24 +214,8 @@ ui_require_jquery_file('pandora.controls');
?>
<script type="text/javascript">
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
$(document).ready (function () {
$("#form_agents").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $("#form_agents").serializeArray().length;
var count_parameters =
get_parameters_count + post_parameters_count;
if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
return false;
}
});
var recursion;
$("#checkbox-recursion").click(function () {

View File

@ -1,17 +1,32 @@
<?php
/**
* View for Delete alerts in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -321,10 +336,8 @@ $table->data[2][3] = html_print_select([], 'module[]', '', false, '', '', true,
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_alerts" >';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden('delete', 1);
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
attachActionButton('delete', 'delete', $table->width);
echo '</form>';
// Hack to translate text "none" in PHP to javascript
@ -371,7 +384,7 @@ $(document).ready (function () {
$("#id_group").change (function () {
var $select = $("#id_agents").disable ();
$("#agent_loading").show ();
showSpinner();
$("option", $select).remove ();
jQuery.post ("ajax.php",
@ -393,7 +406,7 @@ $(document).ready (function () {
options += "<option value=\""+id+"\">"+value+"</option>";
});
$("#id_agents").append (options);
$("#agent_loading").hide ();
hideSpinner();
$select.enable ();
},
"json"

View File

@ -1,17 +1,32 @@
<?php
/**
* View for delete modules in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -563,10 +578,8 @@ $table->data['form_agents_3'][3] = html_print_select(
echo '<form method="post" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('delete', 1);
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
attachActionButton('delete', 'delete', $table->width);
echo '</form>';
echo '<h3 class="error invisible" id="message"> </h3>';
@ -575,6 +588,9 @@ ui_require_jquery_file('form');
// Hack to translate text "none" in PHP to javascript
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo '<span id ="select_agent_first_text" style="display: none;">'.__('Please, select an agent first').'</span>';
// Load JS files.
ui_require_javascript_file('pandora_modules');
ui_require_jquery_file('pandora.controls');
if ($selection_mode == 'modules') {
@ -586,13 +602,10 @@ if ($selection_mode == 'modules') {
}
?>
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
$(document).ready (function () {
$("#checkbox-select_all_modules").change(function() {
if( $('#checkbox-select_all_modules').prop('checked')) {
$("#module_name option").prop('selected', 'selected');
@ -689,7 +702,7 @@ $(document).ready (function () {
}
}
$("#module_loading").show ();
showSpinner();
$("tr#delete_table-edit1, tr#delete_table-edit2").hide ();
$("#module_name").attr ("disabled", "disabled")
$("#module_name option[value!=0]").remove ();
@ -702,7 +715,7 @@ $(document).ready (function () {
.html(value["nombre"]);
$("#module_name").append (option);
});
$("#module_loading").hide();
hideSpinner();
$("#module_name").removeAttr ("disabled");
//Filter modules. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
@ -832,21 +845,7 @@ $(document).ready (function () {
selector = $("#form_edit input[name=selection_mode]:checked").val();
$("#id_agents").trigger("change");
});
$("#form_modules").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $("#form_modules").serializeArray().length;
var count_parameters =
get_parameters_count + post_parameters_count;
if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
return false;
}
});
if("<?php echo $delete; ?>"){
if("<?php echo $selection_mode; ?>" == 'agents'){
$("#groups_select").trigger("change");

View File

@ -1,17 +1,32 @@
<?php
/**
* View for delete profiles in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'UM')) {
@ -199,16 +214,13 @@ array_push($table->data, $data);
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden('delete_profiles', 1);
html_print_submit_button(__('Delete'), 'del', false, 'class="sub delete"');
echo '</div>';
attachActionButton('delete_profiles', 'delete', $table->width);
echo '</form>';
unset($table);
// TODO: Change to iu_print_error system
// TODO: Change to iu_print_error system.
echo '<h3 class="error invisible" id="message"> </h3>';
ui_require_jquery_file('form');
@ -224,7 +236,7 @@ $(document).ready (function () {
var $select = $("#users_id").disable ();
$("#users_loading").show ();
$("option", $select).remove ();
console.log($("#groups_id").val());
jQuery.post ("ajax.php",
{"page" : "godmode/massive/massive_delete_profiles",
"get_users" : 1,

View File

@ -1,17 +1,32 @@
<?php
/**
* View for edit agents in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -327,13 +342,16 @@ if ($update_agents) {
// Update Custom Fields
foreach ($fields as $field) {
$info[$field['id_field']] = $field['name'];
if (get_parameter_post('customvalue_'.$field['id_field'], '') != '') {
$value = get_parameter('customvalue_'.$field['id_field']);
if (empty($value) === false) {
$key = $field['id_field'];
$value = get_parameter_post('customvalue_'.$field['id_field'], '');
$old_value = db_get_all_rows_filter('tagent_custom_data', ['id_agent' => $id_agent, 'id_field' => $key]);
$old_value = db_get_all_rows_filter(
'tagent_custom_data',
[
'id_agent' => $id_agent,
'id_field' => $key,
]
);
if ($old_value === false) {
// Create custom field if not exist
@ -346,14 +364,16 @@ if ($update_agents) {
]
);
} else {
$result = db_process_sql_update(
'tagent_custom_data',
['description' => $value],
[
'id_field' => $key,
'id_agent' => $id_agent,
]
);
if ($old_value[0]['description'] !== $value) {
$result = db_process_sql_update(
'tagent_custom_data',
['description' => $value],
[
'id_field' => $key,
'id_agent' => $id_agent,
]
);
}
}
}
}
@ -373,7 +393,7 @@ if ($update_agents) {
ui_print_result_message(
$result !== false,
__('Agents updated successfully').'('.$n_edited.')',
__('Agents updated successfully (%d)', $n_edited),
__('Agents cannot be updated (maybe there was no field to update)')
);
}
@ -830,19 +850,16 @@ if (!empty($fields)) {
echo '<h3 class="error invisible" id="message"> </h3>';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"');
html_print_input_hidden('update_agents', 1);
html_print_input_hidden('id_agente', $id_agente);
echo '</div>';
if (is_central_policies_on_node() === false) {
attachActionButton('update_agents', 'update', $table->width);
}
// Shown and hide div
echo '</div></form>';
ui_require_jquery_file('form');
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('ajaxqueue');

View File

@ -1,17 +1,32 @@
<?php
/**
* View for edit modules in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -280,9 +295,6 @@ $table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-bl
$table->rowclass['form_modules_1'] = 'select_modules_row';
$table->data['form_modules_1'][0] = __('Module type');
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
$table->data['form_modules_1'][0] .= '</span>';
$types[0] = __('All');
$table->colspan['form_modules_1'][1] = 2;
@ -1161,30 +1173,37 @@ $table->data['edit1'][1] = '<table width="100%">';
''
);
if (!empty($id_plugin)) {
$preload = db_get_sql("SELECT description FROM tplugin WHERE id = $id_plugin");
if (empty($id_plugin) === false) {
$preload = db_get_sql(
sprintf(
'SELECT description FROM tplugin WHERE id = %s',
$id_plugin
)
);
$preload = io_safe_output($preload);
$preload = str_replace("\n", '<br>', $preload);
} else {
$preload = '';
}
$table->data['edit21'][1] = '<span style="font-weight: normal;" id="plugin_description">'.$preload.'</span>';
$table->data['edit21'][1] = sprintf(
'<span style="font-weight: normal;" id="plugin_description">%s</span>',
$preload
);
echo '<form method="post" '.'action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_modules" '.'id="form_edit">';
echo '<form method="post" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_modules" id="form_edit">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden('update', 1);
html_print_submit_button(__('Update'), 'go', false, 'class="sub upd"');
echo '</div>';
attachActionButton('update', 'update', $table->width);
echo '</form>';
echo '<h3 class="error invisible" id="message"> </h3>';
// Hack to translate text "none" in PHP to javascript
// Hack to translate text "none" in PHP to javascript.
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo '<span id ="select_agent_first_text" style="display: none;">'.__('Please, select an agent first').'</span>';
// Load JS files.
ui_require_javascript_file('pandora_modules');
ui_require_jquery_file('pandora.controls');
if ($selection_mode == 'modules') {
@ -1196,27 +1215,11 @@ $table->data['edit1'][1] = '<table width="100%">';
}
?>
<script type="text/javascript">flag_load_plugin_component = false;</script>
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
flag_load_plugin_component = false;
$(document).ready (function () {
$("#form_edit").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $("#form_edit").serializeArray().length;
var count_parameters =
get_parameters_count + post_parameters_count;
if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
return false;
}
});
$("#checkbox-select_all_modules").change(function() {
if( $('#checkbox-select_all_modules').prop('checked')) {
@ -1340,7 +1343,7 @@ $(document).ready (function () {
}
}
$("#module_loading").show ();
showSpinner();
$("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide ();
$("#module_name").attr ("disabled", "disabled")
$("#module_name option[value!=0]").remove ();
@ -1351,7 +1354,7 @@ $(document).ready (function () {
option = $("<option></option>").attr ("value", value["nombre"]).html (value["nombre"]);
$("#module_name").append (option);
});
$("#module_loading").hide ();
hideSpinner();
$("#module_name").removeAttr ("disabled");
//Filter modules. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
@ -1864,7 +1867,6 @@ function changePluginSelect() {
$('#hidden-macros').val(data['base64']);
jQuery.each (data['array'], function (i, macro) {
console.log(macro);
if (macro['desc'] != '') {
$("#delete_table-edit21").after("<tr class='macro_field' id='delete_table-edit"+(80+parseInt(i))+"'><td style='font-weight:bold;'>"+macro['desc']+"<input type='hidden' name='desc"+macro['macro']+"' value='"+macro['desc']+"'></td><td><input type='text' name='"+macro['macro']+"'></td></tr>");
}

View File

@ -1,17 +1,32 @@
<?php
/**
* View for edit plugins in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
global $config;
check_login();
@ -371,10 +386,7 @@ echo '<form method="POST" id="form-massive_plugin_edition"
html_print_table($table);
echo "<div style='text-align: right; width: ".$table->width."'>";
html_print_input_hidden('update', 1);
html_print_submit_button(__('Update'), 'upd-btn', false, 'class="sub upd"');
echo '</div>';
attachActionButton('update', 'update', $table->width);
echo '</form>';
@ -405,35 +417,6 @@ echo '</form>';
canSubmit = val;
$submitButton.prop('disabled', !val);
}
var showSpinner = function () {
var $loadingSpinner = $pluginsSelect.siblings('img#loading_spinner');
if ($loadingSpinner.length > 0) {
// Display inline instead using the show function
// cause its absolute positioning.
$loadingSpinner.css('display', 'inline');
return;
}
$loadingSpinner = $('<img />');
$loadingSpinner
.prop('id', 'loading_spinner')
.css('padding-left', '5px')
.css('position', 'absolute')
.css('top', $pluginsSelect.position().top + 'px')
.prop('src', "<?php echo $config['homeurl'].'/'; ?>images/spinner.gif");
$pluginsSelect.parent().append($loadingSpinner);
}
var hideSpinner = function () {
var $loadingSpinner = $pluginsSelect.siblings('img#loading_spinner');
if ($loadingSpinner.length > 0)
$loadingSpinner.hide();
}
var clearModulePluginMacrosValues = function () {
$('input.plugin-macro')
@ -864,6 +847,7 @@ echo '</form>';
}
var errorHandler = function (error) {
hideSpinner();
console.log("<?php echo __('Error'); ?>: " + error.message);
// alert("<?php echo __('Error'); ?>: " + err.message);
@ -927,7 +911,10 @@ echo '</form>';
$agentModulesRow.show();
}
else {
alert("<?php echo __('There are no modules using this plugin'); ?>");
var contents = {};
contents.html = '<?php echo __('There are no modules using this plugin'); ?>';
contents.title = '<?php echo __('Massive operations'); ?>';
showMassiveModal(contents);
// Abort the another call
if (typeof pluginXHR !== 'undefined') {

View File

@ -1,17 +1,32 @@
<?php
/**
* View for enable/disable alerts in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {

View File

@ -1,17 +1,32 @@
<?php
/**
* Main view for Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars.
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -26,6 +41,7 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
require_once 'include/functions_agents.php';
require_once 'include/functions_alerts.php';
require_once 'include/functions_modules.php';
require_once 'include/functions_massive_operations.php';
enterprise_include('godmode/massive/massive_operations.php');
@ -316,35 +332,49 @@ $submit_template_enabled = get_parameter('id_alert_template_enabled');
$submit_template_not_standby = get_parameter('id_alert_template_not_standby');
$submit_template_standby = get_parameter('id_alert_template_standby');
$submit_add = get_parameter('crtbutton');
// Waiting spinner.
ui_print_spinner(__('Loading'));
// Modal for show messages.
html_print_div(
[
'id' => 'massive_modal',
'content' => '',
]
);
// Load common JS files.
ui_require_javascript_file('massive_operations');
echo '<div id="loading" display="none">';
echo html_print_image('images/wait.gif', true, ['border' => '0']).'<br />';
echo '<strong>'.__('Please wait...').'</strong>';
echo '</div>';
?>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$('#manage_config_form').submit( function() {
confirm_status =
confirm("<?php echo __('Are you sure?'); ?>");
if (confirm_status)
$("#loading").css("display", "");
else
$('#button-go').click( function(e) {
var limitParametersMassive = <?php echo $config['limit_parameters_massive']; ?>;
var thisForm = e.target.form.id;
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $('#'+thisForm).serializeArray().length;
var totalCount = get_parameters_count + post_parameters_count;
var contents = {};
contents.html = '<?php echo __('No changes have been made because they exceed the maximum allowed (%d). Make fewer changes or contact the administrator.', $config['limit_parameters_massive']); ?>';
contents.title = '<?php echo __('Massive operations'); ?>';
contents.question = '<?php echo __('Are you sure?'); ?>';
contents.ok = '<?php echo __('OK'); ?>';
contents.cancel = '<?php echo __('Cancel'); ?>';
var operation = massiveOperationValidation(contents, totalCount, limitParametersMassive, thisForm);
if (operation == false) {
return false;
}
});
$('[id^=form]').submit( function() {
confirm_status =
confirm("<?php echo __('Are you sure?'); ?>");
if (confirm_status)
$("#loading").css("display", "");
else
return false;
});
$("#loading").css("display", "none");
});
/* ]]> */
</script>
<?php

View File

@ -1,17 +1,32 @@
<?php
/**
* View for delete action alerts in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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 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 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.
// Load global vars
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -285,7 +300,7 @@ $(document).ready (function () {
jQuery.each ($("#id_agents option:selected"), function (i, val) {
idAgents.push($(val).val());
});
$("#template_loading").show();
showSpinner();
var $select_template = $("#id_alert_templates").disable ();
$("option", $select_template).remove ();
@ -302,7 +317,7 @@ $(document).ready (function () {
options += "<option value=\""+id+"\">"+value+"</option>";
});
$("#id_alert_templates").append (options);
$("#template_loading").hide ();
hideSpinner();
$select_template.enable ();
},
"json"

View File

@ -64,19 +64,6 @@ if (defined('METACONSOLE')) {
$help_header = 'network_component_tab';
}
ui_print_page_header(
__('Remote components'),
'',
false,
$help_header,
true,
'',
false,
'modulemodal',
GENERIC_SIZE_TEXT,
'',
__('Configuration').'&nbsp;/&nbsp;'.__('Templates').'&nbsp;/&nbsp;'.__('Remote components')
);
$sec = 'gmodules';
}

View File

@ -48,7 +48,9 @@ if (enterprise_installed()) {
'basic' => __('Basic'),
'advanced' => __('Advanced'),
];
$table->data[0][3] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false).' '.ui_print_help_icon('meta_access', true);
// TODO review help tips on meta.
$table->data[0][3] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false).' ';
// .ui_print_help_icon('meta_access', true)
} else {
$table->data[0][2] = '';
$table->data[0][3] = html_print_input_hidden('wizard_level', $wizard_level, true);

View File

@ -68,6 +68,19 @@ $multiple_delete = (bool) get_parameter('multiple_delete', 0);
$id = (int) get_parameter('id');
$name = (string) get_parameter('name');
if ($id > 0) {
$filter_group = db_get_value('id_group', 'tnetflow_filter', 'id_sg', $id);
if (!check_acl_restricted_all($config['id_user'], $filter_group, 'AW')) {
db_pandora_audit(
'ACL Violation',
'Trying to access events filter editor'
);
include 'general/noaccess.php';
return;
}
}
if ($delete) {
$id_filter = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $id);
$result = db_process_sql_delete(
@ -164,12 +177,24 @@ $total_filters = $total_filters[0]['total'];
foreach ($filters as $filter) {
$data = [];
$data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true);
$data[1] = '<a href="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&id='.$filter['id_sg'].'&pure='.$pure.'">'.$filter['id_name'].'</a>';
$data[0] = '';
if (check_acl_restricted_all($config['id_user'], $filter['id_group'], 'AW')) {
$data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true);
$data[1] = '<a href="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&id='.$filter['id_sg'].'&pure='.$pure.'">'.$filter['id_name'].'</a>';
} else {
$data[1] = $filter['id_name'];
}
$data[2] = ui_print_group_icon($filter['id_group'], true, 'groups_small', '', !defined('METACONSOLE'));
$table->cellclass[][3] = 'action_buttons';
$data[3] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
href='".$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit&delete=1&id='.$filter['id_sg']."&offset=0&pure=$pure'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
$data[3] = '';
if (check_acl_restricted_all($config['id_user'], $filter['id_group'], 'AW')) {
$table->cellclass[][3] = 'action_buttons';
$data[3] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
href='".$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit&delete=1&id='.$filter['id_sg']."&offset=0&pure=$pure'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
}
array_push($table->data, $data);
}

View File

@ -212,7 +212,17 @@ $table->data[1][1] = html_print_select_groups(
-1,
true,
false,
false
false,
'',
false,
false,
false,
false,
'id_grupo',
false,
false,
false,
'250px'
);
if ($advanced_filter != '') {

View File

@ -235,7 +235,7 @@ if ($count_module_array > 0) {
echo '<table><tr>';
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&tab=graph_editor&change_label=1&id=".$id_graph.'&graph='.$idgs_array[$a]."'>";
html_print_input_text('label', $label_array[$a], '', 20, 30, false, false);
html_print_input_text('label', $label_array[$a], '', 30, 80, false, false);
html_print_submit_button('Ok', 'btn', false, '', false);
echo '</form>';

View File

@ -132,12 +132,20 @@ $output .= '>';
$own_info = get_user_info($config['id_user']);
$return_all_group = true;
if (users_can_manage_group_all('RW') === false
&& users_can_manage_group_all('RM') === false
) {
$return_all_group = false;
}
$output .= '<td><b>'.__('Group').'</b></td><td>';
if (check_acl($config['id_user'], 0, 'RW')) {
$output .= html_print_select_groups(
$config['id_user'],
'RW',
true,
$return_all_group,
'graph_id_group',
$id_group,
'',
@ -149,7 +157,7 @@ if (check_acl($config['id_user'], 0, 'RW')) {
$output .= html_print_select_groups(
$config['id_user'],
'RM',
true,
$return_all_group,
'graph_id_group',
$id_group,
'',

View File

@ -83,6 +83,20 @@ $change_weight = (bool) get_parameter('change_weight', false);
$change_label = (bool) get_parameter('change_label', false);
$id_graph = (int) get_parameter('id', 0);
if ($id_graph > 0) {
$graph_group = db_get_value('id_group', 'tgraph', 'id_graph', $id_graph);
if (!check_acl_restricted_all($config['id_user'], $graph_group, 'RW')
&& !check_acl_restricted_all($config['id_user'], $graph_group, 'RM')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access graph builder'
);
include 'general/noaccess.php';
exit;
}
}
if ($id_graph !== 0) {
$sql = "SELECT * FROM tgraph
WHERE (private = 0 OR (private = 1 AND id_user = '".$config['id_user']."'))

View File

@ -88,7 +88,11 @@ ui_print_page_header(__('Reporting').' &raquo; '.__('Custom graphs'), 'images/ch
// Delete module SQL code
if ($delete_graph) {
if ($report_w || $report_m) {
$graph_group = db_get_value('id_group', 'tgraph', 'id_graph', $id);
if (check_acl_restricted_all($config['id_user'], $graph_group, 'RW')
|| check_acl_restricted_all($config['id_user'], $graph_group, 'RM')
) {
$exist = db_get_value('id_graph', 'tgraph_source', 'id_graph', $id);
if ($exist) {
$result = db_process_sql_delete('tgraph_source', ['id_graph' => $id]);
@ -299,16 +303,17 @@ $table_aux = new stdClass();
$data[4] = '';
$table->cellclass[][4] = 'action_buttons';
if (($report_w || $report_m)) {
if (check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RM')
|| check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RW')
) {
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.$graph['id_graph'].'">'.html_print_image('images/config.png', true).'</a>';
}
if ($report_m) {
$data[5] = '';
if (check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RM')) {
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
}
if ($report_m) {
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
}

View File

@ -42,7 +42,6 @@ if (!$is_metaconsole) {
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
$url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager';
}
$pure = (int) get_parameter('pure', 0);
@ -123,8 +122,8 @@ if ($delete_layout || $copy_layout) {
// ACL for the visual console
// $vconsole_read = check_acl ($config['id_user'], $group_id, "VR");
$vconsole_write = check_acl($config['id_user'], $group_id, 'VW');
$vconsole_manage = check_acl($config['id_user'], $group_id, 'VM');
$vconsole_write = check_acl_restricted_all($config['id_user'], $group_id, 'VW');
$vconsole_manage = check_acl_restricted_all($config['id_user'], $group_id, 'VM');
if (!$vconsole_write && !$vconsole_manage) {
db_pandora_audit(
@ -441,8 +440,10 @@ if (!$maps && !is_metaconsole()) {
$data[1] = ui_print_group_icon($map['id_group'], true);
$data[2] = db_get_sql('SELECT COUNT(*) FROM tlayout_data WHERE id_layout = '.$map['id']);
// Fix: IW was the old ACL for report editing, now is RW
if ($vconsoles_write || $vconsoles_manage) {
$vconsoles_write_action_btn = check_acl_restricted_all($config['id_user'], $map['id_group'], 'VW');
$vconsoles_manage_action_btn = check_acl_restricted_all($config['id_user'], $map['id_group'], 'VM');
if ($vconsoles_write_action_btn || $vconsoles_manage_action_btn) {
if (!is_metaconsole()) {
$table->cellclass[] = [
3 => 'action_buttons',

View File

@ -140,6 +140,8 @@ $visual_format = 0;
// Others.
$filter_search = '';
$filter_exclude = '';
// Added for select fields.
$total_time = true;
@ -556,6 +558,8 @@ switch ($action) {
$include_extended_events = $item['show_extended_events'];
$filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude'];
break;
case 'event_report_group':
@ -570,6 +574,7 @@ switch ($action) {
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude'];
$filter_event_severity = json_decode($style['filter_event_severity'], true);
$filter_event_status = json_decode($style['filter_event_status'], true);
@ -607,6 +612,8 @@ switch ($action) {
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude'];
$include_extended_events = $item['show_extended_events'];
break;
@ -2744,10 +2751,20 @@ $class = 'databox filters';
</tr>
<tr id="row_filter_search" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Free search'); ?></td>
<td style="font-weight:bold;"><?php echo __('Include filter'); ?></td>
<td>
<?php
html_print_input_text('filter_search', $filter_search);
ui_print_help_tip(__('Free text string search on event description'));
?>
</td>
</tr>
<tr id="row_filter_exclude" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Exclude filter'); ?></td>
<td>
<?php
html_print_input_text('filter_exclude', $filter_exclude);
ui_print_help_tip(__('Free text string search on event description'));
?>
</td>
</tr>
@ -3279,7 +3296,7 @@ function print_SLA_list($width, $action, $idItem=null)
<tr id="sla_form" style="" class="datos">
<td class="sla_list_agent_col">
<input id="hidden-id_agent_sla" name="id_agent_sla" value="" type="hidden">
<input id="hidden-server_name" name="server_name" value="" type="hidden">
<input id="hidden-id_server" name="id_server" value="" type="hidden">
<?php
$params = [];
$params['show_helptip'] = true;
@ -5141,6 +5158,7 @@ function chooseType() {
$("#row_resolution").hide();
$("#row_last_value").hide();
$("#row_filter_search").hide();
$("#row_filter_exclude").hide();
$("#row_percentil").hide();
$("#log_help_tip").css("visibility", "hidden");
$("#agents_row").hide();
@ -5191,6 +5209,8 @@ function chooseType() {
$("#row_extended_events").show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
$("#row_event_severity").show();
$("#row_event_status").show();
@ -5403,11 +5423,9 @@ function chooseType() {
case 'sql':
$("#row_description").show();
$("#row_query").show();
$("#row_max_items").show();
$("#row_header").show();
$("#row_custom").show();
$("#row_custom_example").show();
$("#row_dyn_height").show();
$("#row_servers").show();
$("#row_historical_db_check").show();
break;
@ -5486,6 +5504,8 @@ function chooseType() {
$("#row_extended_events").show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
$("#row_historical_db_check").hide();
break;
@ -5509,6 +5529,8 @@ function chooseType() {
$('#agent_autocomplete').hide();
$('#agent_autocomplete_events').show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
$("#row_historical_db_check").hide();
break;
@ -5531,6 +5553,8 @@ function chooseType() {
$('#agent_autocomplete').hide();
$('#agent_autocomplete_events').show();
$("#row_filter_search").show();
$("#row_filter_exclude").show();
$("#row_historical_db_check").hide();
break;

View File

@ -515,18 +515,68 @@ foreach ($items as $item) {
$style = json_decode(io_safe_output($item['style']), true);
// Macros
$items_macro = [];
if (!empty($item['id_agent'])) {
$id_agent = $item['id_agent'];
// Add macros name.
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$items_macro_agent = [
'id_agent' => $id_agent,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
];
$items_macro = array_merge($items_macro, $items_macro_agent);
}
if (!empty($item['id_agent_module'])) {
$id_agent_module = $item['id_agent_module'];
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
$items_macro_module = [
'id_agent_module' => $id_agent_module,
'module_name' => $module_name,
'module_description' => $module_description,
];
$items_macro = array_merge($items_macro, $items_macro_module);
}
if ($style['name_label'] != '') {
$text = empty($style['name_label']) ? $item['description'] : $style['name_label'];
$row[5] = ui_print_truncate_text($text, 'description', true, true);
} else {
if ($item['name'] == '' && $item['description'] == '') {
$row[5] = '-';
$text = '-';
} else {
$text = empty($item['name']) ? $item['description'] : $item['name'];
$row[5] = ui_print_truncate_text($text, 'description', true, true);
}
}
// Apply macros
$items_macro['type'] = $item['type'];
$text = reporting_label_macro(
$items_macro,
$text
);
$row[5] = ui_print_truncate_text($text, 'description', true, true);
$row[6] = '';
if (check_acl($config['id_user'], $item['id_group'], 'RM')) {

View File

@ -114,11 +114,17 @@ if (isset($write_groups[$idGroupReport]) === false && $idGroupReport) {
$write_groups[$idGroupReport] = groups_get_name($idGroupReport);
}
$return_all_group = false;
if (users_can_manage_group_all('RW') === true) {
$return_all_group = true;
}
$table->data['group'][1] = '<div class="w290px inline">';
$table->data['group'][1] .= html_print_select_groups(
$config['id_user'],
'AR',
true,
$return_all_group,
'id_group',
$idGroupReport,
'',

View File

@ -158,6 +158,26 @@ $pure = get_parameter('pure', 0);
$schedule_report = get_parameter('schbutton', '');
$pagination = (int) get_parameter('pagination', $config['block_size']);
if ($action == 'edit' && $idReport > 0) {
$report_group = db_get_value(
'id_group',
'treport',
'id_report',
$idReport
);
if (! check_acl_restricted_all($config['id_user'], $report_group, 'RW')
&& ! check_acl_restricted_all($config['id_user'], $report_group, 'RM')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access report builder'
);
include 'general/noaccess.php';
exit;
}
}
if ($schedule_report != '') {
$id_user_task = 1;
$scheduled = 'no';
@ -909,8 +929,8 @@ switch ($action) {
$data = [];
if (check_acl($config['id_user'], $report['id_group'], 'RW')
|| check_acl($config['id_user'], $report['id_group'], 'RM')
if (check_acl_restricted_all($config['id_user'], $report['id_group'], 'RW')
|| check_acl_restricted_all($config['id_user'], $report['id_group'], 'RM')
) {
$data[0] = '<a href="'.$config['homeurl'].'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&id_report='.$report['id_report'].'&pure='.$pure.'">'.ui_print_truncate_text($report['name'], 70).'</a>';
} else {
@ -994,7 +1014,7 @@ switch ($action) {
switch ($type_access_selected) {
case 'group_view':
$edit = check_acl(
$edit = check_acl_restricted_all(
$config['id_user'],
$report['id_group'],
'RW'
@ -1005,7 +1025,7 @@ switch ($action) {
break;
case 'group_edit':
$edit = check_acl(
$edit = check_acl_restricted_all(
$config['id_user'],
$report['id_group_edit'],
'RW'
@ -1861,6 +1881,11 @@ switch ($action) {
''
);
$event_filter_exclude = get_parameter(
'filter_exclude',
''
);
// If metaconsole is activated.
if (is_metaconsole() === true) {
if (($values['type'] == 'custom_graph')
@ -1998,6 +2023,8 @@ switch ($action) {
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude;
if ($label != '') {
$style['label'] = $label;
@ -2602,6 +2629,12 @@ switch ($action) {
''
);
$event_filter_exclude = get_parameter(
'filter_exclude',
''
);
// Added for events items.
$style['show_summary_group'] = $show_summary_group;
$style['filter_event_severity'] = json_encode(
@ -2619,6 +2652,8 @@ switch ($action) {
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude;
if ($label != '') {
$style['label'] = $label;
} else {

View File

@ -133,13 +133,18 @@ if ($action == 'new') {
src="">';
}
$table->data[1][0] = __('Group:');
$table->data[1][0] = __('Group');
$return_all_group = false;
if (users_can_manage_group_all('RW') === true) {
$return_all_group = true;
}
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
$config['id_user'],
'RW',
true,
$return_all_group,
'id_group',
$idGroup,
'',

View File

@ -119,6 +119,7 @@ foreach ($layoutDatas as $layoutData) {
}
switch ($layoutData['type']) {
case NETWORK_LINK:
case LINE_ITEM:
visual_map_print_user_line_handles($layoutData);
visual_map_print_user_lines($layoutData);

View File

@ -271,6 +271,7 @@ foreach ($layoutDatas as $layoutData) {
);
break;
case NETWORK_LINK:
case LINE_ITEM:
$table->data[($i + 1)]['icon'] = html_print_image(
'images/line_item.png',
@ -303,6 +304,7 @@ foreach ($layoutDatas as $layoutData) {
switch ($layoutData['type']) {
case ICON:
case BOX_ITEM:
case NETWORK_LINK:
case LINE_ITEM:
// hasn't the label.
$table->data[($i + 1)][0] = '';
@ -345,6 +347,7 @@ foreach ($layoutDatas as $layoutData) {
// Width and height
switch ($layoutData['type']) {
case NETWORK_LINK:
case LINE_ITEM:
// hasn't the width and height.
$table->data[($i + 1)][2] = '';
@ -361,6 +364,7 @@ foreach ($layoutDatas as $layoutData) {
// Position
switch ($layoutData['type']) {
case NETWORK_LINK:
case LINE_ITEM:
// hasn't the width and height.
$table->data[($i + 1)][3] = '';
@ -375,6 +379,7 @@ foreach ($layoutDatas as $layoutData) {
// Parent
switch ($layoutData['type']) {
case BOX_ITEM:
case NETWORK_LINK:
case LINE_ITEM:
case COLOR_CLOUD:
$table->data[($i + 1)][4] = '';
@ -434,6 +439,7 @@ foreach ($layoutDatas as $layoutData) {
case BOX_ITEM:
case ICON:
case LABEL:
case NETWORK_LINK:
case LINE_ITEM:
$table->data[($i + 2)][0] = '';
break;
@ -494,6 +500,7 @@ foreach ($layoutDatas as $layoutData) {
case ICON:
case LABEL:
case BOX_ITEM:
case NETWORK_LINK:
case LINE_ITEM:
case GROUP_ITEM:
$table->data[($i + 2)][1] = '';
@ -598,6 +605,7 @@ foreach ($layoutDatas as $layoutData) {
// Map linked
switch ($layoutData['type']) {
case NETWORK_LINK:
case LINE_ITEM:
case BOX_ITEM:
case AUTO_SLA_GRAPH:

View File

@ -85,8 +85,8 @@ else if ($activeTab != 'data' || ($activeTab == 'data' && $action != 'new')) {
// ACL for the existing visual console
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
$vconsole_write = check_acl($config['id_user'], $visualConsole['id_group'], 'VW');
$vconsole_manage = check_acl($config['id_user'], $visualConsole['id_group'], 'VM');
$vconsole_write = check_acl_restricted_all($config['id_user'], $visualConsole['id_group'], 'VW');
$vconsole_manage = check_acl_restricted_all($config['id_user'], $visualConsole['id_group'], 'VM');
} else {
db_pandora_audit(
'ACL Violation',
@ -143,8 +143,8 @@ switch ($activeTab) {
// ACL for the new visual console
// $vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
$vconsole_write_new = check_acl($config['id_user'], $idGroup, 'VW');
$vconsole_manage_new = check_acl($config['id_user'], $idGroup, 'VM');
$vconsole_write_new = check_acl_restricted_all($config['id_user'], $idGroup, 'VW');
$vconsole_manage_new = check_acl_restricted_all($config['id_user'], $idGroup, 'VM');
// The user should have permissions on the new group
if (!$vconsole_write_new && !$vconsole_manage_new) {

View File

@ -41,7 +41,6 @@ if (!$is_metaconsole) {
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
$url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager';
}
$buttons['visual_console'] = [

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