solved conflicts

This commit is contained in:
marcos 2021-08-23 08:25:12 +02:00
commit 244d7f6c8b
309 changed files with 12573 additions and 6439 deletions

View File

@ -10,7 +10,7 @@ For community support you can visit our forums at http://forums.pandorafms.org.
### How to install Pandora FMS
Installing Pandora FMS is a very easy task. Please visit our wiki and follow all the steps described for a quick and proper installation. http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Installing
Installing Pandora FMS is a very easy task. Please visit our wiki and follow all the steps described for a quick and proper installation. https://pandorafms.com/manual/en/documentation/02_installation/01_installing
### What is Pandora FMS?

View File

@ -68,7 +68,7 @@ check_root_permissions () {
install_autodiscover () {
local arch=$1
wget https://pandorafms.com/library/wp-content/uploads/2020/04/autodiscover-linux.zip
wget http://firefly.artica.es/projects/autodiscover-linux.zip
unzip autodiscover-linux.zip
chmod +x $arch/autodiscover
mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover

View File

@ -151,7 +151,7 @@ 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
[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
# Console dependencies
@ -428,7 +428,8 @@ mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done
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
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">

View File

@ -0,0 +1,613 @@
#!/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
DBHOST=127.0.0.1
DBNAME=pandora
DBUSER=pandora
DBPASS=pandora
DBPORT=3306
S_VERSION='2021070101'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# Ansi color code variables
red="\e[0;91m"
green="\e[0;92m"
cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
echo -e "${cyan}$msg...${reset}"
$cmd &>> "$LOGFILE"
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$3" ] && echo "$3"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
exit 1
else
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
return 0
fi
}
check_cmd_status () {
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$1" ] && echo "$1"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
return 0
fi
}
check_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.pandorafms.com" "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 EL8 ver. $S_VERSION"
# Centos Version
if [ ! "$(grep -Ei 'centos|rocky' /etc/redhat-release)" ]; then
printf "\n ${red}Error this is not a Centos/Rocky Base system, this installer is compatible with Centos/Rocky systems only${reset}\n"
exit 1
fi
echo -en "${cyan}Check Centos Version...${reset}"
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ]
check_cmd_status 'Error OS version, Centos/Rocky 8+ 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" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
# Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "dnf --version" 'Checking needed tools: dnf'
# 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 "dnf install -y wget" "Installing wget"
#Installing extra repositiries
extra_repos=" \
tar \
dnf-utils \
epel-release \
http://rpms.remirepo.net/enterprise/remi-release-8.rpm \
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
execute_cmd "dnf module reset -y php " "Disabling standard PHP module"
execute_cmd "dnf module install -y php:remi-7.3" "Configuring PHP"
# Install percona Database
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
rm -rf /etc/my.cnf
execute_cmd "dnf 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/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "dnf 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 \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
perl(XML::Simple) \
perl(Geo::IP) \
perl(IO::Socket::INET6) \
perl(XML::Twig) \
expect \
openssh-clients \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# SDK VMware perl dependencies
vmware_dependencies=" \
perl-Net-HTTP \
perl-libwww-perl \
openssl-devel \
perl-Crypt-CBC \
perl-Bytes-Random-Secure \
perl-Crypt-Random-Seed \
perl-Math-Random-ISAAC \
perl-JSON \
http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm \
http://mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm \
http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm"
execute_cmd "dnf install -y $vmware_dependencies" "Installing SDK VMware perl dependencies"
# Instant client Oracle
oracle_dependencies=" \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant client"
ipam_dependencies=" \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
perl(XML::Simple) \
perl(Geo::IP) \
perl(IO::Socket::INET6) \
perl(XML::Twig)"
execute_cmd "dnf install -y $ipam_dependencies" "Installing Oracle Instant client"
# Disabling SELINUX and firewalld
setenforce 0 &>> "$LOGFILE"
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
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 "dnf 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"
execute_cmd "systemctl enable php-fpm --now" "Enabling PHP-FPM 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 = 800M/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"
execute_cmd "systemctl restart php-fpm" "Restarting php-fpm 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
[ -d /dev/lxd/ ] || 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

@ -149,6 +149,7 @@ EOF_INDEX
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 = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
echo "- Setting Public URL: $PUBLICURL"
q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url)

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, AIX version
# Version 7.0NG.756, 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.755, FreeBSD Version
# Version 7.0NG.756, 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.755, HP-UX Version
# Version 7.0NG.756, 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.755, GNU/Linux
# Version 7.0NG.756, 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.755, GNU/Linux
# Version 7.0NG.756, 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.755, Solaris Version
# Version 7.0NG.756, 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.755
# Version 7.0NG.756
# 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.755, AIX version
# Version 7.0NG.756, 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.755
# Version 7.0NG.756
# 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.755, HPUX Version
# Version 7.0NG.756, HPUX Version
# General Parameters
# ==================

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, AIX version
# Version 7.0NG.756, 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.755-210614
Version: 7.0NG.756-210823
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.755-210614"
pandora_version="7.0NG.756-210823"
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

@ -6,11 +6,18 @@ function error {
exit 1
}
# Gets information about Apple notarization process
function get_notarization_info() {
CALL=$(xcrun altool --notarization-info "$1" -u $APPLE_USER -p "$APPLE_PASS"| grep -Ei "Status:|Status Message")
STATUS=`echo $CALL |grep -ic "in progress"`
MESSAGE=`echo $CALL |grep -ic "package approved"`
}
# Keeping this for future CICD integration
if [ "$CI_PROJECT_DIR" != "" ]; then
LOCALINST="$CODEHOME/pandora_agents/unix/Darwin/dmg"
else
LOCALINST="/root/code/pandorafms/pandora_agents/unix/Darwin/dmg"
LOCALINST="/opt/code/pandorafms/pandora_agents/unix/Darwin/dmg"
fi
# DMG package name
@ -24,21 +31,26 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.755"
VERSION="7.0NG.756"
fi
# Path for the generated DMG file
if [ "$#" -ge 3 ]; then
BUILD_PATH="$3"
else
BUILD_PATH="/root/code/pandorafms/pandora_agents/unix/Darwin/dmg"
BUILD_PATH="/opt/code/pandorafms/pandora_agents/unix/Darwin/dmg"
fi
BUILD_DMG="$BUILD_PATH/build"
BUILD_TMP="$BUILD_PATH/buildtmp"
APPLE_USER="kevin.rojas@pandorafms.com"
APPLE_PASS="@keychain:signing"
APPLE_DEVNAME="Developer ID Installer: Artica Soluciones Tecnologicas SL"
APPLE_DEVAPP="Developer ID Application: Artica Soluciones Tecnologicas SL"
APPLE_DEVID="Q35RP2Y7WU"
FULLNAME="$DMGNAME-$VERSION.dmg"
echo "VERSION-"$VERSION" NAME-"$DMGNAME
printf "VERSION-'$VERSION' NAME-'$DMGNAME'\n"
pushd .
cd $LOCALINST
@ -49,8 +61,20 @@ cp ../../../../pandora_agents/unix/tentacle* files/pandorafms/
cp -R ../../../../pandora_agents/unix/plugins files/pandorafms/
cp -R ../../../../pandora_agents/unix/man files/pandorafms/
cp -R ../../../../pandora_agents/unix/Darwin/pandora_agent.conf files/pandorafms/
mkdir $BUILD_DMG
mkdir $BUILD_TMP
mkdir -p $BUILD_DMG
mkdir -p $BUILD_TMP
# Make sure the scripts have execution privileges
chmod +x "./scripts/preinstall"
chmod +x "./scripts/postinstall"
chmod +x "./files/pandorafms/inst_utilities/get_group.scpt"
chmod +x "./files/pandorafms/inst_utilities/get_remotecfg.scpt"
chmod +x "./files/pandorafms/inst_utilities/get_serverip.scpt"
chmod +x "./files/pandorafms/inst_utilities/print_conf.pl"
chmod +x "./files/pandorafms_uninstall/PandoraFMS agent uninstaller.app/Contents/MacOS/uninstall.sh"
chmod +x "./files/pandorafms_uninstall/PandoraFMS agent uninstaller.app/Contents/Resources/ask_root"
chmod +x "./files/pandorafms_uninstall/PandoraFMS agent uninstaller.app/Contents/Resources/confirm_uninstall"
chmod +x "./files/pandorafms_uninstall/PandoraFMS agent uninstaller.app/Contents/Resources/uninstall"
# Build pandorafms agent component
pkgbuild --root files/pandorafms/ \
@ -72,13 +96,53 @@ productbuild --distribution extras/distribution.xml \
--resources resources \
--scripts scripts \
--version "$VERSION" \
$BUILD_TMP/pandorafms_agent.pkg || error
$BUILD_TMP/pfms_agent.pkg || error
# Sign the package
productsign --sign "$APPLE_DEVNAME ($APPLE_DEVID)" \
$BUILD_TMP/pfms_agent.pkg \
$BUILD_TMP/pandorafms_agent.pkg
# Notarize
NOTARIZE=$(xcrun altool --notarize-app \
--primary-bundle-id "com.pandorafms.pandorafms" \
--asc-provider "$APPLE_DEVID" \
--username "$APPLE_USER" \
--password "$APPLE_PASS" \
--file "$BUILD_TMP/pandorafms_agent.pkg")
if [ $(echo $NOTARIZE |grep -c UUID) -ne 1 ]
then
printf "Unable to send the package to notarization. Exiting..."
error
fi
RUUID=$(echo $NOTARIZE | awk '{print $NF}')
printf "PKG sent for notarization (Request UUID=$RUUID). This may take a few minutes...\n"
# In order to staple the pkg, notarization must be approved!
STATUS=1
while [ $STATUS -eq 1 ]; do
get_notarization_info "$RUUID"
printf "PKG not yet notarized by Apple. Trying again in 60 seconds...\n"
sleep 60
done
if [ $MESSAGE -eq 1 ]
then
echo "Package notarized. Stapling PKG..."
xcrun stapler staple "$BUILD_TMP/pandorafms_agent.pkg" || error
fi
# Clean and prepare dmg creation
rm $BUILD_TMP/pfms_agent.pkg
rm $BUILD_TMP/pandorafms_src.pdk
rm $BUILD_TMP/pandorafms_uninstall.pdk
#Create dmg file
printf "Creating DMG file...\n"
hdiutil create -volname "Pandora FMS agent installer" \
-srcfolder "$BUILD_TMP" \
-ov -format UDZO \
@ -90,6 +154,10 @@ DeRez -only icns extras/pandora_installer.png > tmpicns.rsrc || error
Rez -append tmpicns.rsrc -o "$BUILD_DMG/$FULLNAME" || error
SetFile -a C "$BUILD_DMG/$FULLNAME" || error
# Sign DMG. Not needed, but does not harm
printf "Signing DMG file...\n"
codesign --timestamp --options=runtime --sign "$APPLE_DEVAPP ($APPLE_DEVID)" \
"$BUILD_DMG/$FULLNAME" || error
# Copy and clean folder
rm -Rf $BUILD_TMP

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.755" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.756" 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.755" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.756" 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.755</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.755 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.755</string>
<key>CFBundleVersion</key> <string>7.0NG.756</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.756 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.756</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,6 +1,6 @@
GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free
Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license
Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed. Preamble The licenses for most
software are designed to take away your freedom to share and change it. By
contrast, the GNU General Public License is intended to guarantee your freedom
@ -33,205 +33,159 @@ constantly by software patents. We wish to avoid the danger that redistributors
of a free program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any patent must
be licensed for everyone's free use or not licensed at all. The precise terms
and conditions for copying, distribution and modification follow. GNU GENERAL
PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms of
this General Public License. The "Program", below, refers to any such program or
work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or
translated into another language. (Hereinafter, translation is included without
limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by
this License; they are outside its scope. The act of running the Program is not
restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made by
running the Program). Whether that is true depends on what the Program does. 1.
You may copy and distribute verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and appropriately
publish on each copy an appropriate copyright notice and disclaimer of warranty;
keep intact all the notices that refer to this License and to the absence of any
warranty; and give any other recipients of the Program a copy of this License
along with the Program. You may charge a fee for the physical act of
transferring a copy, and you may at your option offer warranty protection in
exchange for a fee. 2. You may modify your copy or copies of the Program or any
portion of it, thus forming a work based on the Program, and copy and distribute
such modifications or work under the terms of Section 1 above, provided that you
also meet all of these conditions: a) You must cause the modified files to carry
prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in
part contains or is derived from the Program or any part thereof, to be licensed
as a whole at no charge to all third parties under the terms of this License. c)
If the modified program normally reads commands interactively when run, you must
cause it, when started running for such interactive use in the most ordinary
way, to print or display an announcement including an appropriate copyright
notice and a notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under these conditions,
and telling the user how to view a copy of this License. (Exception: if the
Program itself is interactive but does not normally print such an announcement,
your work based on the Program is not required to print an announcement.) These
requirements apply to the modified work as a whole. If identifiable sections of
that work are not derived from the Program, and can be reasonably considered
independent and separate works in themselves, then this License, and its terms,
do not apply to those sections when you distribute them as separate works. But
when you distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of this
License, whose permissions for other licensees extend to the entire whole, and
thus to each and every part regardless of who wrote it. Thus, it is not the
intent of this section to claim rights or contest your rights to work written
entirely by you; rather, the intent is to exercise the right to control the
distribution of derivative or collective works based on the Program. In
addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
distribution medium does not bring the other work under the scope of this
License. 3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of Sections 1
and 2 above provided that you also do one of the following: a) Accompany it with
the complete corresponding machine-readable source code, which must be
distributed under the terms of Sections 1 and 2 above on a medium customarily
used for software interchange; or, b) Accompany it with a written offer, valid
for at least three years, to give any third party, for a charge no more than
your cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be distributed under
the terms of Sections 1 and 2 above on a medium customarily used for software
interchange; or, c) Accompany it with the information you received as to the
offer to distribute corresponding source code. (This alternative is allowed only
for noncommercial distribution and only if you received the program in object
code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all the
source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and installation
of the executable. However, as a special exception, the source code distributed
need not include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component itself
accompanies the executable. If distribution of executable or object code is made
by offering access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as distribution of the
source code, even though third parties are not compelled to copy the source
along with the object code. 4. You may not copy, modify, sublicense, or
distribute the Program except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense or distribute the Program is void,
and will automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this License will
not have their licenses terminated so long as such parties remain in full
compliance. 5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or distribute
the Program or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Program
(or any work based on the Program), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or
modifying the Program or works based on it. 6. Each time you redistribute the
Program (or any work based on the Program), the recipient automatically receives
a license from the original licensor to copy, distribute or modify the Program
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein. You are
not responsible for enforcing compliance by third parties to this License. 7.
If, as a consequence of a court judgment or allegation of patent infringement or
for any other reason (not limited to patent issues), conditions are imposed on
you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of this
License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as a
consequence you may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by all those
who receive copies directly or indirectly through you, then the only way you
could satisfy both it and this License would be to refrain entirely from
distribution of the Program. If any portion of this section is held invalid or
unenforceable under any particular circumstance, the balance of the section is
intended to apply and the section as a whole is intended to apply in other
circumstances. It is not the purpose of this section to induce you to infringe
any patents or other property right claims or to contest validity of any such
claims; this section has the sole purpose of protecting the integrity of the
free software distribution system, which is implemented by public license
practices. Many people have made generous contributions to the wide range of
software distributed through that system in reliance on consistent application
of that system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot impose
that choice. This section is intended to make thoroughly clear what is believed
to be a consequence of the rest of this License. 8. If the distribution and/or
use of the Program is restricted in certain countries either by patents or by
copyrighted interfaces, the original copyright holder who places the Program
under this License may add an explicit geographical distribution limitation
excluding those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates the
limitation as if written in the body of this License. 9. The Free Software
Foundation may publish revised and/or new versions of the General Public License
from time to time. Such new versions will be similar in spirit to the present
version, but may differ in detail to address new problems or concerns. Each
version is given a distinguishing version number. If the Program specifies a
version number of this License which applies to it and "any later version", you
have the option of following the terms and conditions either of that version or
of any later version published by the Free Software Foundation. If the Program
does not specify a version number of this License, you may choose any version
ever published by the Free Software Foundation. 10. If you wish to incorporate
parts of the Program into other free programs whose distribution conditions are
different, write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free Software
Foundation; we sometimes make exceptions for this. Our decision will be guided
by the two goals of preserving the free status of all derivatives of our free
software and of promoting the sharing and reuse of software generally. NO
WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE
THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU
ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO
EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY
TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND
CONDITIONS How to Apply These Terms to Your New Programs If you develop a new
program, and you want it to be of the greatest possible use to the public, the
best way to achieve this is to make it free software which everyone can
redistribute and change under these terms. To do so, attach the following
notices to the program. It is safest to attach them to the start of each source
file to most effectively convey the exclusion of warranty; and each file should
have at least the "copyright" line and a pointer to where the full notice is
found. <one line to give the program's name and a brief idea of what it does.>
Copyright (C)
<year>
<name of author>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version. This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details. You should have received a copy of the GNU
General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when
it starts in an interactive mode: Gnomovision version 69, Copyright (C) year
name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'. This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. The hypothetical
commands `show w' and `show c' should show the appropriate parts of the
General Public License. Of course, the commands you use may be called
something other than `show w' and `show c'; they could even be mouse-clicks
or menu items--whatever suits your program. You should also get your
employer (if you work as a programmer) or your school, if any, to sign a
"copyright disclaimer" for the program, if necessary. Here is a sample;
alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in
the program `Gnomovision' (which makes passes at compilers) written by James
Hacker.
<signature of Ty Coon
>, 1 April 1989 Ty Coon, President of Vice This General Public License
does not permit incorporating your program into proprietary programs. If
your program is a subroutine library, you may consider it more useful to
permit linking proprietary applications with the library. If this is what
you want to do, use the GNU Library General Public License instead of this
License.
</signature></name
></year
>
and conditions for copying, distribution and modification follow. TERMS AND
CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to
any program or other work which contains a notice placed by the copyright holder
saying it may be distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based on the
Program" means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it, either
verbatim or with modifications and/or translated into another language.
(Hereinafter, translation is included without limitation in the term
"modification".) Each licensee is addressed as "you". Activities other than
copying, distribution and modification are not covered by this License; they are
outside its scope. The act of running the Program is not restricted, and the
output from the Program is covered only if its contents constitute a work based
on the Program (independent of having been made by running the Program). Whether
that is true depends on what the Program does. 1. You may copy and distribute
verbatim copies of the Program's source code as you receive it, in any medium,
provided that you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty; and give
any other recipients of the Program a copy of this License along with the
Program. You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee. 2. You
may modify your copy or copies of the Program or any portion of it, thus forming
a work based on the Program, and copy and distribute such modifications or work
under the terms of Section 1 above, provided that you also meet all of these
conditions: a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change. b) You must cause
any work that you distribute or publish, that in whole or in part contains or is
derived from the Program or any part thereof, to be licensed as a whole at no
charge to all third parties under the terms of this License. c) If the modified
program normally reads commands interactively when run, you must cause it, when
started running for such interactive use in the most ordinary way, to print or
display an announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a warranty) and that
users may redistribute the program under these conditions, and telling the user
how to view a copy of this License. (Exception: if the Program itself is
interactive but does not normally print such an announcement, your work based on
the Program is not required to print an announcement.) These requirements apply
to the modified work as a whole. If identifiable sections of that work are not
derived from the Program, and can be reasonably considered independent and
separate works in themselves, then this License, and its terms, do not apply to
those sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based on the
Program, the distribution of the whole must be on the terms of this License,
whose permissions for other licensees extend to the entire whole, and thus to
each and every part regardless of who wrote it. Thus, it is not the intent of
this section to claim rights or contest your rights to work written entirely by
you; rather, the intent is to exercise the right to control the distribution of
derivative or collective works based on the Program. In addition, mere
aggregation of another work not based on the Program with the Program (or with a
work based on the Program) on a volume of a storage or distribution medium does
not bring the other work under the scope of this License. 3. You may copy and
distribute the Program (or a work based on it, under Section 2) in object code
or executable form under the terms of Sections 1 and 2 above provided that you
also do one of the following: a) Accompany it with the complete corresponding
machine-readable source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for software interchange;
or, b) Accompany it with a written offer, valid for at least three years, to
give any third party, for a charge no more than your cost of physically
performing source distribution, a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of Sections 1 and 2
above on a medium customarily used for software interchange; or, c) Accompany it
with the information you received as to the offer to distribute corresponding
source code. (This alternative is allowed only for noncommercial distribution
and only if you received the program in object code or executable form with such
an offer, in accord with Subsection b above.) The source code for a work means
the preferred form of the work for making modifications to it. For an executable
work, complete source code means all the source code for all modules it
contains, plus any associated interface definition files, plus the scripts used
to control compilation and installation of the executable. However, as a special
exception, the source code distributed need not include anything that is
normally distributed (in either source or binary form) with the major components
(compiler, kernel, and so on) of the operating system on which the executable
runs, unless that component itself accompanies the executable. If distribution
of executable or object code is made by offering access to copy from a
designated place, then offering equivalent access to copy the source code from
the same place counts as distribution of the source code, even though third
parties are not compelled to copy the source along with the object code. 4. You
may not copy, modify, sublicense, or distribute the Program except as expressly
provided under this License. Any attempt otherwise to copy, modify, sublicense
or distribute the Program is void, and will automatically terminate your rights
under this License. However, parties who have received copies, or rights, from
you under this License will not have their licenses terminated so long as such
parties remain in full compliance. 5. You are not required to accept this
License, since you have not signed it. However, nothing else grants you
permission to modify or distribute the Program or its derivative works. These
actions are prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the Program), you
indicate your acceptance of this License to do so, and all its terms and
conditions for copying, distributing or modifying the Program or works based on
it. 6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these terms and
conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties to this License. 7. If, as a consequence of a court
judgment or allegation of patent infringement or for any other reason (not
limited to patent issues), conditions are imposed on you (whether by court
order, agreement or otherwise) that contradict the conditions of this License,
they do not excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this License
and any other pertinent obligations, then as a consequence you may not
distribute the Program at all. For example, if a patent license would not permit
royalty-free redistribution of the Program by all those who receive copies
directly or indirectly through you, then the only way you could satisfy both it
and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and the
section as a whole is intended to apply in other circumstances. It is not the
purpose of this section to induce you to infringe any patents or other property
right claims or to contest validity of any such claims; this section has the
sole purpose of protecting the integrity of the free software distribution
system, which is implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed through that
system in reliance on consistent application of that system; it is up to the
author/donor to decide if he or she is willing to distribute software through
any other system and a licensee cannot impose that choice. This section is
intended to make thoroughly clear what is believed to be a consequence of the
rest of this License. 8. If the distribution and/or use of the Program is
restricted in certain countries either by patents or by copyrighted interfaces,
the original copyright holder who places the Program under this License may add
an explicit geographical distribution limitation excluding those countries, so
that distribution is permitted only in or among countries not thus excluded. In
such case, this License incorporates the limitation as if written in the body of
this License. 9. The Free Software Foundation may publish revised and/or new
versions of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to address
new problems or concerns. Each version is given a distinguishing version number.
If the Program specifies a version number of this License which applies to it
and "any later version", you have the option of following the terms and
conditions either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of this
License, you may choose any version ever published by the Free Software
Foundation. 10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author to ask
for permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the sharing and
reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED
FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR
OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT
OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.755, GNU/Linux
# Version 7.0NG.756, 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.755, FreeBSD Version
# Version 7.0NG.756, 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.755, HP-UX Version
# Version 7.0NG.756, 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.755, GNU/Linux
# Version 7.0NG.756, 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.755, GNU/Linux
# Version 7.0NG.756, 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.755, NetBSD Version
# Version 7.0NG.756, 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.755, Solaris Version
# Version 7.0NG.756, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1014,8 +1014,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.755';
use constant AGENT_BUILD => '210614';
use constant AGENT_VERSION => '7.0NG.756';
use constant AGENT_BUILD => '210823';
# 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.755
%define release 210614
%define version 7.0NG.756
%define release 210823
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.755
%define release 210614
%define version 7.0NG.756
%define release 210823
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -12,12 +12,19 @@
#
###################################################
from sys import argv, path, stderr, exit
from sys import argv
from sys import path
from sys import stderr
from sys import exit
from subprocess import Popen
from subprocess import PIPE
from subprocess import DEVNULL
from subprocess import getstatusoutput
import psutil
from subprocess import *
global module_list
module_list = []
version = "1.1"
#########################################################################################
@ -116,7 +123,7 @@ def service_module(name, value, parent=None):
"value" : value,
"module_parent" : parent,
}]
#print ("service_module END "+str(now(0,1)))
#print ("service_module END "+str(now(0,1)))
return (module)
def get_memcpu (process, servicename):
@ -169,7 +176,7 @@ def win_service(servicelist, option=False, memcpu=False):
if output != None and output["modules"]:
modules += PSCheck.check_service(srvc.strip(), option, memcpu)["modules"]
module_list.append(srvc)
winprocess = output["name"]
#winprocess = output["name"]
#if memcpu == True:
# modules += get_memcpu(winprocess) ## Only available for parent service ATM.
else:
@ -189,18 +196,19 @@ def lnx_service(services_list, memcpu=False):
status = None
if sysctl == 0:
### Systemd available
syscall = Popen(["systemctl", "is-active", srvc], stdout=PIPE,
syscall = Popen(["systemctl", "show", "-pLoadState", "-pActiveState", srvc], stdout=PIPE,
stdin=DEVNULL, universal_newlines=True)
result = syscall.communicate()
result = result[0].strip().lower()
if result == "active":
modules += service_module(srvc, 1)
status = 1
elif result == "inactive":
modules += service_module(srvc, 0)
status = 0
elif result == "unknown":
srvstatus= result[0].strip().lower().split("\n")
if srvstatus[0] == "loadstate=not-found":
next
else:
if srvstatus[1] == "activestate=active":
modules += service_module(srvc, 1)
status = 1
elif srvstatus[1] == "activestate=inactive":
modules += service_module(srvc, 0)
status = 0
elif sysctl != 0 and servic == 0:
### Systemd not available, switch to service command
syscall = Popen(["service", srvc, "status"], stdout=PIPE,
@ -375,14 +383,14 @@ def discover(osyst, servicelist):
elif osyst == "Linux":
lnx_service(servicelist, memcpu)
else:
print ("\nPandora FMS Autodiscovery plugin.")
print ("\nPandora FMS Autodiscovery plugin v{}".format(version))
print ("Checks the status of the services in list and monitors CPU and Memory for each of them.\n")
print ("Usage:")
print ("{} [options] [--usage]".format(argv[0]))
print ("--help")
print ("\tPrints this help screen")
print ("--default")
print ("\tRuns this tool with default monitoring.".format(argv[0]))
print ("\tRuns this tool with default monitoring.")
print ("\tServices monitored by default for {}:".format(osyst))
print ("\t",", ".join(servicelist))
print ("--list \"<srvc1,srvc2,srvc3>\"")

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.755
# Version 7.0NG.756
# 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

BIN
pandora_agents/win32/bin/util/omnishell_client.exe Executable file → Normal file

Binary file not shown.

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.755}
{Pandora FMS Windows Agent v7.0NG.756}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210614}
{210823}
ViewReadme
{Yes}

View File

@ -63,7 +63,7 @@ my $config = read_configuration({},' ', [
if (!defined($ConfFile) || !-e $ConfFile) {
print $HELP;
exit 1;
exit 0;
}
if(!-d dirname($ConfFile).'\commands') {
@ -87,7 +87,7 @@ if ($@) {
if (is_enabled($config->{'debug'})) {
print STDERR $@."\n";
}
exit 1;
exit 0;
}
exit 0;

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.755 Build 210614")
#define PANDORA_VERSION ("7.0NG.756 Build 210823")
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.755(Build 210614))"
VALUE "ProductVersion", "(7.0NG.756(Build 210823))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.755-210614
Version: 7.0NG.756-210823
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.755-210614"
pandora_version="7.0NG.756-210823"
package_pear=0
package_pandora=1

View File

@ -64,7 +64,7 @@ sed "s/.*error_reporting =.*/error_reporting = E_ALL \& \~E_DEPRECATED \& \~E_NO
sed "s/.*max_execution_time =.*/max_execution_time = 0/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
sed "s/.*max_input_time =.*/max_input_time = -1/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
sed "s/.*upload_max_filesize =.*/upload_max_filesize = 800M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
sed "s/.*memory_limit =.*/memory_limit = 500M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
sed "s/.*memory_limit =.*/memory_limit = 800M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
sed "s/.*post_max_size =.*/post_max_size = 100M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
cd /var/www/html/pandora_console && mv -f install.php install.php.done

View File

@ -30,7 +30,7 @@
global $config;
check_login();
// ACL Check
// ACL Check.
if (!check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
@ -56,12 +56,12 @@ if (is_ajax()) {
}
/**
* The main function of module groups and the enter point to
* execute the code.
*
* @return void
*/
/**
* The main function of module groups and the enter point to
* execute the code.
*
* @return void
*/
function mainModuleGroups()
{
global $config;
@ -94,7 +94,7 @@ function mainModuleGroups()
$user_groups = users_get_groups($config['user'], 'AR');
$info = array_filter(
$info,
function ($v, $k) use ($user_groups) {
function ($v) use ($user_groups) {
return $user_groups[$v['id']] != null;
},
ARRAY_FILTER_USE_BOTH
@ -102,7 +102,7 @@ function mainModuleGroups()
$info = array_filter(
$info,
function ($v, $k) use ($agent_group_search) {
function ($v) use ($agent_group_search) {
return preg_match(
'/'.$agent_group_search.'/i',
$v['name']
@ -111,7 +111,7 @@ function mainModuleGroups()
ARRAY_FILTER_USE_BOTH
);
if (!empty($info)) {
if (empty($info) === false) {
$groups_view = ($is_not_paginated) ? $info : array_slice(
$info,
$offset,
@ -156,7 +156,7 @@ function mainModuleGroups()
$array_module_group = array_filter(
$array_module_group,
function ($v, $k) use ($module_group_search) {
function ($v) use ($module_group_search) {
return preg_match('/'.$module_group_search.'/i', $v);
},
ARRAY_FILTER_USE_BOTH
@ -332,13 +332,16 @@ function mainModuleGroups()
// Orange when the cell for this model group and agent has at least one alert fired.
} else if ($array_data[$key][$k]['critical_module_count'] != 0) {
$color = COL_CRITICAL;
// Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
// Red when the cell for this model group and agent
// has at least one module in critical state and the rest in any state.
} else if ($array_data[$key][$k]['warning_module_count'] != 0) {
$color = COL_WARNING;
// Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
// Yellow when the cell for this model group and agent
// has at least one in warning state and the rest in green state.
} else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
$color = COL_UNKNOWN;
// Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
// Grey when the cell for this model group and agent
// has at least one module in unknown state and the rest in any state.
} else if ($array_data[$key][$k]['normal_module_count'] != 0) {
$color = COL_NORMAL;
// Green when the cell for this model group and agent has OK state all modules.
@ -348,7 +351,7 @@ function mainModuleGroups()
}
$data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
$data[$i][$j] .= "<a class='info_cell white font_18px' rel='$rel' href='$url'>";
$data[$i][$j] .= '<a class="info_cell white font_18px" rel="'.$rel.'" href="'.$url.'">';
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
$data[$i][$j] .= '</a></div>';
} else {

View File

@ -1,418 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function pluginreg_extension_main()
{
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
include 'general/noaccess.php';
return;
}
ui_require_css_file('first_task');
ui_print_page_header(__('Plugin registration'), 'images/extensions.png', false, '', true, '');
echo '<div class="new_task">
<div class="image_task">';
echo html_print_image('images/first_task/icono_grande_import.png', true, ['title' => __('Plugin Registration') ]);
echo '</div>';
echo '<div class="text_task">';
echo '<h3>'.__('Plugin registration').'</h3>';
echo '<p id="description_task">'.__(
"This extension makes registering server plugins an easier task.
Here you can upload a server plugin in .pspz zipped format.
Please refer to the official documentation on how to obtain and use Server Plugins.
<br><br>You can get more plugins in our <a href='http://pandorafms.com/Library/Library/'>Public Resource Library</a> "
).'</p>';
// Upload form
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
echo '<table class="" id="table1" width="100%" border="0" cellpadding="4" cellspacing="4">';
echo "<tr><td class='datos'><input type='file' name='plugin_upload' />";
echo "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
echo '</form></table>';
echo '</div>';
echo '</div>';
$zip = null;
$upload = false;
if (isset($_FILES['plugin_upload'])) {
$config['plugin_store'] = $config['attachment_store'].'/plugin';
$name_file = $_FILES['plugin_upload']['name'];
$zip = zip_open($_FILES['plugin_upload']['tmp_name']);
$upload = true;
}
if ($zip) {
while ($zip_entry = zip_read($zip)) {
if (zip_entry_open($zip, $zip_entry, 'r')) {
if (zip_entry_name($zip_entry) == 'plugin_definition.ini') {
$basepath = $config['attachment_store'];
} else {
$basepath = $config['plugin_store'];
}
$filename = $basepath.'/'.zip_entry_name($zip_entry);
$fp = fopen($filename, 'w');
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
fwrite($fp, $buf);
fclose($fp);
chmod($filename, 0755);
zip_entry_close($zip_entry);
}
}
zip_close($zip);
}
if ($upload) {
// Parse with sections
if (! $ini_array = parse_ini_file($config['attachment_store'].'/plugin_definition.ini', true)) {
echo '<h2 class=error>'.__('Cannot load INI file').'</h2>';
} else {
$version = preg_replace('/.*[.]/', '', $name_file);
$exec_path = $config['plugin_store'].'/'.$ini_array['plugin_definition']['filename'];
$file_exec_path = $exec_path;
if (isset($ini_array['plugin_definition']['execution_command'])
&& ($ini_array['plugin_definition']['execution_command'] != '')
) {
$exec_path = $ini_array['plugin_definition']['execution_command'].' '.$config['plugin_store'].'/'.$ini_array['plugin_definition']['filename'];
}
if (isset($ini_array['plugin_definition']['execution_postcommand'])
&& ($ini_array['plugin_definition']['execution_postcommand'] != '')
) {
$exec_path = $exec_path.' '.$ini_array['plugin_definition']['execution_postcommand'];
}
if (!file_exists($file_exec_path)) {
echo '<h2 class=error>'.__('Plugin exec not found. Aborting!').'</h2>';
unlink($config['attachment_store'].'/plugin_definition.ini');
} else {
// Verify if a plugin with the same name is already registered
$sql0 = "SELECT COUNT(*)
FROM tplugin
WHERE name = '".io_safe_input($ini_array['plugin_definition']['name'])."'";
$result = db_get_sql($sql0);
if ($result > 0) {
echo '<h2 class=error>'.__('Plugin already registered. Aborting!').'</h2>';
unlink($config['attachment_store'].'/plugin_definition.ini');
} else {
$values = [
'name' => io_safe_input($ini_array['plugin_definition']['name']),
'description' => io_safe_input($ini_array['plugin_definition']['description']),
'max_timeout' => $ini_array['plugin_definition']['timeout'],
'execute' => io_safe_input($exec_path),
'net_dst_opt' => $ini_array['plugin_definition']['ip_opt'],
'net_port_opt' => $ini_array['plugin_definition']['port_opt'],
'user_opt' => $ini_array['plugin_definition']['user_opt'],
'pass_opt' => $ini_array['plugin_definition']['pass_opt'],
'parameters' => $ini_array['plugin_definition']['parameters'],
'plugin_type' => $ini_array['plugin_definition']['plugin_type'],
];
switch ($version) {
case 'pspz':
// Fixed the static parameters
// for
// the dinamic parameters of pandoras 5
$total_macros = 0;
$macros = [];
if (!isset($values['parameters'])) {
$values['parameters'] = '';
}
if ($values['net_dst_opt'] != '') {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Target IP from net';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['net_dst_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if ($values['ip_opt'] != '') {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Target IP';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['ip_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if ($values['net_port_opt'] != '') {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Port from net';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['net_port_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if ($values['port_opt'] != '') {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Port';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['port_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if ($values['user_opt'] != '') {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Username';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['user_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if ($values['pass_opt'] != '') {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Password';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['pass_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
// A last parameter is defined always to
// add the old "Plug-in parameters" in the
// side of the module
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Plug-in Parameters';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= ' _field'.$total_macros.'_';
$macros[(string) $total_macros] = $macro;
break;
case 'pspz2':
// Fill the macros field.
$total_macros = $ini_array['plugin_definition']['total_macros_provided'];
$macros = [];
for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) {
$label = 'macro_'.$it_macros;
$macro = [];
$macro['macro'] = '_field'.$it_macros.'_';
$macro['hide'] = $ini_array[$label]['hide'];
$macro['desc'] = io_safe_input(
$ini_array[$label]['description']
);
$macro['help'] = io_safe_input(
$ini_array[$label]['help']
);
$macro['value'] = io_safe_input(
$ini_array[$label]['value']
);
$macros[(string) $it_macros] = $macro;
}
break;
}
if (!empty($macros)) {
$values['macros'] = json_encode($macros);
}
$create_id = db_process_sql_insert('tplugin', $values);
if (empty($create_id)) {
ui_print_error_message(
__('Plug-in Remote Registered unsuccessfull')
);
ui_print_info_message(
__('Please check the syntax of file "plugin_definition.ini"')
);
} else {
for ($ax = 1; $ax <= $ini_array['plugin_definition']['total_modules_provided']; $ax++) {
$label = 'module'.$ax;
$plugin_user = '';
if (isset($ini_array[$label]['plugin_user'])) {
$plugin_user = $ini_array[$label]['plugin_user'];
}
$plugin_pass = '';
if (isset($ini_array[$label]['plugin_pass'])) {
$plugin_pass = $ini_array[$label]['plugin_pass'];
}
$plugin_parameter = '';
if (isset($ini_array[$label]['plugin_parameter'])) {
$plugin_parameter = $ini_array[$label]['plugin_parameter'];
}
$unit = '';
if (isset($ini_array[$label]['unit'])) {
$unit = $ini_array[$label]['unit'];
}
$values = [
'name' => io_safe_input($ini_array[$label]['name']),
'description' => io_safe_input($ini_array[$label]['description']),
'id_group' => $ini_array[$label]['id_group'],
'type' => $ini_array[$label]['type'],
'max' => isset($ini_array[$label]['max']) ? $ini_array[$label]['max'] : '',
'min' => isset($ini_array[$label]['min']) ? $ini_array[$label]['min'] : '',
'module_interval' => isset($ini_array[$label]['module_interval']) ? $ini_array[$label]['module_interval'] : '',
'id_module_group' => $ini_array[$label]['id_module_group'],
'id_modulo' => $ini_array[$label]['id_modulo'],
'plugin_user' => io_safe_input($plugin_user),
'plugin_pass' => io_safe_input($plugin_pass),
'plugin_parameter' => io_safe_input($plugin_parameter),
'unit' => io_safe_input($unit),
'max_timeout' => isset($ini_array[$label]['max_timeout']) ? $ini_array[$label]['max_timeout'] : '',
'history_data' => isset($ini_array[$label]['history_data']) ? $ini_array[$label]['history_data'] : '',
'dynamic_interval' => isset($ini_array[$label]['dynamic_interval']) ? $ini_array[$label]['dynamic_interval'] : '',
'dynamic_min' => isset($ini_array[$label]['dynamic_min']) ? $ini_array[$label]['dynamic_min'] : '',
'dynamic_max' => isset($ini_array[$label]['dynamic_max']) ? $ini_array[$label]['dynamic_max'] : '',
'dynamic_two_tailed' => isset($ini_array[$label]['dynamic_two_tailed']) ? $ini_array[$label]['dynamic_two_tailed'] : '',
'min_warning' => isset($ini_array[$label]['min_warning']) ? $ini_array[$label]['min_warning'] : '',
'max_warning' => isset($ini_array[$label]['max_warning']) ? $ini_array[$label]['max_warning'] : '',
'str_warning' => isset($ini_array[$label]['str_warning']) ? $ini_array[$label]['str_warning'] : '',
'min_critical' => isset($ini_array[$label]['min_critical']) ? $ini_array[$label]['min_critical'] : '',
'max_critical' => isset($ini_array[$label]['max_critical']) ? $ini_array[$label]['max_critical'] : '',
'str_critical' => isset($ini_array[$label]['str_critical']) ? $ini_array[$label]['str_critical'] : '',
'min_ff_event' => isset($ini_array[$label]['min_ff_event']) ? $ini_array[$label]['min_ff_event'] : '',
'tcp_port' => isset($ini_array[$label]['tcp_port']) ? $ini_array[$label]['tcp_port'] : '',
'id_plugin' => $create_id,
];
$macros_component = $macros;
switch ($version) {
case 'pspz':
// Fixed the static parameters
// for
// the dinamic parameters of pandoras 5
foreach ($macros_component as $key => $macro) {
if ($macro['desc'] == 'Target IP from net') {
if (!empty($values['ip_target'])) {
$macros_component[$key]['value'] = io_safe_input($values['ip_target']);
}
}
if ($macro['desc'] == 'Target IP') {
if (!empty($values['ip_target'])) {
$macros_component[$key]['value'] = io_safe_input($values['ip_target']);
}
} else if ($macro['desc'] == 'Port from net') {
if (!empty($values['tcp_port'])) {
$macros_component[$key]['value'] = io_safe_input($values['tcp_port']);
}
} else if ($macro['desc'] == 'Port') {
if (!empty($values['tcp_port'])) {
$macros_component[$key]['value'] = io_safe_input($values['tcp_port']);
}
} else if ($macro['desc'] == 'Username') {
if (!empty($values['plugin_user'])) {
$macros_component[$key]['value'] = io_safe_input($values['plugin_user']);
}
} else if ($macro['desc'] == 'Password') {
if (!empty($values['plugin_pass'])) {
$macros_component[$key]['value'] = io_safe_input($values['plugin_pass']);
}
} else if ($macro['desc'] == 'Plug-in Parameters') {
if (!empty($values['plugin_parameter'])) {
$macros_component[$key]['value'] = io_safe_input($values['plugin_parameter']);
}
}
}
break;
case 'pspz2':
if ($total_macros > 0) {
for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) {
$macro = 'macro_'.$it_macros.'_value';
// Set the value or use the default
if (isset($ini_array[$label][$macro])) {
$macros_component[(string) $it_macros]['value'] = io_safe_input($ini_array[$label][$macro]);
}
}
}
break;
}
if (!empty($macros_component)) {
$values['macros'] = json_encode($macros_component);
}
db_process_sql_insert('tnetwork_component', $values);
echo '<h3 class=suc>'.__('Module plugin registered').' : '.$ini_array[$label]['name'].'</h3>';
}
echo '<h2 class=suc>'.__('Plugin').' '.$ini_array['plugin_definition']['name'].' '.__('Registered successfully').'</h2>';
}
unlink($config['attachment_store'].'/plugin_definition.ini');
}
}
}
}
}
extensions_add_godmode_menu_option(__('Register plugin'), 'PM', 'gservers', null, 'v1r1');
extensions_add_godmode_function('pluginreg_extension_main');

View File

@ -1047,8 +1047,8 @@ function process_upload_xml($xml)
// Extract policies.
if ($hook_enterprise === true) {
$centralized_management = !is_central_policies_on_node();
if ($centralized_management) {
$centralized_management = is_management_allowed();
if ($centralized_management === true) {
process_upload_xml_policy($xml, $group_filter);
}
}
@ -1080,9 +1080,17 @@ function resource_registration_extension_main()
return;
}
$centralized_management = !is_central_policies_on_node();
if (!$centralized_management) {
ui_print_warning_message(__('This node is configured with centralized mode. Go to metaconsole to create a policy.'));
if (is_management_allowed() === false) {
ui_print_warning_message(
__(
'This node is configured with centralized mode. Go to %s to create a policy.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/policymanager'
).'">'.__('metaconsole').'</a>'
)
);
return;
}
echo '<div class=notify>';
@ -1091,7 +1099,7 @@ function resource_registration_extension_main()
echo '<br /><br />';
// Upload form
// Upload form.
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
echo '<tr>';
@ -1105,7 +1113,7 @@ function resource_registration_extension_main()
echo '</table>';
echo '</form>';
if (!isset($_FILES['resource_upload']['tmp_name'])) {
if (isset($_FILES['resource_upload']['tmp_name']) === false) {
return;
}

View File

@ -33,10 +33,19 @@ function users_extension_main_god($god=true)
$image = 'images/user.png';
}
// Header
// Header.
ui_print_page_header(__('Users connected'), $image, false, '', $god);
// Get groups user has permission
$check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up');
if ($check_profile === false && !users_is_admin()) {
return ui_print_error_message(
__('This user does not have any associated profile'),
'',
false
);
}
// 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));
@ -44,51 +53,85 @@ function users_extension_main_god($god=true)
// Get user conected last 5 minutes.Show only those on which the user has permission.
switch ($config['dbtype']) {
case 'mysql':
$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
);
if (users_is_admin()) {
$sql = sprintf(
'SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
GROUP BY tusuario.id_user
ORDER BY last_connect DESC'
);
} else {
$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 = 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
);
if (users_is_admin()) {
$sql = sprintf(
"SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
GROUP BY tusuario.id_user
ORDER BY last_connect DESC'
);
} else {
$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 = 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
);
if (users_is_admin()) {
$sql = sprintf(
"SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
GROUP BY tusuario.id_user
ORDER BY last_connect DESC'
);
} else {
$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;
default:
// Nothing to do.
break;
}
$rows = db_get_all_rows_sql($sql);
if (empty($rows)) {
$rows = [];
echo "<div class='nf'>".__('No other users connected').'</div>';
} else {
$table = new StdClass();
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
@ -105,7 +148,7 @@ function users_extension_main_god($god=true)
$rowPair = true;
$iterator = 0;
// Get data
// Get data.
foreach ($rows as $row) {
// Get data of user's last login.
switch ($config['dbtype']) {
@ -135,6 +178,10 @@ function users_extension_main_god($god=true)
)
);
break;
default:
// Nothing to do.
break;
}
if ($rowPair) {

View File

@ -82,6 +82,14 @@ include/lib/WSManager.php
include/lib/WebSocketServer.php
include/lib/WebSocketUser.php
operation/network/network_explorer.php
enterprise/meta/advanced/synchronizing.php
enterprise/meta/advanced/synchronizing.os.php
enterprise/meta/advanced/synchronizing.module_groups.php
enterprise/meta/advanced/synchronizing.component.php
enterprise/meta/advanced/synchronizing.alert.php
enterprise/meta/advanced/synchronizing.user.php
enterprise/meta/advanced/synchronizing.tag.php
enterprise/meta/advanced/synchronizing.group.php
operation/visual_console/pure_ajax.php
include/ajax/update_manager.ajax.php
godmode/update_manager/update_manager.css
@ -89,4 +97,12 @@ godmode/update_manager/update_manager.offline.php
godmode/update_manager/update_manager.online.php
include/javascript/update_manager.js
enterprise/include/functions_update_manager.php
include/ajax/rolling_release.ajax.php
include/ajax/rolling_release.ajax.php
extensions/plugin_registration.php
enterprise/include/functions_plugins.php
include/help/en/help_event_alert.php
include/help/es/help_event_alert.php
enterprise/godmode/alerts/alert_events.php
enterprise/godmode/alerts/alert_events_list.php
enterprise/godmode/alerts/alert_events_rules.php
enterprise/godmode/alerts/configure_alert_rule.php

View File

@ -0,0 +1,45 @@
START TRANSACTION;
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `unified` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
ALTER TABLE `tlayout_data` ADD COLUMN `title` TEXT default '';
CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_alert_template_module` int(10) unsigned NOT NULL,
`alert_mode` tinyint(1) NOT NULL,
`data` mediumtext NOT NULL,
`extra_macros` text,
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tsync_queue` (
`id` serial,
`sql` MEDIUMTEXT,
`target` bigint(20) unsigned NOT NULL,
`utimestamp` bigint(20) default '0',
`operation` text,
`table` text,
`error` MEDIUMTEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE `tlink` SET `link` = 'https://pandorafms.com/manual/' WHERE `id_link` = 0000000001;
UPDATE `tuser_task`
SET parameters='a:7:{i:0;a:7:{s:11:"description";s:30:"Template pending to be created";s:5:"table";s:16:"treport_template";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:8:"required";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:7:{s:11:"description";s:6:"Agents";s:5:"table";s:7:"tagente";s:8:"field_id";s:9:"id_agente";s:10:"field_name";s:6:"nombre";s:8:"multiple";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_grupo";}i:2;a:2:{s:11:"description";s:16:"Report per agent";s:10:"select_two";b:1;}i:3;a:2:{s:11:"description";s:11:"Report name";s:4:"type";s:6:"string";}i:4;a:2:{s:11:"description";s:47:"Send to e-mail addresses (separated by a comma)";s:4:"type";s:4:"text";}i:5;a:2:{s:11:"description";s:7:"Subject";s:8:"optional";i:1;}i:6;a:3:{s:11:"description";s:7:"Message";s:4:"type";s:4:"text";s:8:"optional";i:1;}}i:7;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}'
WHERE id=2;
UPDATE `tuser_task_scheduled` SET
`args` = REPLACE (`args`, 'a:8', 'a:9'),
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:7;s:3:"PDF";s:15:"first_execution"')
WHERE `id_user_task` = 2;
UPDATE `tconfig` SET `value` = 0 WHERE `token` = 'centralized_management';
DELETE ta FROM `tagente` ta LEFT JOIN `tgrupo` tg on ta.`id_grupo` = tg.`id_grupo` WHERE tg.`id_grupo` IS NULL;
COMMIT;

View File

@ -0,0 +1,6 @@
START TRANSACTION;
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font';
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath';
COMMIT;

View File

@ -418,6 +418,8 @@ ALTER TABLE `tmetaconsole_setup` MODIFY COLUMN `meta_dbuser` text NULL,
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `server_uid` TEXT NOT NULL default '';
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `unified` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tprofile_view`
-- ---------------------------------------------------------------------
@ -1026,6 +1028,7 @@ ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_timestamp_idx` (`timestamp`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_module_status_idx` (`module_status`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_criticity_idx` (`criticity`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_agent_name_idx` (`agent_name`);
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
-- ---------------------------------------------------------------------
-- Table `tmetaconsole_event_history`
@ -1438,13 +1441,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
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', 44);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 48);
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', 752);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 756);
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';
@ -1496,7 +1499,7 @@ ALTER TABLE tplanned_downtime_agents ADD COLUMN `manually_disabled` tinyint(1) D
-- ---------------------------------------------------------------------
UPDATE `tlink` SET `link` = 'http://library.pandorafms.com/' WHERE `name` = 'Module library';
UPDATE `tlink` SET `name` = 'Enterprise Edition' WHERE `id_link` = 0000000002;
UPDATE `tlink` SET `name` = 'Documentation', `link` = 'http://wiki.pandorafms.com/' WHERE `id_link` = 0000000001;
UPDATE `tlink` SET `name` = 'Documentation', `link` = 'https://pandorafms.com/manual/' WHERE `id_link` = 0000000001;
UPDATE `tlink` SET `link` = 'http://forums.pandorafms.com/index.php?board=22.0' WHERE `id_link` = 0000000004;
UPDATE `tlink` SET `link` = 'https://github.com/pandorafms/pandorafms/issues' WHERE `id_link` = 0000000003;
@ -1665,6 +1668,8 @@ UPDATE tlayout SET is_favourite = 1 WHERE name REGEXP '^&#40;' OR name REGEXP '^
ALTER TABLE `tlayout` MODIFY COLUMN `is_favourite` int(10) unsigned NOT NULL DEFAULT '0';
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tlayout_data`
-- ---------------------------------------------------------------------
@ -2253,6 +2258,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
`linked_layout_node_id` INT(10) NOT NULL default 0,
`cache_expiration` INTEGER UNSIGNED NOT NULL default 0,
`title` TEXT default '',
PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -2345,6 +2351,8 @@ ALTER TABLE `tevento` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
-- ---------------------------------------------------------------------
-- Table `tevent_extended`
-- ---------------------------------------------------------------------
@ -2562,6 +2570,8 @@ 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;
UPDATE `tuser_task`
SET parameters='a:7:{i:0;a:7:{s:11:"description";s:30:"Template pending to be created";s:5:"table";s:16:"treport_template";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:8:"required";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:7:{s:11:"description";s:6:"Agents";s:5:"table";s:7:"tagente";s:8:"field_id";s:9:"id_agente";s:10:"field_name";s:6:"nombre";s:8:"multiple";b:1;s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_grupo";}i:2;a:2:{s:11:"description";s:16:"Report per agent";s:10:"select_two";b:1;}i:3;a:2:{s:11:"description";s:11:"Report name";s:4:"type";s:6:"string";}i:4;a:2:{s:11:"description";s:47:"Send to e-mail addresses (separated by a comma)";s:4:"type";s:4:"text";}i:5;a:2:{s:11:"description";s:7:"Subject";s:8:"optional";i:1;}i:6;a:3:{s:11:"description";s:7:"Message";s:4:"type";s:4:"text";s:8:"optional";i:1;}}i:7;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE id=2;
DELETE FROM `tuser_task` WHERE id = 6;
-- Migrate old tasks
@ -2576,6 +2586,12 @@ UPDATE `tuser_task_scheduled` SET
`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;
UPDATE `tuser_task_scheduled` SET
`args` = REPLACE (`args`, 'a:8', 'a:9'),
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:7;s:3:"PDF";s:15:"first_execution"')
WHERE `id_user_task` = 2;
-- ----------------------------------------------------------------------
-- ADD message in table 'tnews'
-- ----------------------------------------------------------------------
@ -2728,7 +2744,7 @@ CREATE TABLE `tremote_command_target` (
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
=========
-- ---------------------------------------------------------------------
-- Table `trecon_script`
-- ---------------------------------------------------------------------
@ -4032,6 +4048,33 @@ DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';
-- ----------------------------------------------------------------------
-- Table `tsync_queue`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tsync_queue` (
`id` serial,
`sql` MEDIUMTEXT,
`target` bigint(20) unsigned NOT NULL,
`utimestamp` bigint(20) default '0',
`operation` text,
`table` text,
`error` MEDIUMTEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tperfil` DROP COLUMN `incident_view`;
ALTER TABLE `tperfil` DROP COLUMN `incident_edit`;
ALTER TABLE `tperfil` DROP COLUMN `incident_management`;
ALTER TABLE `tperfil` DROP COLUMN `incident_management`;
-- -----------------------------------------------------
-- Table `talert_execution_queue`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_alert_template_module` int(10) unsigned NOT NULL,
`alert_mode` tinyint(1) NOT NULL,
`data` mediumtext NOT NULL,
`extra_macros` text,
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -11,21 +11,25 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
require_once 'include/functions.php';
require_once 'include/functions_html.php';
require_once 'include/functions_ui.php';
require_once 'include/functions_io.php';
require_once 'include/functions_extensions.php';
require_once __DIR__.'/../include/functions.php';
require_once __DIR__.'/../include/functions_html.php';
require_once __DIR__.'/../include/functions_ui.php';
require_once __DIR__.'/../include/functions_io.php';
require_once __DIR__.'/../include/functions_extensions.php';
global $config;
$config['homedir'] = realpath(__DIR__.'/../');
echo '<html>';
ob_start('ui_process_page_head');
echo '<link rel="stylesheet" href="include/styles/pandora.css" type="text/css">';
echo '</head>'."\n";
require_once 'include/functions_themes.php';
require_once __DIR__.'/../include/functions_themes.php';
ob_start('ui_process_page_body');
// At this point, $login_screen is setted with the error type desired
require 'login_page.php';
// At this point, $login_screen is set with the error type desired.
require __DIR__.'/login_page.php';
?>
</body>

View File

@ -12,20 +12,19 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
global $agent_w;
check_login();
ui_require_css_file('first_task');
?>
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no services defined yet.') ]); ?>
<?php if ($agent_w) { ?>
<?php if ((bool) $agent_w === true) { ?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/first_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Services'); ?></h3><p id="description_task">
<h3> <?php echo __('Create Services'); ?></h3>
<p id="description_task">
<?php
echo __(
"A service is a way to group your IT resources based on their functionalities.
@ -36,8 +35,7 @@ ui_require_css_file('first_task');
His company consists of three big departments: A management, an on-line shop and support."
);
?>
</p>
</p>
<form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Services'); ?>" />
</form>

View File

@ -23,13 +23,8 @@ ui_require_css_file('order_interpreter');
// Global errors/warnings checking.
config_check();
echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
if ($config['menu_type'] == 'classic') {
echo '<div id="header_table" class="header_table_classic">';
} else {
echo '<div id="header_table" class="header_table_collapsed">';
}
?>
<div id="header_table_inner">
<?php
@ -77,9 +72,9 @@ if ($config['menu_type'] == 'classic') {
if ($check_minor_release_available) {
if (users_is_admin($config['id_user'])) {
if ($config['language'] == 'es') {
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a id="aviable_updates" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/es/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
} else {
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a id="aviable_updates" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29">'.__('About minor release update').'</a>', 'minor release/s available');
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/en/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('About minor release update').'</a>', 'minor release/s available');
}
}
}

View File

@ -63,6 +63,7 @@ switch ($login_screen) {
case 'error_perms':
case 'homedir_bad_defined':
case 'homeurl_bad_defined':
case 'disabled_access_node':
$logo_link = 'index.php';
$logo_title = __('Go to Login');
break;
@ -134,8 +135,8 @@ if (isset($config['custom_docs_url'])) {
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Docs').'</li>';
} else if (!$custom_conf_enabled) {
echo '<li><a href="http://wiki.pandorafms.com/" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
echo '<li><a href="http://wiki.pandorafms.com/" target="_blank">'.__('Docs').'</li>';
echo '<li><a href="https://pandorafms.com/manual/" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
echo '<li><a href="https://pandorafms.com/manual/" target="_blank">'.__('Docs').'</li>';
}
if (isset($config['custom_support_url'])) {
@ -208,9 +209,10 @@ if (is_metaconsole() === true) {
switch ($login_screen) {
case 'logout':
case 'login':
case 'disabled_access_node':
if (!empty($page) && !empty($sec)) {
foreach ($_POST as $key => $value) {
html_print_input_hidden(io_safe_input($key), $value);
html_print_input_hidden(io_safe_input($key), io_safe_input($value));
}
}
@ -334,6 +336,9 @@ if ($config['enterprise_installed']) {
}
}
// CSRF validation.
html_print_csrf_hidden();
echo '</form></div>';
echo '<div class="login_data">';
echo '<div class ="text_banner_login">';
@ -505,9 +510,29 @@ if ($login_screen == 'logout') {
echo '</div>';
}
if ($login_screen === 'disabled_access_node') {
echo '<div id="disabled_access_node" title="'.__('User node access not enabled').'">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
echo html_print_image('images/icono_logo_pandora.png', true, ['alt' => __('Centralized user in metaconsole'), 'border' => 0]);
echo '</div>';
echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">';
echo '<h1>'.__('Centralized user in metaconsole').'</h1>';
echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>';
echo '</div>';
echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-logout', false);
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
switch ($login_screen) {
case 'error_dbconfig':
case 'error_authconfig':
case 'disabled_node_access':
if (!isset($config['rb_product_name_alt'])) {
$title = __('Problem with %s database', get_product_name());
} else {
@ -686,7 +711,30 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
});
$("#submit-hide-login-logout").click (function () {
$("#login_logout").dialog('close');
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
});
});
break;
case 'disabled_access_node':
$(document).ready (function () {
$(function() {
$("#disabled_access_node").dialog({
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
clickOutside: true,
overlay: {
opacity: 0.5,
background: "black"
}
});
});
$("#submit-hide-login-logout").click (function () {
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
});
});
break;

View File

@ -1,17 +1,33 @@
<?php
/**
* Lateral Main Menu.
*
* @category Main Menu.
* @package Pandora FMS.
* @subpackage OpenSource.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($config['id_user'])) {
// Begin.
if (isset($config['id_user']) === false) {
include 'general/login_page.php';
exit();
}
@ -20,9 +36,9 @@ if (! isset($config['id_user'])) {
<script type="text/javascript" language="javascript">
$(document).ready(function(){
var menuType_value = "<?php echo $config['menu_type']; ?>";
var menuType_value = "<?php echo $_SESSION['menu_type']; ?>";
if (menuType_value == 'classic') {
if (menuType_value === 'classic') {
$('ul.submenu').css('left', '214px');
}
else{
@ -34,26 +50,22 @@ $(document).ready(function(){
<?php
$autohidden_menu = 0;
if (isset($config['autohidden_menu']) && $config['autohidden_menu']) {
if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_menu'] === true) {
$autohidden_menu = 1;
}
// Menu container prepared to autohide menu
if ($config['menu_type'] == 'classic') {
echo '<div id="menu_full" class="menu_full_classic">';
} else {
echo '<div id="menu_full" class="menu_full_collapsed">';
}
// Start of full lateral menu.
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
if (!defined('PANDORA_ENTERPRISE')) {
if (defined('PANDORA_ENTERPRISE') === false) {
$logo_title = get_product_name().' Opensource';
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png';
} else {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo) === true) {
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
}
@ -61,54 +73,48 @@ if (!defined('PANDORA_ENTERPRISE')) {
}
echo '<div class="logo_green"><a href="index.php?sec=main">';
if (isset($config['custom_logo'])) {
if ($config['menu_type'] == 'classic') {
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:block']);
} else {
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:none']);
}
if (isset($config['custom_logo']) === true) {
echo html_print_image(
$custom_logo,
true,
[
'border' => '0',
'width' => '215',
'alt' => $logo_title,
'class' => 'logo_full',
'style' => ($menuCollapsed === true) ? 'display:none' : 'display:block',
]
);
}
if (isset($config['custom_logo_collapsed'])) {
if ($config['menu_type'] == 'classic') {
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:none']);
} else {
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:block']);
}
if (isset($config['custom_logo_collapsed']) === true) {
echo html_print_image(
$custom_logo_collapsed,
true,
[
'border' => '0',
'width' => '60',
'alt' => $logo_title,
'class' => 'logo_icon',
'style' => ($menuCollapsed === true) ? 'display:block' : 'display:none',
]
);
}
echo '</a></div>';
// echo '<div class="tit bg titop">:: '.__('Operation').' ::</div>';
require 'operation/menu.php';
// Check all enterprise ACL used in godmenu items to print menu headers
if (check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'PM')
|| check_acl($config['id_user'], 0, 'LM')
|| check_acl($config['id_user'], 0, 'UM')
|| check_acl($config['id_user'], 0, 'LW')
|| check_acl($config['id_user'], 0, 'EW')
|| check_acl($config['id_user'], 0, 'DW')
) {
// echo '<div class="tit bg3">:: '.__('Administration').' ::</div>';
}
require 'godmode/menu.php';
if ($config['menu_type'] == 'classic') {
echo '<div id="button_collapse" class="button_classic button_collapse"></div>';
} else {
echo '<div id="button_collapse" class="button_collapsed button_collapse"></div>';
}
echo sprintf('<div id="button_collapse" class="button_%s button_collapse"></div>', $menuTypeClass);
// require ("links_menu.php");
echo '</div>';
// menu_container
// Menu_container.
ui_require_jquery_file('cookie');
$config_fixed_header = false;
if (isset($config['fixed_header'])) {
if (isset($config['fixed_header']) === true) {
$config_fixed_header = $config['fixed_header'];
}
?>

View File

@ -31,9 +31,8 @@ ui_require_css_file('maintenance');
?>
<html>
<body>
<h1>Ups ...</h1>
<div class="responsive">
<div class="responsive center padding-6">
<p><?php echo __('Maintenance tasks in progress'); ?></p>
<br>
<br>

View File

@ -133,7 +133,7 @@ img.modalclose {
if (isset($config['custom_docs_url_alt'])) {
$docs_url = $config['custom_docs_url_alt'];
} else {
$docs_url = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration';
$docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration';
}
echo '

View File

@ -0,0 +1,79 @@
<?php
/**
* Static page to lock access to console
*
* @category Wizard
* @package Pandora FMS
* @subpackage Applications.VMware
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
ui_require_css_file('maintenance');
?>
<html>
<body>
<div class="responsive center padding-6">
<p><?php echo __('You cannot use this node until system is unified'); ?></p>
<br>
<br>
<?php
html_print_image(
'images/maintenance.png',
false,
[
'class' => 'responsive',
'width' => 800,
]
);
?>
<br>
<br>
<p>
<?php
echo __(
'Please navigate to %s to unify system',
'<a href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/command_center'
).'" target="_new">'.__('command center').'</a>'
);
?>
</p>
<br>
<p><?php echo __('You will be automatically redirected when all tasks finish'); ?></p>
</div>
</body>
<script type="text/javascript">
$(document).ready(function() {
setTimeout(
function() {
location.reload();
},
10000
);
})
</script>
</html>

View File

@ -19,9 +19,9 @@
global $config;
if ($config['language'] == 'es') {
$url_help = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Instalaci%C3%B3n_y_actualizaci%C3%B3n_PHP_7';
$url_help = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/14_php_7';
} else {
$url_help = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:_PHP_7';
$url_help = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/14_php_7';
}
// Prints help dialog information

View File

@ -230,7 +230,7 @@ if (!$new_agent && $alias != '') {
$agent_options_update = 'agent_options_update';
// Delete link from here.
if (!is_central_policies_on_node()) {
if (is_management_allowed() === true) {
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image(
'images/cross.png',
true,
@ -349,7 +349,14 @@ if (isset($groups[$grupo]) || $new_agent) {
}
$table_primary_group .= '<div class="label_select_child_icons"><span id="group_preview">';
$table_primary_group .= ui_print_group_icon($grupo, true);
if ($id_agente === 0) {
$hidden = 'display: none;';
} else {
$hidden = '';
}
$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden);
$table_primary_group .= '</span></div></div></div>';
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').'</p>';
@ -392,9 +399,9 @@ $table_os .= '</span></div></div></div>';
// Network server.
$servers = servers_get_names();
if (!array_key_exists($server_name, $servers)) {
$server_Name = 0;
// Set the agent have not server.
// Set the agent have not server.
if (array_key_exists($server_name, $servers) === false) {
$server_name = 0;
}
$table_server = '<div class="label_select"><p class="input_label">'.__('Server').'</p>';
@ -500,7 +507,10 @@ if (enterprise_installed()) {
false,
// Delete_groups.
// Do not show the primary group in this selection.
array_merge(($secondary_groups_selected['plain'] ?? []), [$agent['id_grupo']])
array_merge(
(empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [],
[$agent['id_grupo']]
)
// Include_groups.
// Size.
// Simple_multiple_options.
@ -1243,6 +1253,9 @@ ui_require_jquery_file('bgiframe');
});
$("select#id_os").pandoraSelectOS ();
$('select#grupo').pandoraSelectGroupIcon ();
var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) {

View File

@ -1494,7 +1494,7 @@ if ($update_module || $create_module) {
$ff_event_normal = (int) get_parameter('ff_event_normal');
$ff_event_warning = (int) get_parameter('ff_event_warning');
$ff_event_critical = (int) get_parameter('ff_event_critical');
$ff_type = (int) get_parameter('ff_type', $module['ff_type']);
$ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff', $module['each_ff']);
$ff_timeout = (int) get_parameter('ff_timeout');
$unit = (string) get_parameter('unit');
@ -2368,7 +2368,7 @@ switch ($tab) {
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>';
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() &&
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() &&
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){
event.preventDefault();
@ -2402,7 +2402,7 @@ switch ($tab) {
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>';
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && (
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && (
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
event.preventDefault();

View File

@ -110,9 +110,14 @@ ui_print_standard_header(
]
);
if (is_central_policies_on_node()) {
if (is_management_allowed() === false) {
ui_print_warning_message(
__('This node is configured with centralized mode. To delete an agent go to metaconsole.')
__(
'This node is configured with centralized mode. Go to %s to delete an agent',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=monitoring&sec2=monitoring/wizard/wizard'
).'">'.__('metaconsole').'</a>'
)
);
}
@ -912,7 +917,7 @@ if ($agents !== false) {
echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent'), 'class' => 'invert_filter']).'</a>';
}
if ($check_aw && !is_central_policies_on_node()) {
if ($check_aw && is_management_allowed() === true) {
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";

View File

@ -170,9 +170,9 @@ $checked = get_parameter('checked');
if (($policy_page) || (isset($agent))) {
if ($policy_page) {
$show_creation = !is_central_policies_on_node();
$show_creation = is_management_allowed();
} else {
if (!isset($all_groups)) {
if (isset($all_groups) === false) {
$all_groups = agents_get_all_groups_agent(
$agent['id_agente'],
$agent['id_grupo']
@ -184,7 +184,7 @@ if (($policy_page) || (isset($agent))) {
}
}
if ($show_creation) {
if ($show_creation === true) {
// Create module/type combo.
echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) {

View File

@ -108,6 +108,7 @@ function add_component_selection($id_network_component_type)
$data[0] = __('Using module component').' ';
$component_groups = network_components_get_groups($id_network_component_type);
$data[1] = '<span id="component_group" class="left">';
$data[1] .= html_print_select(
$component_groups,
@ -214,7 +215,7 @@ $table_simple->colspan[3][1] = 3;
$table_simple->data[0][0] = __('Name');
$table_simple->data[0][1] = html_print_input_text_extended(
'name',
io_safe_input(html_entity_decode($name, ENT_QUOTES, 'UTF-8')),
$name,
'text-name',
'',
45,
@ -1385,7 +1386,7 @@ $(document).ready (function () {
tag_name = $(value).html();
if (tag_name != <?php echo "'".__('None')."'"; ?>) {
$("select[name='id_tag_selected[]']").append(value);
$("#id_tag_available").find("option[value='" + id_tag + "']").remove();
$("#id_tag_available").find("option[value='" + tag_name + "']").remove();
$("#id_tag_selected").find("option[value='']").remove();
if($("#id_tag_available option").length == 0) {
$("select[name='id_tag_available[]']").append(value);
@ -1442,14 +1443,14 @@ $(document).ready (function () {
){
if (language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos',
'https://pandorafms.com/manual/es/documentation/03_monitoring/02_operations#tipos_de_modulos',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
'https://pandorafms.com/manual/en/documentation/03_monitoring/02_operations#types_of_modules',
'_blank',
'width=800,height=600'
);
@ -1462,14 +1463,14 @@ $(document).ready (function () {
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
'https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizacion_icmp',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#icmp_monitoring',
'_blank',
'width=800,height=600'
);
@ -1484,14 +1485,14 @@ $(document).ready (function () {
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
'https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizando_con_modulos_de_red_tipo_snmp',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitorins#monitoring_through_network_modules_with_snmp',
'_blank',
'width=800,height=600'
);
@ -1506,14 +1507,14 @@ $(document).ready (function () {
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
'https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizacion_tcp',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#tcp_monitoring',
'_blank',
'width=800,height=600'
);
@ -1526,14 +1527,14 @@ $(document).ready (function () {
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
'https://pandorafms.com/manual/es/documentation/03_monitoring/06_web_monitoring#creacion_de_modulos_web',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
'https://pandorafms.com/manual/en/documentation/03_monitoring/06_web_monitoring#creating_web_modules',
'_blank',
'width=800,height=600'
);

View File

@ -213,9 +213,15 @@ if ($delete_action) {
);
}
if (is_central_policies_on_node() === true) {
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
__(
'This node is configured with centralized mode. All alert actions information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_actions&tab=action&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
}
@ -320,7 +326,7 @@ $table->head = [];
$table->head[0] = __('Name');
$table->head[1] = __('Command');
$table->head[2] = __('Group');
if (is_central_policies_on_node() === false) {
if (is_management_allowed() === true) {
$table->head[3] = __('Copy');
$table->head[4] = __('Delete');
}
@ -337,7 +343,7 @@ $table->align[3] = 'left';
$table->align[4] = 'left';
$filter = [];
if (!is_user_admin($config['id_user']) && $group === 0) {
if (!is_user_admin($config['id_user'])) {
$filter['talert_actions.id_group'] = array_keys(
users_get_groups(false, 'LM')
);
@ -406,7 +412,7 @@ foreach ($actions as $action) {
$data[3] = '';
$data[4] = '';
if (is_central_policies_on_node() === false
if (is_management_allowed() === true
&& check_acl($config['id_user'], $action['id_group'], 'LM')
) {
$table->cellclass[] = [
@ -459,7 +465,7 @@ if (isset($data)) {
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
}
if (is_central_policies_on_node() === false) {
if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');

View File

@ -48,7 +48,11 @@ if (is_ajax()) {
$id = (int) get_parameter('id', 0);
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
$is_central_policies_on_node = is_central_policies_on_node();
// Snmp alerts are not in the metaconsole so they cannot be centralized.
$is_management_allowed = false;
if ($get_recovery_fields !== 0) {
$is_management_allowed = !is_management_allowed();
}
// If command ID is not provided, check for action id.
if ($id == 0) {
@ -144,7 +148,7 @@ if (is_ajax()) {
0,
'',
false,
$is_central_policies_on_node,
$is_management_allowed,
"removeTinyMCE('textarea_field".$i."_value')",
'',
true
@ -156,7 +160,7 @@ if (is_ajax()) {
0,
'',
true,
$is_central_policies_on_node,
$is_management_allowed,
"addTinyMCE('textarea_field".$i."_value')",
'',
true
@ -171,7 +175,7 @@ if (is_ajax()) {
'class="fields"',
true,
'',
$is_central_policies_on_node
$is_management_allowed
);
$editor_type_chkbx = '<div id="command_div"><b><small>';
@ -181,7 +185,7 @@ if (is_ajax()) {
0,
'',
false,
$is_central_policies_on_node,
$is_management_allowed,
"removeTinyMCE('textarea_field".$i."_recovery_value')",
'',
true
@ -193,7 +197,7 @@ if (is_ajax()) {
0,
'',
true,
$is_central_policies_on_node,
$is_management_allowed,
"addTinyMCE('textarea_field".$i."_recovery_value')",
'',
true
@ -208,7 +212,7 @@ if (is_ajax()) {
'class="fields_recovery"',
true,
'',
$is_central_policies_on_node
$is_management_allowed
);
} else if (preg_match('/^_content_type_$/i', $field_value)) {
$editor_type_chkbx = '<div id="command_div"><b><small>';
@ -222,7 +226,7 @@ if (is_ajax()) {
'text/plain',
'',
'',
$is_central_policies_on_node,
$is_management_allowed,
'',
'',
true
@ -234,7 +238,7 @@ if (is_ajax()) {
'text/html',
'',
'text/html',
$is_central_policies_on_node,
$is_management_allowed,
'',
'',
true
@ -253,7 +257,7 @@ if (is_ajax()) {
'text/plain',
'',
'',
$is_central_policies_on_node,
$is_management_allowed,
'',
'',
true
@ -265,7 +269,7 @@ if (is_ajax()) {
'text/html',
'',
'text/html',
$is_central_policies_on_node,
$is_management_allowed,
'',
'',
true
@ -301,7 +305,7 @@ if (is_ajax()) {
false,
false,
'fields',
$is_central_policies_on_node
$is_management_allowed
);
$rfield .= html_print_select(
@ -315,7 +319,7 @@ if (is_ajax()) {
false,
false,
'fields',
$is_central_policies_on_node
$is_management_allowed
);
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
@ -329,7 +333,7 @@ if (is_ajax()) {
'style="min-height:40px; '.$style.'" class="fields"',
true,
'',
$is_central_policies_on_node
$is_management_allowed
);
@ -341,7 +345,7 @@ if (is_ajax()) {
'style="min-height:40px; '.$style.'" class="fields_recovery',
true,
'',
$is_central_policies_on_node
$is_management_allowed
);
} else {
$fields_value_select = [];
@ -375,7 +379,7 @@ if (is_ajax()) {
false,
false,
'fields',
$is_central_policies_on_node
$is_management_allowed
);
$rfield = html_print_select(
$fields_value_select,
@ -388,7 +392,7 @@ if (is_ajax()) {
false,
false,
'fields_recovery',
$is_central_policies_on_node
$is_management_allowed
);
} else {
$ffield = html_print_textarea(
@ -399,7 +403,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields min-height-40px"',
true,
'',
$is_central_policies_on_node
$is_management_allowed
);
$rfield = html_print_textarea(
'field'.$i.'_recovery_value',
@ -409,7 +413,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields_recovery min-height-40px',
true,
'',
$is_central_policies_on_node
$is_management_allowed
);
}
}
@ -422,7 +426,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields min-height-40px"',
true,
'',
$is_central_policies_on_node
$is_management_allowed
);
$rfield = html_print_textarea(
'field'.$i.'_recovery_value',
@ -432,7 +436,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields_recovery min-height-40px"',
true,
'',
$is_central_policies_on_node
$is_management_allowed
);
}
@ -610,11 +614,15 @@ if ($copy_command) {
}
}
$is_central_policies_on_node = is_central_policies_on_node();
if ($is_central_policies_on_node === true) {
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
__(
'This node is configured with centralized mode. All alert commands information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_commands&tab=command&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
}
@ -682,7 +690,7 @@ foreach ($commands as $command) {
$table->cellclass[]['action'] = 'action_buttons';
// (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')) {
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
if (check_acl($config['id_user'], 0, 'PM') || is_user_admin(
$config['id_user
']
@ -714,7 +722,7 @@ if (isset($data) === true && count($table->data) > 0) {
);
}
if ($is_central_policies_on_node === false && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
if ($is_management_allowed === true && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');

View File

@ -708,7 +708,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible left">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
$data[3] .= '<table class="databox_color w100p">';
$data[3] .= '<table class="databox_color w100p bg_color222">';
$data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
@ -1120,6 +1120,12 @@ function show_add_action(id_alert) {
opacity: 0.5,
background: "black"
},
open: function() {
$("#action_select, #action_select").select2({
tags: true,
dropdownParent: $("#add_action-div-" + id_alert)
});
},
width: 500,
height: 300
})
@ -1150,6 +1156,12 @@ function show_display_update_action(id_module_action, alert_id, alert_id_agent_m
opacity: 0.5,
background: "black"
},
open: function() {
$("#action_select_ajax, #action_select_ajax").select2({
tags: true,
dropdownParent: $("#update_action-div")
});
},
width: 500,
height: 300
})

View File

@ -259,9 +259,14 @@ if ($delete_template) {
);
}
if (is_central_policies_on_node() === true) {
if (is_management_allowed() === false) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
__(
'This node is configured with centralized mode. All alert templates information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_templates&tab=template'
).'">'.__('metaconsole').'</a>'
)
);
}
@ -409,7 +414,7 @@ foreach ($templates as $template) {
$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
if (is_management_allowed() === true
&& check_acl($config['id_user'], $template['id_group'], 'LM')
) {
$table->cellclass[][4] = 'action_buttons';
@ -469,7 +474,7 @@ if (isset($data) === true) {
);
}
if (is_central_policies_on_node() === false) {
if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');

View File

@ -101,11 +101,16 @@ if (!$is_in_group && $al_action['id_group'] != 0) {
exit;
}
$is_central_policies_on_node = is_central_policies_on_node();
$is_management_allowed = is_management_allowed();
if ($is_central_policies_on_node === true) {
if ($is_management_allowed === false) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
__(
'This node is configured with centralized mode. All alert actions information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_action&tab=action&pure=0&id='.$id
).'">'.__('metaconsole').'</a>'
)
);
}
@ -130,6 +135,10 @@ if ($id) {
$create_wu_integria = $action['create_wu_integria'];
}
if (users_can_manage_group_all('LW') === false && !$id) {
$group = users_get_first_group(false, 'LW', false);
}
// Hidden div with help hint to fill with javascript.
html_print_div(
[
@ -178,7 +187,7 @@ $table->data[0][1] = html_print_input_text(
'',
'',
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
if (io_safe_output($name) == 'Monitoring Event') {
@ -214,7 +223,7 @@ $table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups(
false,
true,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
).'</div>';
$table->colspan[1][1] = 2;
@ -248,10 +257,10 @@ $table->data[2][1] = html_print_select_from_sql(
true,
false,
false,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[2][1] .= ' ';
if ($is_central_policies_on_node === false
if ($is_management_allowed === true
&& check_acl($config['id_user'], 0, 'PM') && !$disabled
) {
$table->data[2][1] .= __('Create Command');
@ -275,7 +284,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
false,
true,
'',
($is_central_policies_on_node | $disabled),
(!$is_management_allowed | $disabled),
false,
'',
false,
@ -359,7 +368,7 @@ echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/ale
$table_html = html_print_table($table, true);
echo $table_html;
if ($is_central_policies_on_node === false) {
if ($is_management_allowed === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) {
html_print_input_hidden('id', $id);
@ -618,9 +627,6 @@ $(document).ready (function () {
$("#group option").each(function(index, value) {
var current_group = $(value).val();
});
if (data.id_group != 0 && $("#group").val() != data.id_group) {
$("#group").val(0);
}
var integria_custom_fields_values = [];
var integria_custom_fields_rvalues = [];

View File

@ -105,6 +105,7 @@ if ($update_command) {
$alert['command'] = $command;
$alert['description'] = $description;
$alert['id_group'] = $id_group;
$alert['fields_hidden'] = io_json_mb_encode($fields_hidden);
}
}
@ -155,11 +156,16 @@ if (empty($fields_hidden) === false) {
}
$is_central_policies_on_node = is_central_policies_on_node();
$is_management_allowed = is_management_allowed();
if ($is_central_policies_on_node === true) {
if ($is_management_allowed === false) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
__(
'This node is configured with centralized mode. All alert commands information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_command&pure=0&id='.$id
).'">'.__('metaconsole').'</a>'
)
);
}
@ -203,7 +209,7 @@ $table->data['name'][2] = html_print_input_text(
'',
'',
'',
$is_central_policies_on_node
!$is_management_allowed
);
$table->colspan['command'][1] = 3;
@ -216,7 +222,7 @@ $table->data['command'][1] = html_print_textarea(
'',
true,
'',
$is_central_policies_on_node
!$is_management_allowed
);
$return_all_group = false;
@ -240,7 +246,7 @@ $table->data['group'][1] = '<div class="w250px inline">'.html_print_select_group
false,
true,
'',
$is_central_policies_on_node
!$is_management_allowed
).'</div>';
$table->colspan['description'][1] = 3;
@ -253,7 +259,7 @@ $table->data['description'][1] = html_print_textarea(
'',
true,
'',
$is_central_policies_on_node
!$is_management_allowed
);
@ -283,7 +289,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
'',
'',
'',
$is_central_policies_on_node
!$is_management_allowed
);
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
@ -321,7 +327,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
'',
'',
'',
$is_central_policies_on_node
!$is_management_allowed
);
$table->data['field'.$i][4] = __('Hide');
@ -330,7 +336,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
'field'.$i.'_hide',
1,
$selected,
$is_central_policies_on_node,
!$is_management_allowed,
'cursor: \'pointer\'',
'class="hide_inputs"',
true
@ -340,7 +346,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">';
html_print_table($table);
if ($is_central_policies_on_node === false) {
if ($is_management_allowed === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) {
html_print_input_hidden('id', $id);

View File

@ -36,7 +36,9 @@ $id = (int) get_parameter('id');
$pure = get_parameter('pure', 0);
$step = (int) get_parameter('step', 1);
// We set here the number of steps.
define('LAST_STEP', 3);
if (defined('LAST_STEP') === false) {
define('LAST_STEP', 3);
}
if ($duplicate_template) {
$source_id = (int) get_parameter('source_id');
@ -368,17 +370,19 @@ function update_template($step)
}
$is_central_policies_on_node = is_central_policies_on_node();
$is_management_allowed = is_management_allowed();
if ($is_central_policies_on_node === true) {
if ($is_management_allowed === false) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
__(
'This node is configured with centralized mode. All alerts templates information is read only. Go to Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_template&pure=0&id='.$id.'&step='.$step
).'">'.__('metaconsole').'</a>'
)
);
}
// We set here the number of steps.
define('LAST_STEP', 3);
$step = (int) get_parameter('step', 1);
$create_alert = (bool) get_parameter('create_alert');
@ -609,7 +613,7 @@ if ($step == 2) {
1,
$monday,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[0][1] .= __('Tue');
$table->data[0][1] .= html_print_checkbox(
@ -617,7 +621,7 @@ if ($step == 2) {
1,
$tuesday,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[0][1] .= __('Wed');
$table->data[0][1] .= html_print_checkbox(
@ -625,7 +629,7 @@ if ($step == 2) {
1,
$wednesday,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[0][1] .= __('Thu');
$table->data[0][1] .= html_print_checkbox(
@ -633,7 +637,7 @@ if ($step == 2) {
1,
$thursday,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[0][1] .= __('Fri');
$table->data[0][1] .= html_print_checkbox(
@ -641,7 +645,7 @@ if ($step == 2) {
1,
$friday,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[0][1] .= __('Sat');
$table->data[0][1] .= html_print_checkbox(
@ -649,7 +653,7 @@ if ($step == 2) {
1,
$saturday,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[0][1] .= __('Sun');
$table->data[0][1] .= html_print_checkbox(
@ -657,7 +661,7 @@ if ($step == 2) {
1,
$sunday,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[0][2] = __('Use special days list');
@ -666,7 +670,7 @@ if ($step == 2) {
1,
$special_day,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[1][0] = __('Time from');
@ -687,7 +691,7 @@ if ($step == 2) {
'',
'',
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[1][2] = __('Time to');
$table->data[1][3] = html_print_input_text(
@ -707,7 +711,7 @@ if ($step == 2) {
'',
'',
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->colspan['threshold'][1] = 3;
@ -723,7 +727,7 @@ if ($step == 2) {
false,
true,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[3][0] = __('Min. number of alerts');
@ -744,7 +748,7 @@ if ($step == 2) {
'',
'',
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[3][2] = __('Reset counter for non-sustained alerts');
@ -757,7 +761,7 @@ if ($step == 2) {
1,
$min_alerts_reset_counter,
true,
($is_central_policies_on_node | $disabled),
(!$is_management_allowed | $disabled),
'',
false,
$create_template == 1 ? 'checked=checked' : ''
@ -781,7 +785,7 @@ if ($step == 2) {
'',
'',
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[4][2] = __('Disable event');
@ -790,7 +794,7 @@ if ($step == 2) {
1,
$disable_event,
true,
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[5][0] = __('Default action');
@ -818,7 +822,7 @@ if ($step == 2) {
true,
false,
false,
($is_central_policies_on_node | $disabled),
(!$is_management_allowed | $disabled),
false,
false,
0
@ -840,7 +844,7 @@ if ($step == 2) {
false,
false,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'class="invisible"').'>';
$table->data[6][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true);
@ -949,7 +953,7 @@ if ($step == 2) {
false,
false,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->colspan[0][1] = 2;
@ -975,7 +979,7 @@ if ($step == 2) {
0,
'',
false,
($is_central_policies_on_node | $disabled),
(!$is_management_allowed | $disabled),
"removeTinyMCE('textarea_field".$i."')",
'',
true
@ -988,7 +992,7 @@ if ($step == 2) {
0,
'',
true,
($is_central_policies_on_node | $disabled),
(!$is_management_allowed | $disabled),
"addTinyMCE('textarea_field".$i."')",
'',
true
@ -1004,7 +1008,7 @@ if ($step == 2) {
'class="fields" min-height-40px',
true,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
// Recovery.
@ -1016,7 +1020,7 @@ if ($step == 2) {
0,
'',
false,
($is_central_policies_on_node | $disabled),
(!$is_management_allowed | $disabled),
"removeTinyMCE('textarea_field".$i."_recovery')",
'',
true
@ -1029,7 +1033,7 @@ if ($step == 2) {
0,
'',
true,
($is_central_policies_on_node | $disabled),
(!$is_management_allowed | $disabled),
"addTinyMCE('textarea_field".$i."_recovery')",
'',
true
@ -1045,7 +1049,7 @@ if ($step == 2) {
'class="fields min-height-40px"',
true,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
}
} else {
@ -1102,7 +1106,7 @@ if ($step == 2) {
'',
'',
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
@ -1134,7 +1138,7 @@ if ($step == 2) {
false,
true,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
).'</div>';
@ -1147,7 +1151,7 @@ if ($step == 2) {
'',
true,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
$table->data[2][0] = __('Priority');
@ -1162,7 +1166,7 @@ if ($step == 2) {
false,
false,
'',
($is_central_policies_on_node | $disabled)
(!$is_management_allowed | $disabled)
);
if (defined('METACONSOLE')) {
@ -1200,7 +1204,7 @@ if ($id) {
}
if (!$disabled) {
if ($is_central_policies_on_node === false) {
if ($is_management_allowed === true) {
if ($step >= LAST_STEP) {
html_print_submit_button(
__('Finish'),

View File

@ -1,40 +1,55 @@
<?php
/**
* Category.
*
* @category Category
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Load global vars.
global $config;
// Check login and ACLs
// Check login and ACLs.
check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
db_pandora_audit('ACL Violation', 'Trying to access Categories Management');
include 'general/noaccess.php';
return;
}
// Include functions code
// Include functions code.
require_once $config['homedir'].'/include/functions_categories.php';
// Get parameters
// Get parameters.
$delete = (int) get_parameter('delete_category', 0);
$search = (int) get_parameter('search_category', 0);
$category_name = (string) get_parameter('category_name', '');
$tab = (string) get_parameter('tab', 'list');
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$buttons = [
'list' => [
'active' => false,
@ -66,34 +81,47 @@ if (defined('METACONSOLE')) {
$buttons[$tab]['active'] = true;
// Header
if (defined('METACONSOLE')) {
// Header.
if (is_metaconsole() === true) {
ui_meta_print_header(__('Categories configuration'), __('List'), $buttons);
} else {
ui_print_page_header(__('Categories configuration'), 'images/gm_modules.png', false, '', true, $buttons);
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
ui_print_warning_message(
__(
'This node is configured with centralized mode. All categories information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>'
)
);
}
// Two actions can performed in this page: search and delete categories
// Delete action: This will delete a category
if ($delete != 0) {
// Delete action: This will delete a category.
if ($is_management_allowed === true && $delete != 0) {
$return_delete = categories_delete_category($delete);
if (!$return_delete) {
db_pandora_audit('Category management', "Fail try to delete category #$delete");
db_pandora_audit('Category management', 'Fail try to delete category #'.$delete);
ui_print_error_message(__('Error deleting category'));
} else {
db_pandora_audit('Category management', "Delete category #$delete");
db_pandora_audit('Category management', 'Delete category #'.$delete);
ui_print_success_message(__('Successfully deleted category'));
}
}
// statements for pagination
// Statements for pagination.
$url = ui_get_url_refresh();
$total_categories = categories_get_category_count();
$filter['offset'] = (int) get_parameter('offset');
$filter['limit'] = (int) $config['block_size'];
// Search action: This will filter the display category view
// Search action: This will filter the display category view.
$result = false;
$result = db_get_all_rows_filter(
@ -104,12 +132,12 @@ $result = db_get_all_rows_filter(
]
);
// Display categories previously filtered or not
// Display categories previously filtered or not.
$rowPair = true;
$iterator = 0;
if (!empty($result)) {
// Prepare pagination
if (empty($result) === false) {
// Prepare pagination.
ui_pagination($total_categories, $url);
$table = new stdClass();
@ -123,7 +151,9 @@ if (!empty($result)) {
$table->style[0] = 'font-weight: bold; text-align:left';
$table->style[1] = 'text-align:center; width: 100px;';
$table->head[0] = __('Category name');
$table->head[1] = __('Actions');
if ($is_management_allowed === true) {
$table->head[1] = __('Actions');
}
foreach ($result as $category) {
if ($rowPair) {
@ -137,7 +167,7 @@ if (!empty($result)) {
$data = [];
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$data[0] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>';
$data[1] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image(
'images/config.png',
@ -150,18 +180,25 @@ if (!empty($result)) {
['title' => 'Delete']
).'</a>';
} else {
$data[0] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>';
$table->cellclass[][1] = 'action_buttons';
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image(
'images/config.png',
true,
['title' => 'Edit']
).'</a>';
$data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
'images/cross.png',
true,
['title' => 'Delete']
).'</a>';
if ($is_management_allowed === true) {
$data[0] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>';
} else {
$data[0] = $category['name'];
}
if ($is_management_allowed === true) {
$table->cellclass[][1] = 'action_buttons';
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image(
'images/config.png',
true,
['title' => 'Edit']
).'</a>';
$data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
'images/cross.png',
true,
['title' => 'Delete']
).'</a>';
}
}
array_push($table->data, $data);
@ -170,21 +207,23 @@ if (!empty($result)) {
html_print_table($table);
ui_pagination($total_categories, $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
} else {
// No categories available or selected
// No categories available or selected.
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);
}
// Form to add new categories or search categories
echo "<div class='w100p right_align'>";
if (defined('METACONSOLE')) {
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
} else {
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
}
if ($is_management_allowed === true) {
// Form to add new categories or search categories.
echo "<div class='w100p right_align'>";
if (is_metaconsole() === true) {
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
} else {
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
}
html_print_input_hidden('create_category', '1', true);
html_print_submit_button(__('Create category'), 'create_button', false, 'class="sub next"');
echo '</form>';
echo '</div>';
echo '</div>';
enterprise_hook('close_meta_frame');
enterprise_hook('close_meta_frame');
}

View File

@ -263,15 +263,7 @@ if (defined('METACONSOLE')) {
$sec = 'gagente';
}
if (isset($config['metaconsole_node_id']) && $config['metaconsole_node_id'] > 0) {
if (isset($config['metaconsole_agent_cache']) && $config['metaconsole_agent_cache'] == 1) {
$confirm_bottom = " onsubmit=' return message_check_create();'";
}
} else {
$confirm_bottom = '';
}
echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'"'.$confirm_bottom.' >';
echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'" >';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_button(__('Back'), 'button_back', false, '', 'class="sub cancel"');
@ -291,15 +283,6 @@ enterprise_hook('close_meta_frame');
?>
<script language="javascript" type="text/javascript">
function message_check_create() {
var return_value = false;
return_value = confirm("<?php echo __("WARNING: You\'re trying to create a group in a node member of a metaconsole.\\n\\nThis group and all of this contents will not be visible in the metaconsole.\\n\\nIf you want to create a visible group, you must do it from the metaconsole and propagate to the node. "); ?>");
return return_value;
}
function icon_changed () {
var inputs = [];
var data = this.value;

View File

@ -379,6 +379,19 @@ if (is_metaconsole() === true) {
);
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
ui_print_warning_message(
__(
'This node is configured with centralized mode. All groups information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/groups/group_list&tab=groups'
).'">'.__('metaconsole').'</a>'
)
);
}
// Load credential store view before parse list-tree forms.
if ($tab == 'credbox') {
include_once __DIR__.'/credential_store.php';
@ -392,7 +405,10 @@ $delete_group = (bool) get_parameter('delete_group');
$pure = get_parameter('pure', 0);
// Create group.
if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
if ($is_management_allowed === true
&& $create_group === true
&& ((bool) check_acl($config['id_user'], 0, 'PM') === true)
) {
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
$id_parent = (int) get_parameter('id_parent');
@ -448,7 +464,7 @@ if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true))
}
// Update group.
if ($update_group) {
if ($is_management_allowed === true && $update_group === true) {
$id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
@ -520,7 +536,10 @@ if ($update_group) {
}
// Delete group.
if (($delete_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
if ($is_management_allowed === true
&& $delete_group === true
&& ((bool) check_acl($config['id_user'], 0, 'PM') === true)
) {
$id_group = (int) get_parameter('id_group');
$usedGroup = groups_check_used($id_group);
@ -701,7 +720,6 @@ if (($delete_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true))
}
}
// Credential store is loaded previously in this document to avoid
// process group tree - list forms.
if ($tab == 'tree') {
@ -817,15 +835,24 @@ if ($tab == 'tree') {
$table->headstyle[4] = 'min-width: 100px;';
$table->head[5] = __('Description');
$table->headstyle[5] = 'min-width: 100px;';
$table->head[6] = __('Actions');
$table->headstyle[6] = 'min-width: 100px;';
if ($is_management_allowed === true) {
$table->head[6] = __('Actions');
$table->headstyle[6] = 'min-width: 100px;';
}
$table->align = [];
$table->align[0] = 'left';
$table->align[2] = 'left';
$table->align[6] = 'left';
if ($is_management_allowed === true) {
$table->align[6] = 'left';
}
$table->size[0] = '3%';
$table->size[5] = '30%';
$table->size[6] = '5%';
if ($is_management_allowed === true) {
$table->size[6] = '5%';
}
$table->data = [];
foreach ($groups as $key => $group) {
@ -837,7 +864,12 @@ if ($tab == 'tree') {
}
$table->data[$key][0] = $group['id_grupo'];
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
if ($is_management_allowed === true) {
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
} else {
$table->data[$key][1] = $group['nombre'];
}
if ($group['icon'] != '') {
$table->data[$key][2] = html_print_image(
'images/groups_small/'.$group['icon'].'.png',
@ -862,36 +894,38 @@ if ($tab == 'tree') {
$table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
$table->data[$key][4] = $group['parent_name'];
$table->data[$key][5] = $group['description'];
$table->cellclass[$key][6] = 'action_buttons';
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
'images/config.png',
true,
[
'alt' => __('Edit'),
'title' => __('Edit'),
'border' => '0',
]
).'</a>';
if ($is_management_allowed === true) {
$table->cellclass[$key][6] = 'action_buttons';
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
'images/config.png',
true,
[
'alt' => __('Edit'),
'title' => __('Edit'),
'border' => '0',
]
).'</a>';
if (is_metaconsole() === true) {
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
} else {
$confirm_message = __('Are you sure?');
if (is_metaconsole() === true) {
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
} else {
$confirm_message = __('Are you sure?');
}
if ($group['has_child']) {
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
}
$table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image(
'images/cross.png',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'border' => '0',
]
).'</a>';
}
if ($group['has_child']) {
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
}
$table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image(
'images/cross.png',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'border' => '0',
]
).'</a>';
}
echo ui_pagination(
@ -924,7 +958,10 @@ if ($tab == 'tree') {
}
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
if ($is_management_allowed === true
&& (bool) check_acl($config['id_user'], 0, 'PM') === true
) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group">';
echo '<div class="action-buttons w100p">';
html_print_submit_button(__('Create group'), 'crt', false, 'class="sub next"');

View File

@ -1,9 +1,8 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
* Module Groups.
*
* @category Extensions
* @category Module groups
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
@ -40,7 +39,7 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
return;
}
if (is_ajax()) {
if (is_ajax() === true) {
$get_group_json = (bool) get_parameter('get_group_json');
$get_group_agents = (bool) get_parameter('get_group_agents');
@ -65,7 +64,7 @@ if (is_ajax()) {
return;
}
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
// Header.
ui_print_page_header(
__('Module groups defined in %s', get_product_name()),
@ -77,12 +76,25 @@ if (!is_metaconsole()) {
);
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
ui_print_warning_message(
__(
'This node is configured with centralized mode. All module groups information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management&tab=module_group'
).'">'.__('metaconsole').'</a>'
)
);
}
$create_group = (bool) get_parameter('create_group');
$update_group = (bool) get_parameter('update_group');
$delete_group = (bool) get_parameter('delete_group');
// Create group.
if ($create_group) {
if ($is_management_allowed === true && $create_group === true) {
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
$id_parent = (int) get_parameter('id_parent');
@ -115,7 +127,7 @@ if ($create_group) {
}
// Update group.
if ($update_group) {
if ($is_management_allowed === true && $update_group === true) {
$id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
@ -151,7 +163,7 @@ if ($update_group) {
}
// Delete group.
if ($delete_group) {
if ($is_management_allowed === true && $delete_group === true) {
$id_group = (int) get_parameter('id_group');
$result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]);
@ -217,7 +229,6 @@ $total_groups = db_get_num_rows('SELECT * FROM tmodule_group');
$url = ui_get_url_refresh(['offset' => false]);
$offset = (int) get_parameter('offset', 0);
$sql = 'SELECT *
FROM tmodule_group
ORDER BY name ASC
@ -229,27 +240,39 @@ $table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
if (!empty($groups)) {
if (empty($groups) === false) {
$table->head = [];
$table->head[0] = __('ID');
$table->head[1] = __('Name');
$table->head[2] = __('Delete');
if ($is_management_allowed === true) {
$table->head[2] = __('Delete');
}
$table->align = [];
$table->align[1] = 'left';
$table->align[2] = 'left';
$table->size[2] = '5%';
if ($is_management_allowed === true) {
$table->align[2] = 'left';
$table->size[2] = '5%';
}
$table->data = [];
foreach ($groups as $id_group) {
$data = [];
$data[0] = $id_group['id_mg'];
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole()) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
if ($is_management_allowed === true) {
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole() === true) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} else {
$table->cellclass[][2] = 'action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
}
} else {
$table->cellclass[][2] = 'action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
$data[1] = '<strong>';
$data[1] .= ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT);
$data[1] .= '</strong>';
}
array_push($table->data, $data);
@ -267,13 +290,15 @@ if (!empty($groups)) {
);
}
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(
__('Create module group'),
'crt',
false,
'class="sub next"'
);
echo '</div>';
echo '</form>';
if ($is_management_allowed === true) {
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(
__('Create module group'),
'crt',
false,
'class="sub next"'
);
echo '</div>';
echo '</form>';
}

View File

@ -38,6 +38,19 @@ if (!check_acl($config['id_user'], 0, 'UM')) {
return;
}
if (is_management_allowed() === false) {
ui_print_warning_message(
__(
'This node is configured with centralized mode. All profiles user information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
return;
}
require_once 'include/functions_agents.php';
require_once 'include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_profile.php';

View File

@ -201,7 +201,7 @@ $table->data[2][1] = html_print_select(
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
html_print_table($table);
if (is_central_policies_on_node() === false) {
if (is_management_allowed() === true) {
attachActionButton('delete', 'delete', $table->width);
}

View File

@ -38,6 +38,19 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
return;
}
if (is_management_allowed() === false) {
ui_print_warning_message(
__(
'This node is configured with centralized mode. All profiles user information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
return;
}
require_once 'include/functions_agents.php';
require_once 'include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_profile.php';

View File

@ -845,11 +845,9 @@ echo '<h3 class="error invisible" id="message"> </h3>';
html_print_input_hidden('id_agente', $id_agente);
if (is_central_policies_on_node() === false) {
attachActionButton('update_agents', 'update', $table->width);
}
attachActionButton('update_agents', 'update', $table->width);
// Shown and hide div
// Shown and hide div.
echo '</div></form>';
ui_require_jquery_file('form');

View File

@ -333,8 +333,15 @@ $agentstab = [
echo '</div>';
}
if ($tab == 'massive_policies' && is_central_policies_on_node()) {
ui_print_warning_message(__('This node is configured with centralized mode. All policies information is read only. Go to metaconsole to manage it.'));
if ($tab == 'massive_policies' && is_management_allowed() === false) {
ui_print_warning_message(
__(
'This node is configured with centralized mode. All policies information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/policymanager'
).'">'.__('metaconsole').'</a>'
)
);
return;
}
@ -393,8 +400,15 @@ $agentstab = [
</script>
<?php
if (is_central_policies_on_node() && $option == 'delete_agents') {
ui_print_warning_message(__('This node is configured with centralized mode. To delete an agent go to metaconsole.'));
if (is_management_allowed() === false && $option == 'delete_agents') {
ui_print_warning_message(
__(
'This node is configured with centralized mode. To delete agents go to %s',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=monitoring&sec2=monitoring/wizard/wizard'
).'">'.__('metaconsole').'</a>'
)
);
}
echo '<br />';

View File

@ -282,13 +282,16 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, '
$sub['godmode/servers/modificar_server']['id'] = 'Manage servers';
}
// This subtabs are only for Pandora Admin
// This subtabs are only for Pandora Admin.
if (check_acl($config['id_user'], 0, 'PM')) {
enterprise_hook('ha_cluster');
$sub['godmode/servers/plugin']['text'] = __('Plugins');
$sub['godmode/servers/plugin']['id'] = 'Plugins';
$sub['godmode/servers/plugin_registration']['text'] = __('Register Plugin');
$sub['godmode/servers/plugin_registration']['id'] = 'register_plugin';
enterprise_hook('export_target_submenu');
enterprise_hook('manage_satellite_submenu');
@ -522,10 +525,8 @@ if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager'])
$menu_godmode['messages']['id'] = 'god-um_messages';
$sub = [];
if ($config['enterprise_installed']) {
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline');
$sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline';
}
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline');
$sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline';
$sub['godmode/update_manager/update_manager&tab=online']['text'] = __('Update Manager online');
$sub['godmode/update_manager/update_manager&tab=online']['id'] = 'Online';

View File

@ -255,7 +255,7 @@ foreach ($groups as $group) {
$tabulation = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $group['deep']);
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$data[0] = $tabulation.'<a href="index.php?sec=advanced&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>';
} else {
$data[0] = $tabulation.'<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>';
@ -270,8 +270,15 @@ foreach ($groups as $group) {
array_push($table->data, $data);
}
if (is_management_allowed() === false && !is_metaconsole()) {
ui_print_warning_message(__('This node is configured with centralized mode. This page is for read only. Go to metaconsole to manage the component groups.'));
if (is_management_allowed() === false && is_metaconsole() === false) {
ui_print_warning_message(
__(
'This node is configured with centralized mode. Component groups are read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/modules/manage_nc_groups'
).'">'.__('metaconsole').'</a>'
)
);
}
if (isset($data)) {

View File

@ -1,9 +1,8 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
* Remote components
*
* @category Extensions
* @category Remote Components
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
@ -48,7 +47,7 @@ enterprise_include_once('meta/include/functions_components_meta.php');
require_once $config['homedir'].'/include/functions_component_groups.php';
// Header.
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$sec = 'advanced';
$id_modulo = (int) get_parameter('id_component_type');
@ -67,6 +66,11 @@ if (defined('METACONSOLE')) {
$sec = 'gmodules';
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
}
$type = (int) get_parameter('type');
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
@ -87,7 +91,7 @@ $macros = (string) get_parameter('macros');
$id_modulo = (int) get_parameter('id_component_type');
$new_component = (bool) get_parameter('new_component');
if (!empty($macros)) {
if (empty($macros) === false) {
$macros = json_decode(base64_decode($macros), true);
foreach ($macros as $k => $m) {
@ -179,7 +183,7 @@ $create_network_from_snmp_browser = (bool) get_parameter(
0
);
if ($duplicate_network_component) {
if ($is_management_allowed === true && $duplicate_network_component) {
$source_id = (int) get_parameter('source_id');
$id = network_components_duplicate_network_component($source_id);
@ -267,7 +271,7 @@ $custom_string_2 = '';
$custom_string_3 = '';
// Header.
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
components_meta_print_header();
$sec = 'advanced';
} else {
@ -292,6 +296,17 @@ if (defined('METACONSOLE')) {
$sec = 'gmodules';
}
if ($is_management_allowed === false) {
ui_print_warning_message(
__(
'This node is configured with centralized mode. All remote components are read only. Go to %s to manage them.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/modules/manage_network_components&tab=network&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
}
if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
// New support for snmp v3.
$tcp_send = $snmp_version;
@ -307,7 +322,7 @@ if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
$custom_string_2 = $command_os;
}
if ($create_component) {
if ($is_management_allowed === true && $create_component) {
$name_check = db_get_value(
'name',
'tnetwork_component',
@ -410,7 +425,7 @@ if ($create_component) {
$id = 0;
}
if ($update_component) {
if ($is_management_allowed === true && $update_component) {
$id = (int) get_parameter('id');
if (!empty($name)) {
@ -502,7 +517,7 @@ if ($update_component) {
$id = 0;
}
if ($delete_component) {
if ($is_management_allowed === true && $delete_component) {
$id = (int) get_parameter('id');
$result = network_components_delete_network_component($id);
@ -527,7 +542,7 @@ if ($delete_component) {
$id = 0;
}
if ($multiple_delete) {
if ($is_management_allowed === true && $multiple_delete) {
$ids = (array) get_parameter('delete_multiple', []);
foreach ($ids as $id) {
@ -645,7 +660,7 @@ $table->data[0][3] = html_print_input_text(
255,
true
);
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$table->data[0][4] = '<div>';
} else {
$table->data[0][4] = '<div class="action-buttons">';
@ -660,7 +675,7 @@ $table->data[0][4] .= html_print_submit_button(
);
$table->data[0][4] .= '</div>';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$filter = '<form class="filters_form" method="post" action="'.$url.'">';
$filter .= html_print_table($table, true);
$filter .= '</form>';
@ -713,26 +728,38 @@ unset($table);
$table->width = '100%';
$table->head = [];
$table->class = 'info_table';
$table->head['checkbox'] = html_print_checkbox(
'all_delete',
0,
false,
true,
false
);
if ($is_management_allowed === true) {
$table->head['checkbox'] = html_print_checkbox(
'all_delete',
0,
false,
true,
false
);
}
$table->head[0] = __('Module name');
$table->head[1] = __('Server');
$table->head[2] = __('Type');
$table->head[3] = __('Description');
$table->head[4] = __('Group');
$table->head[5] = __('Max/Min');
$table->head[6] = __('Action');
if ($is_management_allowed === true) {
$table->head[6] = __('Action');
}
$table->size = [];
$table->size['checkbox'] = '20px';
if ($is_management_allowed === true) {
$table->size['checkbox'] = '20px';
}
$table->size[1] = '40px';
$table->size[2] = '50px';
$table->size[6] = '80px';
$table->align[6] = 'left';
if ($is_management_allowed === true) {
$table->size[6] = '80px';
$table->align[6] = 'left';
}
$table->data = [];
foreach ($components as $component) {
@ -743,19 +770,24 @@ foreach ($components as $component) {
$component['min'] = __('N/A');
}
$data['checkbox'] = html_print_checkbox_extended(
'delete_multiple[]',
$component['id_nc'],
false,
false,
'',
'class="check_delete"',
true
);
if ($is_management_allowed === true) {
$data['checkbox'] = html_print_checkbox_extended(
'delete_multiple[]',
$component['id_nc'],
false,
false,
'',
'class="check_delete"',
true
);
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
$data[0] .= io_safe_output($component['name']);
$data[0] .= '</a>';
} else {
$data[0] = io_safe_output($component['name']);
}
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
$data[0] .= io_safe_output($component['name']);
$data[0] .= '</a>';
switch ($component['id_modulo']) {
case MODULE_NETWORK:
$data[1] .= html_print_image(
@ -811,32 +843,37 @@ foreach ($components as $component) {
$data[4] = network_components_get_group_name($component['id_group']);
$data[5] = $component['max'].' / '.$component['min'];
$table->cellclass[][6] = 'action_buttons';
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image(
'images/copy.png',
true,
[
'alt' => __('Duplicate'),
'title' => __('Duplicate'),
'class' => 'invert_filter',
]
).'</a>';
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
'images/cross.png',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'class' => 'invert_filter',
]
).'</a>';
if ($is_management_allowed === true) {
$table->cellclass[][6] = 'action_buttons';
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image(
'images/copy.png',
true,
[
'alt' => __('Duplicate'),
'title' => __('Duplicate'),
'class' => 'invert_filter',
]
).'</a>';
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
'images/cross.png',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'class' => 'invert_filter',
]
).'</a>';
}
array_push($table->data, $data);
}
if (isset($data)) {
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
html_print_input_hidden('multiple_delete', 1);
if (isset($data) === true) {
if ($is_management_allowed === true) {
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
html_print_input_hidden('multiple_delete', 1);
}
html_print_table($table);
ui_pagination(
$total_components,
@ -848,15 +885,17 @@ if (isset($data)) {
true,
'pagination-bottom'
);
echo "<div id='btn_delete_5' class='float-right'>";
html_print_submit_button(
__('Delete'),
'delete_btn',
false,
'class="sub delete"'
);
echo '</div>';
echo '</form>';
if ($is_management_allowed === true) {
echo "<div id='btn_delete_5' class='float-right'>";
html_print_submit_button(
__('Delete'),
'delete_btn',
false,
'class="sub delete"'
);
echo '</div>';
echo '</form>';
}
} else {
ui_print_info_message(
[
@ -866,31 +905,33 @@ if (isset($data)) {
);
}
echo '<form method="post" action="'.$url.'">';
echo '<div class="right_align mrgn_btn_15px">';
html_print_input_hidden('new_component', 1);
html_print_select(
[
COMPONENT_TYPE_NETWORK => __('Create a new network component'),
COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'),
COMPONENT_TYPE_WMI => __('Create a new WMI component'),
COMPONENT_TYPE_WIZARD => __('Create a new wizard component'),
],
'id_component_type',
'',
'',
'',
'',
''
);
html_print_submit_button(
__('Create'),
'crt',
false,
'class="sub next mrgn_lft_5px"'
);
echo '</div>';
echo '</form>';
if ($is_management_allowed === true) {
echo '<form method="post" action="'.$url.'">';
echo '<div class="right_align mrgn_btn_15px">';
html_print_input_hidden('new_component', 1);
html_print_select(
[
COMPONENT_TYPE_NETWORK => __('Create a new network component'),
COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'),
COMPONENT_TYPE_WMI => __('Create a new WMI component'),
COMPONENT_TYPE_WIZARD => __('Create a new wizard component'),
],
'id_component_type',
'',
'',
'',
'',
''
);
html_print_submit_button(
__('Create'),
'crt',
false,
'class="sub next mrgn_lft_5px"'
);
echo '</div>';
echo '</form>';
}
enterprise_hook('close_meta_frame');

View File

@ -182,6 +182,7 @@ if (isset($id)) {
$snmp3_privacy_pass = io_output_password(
$component['custom_string_2']
);
unset($tcp_send);
$snmp3_security_level = $component['custom_string_3'];
} else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) {
$command_text = $component['tcp_send'];

View File

@ -408,14 +408,14 @@ $next_row++;
){
if (language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos',
'https://pandorafms.com/manual/es/documentation/03_monitoring/02_operations#tipos_de_modulos',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
'https://pandorafms.com/manual/en/documentation/03_monitoring/02_operations#types_of_modules',
'_blank',
'width=800,height=600'
);
@ -428,14 +428,14 @@ $next_row++;
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
'https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizacion_icmp',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#icmp_monitoring',
'_blank',
'width=800,height=600'
);
@ -450,14 +450,14 @@ $next_row++;
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
'https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizando_con_modulos_de_red_tipo_snmp',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring&printable=yes#monitoring_through_network_modules_with_snmp',
'_blank',
'width=800,height=600'
);
@ -472,14 +472,14 @@ $next_row++;
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
'https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizacion_tcp',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring&printable=yes#tcp_monitoring',
'_blank',
'width=800,height=600'
);
@ -494,14 +494,14 @@ $next_row++;
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
'https://pandorafms.com/manual/es/documentation/03_monitoring/06_web_monitoring#creacion_de_modulos_web',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
'https://pandorafms.com/manual/en/documentation/03_monitoring/06_web_monitoring#creating_web_modules',
'_blank',
'width=800,height=600'
);

View File

@ -331,9 +331,9 @@ echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters'>";
echo '<tr>';
echo "<td colspan='3'>".__('Filter group').'</td>';
echo "<td colspan='1'>".__('Filter group').'</td>';
echo '</tr><tr>';
echo "<td colspan='3'>".html_print_select_groups(
echo "<td colspan='1'>".html_print_select_groups(
$config['id_user'],
($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RW'),
true,

View File

@ -160,7 +160,7 @@ $pure = get_parameter('pure', 0);
$schedule_report = get_parameter('schbutton', '');
$pagination = (int) get_parameter('pagination', $config['block_size']);
if ($action == 'edit' && $idReport > 0) {
if ($action === 'edit' && $idReport > 0) {
$report_group = db_get_value(
'id_group',
'treport',
@ -451,6 +451,14 @@ switch ($action) {
} else {
$resultOperationDB = false;
}
header(
sprintf(
'Location: %sindex.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=%d',
$config['homeurl'],
$idReport
)
);
break;
case 'delete_items_pos':
@ -514,6 +522,7 @@ switch ($action) {
}
break;
case 'copy_report':
case 'delete_report':
case 'list':
$buttons = [
@ -666,6 +675,81 @@ switch ($action) {
);
}
if ($action === 'copy_report') {
$copy = false;
switch ($type_access_selected) {
case 'group_view':
if ($config['id_user'] == $report['id_user']
|| is_user_admin($config['id_user'])
) {
$copy = true;
// Owner can delete.
} else {
$copy = check_acl(
$config['id_user'],
$report['id_group'],
'RM'
);
}
break;
case 'group_edit':
if ($config['id_user'] == $report['id_user']
|| is_user_admin($config['id_user'])
) {
$copy = true;
// Owner can delete.
} else {
$copy = check_acl(
$config['id_user'],
$report['id_group'],
'RM'
);
}
break;
case 'user_edit':
if ($config['id_user'] == $report['id_user']
|| is_user_admin($config['id_user'])
) {
$copy = true;
}
break;
default:
// Default.
break;
}
if (! $copy && !empty($type_access_selected)) {
db_pandora_audit(
'ACL Violation',
'Trying to access report builder copy'
);
include 'general/noaccess.php';
exit;
}
$result = reports_copy_report($idReport);
if ($result !== false) {
db_pandora_audit(
'Report management',
'Copy report #'.$idReport
);
} else {
db_pandora_audit(
'Report management',
'Fail try to copy report #'.$idReport
);
}
ui_print_result_message(
$result,
__('Successfully copied'),
__('Could not be copied')
);
}
$id_group = (int) get_parameter('id_group', 0);
$search = trim(get_parameter('search', ''));
@ -1101,6 +1185,27 @@ switch ($action) {
$data[$next] .= '</form>';
}
$data[$next] .= '<form method="post" style="display: inline"; onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[$next] .= html_print_input_hidden(
'id_report',
$report['id_report'],
true
);
$data[$next] .= html_print_input_hidden(
'action',
'copy_report',
true
);
$data[$next] .= html_print_input_image(
'dup',
'images/copy.png',
1,
'',
true,
['title' => __('Duplicate')]
);
$data[$next] .= '</form> ';
if ($delete) {
$data[$next] .= '<form method="post" class="inline_line" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[$next] .= html_print_input_image(
@ -3349,7 +3454,7 @@ if ($resultOperationDB !== null) {
$textReportName,
'images/op_reporting.png',
false,
$helpers,
'',
false,
$buttons,
[

View File

@ -222,6 +222,9 @@ $table->data[5][1] .= '<span class="opt" style="visibility:hidden;">
$table->data[6][0] = __('Favourite visual console');
$table->data[6][1] = html_print_checkbox('is_favourite', 0, $is_favourite, true);
$table->data[7][0] = __('Auto adjust to screen in fullscreen');
$table->data[7][1] = html_print_checkbox('auto_adjust', 0, $auto_adjust, true);
if ($action == 'new') {
$textButtonSubmit = __('Save');
$classButtonSubmit = 'sub wand';
@ -426,6 +429,22 @@ $(document).ready (function () {
$("#hidden-is_favourite_sent").val(0);
}
});
if($("#checkbox-auto_adjust").is(":checked")) {
$("#hidden-auto_adjust_sent").val(1);
}
else{
$("#hidden-auto_adjust_sent").val(0);
}
$("#checkbox-auto_adjust").change(function(){
if($(this).is(":checked")) {
$("#hidden-auto_adjust_sent").val(1);
}
else{
$("#hidden-auto_adjust_sent").val(0);
}
});
function metaconsole_url() {
metaconsole = $("input[name='metaconsole_activated']").val();

View File

@ -151,6 +151,7 @@ switch ($activeTab) {
$height = '';
$visualConsoleName = '';
$is_favourite = 0;
$auto_adjust = 0;
break;
case 'update':
@ -162,6 +163,7 @@ switch ($activeTab) {
$height = (int) get_parameter('height');
$visualConsoleName = (string) get_parameter('name');
$is_favourite = (int) get_parameter('is_favourite_sent');
$auto_adjust = (int) get_parameter('auto_adjust_sent');
// ACL for the new visual console
// $vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
@ -186,6 +188,7 @@ switch ($activeTab) {
'width' => $width,
'height' => $height,
'is_favourite' => $is_favourite,
'auto_adjust' => $auto_adjust,
];
$error = $_FILES['background_image']['error'];
@ -353,6 +356,7 @@ switch ($activeTab) {
$width = $visualConsole['width'];
$height = $visualConsole['height'];
$is_favourite = $visualConsole['is_favourite'];
$auto_adjust = $visualConsole['auto_adjust'];
break;
}
break;

View File

@ -1,19 +1,36 @@
<?php
/**
* Manage plugins.
*
* @category Utility
* @package Pandora FMS
* @subpackage Plugins
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Begin.
global $config;
require_once $config['homedir'].'/include/functions_plugins.php';
if (is_ajax()) {
$get_plugin_description = get_parameter('get_plugin_description');
$get_list_modules_and_component_locked_plugin = (bool) get_parameter('get_list_modules_and_component_locked_plugin', 0);
@ -112,7 +129,6 @@ $edit_file = get_parameter('edit_file', false);
$update_file = get_parameter('update_file', false);
$plugin_command = get_parameter('plugin_command', '');
$tab = get_parameter('tab', '');
$deploy_plugin = get_parameter('deploy_plugin', 0);
if ($view != '') {
$form_id = $view;
@ -283,11 +299,12 @@ $sec = 'gservers';
if (($create != '') || ($view != '')) {
enterprise_hook('open_meta_frame');
$management_allowed = is_management_allowed();
if (defined('METACONSOLE')) {
components_meta_print_header();
$sec = 'advanced';
$management_allowed = is_management_allowed();
if (!$management_allowed) {
if ($management_allowed === false) {
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
}
} else {
@ -309,8 +326,7 @@ if (($create != '') || ($view != '')) {
);
}
$management_allowed = !is_central_policies_on_node();
if (!$management_allowed) {
if ($management_allowed === false) {
ui_print_warning_message(
__(
'This console is not manager of this environment,
@ -619,36 +635,6 @@ if (($create != '') || ($view != '')) {
__('To manage plugin you must activate centralized management')
);
}
if (!$config['metaconsole_deploy_plugin_server'] && $management_allowed) {
$deploy_plugin_server = true;
echo '<div id="deploy_messages" class="invisible">';
echo '<span>'.__('The previous configuration of plugins has been imported from the nodes. Please check that the definitions are correct.').'</br></br>'.'<b>'.__('Note:').'</b>'.__(
'These definitions will not be operational until you manually
copy the files from the nodes to the atachment/plugin/ directory of the meta console.'
).'</br></br>'.__('You can find more information at:')."<a href='https://wiki.pandorafms.com'>https://wiki.pandorafms.com</a>".'</span>';
echo '</div>';
?>
<script type="text/javascript">
$(document).ready(function () {
$("#deploy_messages").dialog({
resizable: true,
draggable: true,
modal: true,
height: 220,
title: '<?php echo __('Warning'); ?>',
width: 528,
overlay: {
opacity: 0.5,
background: "black"
}
});
});
</script>
<?php
config_update_value('metaconsole_deploy_plugin_server', 1);
}
} else {
ui_print_page_header(
__(
@ -661,8 +647,8 @@ if (($create != '') || ($view != '')) {
true
);
$management_allowed = !is_central_policies_on_node();
if (!$management_allowed) {
$management_allowed = is_management_allowed();
if ($management_allowed === false) {
ui_print_warning_message(
__(
'This console is not manager of this environment,
@ -820,180 +806,20 @@ if (($create != '') || ($view != '')) {
}
}
if ($plugin_id != 0) {
// Delete all the modules with this plugin
$plugin_modules = db_get_all_rows_filter(
'tagente_modulo',
['id_plugin' => $plugin_id]
);
if (empty($plugin_modules)) {
$plugin_modules = [];
}
foreach ($plugin_modules as $pm) {
modules_delete_agent_module($pm['id_agente_modulo']);
}
if (enterprise_installed()) {
enterprise_include_once('include/functions_policies.php');
$policies_ids = db_get_all_rows_filter('tpolicy_modules', ['id_plugin' => $plugin_id]);
foreach ($policies_ids as $policies_id) {
policies_change_delete_pending_module($policies_id['id']);
}
}
if (is_metaconsole()) {
enterprise_include_once('include/functions_plugins.php');
$result = plugins_delete_plugin($plugin_id);
if (!$result) {
ui_print_error_message(__('Problem deleting plugin'));
} else {
ui_print_success_message(__('Plugin deleted successfully'));
}
}
}
}
if ($deploy_plugin) {
if (is_metaconsole()) {
enterprise_include_once('include/functions_plugins.php');
$result = plugins_deploy_plugin($deploy_plugin);
if (!$result) {
ui_print_error_message(__('Problem deploying plugin'));
if ((int) $plugin_id > 0) {
// Delete all iformation related with this plugin.
$result = plugins_delete_plugin($plugin_id);
if (empty($result) === false) {
ui_print_error_message(
implode('<br>', $result)
);
} else {
ui_print_success_message(__('Plugin deployed successfully'));
ui_print_success_message(__('Plugin deleted successfully'));
}
}
}
if ($deploy_plugin_server) {
$setup = db_get_all_rows_in_table('tmetaconsole_setup');
// recorremos todos los nodos.
foreach ($setup as $key => $value) {
// Obtenemos los plugins de la meta.
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
// Conectamos con el nodo.
if (metaconsole_connect($value) == NOERR) {
$values = [];
// Obtenemos los plugin del nodo.
$node_plugin_server = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
foreach ($node_plugin_server as $key2 => $plugin) {
// Comprobamos si el id esta meta y nodo al mismo tiempo.
$key_exists = array_search($plugin['id'], array_column($all_plugin_meta, 'id'));
if ($key_exists !== false) {
// Si el plugin tiene el mismo id pero diferentes datos.
if ($all_plugin_meta[$key_exists] != $plugin) {
$old_id = $plugin['id'];
$new_id = ($plugin['id'] + (1000 * $value['id']));
// El plugin del nodo pasa a tener otro id y otro nombre.
$plugin['id'] = $new_id;
$plugin['name'] = $plugin['name'].'_'.$value['server_name'];
$result_update = db_process_sql_update(
'tplugin',
[
'id' => $new_id,
'name' => $plugin['name'],
],
['id' => $old_id]
);
if ($result_update) {
db_process_sql_update(
'tagente_modulo',
['id_plugin' => $new_id],
['id_plugin' => $old_id]
);
db_process_sql_update(
'tnetwork_component',
['id_plugin' => $new_id],
['id_plugin' => $old_id]
);
db_process_sql_update(
'tpolicy_modules',
['id_plugin' => $new_id],
['id_plugin' => $old_id]
);
}
// New plugins to insert in the metaconsole.
$values[$plugin['id']] = $plugin;
}
} else {
// Exists in the node, but does not exist in the metaconsole.
$values[$plugin['id']] = $plugin;
}
}
// Restore to metaconsole.
metaconsole_restore_db();
// Insert in metaconsole.
if (!empty($values)) {
foreach ($values as $key2 => $val) {
// Insert into metaconsole.
$result_insert = db_process_sql_insert('tplugin', $val);
}
}
}
}
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
foreach ($setup as $key => $value) {
if (metaconsole_connect($value) == NOERR) {
$all_plugin_node = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
$array_diff = array_diff(array_column($all_plugin_meta, 'id'), array_column($all_plugin_node, 'id'));
foreach ($array_diff as $key2 => $pluginid) {
$other = [];
$plugin_meta = $all_plugin_meta[$key2];
unset($plugin_meta['id']);
$other['name'] = urlencode($plugin_meta['name']);
$other['description'] = urlencode($plugin_meta['description']);
$other['max_timeout'] = $plugin_meta['max_timeout'];
$other['max_retries'] = $plugin_meta['max_retries'];
$other['execute'] = urlencode($plugin_meta['execute']);
$other['net_dst_opt'] = $plugin_meta['net_dst_opt'];
$other['net_port_opt'] = $plugin_meta['net_port_opt'];
$other['user_opt'] = $plugin_meta['user_opt'];
$other['pass_opt'] = $plugin_meta['pass_opt'];
$other['plugin_type'] = $plugin_meta['plugin_type'];
$other['macros'] = urlencode($plugin_meta['macros']);
$other['parameters'] = urlencode($plugin_meta['parameters']);
$other = implode('%7E', $other);
$auth_token = json_decode($value['auth_token']);
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7E&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
$file_path = realpath($plugin_meta['execute']);
$post = '';
if (file_exists($file_path)) {
$post = ['file' => curl_file_create($file_path)];
}
$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL, $url);
curl_setopt($curlObj, CURLOPT_POST, 1);
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $post);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
$api_result = curl_exec($curlObj);
curl_close($curlObj);
}
}
// restore to metaconsole
metaconsole_restore_db();
}
}
// If not edition or insert, then list available plugins
// If not edition or insert, then list available plugins.
$rows = db_get_all_rows_sql('SELECT * FROM tplugin ORDER BY name');
if ($rows !== false) {
@ -1081,16 +907,6 @@ if (($create != '') || ($view != '')) {
'class' => 'invert_filter',
]
).'</a>';
if (is_metaconsole()) {
echo "&nbsp;&nbsp;&nbsp;<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&deploy_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image(
'images/deploy.png',
true,
[
'title' => __('Deploy'),
'width' => '21 px',
]
).'</a>&nbsp;&nbsp;';
}
echo '</td>';
}

View File

@ -0,0 +1,571 @@
<?php
/**
* Plugin registration.
*
* @category Plugins
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\Enterprise\Metaconsole\Synchronizer;
use PandoraFMS\Tools\Files;
// Load global vars.
global $config;
// Check ACL and Login.
check_login();
if ((bool) check_acl($config['id_user'], 0, 'PM') === false
|| (bool) check_acl($config['id_user'], 0, 'AW') === false
) {
db_pandora_audit(
'ACL Violation',
'Trying to access Plugin Management'
);
include 'general/noaccess.php';
return;
}
ui_require_css_file('first_task');
if (is_metaconsole() === true) {
enterprise_include_once('meta/include/functions_components_meta.php');
enterprise_hook('open_meta_frame');
components_meta_print_header();
$sec = 'advanced';
$management_allowed = is_management_allowed();
if ($management_allowed === false) {
ui_print_warning_message(
__('To manage plugin you must activate centralized management')
);
return;
}
} else {
ui_print_page_header(
__('PLUGIN REGISTRATION'),
'images/gm_servers.png',
false,
'',
true
);
$management_allowed = is_management_allowed();
if ($management_allowed === false) {
ui_print_warning_message(
__(
'This console is not manager of this environment, please manage this feature from feature from %s.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/servers/plugin_registration&tab=plugin_registration&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
return;
}
}
$str = 'This extension makes registering server plugins an easier task.';
$str .= ' Here you can upload a server plugin in .pspz zipped format.';
$str .= ' Please refer to the official documentation on how to obtain and use Server Plugins.';
$output = '<div class="new_task">';
$output .= '<div class="image_task">';
$output .= html_print_image(
'images/first_task/icono_grande_import.png',
true,
['title' => __('Plugin Registration') ]
);
$output .= '</div>';
$output .= '<div class="text_task">';
$output .= '<h3>'.__('Plugin registration').'</h3>';
$output .= '<p id="description_task">';
$output .= __($str);
$output .= '<br><br>';
$output .= __('You can get more plugins in our');
$output .= '<a href="http://pandorafms.com/Library/Library/">';
$output .= ' '.__('Public Resource Library');
$output .= '</a>';
$output .= '</p>';
// Upload form.
$output .= "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
$output .= '<table class="" id="table1" width="100%" border="0" cellpadding="4" cellspacing="4">';
$output .= "<tr><td class='datos'><input type='file' name='plugin_upload' />";
$output .= "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
$output .= '</form></table>';
$output .= '</div>';
$output .= '</div>';
echo $output;
$zip = null;
$upload = false;
if (isset($_FILES['plugin_upload']) === true) {
$basepath = $config['attachment_store'].'/plugin';
$filename = $_FILES['plugin_upload']['name'];
$uploaded_filename = $_FILES['plugin_upload']['tmp_name'];
$tmp_path = Files::tempdirnam(
$config['attachment_store'].'/downloads/',
'plugin_uploaded_'
);
if ($tmp_path === false) {
$error = __('Failed to create temporary directory');
}
} else {
$error = '';
}
if ($error === null) {
if (Files::unzip($uploaded_filename, $tmp_path) === true) {
// Successfully extracted to tmp directory.
// Grant execution over all files found.
Files::chmod($tmp_path, 0755);
// Operate.
$ini_array = parse_ini_file($tmp_path.'/plugin_definition.ini', true);
// Clean plugin_definition.ini file.
unlink($tmp_path.'/plugin_definition.ini');
// Parse with sections.
if ($ini_array === false) {
$error = __('Cannot load INI file');
} else {
// Relocate files to target destination.
Files::move($tmp_path.'/*', $basepath.'/', true);
// Extract information.
$version = preg_replace('/.*[.]/', '', $filename);
$exec_path = $basepath.'/'.$ini_array['plugin_definition']['filename'];
$file_exec_path = $exec_path;
if (isset($ini_array['plugin_definition']['execution_command']) === true
&& empty($ini_array['plugin_definition']['execution_command']) === false
) {
$exec_path = $ini_array['plugin_definition']['execution_command'];
$exec_path .= ' '.$basepath.'/';
$exec_path .= $ini_array['plugin_definition']['filename'];
}
if (isset($ini_array['plugin_definition']['execution_postcommand']) === true
&& empty($ini_array['plugin_definition']['execution_postcommand']) === false
) {
$exec_path .= ' '.$ini_array['plugin_definition']['execution_postcommand'];
}
if (file_exists($file_exec_path) === false) {
$error = __('Plugin exec not found. Aborting!');
unlink($config['attachment_store'].'/plugin_definition.ini');
} else {
// Verify if a plugin with the same name is already registered.
$sql = sprintf(
'SELECT COUNT(*) FROM tplugin WHERE name = "%s"',
io_safe_input($ini_array['plugin_definition']['name'])
);
$result = db_get_sql($sql);
if ($result > 0) {
$error = __('Plugin already registered. Aborting!');
unlink($config['attachment_store'].'/plugin_definition.ini');
} else {
$values = [
'name' => io_safe_input($ini_array['plugin_definition']['name']),
'description' => io_safe_input($ini_array['plugin_definition']['description']),
'max_timeout' => $ini_array['plugin_definition']['timeout'],
'execute' => io_safe_input($exec_path),
'net_dst_opt' => $ini_array['plugin_definition']['ip_opt'],
'net_port_opt' => $ini_array['plugin_definition']['port_opt'],
'user_opt' => $ini_array['plugin_definition']['user_opt'],
'pass_opt' => $ini_array['plugin_definition']['pass_opt'],
'parameters' => $ini_array['plugin_definition']['parameters'],
'plugin_type' => $ini_array['plugin_definition']['plugin_type'],
];
switch ($version) {
case 'pspz':
// Fixed the static parameters
// for
// the dinamic parameters of pandoras 5.
$total_macros = 0;
$macros = [];
if (isset($values['parameters']) === false) {
$values['parameters'] = '';
}
if (empty($values['net_dst_opt']) === false) {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Target IP from net';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['net_dst_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if (empty($values['ip_opt']) === false) {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Target IP';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['ip_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if (empty($values['net_port_opt']) === false) {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Port from net';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['net_port_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if (empty($values['port_opt']) === false) {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Port';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['port_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if (empty($values['user_opt']) === false) {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Username';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['user_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
if (empty($values['pass_opt']) === false) {
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Password';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= $values['pass_opt'].' _field'.$total_macros.'_ ';
$macros[(string) $total_macros] = $macro;
}
// A last parameter is defined always to
// add the old "Plug-in parameters" in the
// side of the module.
$total_macros++;
$macro = [];
$macro['macro'] = '_field'.$total_macros.'_';
$macro['desc'] = 'Plug-in Parameters';
$macro['help'] = '';
$macro['value'] = '';
$values['parameters'] .= ' _field'.$total_macros.'_';
$macros[(string) $total_macros] = $macro;
break;
case 'pspz2':
// Fill the macros field.
$total_macros = $ini_array['plugin_definition']['total_macros_provided'];
$macros = [];
for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) {
$label = 'macro_'.$it_macros;
$macro = [];
$macro['macro'] = '_field'.$it_macros.'_';
$macro['hide'] = $ini_array[$label]['hide'];
$macro['desc'] = io_safe_input(
$ini_array[$label]['description']
);
$macro['help'] = io_safe_input(
$ini_array[$label]['help']
);
$macro['value'] = io_safe_input(
$ini_array[$label]['value']
);
$macros[(string) $it_macros] = $macro;
}
break;
default:
// Not possible.
break;
}
if (empty($macros) === false) {
$values['macros'] = json_encode($macros);
}
$create_id = db_process_sql_insert('tplugin', $values);
if (empty($create_id) === true) {
ui_print_error_message(
__('Plug-in Remote Registered unsuccessfull')
);
ui_print_info_message(
__('Please check the syntax of file "plugin_definition.ini"')
);
} else {
for ($ax = 1; $ax <= $ini_array['plugin_definition']['total_modules_provided']; $ax++) {
$label = 'module'.$ax;
$plugin_user = '';
if (isset($ini_array[$label]['plugin_user']) === true) {
$plugin_user = $ini_array[$label]['plugin_user'];
}
$plugin_pass = '';
if (isset($ini_array[$label]['plugin_pass']) === true) {
$plugin_pass = $ini_array[$label]['plugin_pass'];
}
$plugin_parameter = '';
if (isset($ini_array[$label]['plugin_parameter']) === true) {
$plugin_parameter = $ini_array[$label]['plugin_parameter'];
}
$unit = '';
if (isset($ini_array[$label]['unit']) === true) {
$unit = $ini_array[$label]['unit'];
}
$values = [
'name' => io_safe_input($ini_array[$label]['name']),
'description' => io_safe_input($ini_array[$label]['description']),
'id_group' => $ini_array[$label]['id_group'],
'type' => $ini_array[$label]['type'],
'max' => ($ini_array[$label]['max'] ?? ''),
'min' => ($ini_array[$label]['min'] ?? ''),
'module_interval' => ($ini_array[$label]['module_interval'] ?? ''),
'id_module_group' => $ini_array[$label]['id_module_group'],
'id_modulo' => $ini_array[$label]['id_modulo'],
'plugin_user' => io_safe_input($plugin_user),
'plugin_pass' => io_safe_input($plugin_pass),
'plugin_parameter' => io_safe_input($plugin_parameter),
'unit' => io_safe_input($unit),
'max_timeout' => ($ini_array[$label]['max_timeout'] ?? ''),
'history_data' => ($ini_array[$label]['history_data'] ?? ''),
'dynamic_interval' => ($ini_array[$label]['dynamic_interval'] ?? ''),
'dynamic_min' => ($ini_array[$label]['dynamic_min'] ?? ''),
'dynamic_max' => ($ini_array[$label]['dynamic_max'] ?? ''),
'dynamic_two_tailed' => ($ini_array[$label]['dynamic_two_tailed'] ?? ''),
'min_warning' => ($ini_array[$label]['min_warning'] ?? ''),
'max_warning' => ($ini_array[$label]['max_warning'] ?? ''),
'str_warning' => ($ini_array[$label]['str_warning'] ?? ''),
'min_critical' => ($ini_array[$label]['min_critical'] ?? ''),
'max_critical' => ($ini_array[$label]['max_critical'] ?? ''),
'str_critical' => ($ini_array[$label]['str_critical'] ?? ''),
'min_ff_event' => ($ini_array[$label]['min_ff_event'] ?? ''),
'tcp_port' => ($ini_array[$label]['tcp_port'] ?? ''),
'id_plugin' => $create_id,
];
$macros_component = $macros;
switch ($version) {
case 'pspz':
// Fixed the static parameters
// for
// the dinamic parameters of pandoras 5.
foreach ($macros_component as $key => $macro) {
if ($macro['desc'] === 'Target IP from net') {
if (empty($values['ip_target']) === false) {
$macros_component[$key]['value'] = io_safe_input(
$values['ip_target']
);
}
}
if ($macro['desc'] === 'Target IP') {
if (empty($values['ip_target']) === false) {
$macros_component[$key]['value'] = io_safe_input(
$values['ip_target']
);
}
} else if ($macro['desc'] === 'Port from net') {
if (empty($values['tcp_port']) === false) {
$macros_component[$key]['value'] = io_safe_input(
$values['tcp_port']
);
}
} else if ($macro['desc'] === 'Port') {
if (empty($values['tcp_port']) === false) {
$macros_component[$key]['value'] = io_safe_input(
$values['tcp_port']
);
}
} else if ($macro['desc'] === 'Username') {
if (empty($values['plugin_user']) === false) {
$macros_component[$key]['value'] = io_safe_input(
$values['plugin_user']
);
}
} else if ($macro['desc'] === 'Password') {
if (empty($values['plugin_pass']) === false) {
$macros_component[$key]['value'] = io_safe_input(
$values['plugin_pass']
);
}
} else if ($macro['desc'] === 'Plug-in Parameters') {
if (empty($values['plugin_parameter']) === false) {
$macros_component[$key]['value'] = io_safe_input(
$values['plugin_parameter']
);
}
}
}
break;
case 'pspz2':
if ($total_macros > 0) {
for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) {
$macro = 'macro_'.$it_macros.'_value';
// Set the value or use the default.
if (isset($ini_array[$label][$macro]) === true) {
$macros_component[(string) $it_macros]['value'] = io_safe_input(
$ini_array[$label][$macro]
);
}
}
}
break;
default:
// Not possible.
break;
}
if (empty($macros_component) === false) {
$values['macros'] = json_encode($macros_component);
}
db_process_sql_insert('tnetwork_component', $values);
ui_print_success_message(
__('Module plugin registered').' : '.$ini_array[$label]['name']
);
}
ui_print_success_message(
__('Plugin').' '.$ini_array['plugin_definition']['name'].' '.__('Registered successfully')
);
}
unlink($config['attachment_store'].'/plugin_definition.ini');
}
}
}
// Clean.
Files::rmrf($tmp_path);
} else {
$error = __('Unable to uncompress uploaded file');
}
}
if (file_exists($uploaded_filename) === true) {
if (is_metaconsole() === true && is_management_allowed() === true) {
// Keep uploaded file to be transferred to nodes.
if (is_dir($config['attachment_store'].'/downloads/') === false) {
mkdir($config['attachment_store'].'/downloads/');
}
$keep = move_uploaded_file(
$uploaded_filename,
$config['attachment_store'].'/downloads/'.$filename
);
if ($keep === false) {
$error = __(
'Cannot move uploaded file to %s.',
$config['attachment_store'].'/downloads/'
);
}
} else {
// Clean temporary files.
unlink($uploaded_filename);
}
}
if ($error !== null && $error !== '') {
ui_print_error_message($error);
} else if ($error === null
&& is_management_allowed() === true
&& is_metaconsole() === true
) {
$attachment = '/'.str_replace(
$config['homedir'],
'',
$config['attachment_store']
);
$sc = new Synchronizer();
$sc->queueOperation(
Synchronizer::OPERATION_REFRESH_PLUGIN,
ui_get_full_url(
$attachment.'/downloads/'.$filename,
false,
false,
false
)
);
}
if (is_metaconsole() === true) {
enterprise_hook('close_meta_frame');
}

View File

@ -1,17 +1,32 @@
<?php
/**
* Os.
*
* @category Os
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Load global vars.
global $config;
check_login();
@ -22,6 +37,19 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
return;
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
ui_print_warning_message(
__(
'This node is configured with centralized mode. All OS definitions are read only. Go to %s to manage them.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=list&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
}
$table = new stdClass();
$table->width = '100%';
@ -31,11 +59,19 @@ $table->head[0] = '';
$table->head[1] = __('ID');
$table->head[2] = __('Name');
$table->head[3] = __('Description');
$table->head[4] = '';
if ($is_management_allowed === true) {
$table->head[4] = '';
}
$table->align[0] = 'center';
$table->align[4] = 'center';
if ($is_management_allowed === true) {
$table->align[4] = 'center';
}
$table->size[0] = '20px';
$table->size[4] = '20px';
if ($is_management_allowed === true) {
$table->size[4] = '20px';
}
// Prepare pagination.
$offset = (int) get_parameter('offset');
@ -59,30 +95,36 @@ foreach ($osList as $os) {
$data = [];
$data[] = ui_print_os_icon($os['id_os'], false, true);
$data[] = $os['id_os'];
if (is_metaconsole()) {
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=edit&tab2=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
if ($is_management_allowed === true) {
if (is_metaconsole() === true) {
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=edit&tab2=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
} else {
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
}
} else {
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os='.$os['id_os'].'">'.io_safe_output($os['name']).'</a>';
$data[] = io_safe_output($os['name']);
}
$data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true);
$table->cellclass[][4] = 'action_buttons';
if ($os['id_os'] > 16) {
if (is_metaconsole()) {
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=delete&tab2=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true).'</a>';
if ($is_management_allowed === true) {
$table->cellclass[][4] = 'action_buttons';
if ($os['id_os'] > 16) {
if (is_metaconsole()) {
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=delete&tab2=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true).'</a>';
} else {
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=delete&tab=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
}
} else {
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=delete&tab=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
// The original icons of pandora don't delete.
$data[] = '';
}
} else {
// The original icons of pandora don't delete.
$data[] = '';
}
$table->data[] = $data;
}
if (isset($data)) {
if (isset($data) === true) {
ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset);
html_print_table($table);
ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset, 0, false, 'offset', true, 'pagination-bottom');
@ -90,7 +132,7 @@ if (isset($data)) {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]);
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
echo '<form method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=builder">';
echo "<div style='text-align:right;width:".$table->width."'>";
html_print_submit_button(__('Create OS'), '', false, 'class="sub next"');

View File

@ -1,10 +1,10 @@
<?php
/**
* OS Edition
* Os.
*
* @category Server
* @category Os
* @package Pandora FMS
* @subpackage Godmode
* @subpackage Community
* @version 1.0.0
* @license See below
*
@ -26,7 +26,7 @@
* ============================================================================
*/
// Begin.
// Load global vars.
global $config;
check_login();
@ -40,7 +40,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
$action = get_parameter('action', 'new');
$idOS = get_parameter('id_os', 0);
$id_message = get_parameter('message', 0);
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$tab = get_parameter('tab2', 'list');
} else {
$tab = get_parameter('tab', 'list');
@ -57,133 +57,140 @@ if ($idOS) {
$icon = get_parameter('icon', 0);
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
}
$message = '';
if ($is_management_allowed === true) {
switch ($action) {
case 'edit':
$actionHidden = 'update';
$textButton = __('Update');
$classButton = 'class="sub upd"';
break;
switch ($action) {
case 'new':
default:
$actionHidden = 'save';
$textButton = __('Create');
$classButton = 'class="sub next"';
break;
case 'save':
$values = [];
$values['name'] = $name;
$values['description'] = $description;
case 'edit':
$actionHidden = 'update';
$textButton = __('Update');
$classButton = 'class="sub upd"';
break;
if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon;
}
case 'save':
$values = [];
$values['name'] = $name;
$values['description'] = $description;
$resultOrId = false;
if ($name != '') {
$resultOrId = db_process_sql_insert('tconfig_os', $values);
}
if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon;
}
if ($resultOrId === false) {
$message = 2;
$tab = 'builder';
$actionHidden = 'save';
$textButton = __('Create');
$classButton = 'class="sub next"';
} else {
$tab = 'list';
$message = 1;
}
$resultOrId = false;
if ($name != '') {
$resultOrId = db_process_sql_insert('tconfig_os', $values);
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
if ($resultOrId === false) {
$message = 2;
$tab = 'builder';
case 'update':
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
$values = [];
$values['name'] = $name;
$values['description'] = $description;
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole() === true) {
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
}
if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon;
}
$result = false;
if ($name != '') {
$result = db_process_sql_update('tconfig_os', $values, ['id_os' => $idOS]);
}
if ($result !== false) {
$message = 3;
$tab = 'list';
} else {
$message = 4;
$tab = 'builder';
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
$name = $os['name'];
}
$actionHidden = 'update';
$textButton = __('Update');
$classButton = 'class="sub upd"';
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
case 'delete':
$sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = '.$idOS;
$count = db_get_all_rows_sql($sql);
$count = $count[0]['count'];
if ($count > 0) {
$message = 5;
} else {
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
if ($result) {
$message = 6;
} else {
$message = 7;
}
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
default:
case 'new':
$actionHidden = 'save';
$textButton = __('Create');
$classButton = 'class="sub next"';
} else {
$tab = 'list';
$message = 1;
}
if (is_metaconsole()) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
case 'update':
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
$values = [];
$values['name'] = $name;
$values['description'] = $description;
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole()) {
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
}
if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon;
}
$result = false;
if ($name != '') {
$result = db_process_sql_update('tconfig_os', $values, ['id_os' => $idOS]);
}
if ($result !== false) {
$message = 3;
$tab = 'list';
} else {
$message = 4;
$tab = 'builder';
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
$name = $os['name'];
}
$actionHidden = 'update';
$textButton = __('Update');
$classButton = 'class="sub upd"';
if (is_metaconsole()) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
case 'delete':
$sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = '.$idOS;
$count = db_get_all_rows_sql($sql);
$count = $count[0]['count'];
if ($count > 0) {
$message = 5;
} else {
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
if ($result) {
$message = 6;
} else {
$message = 7;
}
}
if (is_metaconsole()) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
break;
}
}
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=list">'.html_print_image(
'images/list.png',
true,
[
'title' => __('List OS'),
'class' => 'invert_filter',
]
).'</a>',
],
'builder' => [
$buttons = [];
$buttons['list'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=list">'.html_print_image(
'images/list.png',
true,
[
'title' => __('List OS'),
'class' => 'invert_filter',
]
).'</a>',
];
if ($is_management_allowed === true) {
$buttons['builder'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=builder">'.html_print_image(
'images/builder.png',
@ -193,8 +200,8 @@ $buttons = [
'class' => 'invert_filter',
]
).'</a>',
],
];
];
}
$buttons[$tab]['active'] = true;
@ -260,11 +267,14 @@ if (empty($id_message) === false) {
switch ($tab) {
case 'list':
default:
include_once $config['homedir'].'/godmode/setup/os.list.php';
break;
case 'builder':
include_once $config['homedir'].'/godmode/setup/os.builder.php';
break;
default:
// Default.
break;
}

View File

@ -306,7 +306,7 @@ switch ($section) {
case 'external_tools':
$buttons['external_tools']['active'] = true;
$subpage = ' &raquo '.__('External Tools');
$help_header = 'External_Tools';
$help_header = '';
break;
case 'enterprise':

View File

@ -644,14 +644,14 @@ echo '<legend>'.__('Mail configuration').'</legend>';
$table_mail_test->class = 'databox filters';
$table_mail_test->data = [];
$table_mail_test->style[0] = 'font-weight: bold;';
$table_mail_test->style[1] = 'font-weight: bold;display: flex;height: 54px;align-items: center;';
$table_mail_test->style[1] = 'font-weight: bold;display: flex;height: 54px;align-items: center;padding-left: 15px;';
$table_mail_test->data[0][0] = __('Address');
$table_mail_test->data[0][1] = html_print_input_text(
'email_test_address',
'',
'',
40,
35,
100,
true
);

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