Merge branch 'ent-6898-Integracion-de-Integria-en-Pandora' of brutus.artica.es:artica/pandorafms into ent-6898-Integracion-de-Integria-en-Pandora

This commit is contained in:
alejandro.campos@artica.es 2021-03-10 10:28:45 +01:00
commit 71e9452988
269 changed files with 9259 additions and 3629 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-210105
Version: 7.0NG.752-210304
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-210105"
pandora_version="7.0NG.752-210304"
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 => '210105';
use constant AGENT_VERSION => '7.0NG.752';
use constant AGENT_BUILD => '210304';
# 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 210105
%define version 7.0NG.752
%define release 210304
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 210105
%define version 7.0NG.752
%define release 210304
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="210105"
PI_VERSION="7.0NG.752"
PI_BUILD="210304"
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
{210105}
{210304}
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 210105)")
#define PANDORA_VERSION ("7.0NG.752(Build 210304)")
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 210105))"
VALUE "ProductVersion", "(7.0NG.752(Build 210304))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.751-210105
Version: 7.0NG.752-210304
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-210105"
pandora_version="7.0NG.752-210304"
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,44 +98,13 @@ function users_extension_main_god($god=true)
$table->head = [];
$table->head[0] = __('User');
$table->head[1] = __('IP');
$table->head[2] = __('Date');
$table->head[1] = __('Date');
$rowPair = true;
$iterator = 0;
// Get data
foreach ($rows as $row) {
// Get ip_origin of the last login of the user
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$ip_origin = db_get_value_sql(
sprintf(
"SELECT ip_origen
FROM tsesion
WHERE id_usuario = '%s'
AND descripcion = '".io_safe_input('Logged in')."'
ORDER BY fecha DESC",
$row['id_user']
)
);
break;
case 'oracle':
$ip_origin = db_get_value_sql(
sprintf(
"SELECT ip_origen
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 {
@ -124,8 +116,7 @@ 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] = $ip_origin;
$data[2] = date($config['date_format'], $row['last_connect']);
$data[1] = date($config['date_format'], $row['last_connect']);
array_push($table->data, $data);
}

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
@ -14,4 +15,60 @@ enterprise/godmode/reporting/cluster_view.php
enterprise/include/ajax/clustermap.php
enterprise/include/functions_clustermap.php
enterprise/include/functions_clusters.php
enterprise/include/javascript/ClusterMapController.js
enterprise/include/javascript/ClusterMapController.js
enterprise/extensions/ipam/ipam_supernet_network.php
enterprise/extensions/ipam/ipam_vlan_wizard.php
enterprise/extensions/ipam/sql
enterprise/extensions/ipam/sql/ipam_mr_1.sql
enterprise/extensions/ipam/sql/ipam_mr_2.sql
enterprise/extensions/ipam/sql/ipam.sql
enterprise/extensions/ipam/css
enterprise/extensions/ipam/css/ipam.css
enterprise/extensions/ipam/ipam_ajax.php
enterprise/extensions/ipam/ipam_vlan_network.php
enterprise/extensions/ipam/ipam_supernet_config.php
enterprise/extensions/ipam/ipam_list.php
enterprise/extensions/ipam/ipam_excel.php
enterprise/extensions/ipam/ipam_massive.php
enterprise/extensions/ipam/ipam_editor.php
enterprise/extensions/ipam/recon_script
enterprise/extensions/ipam/recon_script/readme
enterprise/extensions/ipam/ipam_network.php
enterprise/extensions/ipam/ipam_calculator.php
enterprise/extensions/ipam/ipam_vlan_config.php
enterprise/extensions/ipam/images
enterprise/extensions/ipam/images/red_host_agent.png
enterprise/extensions/ipam/images/lil_green_host_alert.png
enterprise/extensions/ipam/images/lil_red_host_alert.png
enterprise/extensions/ipam/images/lil_red_host_agent.png
enterprise/extensions/ipam/images/green_host_dotted.png
enterprise/extensions/ipam/images/red_host.png
enterprise/extensions/ipam/images/red_host_alert.png
enterprise/extensions/ipam/images/not_host.png
enterprise/extensions/ipam/images/lil_green_host_agent_alert.png
enterprise/extensions/ipam/images/ball_alive.png
enterprise/extensions/ipam/images/lil_green_host_agent.png
enterprise/extensions/ipam/images/ball_notalive.png
enterprise/extensions/ipam/images/green_host_agent_alert.png
enterprise/extensions/ipam/images/green_host_agent.png
enterprise/extensions/ipam/images/lil_red_host.png
enterprise/extensions/ipam/images/green_host_alert.png
enterprise/extensions/ipam/images/lil_not_host.png
enterprise/extensions/ipam/images/green_host.png
enterprise/extensions/ipam/images/lil_green_host.png
enterprise/extensions/ipam/images/lil_red_host_agent_alert.png
enterprise/extensions/ipam/images/lil_green_host_dotted.png
enterprise/extensions/ipam/images/red_host_agent_alert.png
enterprise/extensions/ipam/ipam_supernet_map.php
enterprise/extensions/ipam/include
enterprise/extensions/ipam/include/functions_ipam.php
enterprise/extensions/ipam/include/ajax
enterprise/extensions/ipam/include/ajax/ipam_ajax.php
enterprise/extensions/ipam/include/javascript
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/disabled/visual_console_manager.php
enterprise/extensions/visual_console_manager.php

View File

@ -1,5 +1,98 @@
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tipam_network` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`network` varchar(100) NOT NULL default '',
`name_network` varchar(255) default '',
`description` text NOT NULL,
`location` tinytext NOT NULL,
`id_recon_task` int(10) unsigned NOT NULL,
`scan_interval` tinyint(2) default 1,
`monitoring` tinyint(2) default 0,
`id_group` mediumint(8) unsigned NULL default 0,
`lightweight_mode` tinyint(2) default 0,
`users_operator` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_ip` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id_network` bigint(20) unsigned NOT NULL default 0,
`id_agent` int(10) unsigned NOT NULL,
`forced_agent` tinyint(2) NOT NULL default '0',
`ip` varchar(100) NOT NULL default '',
`ip_dec` int(10) unsigned NOT NULL,
`id_os` int(10) unsigned NOT NULL,
`forced_os` tinyint(2) NOT NULL default '0',
`hostname` tinytext NOT NULL,
`forced_hostname` tinyint(2) NOT NULL default '0',
`comments` text NOT NULL,
`alive` tinyint(2) NOT NULL default '0',
`managed` tinyint(2) NOT NULL default '0',
`reserved` tinyint(2) NOT NULL default '0',
`time_last_check` datetime NOT NULL default '1970-01-01 00:00:00',
`time_create` datetime NOT NULL default '1970-01-01 00:00:00',
`users_operator` text,
`time_last_edit` datetime NOT NULL default '1970-01-01 00:00:00',
`enabled` tinyint(2) NOT NULL default '1',
`generate_events` tinyint(2) NOT NULL default '0',
`leased` tinyint(2) DEFAULT '0',
`leased_expiration` bigint(20) DEFAULT '0',
`mac_address` varchar(20) DEFAULT NULL,
`leased_mode` tinyint(2) DEFAULT '0',
PRIMARY KEY (`id`),
FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_vlan` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`name` varchar(250) NOT NULL,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_vlan_network` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id_vlan` bigint(20) unsigned NOT NULL,
`id_network` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_vlan`) REFERENCES tipam_vlan(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_supernet` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`name` varchar(250) NOT NULL,
`description` text default '',
`address` varchar(250) NOT NULL,
`mask` varchar(250) NOT NULL,
`subneting_mask` varchar(250) default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_supernet_network` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id_supernet` bigint(20) unsigned NOT NULL,
`id_network` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_supernet`) REFERENCES tipam_supernet(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET @insert_type = 3;
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;
DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event&#x20;text\",\"Event&#x20;type\",\"Source\",\"Agent&#x20;name&#x20;or&#x20;_agent_\",\"Event&#x20;severity\",\"ID&#x20;extra\",\"Tags&#x20;separated&#x20;by&#x20;commas\",\"Comments\",\"\",\"\"]' WHERE `id` = 3;
ALTER TABLE `talert_templates`
ADD COLUMN `field16` TEXT NOT NULL AFTER `field15`
,ADD COLUMN `field17` TEXT NOT NULL AFTER `field16`
@ -12,4 +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

@ -1,5 +1,9 @@
START TRANSACTION;
ALTER TABLE `talert_actions` ADD COLUMN `create_wu_integria` TINYINT(1) default NULL;
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
@ -1404,6 +1405,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`
@ -1411,13 +1413,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';
@ -2393,6 +2395,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;
@ -2527,6 +2530,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'
@ -2685,6 +2702,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`
@ -3870,3 +3888,104 @@ INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_gro
INSERT IGNORE INTO `tpen` VALUES (171,'dlink','D-Link Systems, Inc.'),(14988,'mikrotik','MikroTik'),(6486,'alcatel','Alcatel-Lucent Enterprise'),(41112,'ubiquiti','Ubiquiti Networks, Inc.'),(207,'telesis','Allied Telesis, Inc.'),(10002,'frogfoot','Frogfoot Networks'),(2,'ibm','IBM'),(4,'unix','Unix'),(63,'apple','Apple Computer, Inc.'),(674,'dell','Dell Inc.'),(111,'oracle','Oracle'),(116,'hitachi','Hitachi, Ltd.'),(173,'netlink','Netlink'),(188,'ascom','Ascom'),(6574,'synology','Synology Inc.'),(3861,'fujitsu','Fujitsu Network Communications, Inc.'),(53526,'dell','Dell ATC'),(52627,'apple','Apple Inc'),(19464,'hitachi','Hitachi Communication Technologies, Ltd.'),(13062,'ascom','Ascom');
CREATE TABLE IF NOT EXISTS `tipam_network` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`network` varchar(100) NOT NULL default '',
`name_network` varchar(255) default '',
`description` text NOT NULL,
`location` tinytext NOT NULL,
`id_recon_task` int(10) unsigned NOT NULL,
`scan_interval` tinyint(2) default 1,
`monitoring` tinyint(2) default 0,
`id_group` mediumint(8) unsigned NULL default 0,
`lightweight_mode` tinyint(2) default 0,
`users_operator` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_ip` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id_network` bigint(20) unsigned NOT NULL default 0,
`id_agent` int(10) unsigned NOT NULL,
`forced_agent` tinyint(2) NOT NULL default '0',
`ip` varchar(100) NOT NULL default '',
`ip_dec` int(10) unsigned NOT NULL,
`id_os` int(10) unsigned NOT NULL,
`forced_os` tinyint(2) NOT NULL default '0',
`hostname` tinytext NOT NULL,
`forced_hostname` tinyint(2) NOT NULL default '0',
`comments` text NOT NULL,
`alive` tinyint(2) NOT NULL default '0',
`managed` tinyint(2) NOT NULL default '0',
`reserved` tinyint(2) NOT NULL default '0',
`time_last_check` datetime NOT NULL default '1970-01-01 00:00:00',
`time_create` datetime NOT NULL default '1970-01-01 00:00:00',
`users_operator` text,
`time_last_edit` datetime NOT NULL default '1970-01-01 00:00:00',
`enabled` tinyint(2) NOT NULL default '1',
`generate_events` tinyint(2) NOT NULL default '0',
`leased` tinyint(2) DEFAULT '0',
`leased_expiration` bigint(20) DEFAULT '0',
`mac_address` varchar(20) DEFAULT NULL,
`leased_mode` tinyint(2) DEFAULT '0',
PRIMARY KEY (`id`),
FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_vlan` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`name` varchar(250) NOT NULL,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_vlan_network` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id_vlan` bigint(20) unsigned NOT NULL,
`id_network` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_vlan`) REFERENCES tipam_vlan(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_supernet` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`name` varchar(250) NOT NULL,
`description` text default '',
`address` varchar(250) NOT NULL,
`mask` varchar(250) NOT NULL,
`subneting_mask` varchar(250) default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_supernet_network` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id_supernet` bigint(20) unsigned NOT NULL,
`id_network` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_supernet`) REFERENCES tipam_supernet(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET @insert_type = 3;
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;
DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';

View File

@ -1385,6 +1385,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');
@ -1551,24 +1555,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

@ -626,7 +626,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'];
@ -650,7 +652,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

@ -116,6 +116,15 @@ if ($id) {
$group = $action['id_group'];
$action_threshold = $action['action_threshold'];
$create_wu_integria = $action['create_wu_integria'];
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.
@ -183,10 +192,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';
@ -205,12 +213,16 @@ if ($update) {
}
if ($create) {
$id = db_process_sql_insert('tevent_filter', $values);
if (!empty($values['id_name'])) {
$id = db_process_sql_insert('tevent_filter', $values);
if ($id === false) {
ui_print_error_message('Error creating filter');
if ($id === false) {
ui_print_error_message('Error creating filter');
} else {
ui_print_success_message('Filter created successfully');
}
} else {
ui_print_success_message('Filter created successfully');
ui_print_error_message('Filter name must not be empty');
}
}
@ -272,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

@ -132,6 +132,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
if (!isset($group_um[0])) {
$display_all_group = false;
}
$data[0] .= html_print_select(
profile_get_profiles(
[
@ -182,8 +183,8 @@ $info_users = [];
// Is admin.
if (users_is_admin()) {
$info_users = users_get_info($users_order, 'id_user');
// has PM permission.
} elseif (check_acl($config['id_user'], 0, 'PM')) {
// has PM permission.
} else if (check_acl($config['id_user'], 0, 'PM')) {
$info_users = users_get_info($users_order, 'id_user');
foreach ($info_users as $id_user => $value) {
if (users_is_admin($id_user)) {
@ -197,7 +198,7 @@ if (users_is_admin()) {
}
foreach ($info as $key => $value) {
if (!$value['is_admin']) {
if (!$value['is_admin']) {
$info_users[$key] = $value['id_user'];
}
}

View File

@ -133,6 +133,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
if (!isset($group_um[0])) {
$display_all_group = false;
}
$data[0] .= html_print_select(
profile_get_profiles(
[

View File

@ -382,6 +382,7 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
$sub['tools/diagnostics']['id'] = 'Diagnostic info';
enterprise_hook('omnishell');
enterprise_hook('ipam_submenu');
$sub['godmode/setup/news']['text'] = __('Site news');
$sub['godmode/setup/news']['id'] = 'Site news';

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'] = [

View File

@ -101,7 +101,40 @@ if (isset($_GET['server'])) {
// Headers.
$id_server = get_parameter_get('server_remote');
$ext = get_parameter('ext', '');
ui_print_page_header(__('Remote Configuration'), 'images/gm_servers.png', false, 'servers', true);
$tab = get_parameter('tab', 'standard_editor');
$advanced_editor = true;
$server_type = (int) db_get_value(
'server_type',
'tserver',
'id_server',
$id_server
);
$buttons = '';
if ($server_type !== 13) {
// Buttons.
$buttons = [
'standard_editor' => [
'active' => false,
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=standard_editor&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('Standard editor')]).'</a>',
],
'advanced_editor' => [
'active' => false,
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=advanced_editor&pure='.$pure.'">'.html_print_image('images/pen.png', true, ['title' => __('Advanced editor')]).'</a>',
],
];
$buttons[$tab]['active'] = true;
}
ui_print_page_header(__('Remote Configuration'), 'images/gm_servers.png', false, 'servers', true, $buttons);
if ($server_type !== 13 && $tab == 'standard_editor') {
$advanced_editor = false;
}
enterprise_include('godmode/servers/server_disk_conf_editor.php');
} else {
// Header.

View File

@ -64,7 +64,7 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
$historical_string_purge = get_parameter('historical_string_purge', 0);
$history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig',
'DESCRIBE tconfig',
'affected_rows',
$config['history_db_connection'],
false
@ -390,8 +390,8 @@ if ($config['history_db_enabled'] == 1) {
$config_history = false;
if ($config['history_db_connection']) {
$history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig',
$history_connect = mysql_db_process_sql(
'DESCRIBE tconfig',
'affected_rows',
$config['history_db_connection'],
false
@ -408,6 +408,7 @@ if ($config['history_db_enabled'] == 1) {
if (isset($config_history_array) && is_array($config_history_array)) {
foreach ($config_history_array as $key => $value) {
$config_history[$value['token']] = $value['value'];
$config_history = true;
}
}
} else {
@ -652,6 +653,30 @@ $table_other->data[14][1] = html_print_input_text(
true
);
$table_other->data[15][0] = __('SNMP walk binary');
$table_other->data[15][1] = html_print_input_text(
'snmpwalk',
$config['snmpwalk'],
'',
50,
10,
true
);
$tip = ui_print_help_tip(
__('SNMP bulk walk is not able to request V1 SNMP, this option will be used instead (by default snmpwalk, slower).'),
true
);
$table_other->data[16][0] = __('SNMP walk binary (fallback)').$tip;
$table_other->data[16][1] = html_print_input_text(
'snmpwalk_fallback',
$config['snmpwalk_fallback'],
'',
50,
10,
true
);
echo '<form id="form_setup" method="post">';
echo '<fieldset>';

View File

@ -110,56 +110,147 @@ $table->data[$i++][1] = html_print_select_from_sql(
);
$table->data[$i][0] = __('Remote config directory');
$table->data[$i++][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true);
$table->data[$i++][1] = html_print_input_text(
'remote_config',
io_safe_output($config['remote_config']),
'',
30,
100,
true
);
$table->data[$i][0] = __('Phantomjs bin directory');
$table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
$table->data[$i++][1] = html_print_input_text(
'phantomjs_bin',
io_safe_output(
$config['phantomjs_bin']
),
'',
30,
100,
true
);
$table->data[$i][0] = __('Auto login (hash) password');
$table->data[$i][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[$i++][1] .= ui_print_reveal_password('loginhash_pwd', true);
$table->data[$i][1] = html_print_input_password(
'loginhash_pwd',
io_output_password($config['loginhash_pwd']),
'',
15,
15,
true
);
$table->data[$i++][1] .= ui_print_reveal_password(
'loginhash_pwd',
true
);
$table->data[$i][0] = __('Time source');
$sources['system'] = __('System');
$sources['sql'] = __('Database');
$table->data[$i++][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
$table->data[$i++][1] = html_print_select(
$sources,
'timesource',
$config['timesource'],
'',
'',
'',
true
);
$table->data[$i][0] = __('Automatic check for updates');
$table->data[$i++][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'autoupdate',
1,
$config['autoupdate'],
true
);
echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>";
echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
echo '</div>';
$table->data[$i][0] = __('Enforce https');
$table->data[$i++][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
$table->data[$i++][1] = html_print_checkbox_switch_extended(
'https',
1,
$config['https'],
false,
'',
'',
true
);
$table->data[$i][0] = __('Use cert of SSL');
$table->data[$i++][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
$table->data[$i++][1] = html_print_checkbox_switch_extended(
'use_cert',
1,
$config['use_cert'],
false,
'',
'',
true
);
$table->rowstyle[$i] = 'display: none;';
$table->rowid[$i] = 'ssl-path-tr';
$table->data[$i][0] = __('Path of SSL Cert.');
$table->data[$i++][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true);
$table->data[$i++][1] = html_print_input_text(
'cert_path',
io_safe_output($config['cert_path']),
'',
50,
255,
true
);
$table->data[$i][0] = __('Attachment store');
$table->data[$i++][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
$table->data[$i++][1] = html_print_input_text(
'attachment_store',
io_safe_output($config['attachment_store']),
'',
50,
255,
true
);
$table->data[$i][0] = __('IP list with API access');
if (isset($_POST['list_ACL_IPs_for_API'])) {
$list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API');
} else {
$list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API']));
$list_ACL_IPs_for_API = get_parameter_get(
'list_ACL_IPs_for_API',
implode("\n", $config['list_ACL_IPs_for_API'])
);
}
$table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
$table->data[$i++][1] = html_print_textarea(
'list_ACL_IPs_for_API',
2,
25,
$list_ACL_IPs_for_API,
'style="height: 50px; width: 300px"',
true
);
$table->data[$i][0] = __('API password');
$table->data[$i][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[$i][1] = html_print_input_password(
'api_password',
io_output_password($config['api_password']),
'',
25,
255,
true
);
$table->data[$i++][1] .= ui_print_reveal_password('api_password', true);
$table->data[$i][0] = __('Enable GIS features');
$table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'activate_gis',
1,
$config['activate_gis'],
true
);
$table->data[$i][0] = __('Enable Netflow');
$rbt_disabled = false;
@ -167,7 +258,15 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$rbt_disabled = true;
}
$table->data[$i++][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
$table->data[$i++][1] = html_print_checkbox_switch_extended(
'activate_netflow',
1,
$config['activate_netflow'],
$rbt_disabled,
'',
'',
true
);
$table->data[$i][0] = __('Enable Network Traffic Analyzer');
$table->data[$i++][1] = html_print_switch(
@ -222,28 +321,106 @@ $table->data[$i][1] = html_print_input_text_extended(
'readonly',
true
);
$table->data[$i][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>';
$table->data[$i][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true);
$table->data[$i++][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$table->data[$i][1] .= '<a id="change_timezone">'.html_print_image(
'images/pencil.png',
true,
['title' => __('Change timezone')]
).'</a>';
$table->data[$i][1] .= '&nbsp;&nbsp;'.html_print_select(
$zone_name,
'zone',
$zone_selected,
'show_timezone();',
'',
'',
true
);
$table->data[$i++][1] .= '&nbsp;&nbsp;'.html_print_select(
$timezone_n,
'timezone',
$config['timezone'],
'',
'',
'',
true
);
$sounds = get_sounds();
$table->data[$i][0] = __('Sound for Alert fired');
$table->data[$i][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[$i][1] = html_print_select(
$sounds,
'sound_alert',
$config['sound_alert'],
'replaySound(\'alert\');',
'',
'',
true
);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image(
'images/control_play_col.png',
true,
[
'id' => 'button_sound_alert',
'style' => 'vertical-align: middle;',
'width' => '16',
'title' => __('Play sound'),
]
).'</a>';
$table->data[$i++][1] .= '<div id="layer_sound_alert"></div>';
$table->data[$i][0] = __('Sound for Monitor critical');
$table->data[$i][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[$i][1] = html_print_select(
$sounds,
'sound_critical',
$config['sound_critical'],
'replaySound(\'critical\');',
'',
'',
true
);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image(
'images/control_play_col.png',
true,
[
'id' => 'button_sound_critical',
'style' => 'vertical-align: middle;',
'width' => '16',
'title' => __('Play sound'),
]
).'</a>';
$table->data[$i++][1] .= '<div id="layer_sound_critical"></div>';
$table->data[$i][0] = __('Sound for Monitor warning');
$table->data[$i][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[$i][1] = html_print_select(
$sounds,
'sound_warning',
$config['sound_warning'],
'replaySound(\'warning\');',
'',
'',
true
);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image(
'images/control_play_col.png',
true,
[
'id' => 'button_sound_warning',
'style' => 'vertical-align: middle;',
'width' => '16',
'title' => __('Play sound'),
]
).'</a>';
$table->data[$i++][1] .= '<div id="layer_sound_warning"></div>';
$table->data[$i][0] = __('Public URL');
$table->data[$i++][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true);
$table->data[$i++][1] = html_print_input_text(
'public_url',
$config['public_url'],
'',
40,
255,
true
);
$table->data[$i][0] = __('Force use Public URL');
$table->data[$i++][1] = html_print_switch(
@ -253,25 +430,54 @@ $table->data[$i++][1] = html_print_switch(
]
);
echo "<div id='force_public_url_dialog' title='".__('Enforce public URL usage information')."' style='display:none;'>";
echo "<div id='force_public_url_dialog' title='".__(
'Enforce public URL usage information'
)."' style='display:none;'>";
echo "<p style='text-align: center;'>".__('If public URL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
echo '</div>';
$table->data[$i][0] = __('Public URL host exclusions');
$table->data[$i++][1] = html_print_textarea('public_url_exclusions', 2, 25, $config['public_url_exclusions'], 'style="height: 50px; width: 300px"', true);
$table->data[$i++][1] = html_print_textarea(
'public_url_exclusions',
2,
25,
$config['public_url_exclusions'],
'style="height: 50px; width: 300px"',
true
);
$table->data[$i][0] = __('Referer security');
$table->data[$i++][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'referer_security',
1,
$config['referer_security'],
true
);
$table->data[$i][0] = __('Event storm protection');
$table->data[$i++][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'event_storm_protection',
1,
$config['event_storm_protection'],
true
);
$table->data[$i][0] = __('Command Snapshot');
$table->data[$i++][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'command_snapshot',
1,
$config['command_snapshot'],
true
);
$table->data[$i][0] = __('Change remote config encoding');
$table->data[$i++][1] = html_print_checkbox_switch('use_custom_encoding', 1, $config['use_custom_encoding'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'use_custom_encoding',
1,
$config['use_custom_encoding'],
true
);
$table->data[$i][0] = __('Server logs directory');
$table->data[$i++][1] = html_print_input_text(
@ -309,9 +515,16 @@ $table->data[$i++][1] = html_print_select(
true
);
$config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1;
$config['past_planned_downtimes'] = isset(
$config['past_planned_downtimes']
) ? $config['past_planned_downtimes'] : 1;
$table->data[$i][0] = __('Allow create planned downtimes in the past');
$table->data[$i++][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'past_planned_downtimes',
1,
$config['past_planned_downtimes'],
true
);
$table->data[$i][0] = __('Limit for bulk operations');
$table->data[$i++][1] = html_print_input_text(
@ -324,22 +537,61 @@ $table->data[$i++][1] = html_print_input_text(
);
$table->data[$i][0] = __('Include agents manually disabled');
$table->data[$i++][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'include_agents',
1,
$config['include_agents'],
true
);
$table->data[$i][0] = __('Set alias as name by default in agent creation');
$table->data[$i++][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'alias_as_name',
1,
$config['alias_as_name'],
true
);
$table->data[$i][0] = __('Unique IP');
$table->data[$i++][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
$table->data[$i++][1] = html_print_checkbox_switch(
'unique_ip',
1,
$config['unique_ip'],
true
);
$table->data[$i][0] = __('Enable console log').ui_print_help_tip(__('Log location').': pandora_console/log/console.log', true);
$table->data[$i++][1] = html_print_checkbox_switch('console_log_enabled', 1, $config['console_log_enabled'], true);
$table->data[$i][0] = __('Enable console log').ui_print_help_tip(
__('Log location').': pandora_console/log/console.log',
true
);
$table->data[$i++][1] = html_print_checkbox_switch(
'console_log_enabled',
1,
$config['console_log_enabled'],
true
);
$table->data[$i][0] = __('Enable audit log').ui_print_help_tip(__('Log location').': pandora_console/log/audit.log', true);
$table->data[$i++][1] = html_print_checkbox_switch('audit_log_enabled', 1, $config['audit_log_enabled'], true);
$table->data[$i][0] = __('Enable audit log').ui_print_help_tip(
__('Log location').': pandora_console/log/audit.log',
true
);
$table->data[$i++][1] = html_print_checkbox_switch(
'audit_log_enabled',
1,
$config['audit_log_enabled'],
true
);
$table->data[$i][0] = __('Module custom ID readonly').ui_print_help_tip(__('Useful for integrations'), true);
$table->data[$i++][1] = html_print_checkbox_switch('module_custom_id_ro', 1, $config['module_custom_id_ro'], true);
$table->data[$i][0] = __('Module custom ID readonly').ui_print_help_tip(
__('Useful for integrations'),
true
);
$table->data[$i++][1] = html_print_checkbox_switch(
'module_custom_id_ro',
1,
$config['module_custom_id_ro'],
true
);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
@ -350,7 +602,7 @@ echo '<legend>'.__('General options').'</legend>';
html_print_table($table);
$encryption = [
'ssl' => 'SSL/TLS',
'ssl' => 'SSL',
'sslv2' => 'SSLv2',
'sslv3' => 'SSLv3',
'tls' => 'STARTTLS',
@ -361,75 +613,159 @@ echo '</fieldset>';
echo '<fieldset>';
echo '<legend>'.__('Mail configuration').'</legend>';
$table_mail_conf->data[0][0] = __('From address');
$table_mail_conf->data[0][1] = html_print_input_text('email_from_dir', $config['email_from_dir'], '', 30, 100, true);
$table_mail_conf->data[0][0] = ui_print_warning_message(
__(
'Please notice that some providers like Gmail or Office365 need to setup/enable manually external connections using SMTP and you need to use STARTTLS on port 587.
$table_mail_conf->data[1][0] = __('From name');
$table_mail_conf->data[1][2] = html_print_input_text('email_from_name', $config['email_from_name'], '', 30, 100, true);
If you have manual settings in your pandora_server.conf, please note these settings will ignore this console setup.'
)
);
$table_mail_conf->data[2][0] = __('SMTP Server');
$table_mail_conf->data[2][1] = html_print_input_text('email_smtpServer', $config['email_smtpServer'], '', 30, 100, true);
$table_mail_conf->data[1][0] = __('From address');
$table_mail_conf->data[1][1] = html_print_input_text(
'email_from_dir',
$config['email_from_dir'],
'',
30,
100,
true
);
$table_mail_conf->data[3][0] = __('SMTP Port');
$table_mail_conf->data[3][1] = html_print_input_text('email_smtpPort', $config['email_smtpPort'], '', 30, 100, true);
$table_mail_conf->data[2][0] = __('From name');
$table_mail_conf->data[2][1] = html_print_input_text(
'email_from_name',
$config['email_from_name'],
'',
30,
100,
true
);
$table_mail_conf->data[4][0] = __('Encryption');
$table_mail_conf->data[4][1] = html_print_select($encryption, 'email_encryption', $config['email_encryption'], '', __('none'), 0, true);
$table_mail_conf->data[3][0] = __('SMTP Server');
$table_mail_conf->data[3][1] = html_print_input_text(
'email_smtpServer',
$config['email_smtpServer'],
'',
30,
100,
true
);
$table_mail_conf->data[5][0] = __('Email user');
$table_mail_conf->data[5][1] = html_print_input_text('email_username', $config['email_username'], '', 30, 100, true);
$table_mail_conf->data[4][0] = __('SMTP Port');
$table_mail_conf->data[4][1] = html_print_input_text(
'email_smtpPort',
$config['email_smtpPort'],
'',
30,
100,
true
);
$table_mail_conf->data[6][0] = __('Email password');
$table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true);
$table_mail_conf->data[6][1] .= ui_print_reveal_password('email_password', true);
$table_mail_conf->data[5][0] = __('Encryption');
$table_mail_conf->data[5][1] = html_print_select(
$encryption,
'email_encryption',
$config['email_encryption'],
'',
__('none'),
0,
true
);
$uniqid = uniqid();
$table_mail_conf->data[6][0] = __('Email user');
$table_mail_conf->data[6][1] = html_print_input_text(
'email_username',
$config['email_username'],
'',
30,
100,
true
);
$table_mail_conf->data[7][0] = html_print_button(__('Email test'), 'email_test_dialog', false, "show_email_test('".$uniqid."');", 'class="sub next"', true);
$table_mail_conf->data[7][0] = __('Email password');
$table_mail_conf->data[7][1] = html_print_input_password(
'email_password',
io_output_password(
$config['email_password']
),
'',
30,
100,
true
);
$table_mail_conf->data[7][1] .= ui_print_reveal_password(
'email_password',
true
);
print_email_test_modal_window($uniqid);
$uniqid = uniqid();
html_print_input_hidden('update_config', 1);
html_print_table($table_mail_conf);
$table_mail_conf->data[8][0] = html_print_button(
__('Email test'),
'email_test_dialog',
false,
"show_email_test('".$uniqid."');",
'class="sub next"',
true
);
print_email_test_modal_window($uniqid);
html_print_input_hidden('update_config', 1);
html_print_table($table_mail_conf);
echo '</fieldset>';
echo '</fieldset>';
echo '<fieldset>';
echo '<fieldset>';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"');
echo '</div>';
echo '</form>';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"');
echo '</div>';
echo '</form>';
/**
* Print the modal window for the summary of each alerts group
*
* @param string $id Id.
*
* @return void
*/
function print_email_test_modal_window($id)
{
// Email config table.
$table_mail_test = new stdClass();
$table_mail_test->width = '100%';
$table_mail_test->class = 'databox filters';
$table_mail_test->data = [];
$table_mail_test->style[0] = 'font-weight: bold';
$table_mail_test->colspan[1][0] = 2;
/**
* Print the modal window for the summary of each alerts group
*
* @param string $id Id.
*
* @return void
*/
function print_email_test_modal_window($id)
{
// Email config table.
$table_mail_test = new stdClass();
$table_mail_test->width = '100%';
$table_mail_test->class = 'databox filters';
$table_mail_test->data = [];
$table_mail_test->style[0] = 'font-weight: bold';
$table_mail_test->colspan[1][0] = 2;
$table_mail_test->data[0][0] = __('Address');
$table_mail_test->data[0][1] = html_print_input_text('email_test_address', '', '', 40, 100, true);
$table_mail_test->data[0][0] = __('Address');
$table_mail_test->data[0][1] = html_print_input_text(
'email_test_address',
'',
'',
40,
100,
true
);
$table_mail_test->data[1][0] = html_print_button(__('Send'), 'email_test', false, '', 'class="sub next"', true).'&nbsp&nbsp<span id="email_test_sent_message" style="display:none;">Email sent</span><span id="email_test_failure_message" style="display:none;">Email could not been sent</span>';
$table_mail_test->data[1][0] = html_print_button(
__('Send'),
'email_test',
false,
'',
'class="sub next"',
true
).'&nbsp&nbsp<span id="email_test_sent_message" style="display:none;">Email sent</span><span id="email_test_failure_message" style="display:none;">Email could not be sent</span>';
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" style="display:none">'.html_print_table($table_mail_test, true).'</div>';
}
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" style="display:none">'.html_print_table($table_mail_test, true).'</div>';
}
?>
?>
<script type="text/javascript">
function toggleButton(type) {
if ($("#button_sound_" + type).attr('src') == 'images/control_pause_col.png') {

View File

@ -65,6 +65,7 @@ if (get_parameter('remove_source_on_database', 0)) {
if (get_parameter('update_config', 0)) {
$element = (string) get_parameter('element', '');
$value = (int) get_parameter('value', 0);
$source = (string) get_parameter('source');
// Update the label value.
ob_clean();
@ -75,6 +76,37 @@ if (get_parameter('update_config', 0)) {
$res = ($value) ? notifications_add_group_to_source($source, [0]) : notifications_remove_group_from_source($source, [0]);
break;
case 'subtype':
$data = explode('.', $source, 2);
$source_id = $data[0];
$subtype = $data[1];
$source = notifications_get_all_sources(
[ 'id' => $source_id ]
);
if ($source !== false && is_array($source[0]) === true) {
$source = $source[0];
$blacklist = json_decode($source['subtype_blacklist'], 1);
if (json_last_error() !== JSON_ERROR_NONE) {
$blacklist = [];
}
if ((bool) $value === true) {
unset($blacklist[$subtype]);
} else {
$blacklist[$subtype] = 1;
}
$source['subtype_blacklist'] = json_encode($blacklist, 1);
$res = (bool) db_process_sql_update(
'tnotification_source',
['subtype_blacklist' => $source['subtype_blacklist']],
['id' => $source['id']]
);
}
break;
default:
$res = (bool) db_process_sql_update(
'tnotification_source',
@ -337,7 +369,7 @@ function remove_source_elements(id, source_id) {
function notifications_handle_change_element(event) {
event.preventDefault();
var match = /nt-([0-9]+)-(.*)/.exec(event.target.id);
var match = /nt-(.+)-(.*)/.exec(event.target.id);
if (!match) {
console.error(
"Cannot handle change element. Id not valid: ", event.target.id
@ -356,6 +388,7 @@ function notifications_handle_change_element(event) {
var value;
switch (action.bit) {
case 'enabled':
case 'subtype':
case 'also_mail':
case 'user_editable':
case 'all_users':
@ -383,6 +416,7 @@ function notifications_handle_change_element(event) {
} else {
switch (action.bit) {
case 'enabled':
case 'subtype':
case 'also_mail':
case 'user_editable':
case 'all_users':

View File

@ -494,6 +494,15 @@ if ($update_alert || $duplicate_alert) {
$position = $alert['position'];
$disable_event = $alert['disable_event'];
$group = $alert['id_group'];
if (!check_acl_restricted_all($config['id_user'], $group, 'LW')) {
db_pandora_audit(
'ACL Violation',
'Trying to access SNMP Alert Management'
);
include 'general/noaccess.php';
return;
}
} else if ($create_alert) {
// Variable init
$id_as = -1;
@ -814,13 +823,19 @@ if ($create_alert || $update_alert) {
html_print_input_text('source_ip', $source_ip, '', 20);
echo '</td></tr>';
$return_all_group = false;
if (users_can_manage_group_all('LW') === true) {
$return_all_group = true;
}
// Group
echo '<tr id="tr-group"><td class="datos2">'.__('Group').'</td><td class="datos2">';
echo '<div class="w250px">';
html_print_select_groups(
$config['id_user'],
'AR',
true,
$return_all_group,
'group',
$group,
'',
@ -1346,10 +1361,17 @@ if ($create_alert || $update_alert) {
$url = 'index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'id_alert_snmp='.$row['id_as'].'&'.'update_alert=1';
$data[1] = '<table>';
$data[1] .= '<tr>';
$data[1] .= '<a href="'.$url.'">'.alerts_get_alert_action_name($row['id_alert']).'</a>';
if (check_acl_restricted_all($config['id_user'], $row['id_group'], 'LW')) {
$data[1] .= '<a href="'.$url.'">'.alerts_get_alert_action_name($row['id_alert']).'</a>';
} else {
$data[1] .= alerts_get_alert_action_name($row['id_alert']);
}
$other_actions = db_get_all_rows_filter('talert_snmp_action', ['id_alert_snmp' => $row['id_as']]);
$data[1] .= '</tr>';
if ($other_actions != false) {
foreach ($other_actions as $action) {
$data[1] .= '<tr>';
@ -1361,6 +1383,7 @@ if ($create_alert || $update_alert) {
$data[1] .= '</table>';
$data[2] = $row['agent'];
$data[3] = $row['oid'];
$data[4] = $row['custom_oid'];
@ -1373,18 +1396,23 @@ if ($create_alert || $update_alert) {
$data[7] = __('Never');
}
$data[8] = '<a href="index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'duplicate_alert=1&'.'id_alert_snmp='.$row['id_as'].'">'.html_print_image('images/copy.png', true, ['alt' => __('Duplicate'), 'title' => __('Duplicate')]).'</a>'.'<a href="index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'update_alert=1&'.'id_alert_snmp='.$row['id_as'].'">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Update')]).'</a>'.'<a href="javascript:show_add_action_snmp(\''.$row['id_as'].'\');">'.html_print_image('images/add.png', true, ['title' => __('Add action')]).'</a>'.'<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_alert&delete_alert='.$row['id_as'].'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
if (check_acl_restricted_all($config['id_user'], $row['id_group'], 'LW')) {
$data[8] = '<a href="index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'duplicate_alert=1&'.'id_alert_snmp='.$row['id_as'].'">'.html_print_image('images/copy.png', true, ['alt' => __('Duplicate'), 'title' => __('Duplicate')]).'</a>'.'<a href="index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'update_alert=1&'.'id_alert_snmp='.$row['id_as'].'">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Update')]).'</a>'.'<a href="javascript:show_add_action_snmp(\''.$row['id_as'].'\');">'.html_print_image('images/add.png', true, ['title' => __('Add action')]).'</a>'.'<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_alert&delete_alert='.$row['id_as'].'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
$data[9] = html_print_checkbox_extended(
'delete_ids[]',
$row['id_as'],
false,
false,
false,
'class="chk_delete"',
true
);
$data[9] = html_print_checkbox_extended(
'delete_ids[]',
$row['id_as'],
false,
false,
false,
'class="chk_delete"',
true
);
} else {
$data[8] = '';
$data[9] = '';
}
$idx = count($table->data);
// The current index of the table is 1 less than the count of table data so we count before adding to table->data

View File

@ -803,7 +803,7 @@ if (defined('METACONSOLE')) {
}
if (!$new_user) {
$user_id = '<div class="label_select_simple"><p class="edit_user_labels">'.__('User ID').'</p>';
$user_id = '<div class="label_select_simple"><p class="edit_user_labels">'.__('User ID').': </p>';
$user_id .= '<span>'.$id.'</span>';
$user_id .= html_print_input_hidden('id_user', $id, true);
$user_id .= '</div>';
@ -1102,7 +1102,8 @@ if (enterprise_installed() && defined('METACONSOLE')) {
$user_info_metaconsole_access = $user_info['metaconsole_access'];
}
$meta_access = '<div class="label_select"><p class="edit_user_labels">'.__('Metaconsole access').' '.ui_print_help_icon('meta_access', true).'</p>';
// TODO review help tips on meta.
$meta_access = '<div class="label_select"><p class="edit_user_labels">'.__('Metaconsole access').' './* ui_print_help_icon('meta_access', true). */'</p>';
$metaconsole_accesses = [
'basic' => __('Basic'),
'advanced' => __('Advanced'),
@ -1175,7 +1176,11 @@ if ($config['double_auth_enabled'] && check_acl($config['id_user'], 0, 'PM')) {
|| ($config['double_auth_enabled'] == '' && $double_auth_enabled)
|| check_acl($config['id_user'], 0, 'PM')
) {
$double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true);
if ($new_user === false) {
$double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true);
} else {
$double_authentication .= ui_print_help_tip(__('User must be created before activating double authentication.'), true);
}
}
// Dialog.
@ -1581,6 +1586,7 @@ console.log(userID);
data: {
page: 'include/ajax/double_auth.ajax',
id_user: userID,
id_user_auth: userID,
get_double_auth_data_page: 1,
FA_forced: 1,
containerID: $dialogContainer.prop('id')
@ -1637,6 +1643,8 @@ function show_double_auth_activation () {
var $loadingSpinner = $("<img src=\"<?php echo $config['homeurl']; ?>/images/spinner.gif\" />");
var $dialogContainer = $("div#dialog-double_auth-container");
// Uncheck until completed successfully.
$("input#checkbox-double_auth").prop( "checked", false );
$dialogContainer.html($loadingSpinner);
@ -1648,6 +1656,7 @@ function show_double_auth_activation () {
data: {
page: 'include/ajax/double_auth.ajax',
id_user: userID,
id_user_auth: userID,
FA_forced: 1,
get_double_auth_info_page: 1,
containerID: $dialogContainer.prop('id')
@ -1690,8 +1699,6 @@ function show_double_auth_activation () {
request.abort();
// Remove the contained html
$dialogContainer.empty();
document.location.reload();
}
})
.show();
@ -1705,6 +1712,9 @@ function show_double_auth_deactivation () {
var message = "<p><?php echo __('Are you sure?').'<br>'.__('The double authentication will be deactivated'); ?></p>";
var $button = $("<input type=\"button\" value=\"<?php echo __('Deactivate'); ?>\" />");
// Prevent switch deactivaction until proceess is done
$("input#checkbox-double_auth").prop( "checked", true );
$dialogContainer
.empty()
@ -1739,6 +1749,7 @@ function show_double_auth_deactivation () {
}
else if (data) {
$dialogContainer.html("<?php echo '<b><div class=\"green\">'.__('The double autentication was deactivated successfully').'</div></b>'; ?>");
$("input#checkbox-double_auth").prop( "checked", false );
}
else {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('There was an error deactivating the double autentication').'</div></b>'; ?>");
@ -1769,7 +1780,6 @@ function show_double_auth_deactivation () {
// Remove the contained html
$dialogContainer.empty();
document.location.reload();
}
})
.show();

View File

@ -409,7 +409,7 @@ class DiscoveryTaskList extends HTML
// Status.
$table->headstyle[5] .= 'min-width: 50px; width: 100px;';
// Task type.
$table->headstyle[6] .= 'min-width: 150px; width: 150px;';
$table->headstyle[6] .= 'min-width: 200px; width: 200px;';
// Progress.
$table->headstyle[7] .= 'min-width: 50px; width: 150px;';
// Updated at.
@ -450,6 +450,10 @@ class DiscoveryTaskList extends HTML
$table->align[9] = 'left';
foreach ($recon_tasks as $task) {
if ($this->aclMulticheck('AR|AW|AM', $task['id_group']) === false) {
continue;
}
$no_operations = false;
$data = [];
$server_name = servers_get_name($task['id_recon_server']);
@ -548,20 +552,31 @@ class DiscoveryTaskList extends HTML
true
);
} else if ($task['review_mode'] == DISCOVERY_STANDARD) {
if ($task['status'] <= 0
&& empty($task['summary']) === false
) {
$data[5] = __('Done');
} else if ($task['utimestamp'] == 0
&& empty($task['summary'])
) {
$data[5] = __('Not started');
if ($task['type'] == DISCOVERY_APP_VMWARE) {
if ($task['status'] <= 0 && $task['utimestamp'] != 0) {
$data[5] = __('Done');
} else if ($task['status'] > 0) {
$data[5] = __('Pending');
} else {
$data[5] = __('Not started');
}
} else {
$data[5] = __('Pending');
if ($task['status'] <= 0
&& empty($task['summary']) === false
) {
$data[5] = __('Done');
} else if ($task['utimestamp'] == 0
&& empty($task['summary'])
) {
$data[5] = __('Not started');
} else {
$data[5] = __('Pending');
}
}
} else {
if ($task['status'] <= 0
&& empty($task['summary']) === false
&& (int) $task['type'] === DISCOVERY_HOSTDEVICES
) {
$can_be_reviewed = true;
$data[5] = '<span class="link review" onclick="show_review('.$task['id_rt'].',\''.$task['name'].'\')">';
@ -758,7 +773,7 @@ class DiscoveryTaskList extends HTML
if ($ipam === true) {
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
'index.php?sec=gextensions&sec2=enterprise/tools/ipam/ipam&action=edit&id=%d',
$tipam_task_id
)
).'">'.html_print_image(
@ -767,7 +782,7 @@ class DiscoveryTaskList extends HTML
['title' => __('Edit task')]
).'</a>';
$data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
'index.php?sec=gextensions&sec2=enterprise/tools/ipam/ipam&action=delete&id='.$tipam_task_id
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png',
true,
@ -1202,12 +1217,15 @@ class DiscoveryTaskList extends HTML
$output = '';
// Header information.
if ((int) $task['status'] <= 0
&& empty($summary)
&& $task['id_recon_script'] == 0
) {
if ((int) $task['status'] <= 0 && empty($summary)) {
if ($task['type'] == DISCOVERY_APP_VMWARE && $task['utimestamp'] != 0) {
$outputMessage = __('Task completed.');
} else {
$outputMessage = __('This task has never executed');
}
$output .= ui_print_info_message(
__('This task has never executed'),
$outputMessage,
'',
true
);

View File

@ -27,7 +27,10 @@
*/
// Begin.
global $config;
require_once $config['homedir'].'/vendor/autoload.php';
require_once $config['homedir'].'/include/class/HTML.class.php';
/**
* Global Wizard generic class. Needs to be inherited.
@ -423,281 +426,6 @@ class Wizard
}
/**
* Print a block of inputs.
* Example, using direct to 'anidate' inputs directly to wrapper:
* [
* 'wrapper' => 'div',
* 'block_id' => 'example_id',
* 'class' => 'your class',
* 'direct' => 1,
* 'block_content' => [
* [
* 'arguments' => [
* 'label' => __('Sugesstion'),
* 'type' => 'button',
* 'attributes' => 'class="sub ok btn_sug"',
* 'name' => 'option_1',
* 'id' => 'option_1',
* 'script' => 'change_option1()',
* ],
* ],
* [
* 'arguments' => [
* 'label' => __('Something is not quite right'),
* 'type' => 'button',
* 'attributes' => 'class="sub ok btn_something"',
* 'name' => 'option_2',
* 'id' => 'option_2',
* 'script' => 'change_option2()',
* ],
* ],
* ],
* ].
*
* @param array $input Definition of target block to be printed.
* @param boolean $return Return as string or direct output.
* @param boolean $direct Avoid encapsulation if input print is direct.
*
* @return string HTML content.
*/
public function printBlock(
array $input,
bool $return=false,
bool $direct=false
) {
$output = '';
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
$class = '';
}
if (isset($input['class']) === true) {
$class = $input['class'].$class;
}
if (is_array($input['block_content']) === true) {
$direct = (bool) $input['direct'];
$toggle = (bool) $input['toggle'];
// Print independent block of inputs.
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
if ($input['wrapper']) {
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
}
if (!$direct) {
// Avoid encapsulation if input is direct => 1.
$output .= '<ul class="wizard '.$input['block_class'].'">';
}
$html = '';
foreach ($input['block_content'] as $in) {
$html .= $this->printBlock(
$in,
$return,
(bool) $direct
);
}
if ($toggle === true) {
$output .= ui_print_toggle(
[
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'content' => $html,
'title' => $input['toggle_title'],
'id' => $input['toggle_id'],
'hidden_default' => $input['toggle_hidden_default'],
'return' => (isset($input['toggle_return']) ? $input['toggle_return'] : true),
'toggle_class' => $input['toggle_toggle_class'],
'main_class' => $input['toggle_main_class'],
'container_class' => $input['toggle_container_class'],
'img_a' => $input['toggle_img_a'],
'img_b' => $input['toggle_img_b'],
'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true),
]
);
} else {
$output .= $html;
}
// Close block.
if (!$direct) {
$output .= '</ul>';
}
if ($input['wrapper']) {
$output .= '</'.$input['wrapper'].'>';
}
$output .= '</li>';
} else {
if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended'
) {
if (!$direct) {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
}
$output .= '<label>'.$input['label'].'</label>';
$output .= $this->printInput($input['arguments']);
// Allow dynamic content.
$output .= $input['extra'];
if (!$direct) {
$output .= '</li>';
}
} else {
$output .= $this->printInput($input['arguments']);
// Allow dynamic content.
$output .= $input['extra'];
}
}
if ($return === false) {
echo $output;
}
return $output;
}
/**
* Print a block of inputs with grid format.
*
* @param array $input Definition of target block to be printed.
* @param boolean $return Return as string or direct output.
*
* @return string HTML content.
*/
public function printBlockAsGrid(array $input, bool $return=false)
{
$output = '';
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
$class = '';
}
if (isset($input['class']) === true) {
$class = $input['class'].$class;
}
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$output .= '<div id="'.$input['block_id'].'" class="wizard '.$class.'">';
$output .= '<ul class="wizard '.$input['block_class'].'">';
foreach ($input['block_content'] as $input) {
$output .= $this->printBlockAsGrid($input, $return);
}
$output .= '</ul></div>';
} else {
if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended'
) {
$id = '';
if ($input['id']) {
$id = $input['id'];
}
if ($input['arguments']['inline'] != 'true') {
$output .= '<div id="'.$id.'" class="std_input '.$class.'">';
} else {
$output .= '<div id="'.$id.'" class="inline_input '.$class.'">';
}
$output .= '<div class="label_select">';
$output .= $input['label'];
$output .= '</div>';
if ($input['arguments']['type'] == 'text' || $input['arguments']['type'] == 'text_extended') {
$output .= '<div class="discovery_text_input">';
$output .= $this->printInput($input['arguments']);
$output .= '</div>';
} else if ($input['arguments']['inline'] == 'true') {
$output .= '<div class="discovery_inline_input">';
$output .= $this->printInput($input['arguments']);
$output .= '</div>';
} else {
$output .= $this->printInput($input['arguments']);
}
// Allow dynamic content.
$output .= $input['extra'];
$output .= '</div>';
} else {
$output .= $this->printInput($input['arguments']);
// Allow dynamic content.
$output .= $input['extra'];
}
}
if ($return === false) {
echo $output;
}
return $output;
}
/**
* Print a block of inputs as a list element.
*
* @param array $input Definition of target block to be printed.
* @param boolean $return Return as string or direct output.
*
* @return string HTML content.
*/
public function printBlockAsList(array $input, bool $return=false)
{
$output = '';
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
$class = '';
}
if (isset($input['class']) === true) {
$class = $input['class'].$class;
}
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<ul class="wizard '.$input['block_class'].'">';
foreach ($input['block_content'] as $input) {
$output .= $this->printBlockAsList($input, $return);
}
$output .= '</ul></li>';
} else {
if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended'
) {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
$output .= '<label>'.$input['label'].'</label>';
$output .= $this->printInput($input['arguments']);
// Allow dynamic content.
$output .= $input['extra'];
$output .= '</li>';
} else {
$output .= $this->printInput($input['arguments']);
// Allow dynamic content.
$output .= $input['extra'];
}
}
if ($return === false) {
echo $output;
}
return $output;
}
/**
* Print a form.
*
@ -712,67 +440,7 @@ class Wizard
bool $return=false,
bool $print_white_box=false
) {
$form = $data['form'];
$inputs = $data['inputs'];
$js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
$output_head = '<form id="'.$form['id'].'" class="discovery '.$form['class'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
if ($return === false) {
echo $output_head;
}
try {
if (isset($cb_function) === true) {
call_user_func_array(
$cb_function,
(isset($cb_args) === true) ? $cb_args : []
);
}
} catch (Exception $e) {
error_log('Error executing wizard callback: ', $e->getMessage());
}
$output_submit = '';
$output = '';
if ($print_white_box === true) {
$output .= '<div class="white_box">';
}
$output .= '<ul class="wizard">';
foreach ($inputs as $input) {
if ($input['arguments']['type'] != 'submit') {
$output .= $this->printBlock($input, true);
} else {
$output_submit .= $this->printBlock($input, true);
}
}
$output .= '</ul>';
if ($print_white_box === true) {
$output .= '</div>';
}
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';
$output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) {
echo $output;
}
return $output_head.$output;
return HTML::printForm($data, $return, $print_white_box);
}
@ -786,112 +454,7 @@ class Wizard
*/
public function printFormAsGrid(array $data, bool $return=false)
{
$form = $data['form'];
$rows = $data['rows'];
$js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
$output_head = '<form class="discovery wizard" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
if ($return === false) {
echo $output_head;
}
try {
if (isset($cb_function) === true) {
call_user_func_array(
$cb_function,
(isset($cb_args) === true) ? $cb_args : []
);
}
} catch (Exception $e) {
error_log('Error executing wizard callback: ', $e->getMessage());
}
$output_submit = '';
$output = '';
$first_block_printed = false;
if (is_array($rows)) {
foreach ($rows as $row) {
if ($row['new_form_block'] == true) {
if ($first_block_printed === true) {
// If first form block has been placed, then close it before starting a new one.
$output .= '</div>';
$output .= '<div class="white_box" style="margin-top: 30px;">';
} else {
$output .= '<div class="white_box">';
}
$first_block_printed = true;
}
$row_output = '<div class="edit_discovery_info '.$row['class'].'" style="'.$row['style'].'">';
foreach ($row['columns'] as $column) {
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
$padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
$padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
$extra_styles = isset($column['style']) ? $column['style'] : '';
$class = isset($column['class']) ? $column['class'] : '';
$row_output .= '<div class="'.$class.'" ';
$row_output .= ' style="'.$width.$padding_left.$padding_right;
$row_output .= $extra_styles.'">';
foreach ($column['inputs'] as $input) {
if (is_array($input)) {
if ($input['arguments']['type'] != 'submit') {
$row_output .= $this->printBlockAsGrid($input, true);
} else {
$output_submit .= $this->printBlockAsGrid($input, true);
}
} else {
$row_output .= $input;
}
}
$row_output .= '</div>';
}
if (isset($row['toggle'])) {
$output .= ui_print_toggle(
[
'content' => $row_output,
'name' => $row['toggle_label'],
'hidden_default' => ! (bool) $row['toggle'],
'return' => true,
]
);
} else {
$output .= $row_output;
}
$output .= '</div>';
}
}
$output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';
$output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) {
echo $output;
}
return $output_head.$output;
return HTML::printFormAsGrid($data, $return);
}
@ -905,57 +468,7 @@ class Wizard
*/
public function printFormAsList(array $data, bool $return=false)
{
$form = $data['form'];
$inputs = $data['inputs'];
$js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
$output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
if ($return === false) {
echo $output_head;
}
try {
if (isset($cb_function) === true) {
call_user_func_array(
$cb_function,
(isset($cb_args) === true) ? $cb_args : []
);
}
} catch (Exception $e) {
error_log('Error executing wizard callback: ', $e->getMessage());
}
$output = '<div class="white_box">';
$output .= '<ul class="wizard">';
foreach ($inputs as $input) {
if ($input['arguments']['type'] != 'submit') {
$output .= $this->printBlockAsList($input, true);
} else {
$output_submit .= $this->printBlockAsList($input, true);
}
}
$output .= '</ul>';
$output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';
$output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) {
echo $output;
}
return $output_head.$output;
return HTML::printFormAsList($data, $return);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -54,6 +54,16 @@ if (check_login()) {
$update_filter_cf = (bool) get_parameter('update_filter_cf', 0);
$delete_filter_cf = (bool) get_parameter('delete_filter_cf', 0);
$change_name_filter = (bool) get_parameter('change_name_filter', 0);
$check_csv_button = (bool) get_parameter('check_csv_button', 0);
if ($check_csv_button) {
if (check_acl($config['id_user'], 0, 'PM')) {
echo json_encode($permission);
return;
} else {
exit;
}
}
if ($get_custom_fields_data) {
$name_custom_fields = get_parameter('name_custom_fields', 0);

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