This commit is contained in:
fbsanchez 2022-01-10 20:52:29 +01:00
parent cc58138f11
commit 58ba683005
6 changed files with 145 additions and 139 deletions

View File

@ -556,7 +556,7 @@ class ConsoleSupervisor
) {
// Process user targets.
$insertion_string = '';
$users_sql = 'INSERT INTO tnotification_user(id_mensaje,id_user)';
$users_sql = 'INSERT IGNORE INTO tnotification_user(id_mensaje,id_user)';
foreach ($this->targetUsers as $user) {
$insertion_string .= sprintf(
'(%d,"%s")',
@ -590,7 +590,7 @@ class ConsoleSupervisor
) {
// Process group targets.
$insertion_string = '';
$groups_sql = 'INSERT INTO tnotification_group(id_mensaje,id_group)';
$groups_sql = 'INSERT IGNORE INTO tnotification_group(id_mensaje,id_group)';
foreach ($this->targetGroups as $group) {
$insertion_string .= sprintf(
'(%d,"%s")',

View File

@ -12353,27 +12353,27 @@ function api_set_update_user_profile_info($id_profile, $thrash1, $other, $return
}
$values = [
'name' => $other['data'][0] == '' ? $profile['name'] : (string) $other['data'][0],
'agent_view' => $other['data'][1] == '' ? $profile['agent_view'] : (bool) $other['data'][1] ? 1 : 0,
'agent_edit' => $other['data'][2] == '' ? $profile['agent_edit'] : (bool) $other['data'][2] ? 1 : 0,
'agent_disable' => $other['data'][3] == '' ? $profile['agent_disable'] : (bool) $other['data'][3] ? 1 : 0,
'alert_edit' => $other['data'][4] == '' ? $profile['alert_edit'] : (bool) $other['data'][4] ? 1 : 0,
'alert_management' => $other['data'][5] == '' ? $profile['alert_management'] : (bool) $other['data'][5] ? 1 : 0,
'user_management' => $other['data'][6] == '' ? $profile['user_management'] : (bool) $other['data'][6] ? 1 : 0,
'db_management' => $other['data'][7] == '' ? $profile['db_management'] : (bool) $other['data'][7] ? 1 : 0,
'event_view' => $other['data'][8] == '' ? $profile['event_view'] : (bool) $other['data'][8] ? 1 : 0,
'event_edit' => $other['data'][9] == '' ? $profile['event_edit'] : (bool) $other['data'][9] ? 1 : 0,
'event_management' => $other['data'][10] == '' ? $profile['event_management'] : (bool) $other['data'][10] ? 1 : 0,
'report_view' => $other['data'][11] == '' ? $profile['report_view'] : (bool) $other['data'][11] ? 1 : 0,
'report_edit' => $other['data'][12] == '' ? $profile['report_edit'] : (bool) $other['data'][12] ? 1 : 0,
'report_management' => $other['data'][13] == '' ? $profile['report_management'] : (bool) $other['data'][13] ? 1 : 0,
'map_view' => $other['data'][14] == '' ? $profile['map_view'] : (bool) $other['data'][14] ? 1 : 0,
'map_edit' => $other['data'][15] == '' ? $profile['map_edit'] : (bool) $other['data'][15] ? 1 : 0,
'map_management' => $other['data'][16] == '' ? $profile['map_management'] : (bool) $other['data'][16] ? 1 : 0,
'vconsole_view' => $other['data'][17] == '' ? $profile['vconsole_view'] : (bool) $other['data'][17] ? 1 : 0,
'vconsole_edit' => $other['data'][18] == '' ? $profile['vconsole_edit'] : (bool) $other['data'][18] ? 1 : 0,
'vconsole_management' => $other['data'][19] == '' ? $profile['vconsole_management'] : (bool) $other['data'][19] ? 1 : 0,
'pandora_management' => $other['data'][20] == '' ? $profile['pandora_management'] : (bool) $other['data'][20] ? 1 : 0,
'name' => ($other['data'][0] == '') ? $profile['name'] : (string) $other['data'][0],
'agent_view' => ($other['data'][1] == '') ? $profile['agent_view'] : ((bool) $other['data'][1] ? 1 : 0),
'agent_edit' => ($other['data'][2] == '') ? $profile['agent_edit'] : ((bool) $other['data'][2] ? 1 : 0),
'agent_disable' => ($other['data'][3] == '') ? $profile['agent_disable'] : ((bool) $other['data'][3] ? 1 : 0),
'alert_edit' => ($other['data'][4] == '') ? $profile['alert_edit'] : ((bool) $other['data'][4] ? 1 : 0),
'alert_management' => ($other['data'][5] == '') ? $profile['alert_management'] : ((bool) $other['data'][5] ? 1 : 0),
'user_management' => ($other['data'][6] == '') ? $profile['user_management'] : ((bool) $other['data'][6] ? 1 : 0),
'db_management' => ($other['data'][7] == '') ? $profile['db_management'] : ((bool) $other['data'][7] ? 1 : 0),
'event_view' => ($other['data'][8] == '') ? $profile['event_view'] : ((bool) $other['data'][8] ? 1 : 0),
'event_edit' => ($other['data'][9] == '') ? $profile['event_edit'] : ((bool) $other['data'][9] ? 1 : 0),
'event_management' => ($other['data'][10] == '') ? $profile['event_management'] : ((bool) $other['data'][10] ? 1 : 0),
'report_view' => ($other['data'][11] == '') ? $profile['report_view'] : ((bool) $other['data'][11] ? 1 : 0),
'report_edit' => ($other['data'][12] == '') ? $profile['report_edit'] : ((bool) $other['data'][12] ? 1 : 0),
'report_management' => ($other['data'][13] == '') ? $profile['report_management'] : ((bool) $other['data'][13] ? 1 : 0),
'map_view' => ($other['data'][14] == '') ? $profile['map_view'] : ((bool) $other['data'][14] ? 1 : 0),
'map_edit' => ($other['data'][15] == '') ? $profile['map_edit'] : ((bool) $other['data'][15] ? 1 : 0),
'map_management' => ($other['data'][16] == '') ? $profile['map_management'] : ((bool) $other['data'][16] ? 1 : 0),
'vconsole_view' => ($other['data'][17] == '') ? $profile['vconsole_view'] : ((bool) $other['data'][17] ? 1 : 0),
'vconsole_edit' => ($other['data'][18] == '') ? $profile['vconsole_edit'] : ((bool) $other['data'][18] ? 1 : 0),
'vconsole_management' => ($other['data'][19] == '') ? $profile['vconsole_management'] : ((bool) $other['data'][19] ? 1 : 0),
'pandora_management' => ($other['data'][20] == '') ? $profile['pandora_management'] : ((bool) $other['data'][20] ? 1 : 0),
];
$return = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]);

0
pandora_console/pandora_console_install Normal file → Executable file
View File

View File

@ -1,126 +1,127 @@
FROM centos:7
FROM centos:8
RUN { \
echo '[artica_pandorafms]'; \
echo 'name=CentOS7 - PandoraFMS official repo'; \
echo 'baseurl=http://firefly.artica.es/centos7'; \
echo 'gpgcheck=0'; \
echo 'enabled=1'; \
} > /etc/yum.repos.d/pandorafms.repo
echo '[artica_pandorafms]'; \
echo 'name=CentOS7 - PandoraFMS official repo'; \
echo 'baseurl=http://firefly.artica.es/centos7'; \
echo 'gpgcheck=0'; \
echo 'enabled=1'; \
} > /etc/yum.repos.d/pandorafms.repo
# Pandora FMS dependencies.
RUN yum install -y epel-release vim wget bzip2 curl && \
yum install -y yum-utils && \
yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm && \
yum-config-manager --disable mysql80-community && \
yum-config-manager --enable mysql57-community && \
yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm && \
yum-config-manager --enable remi-php72 && \
yum install -y gtk3 python-pip \
python-pip \
firefox \
xorg-x11-server-Xvfb \
x11vnc && \
wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz && \
tar xvzf geckodriver-v0.26.0-linux64.tar.gz && \
mv geckodriver /usr/bin/ && rm geckodriver-v0.26.0-linux64.tar.gz && \
pip install pyvirtualdisplay && \
pip install "selenium==3.141" && \
pip install unittest2 && \
pip install testtools && \
yum install -y git \
httpd \
cronie \
ntp \
openldap \
nfdump \
openldap \
plymouth \
xterm \
php \
php-gd \
graphviz \
php-mysqlnd \
php-pear-DB \
php-pear \
php-pdo \
php-mbstring \
php-ldap \
php-snmp \
php-ldap \
php-common \
php-zip \
php-xmlrpc \
nmap \
xprobe2 \
mysql-server \
mysql \
ntp \
htop \
nano \
postfix \
perl-HTML-Tree \
perl-DBI \
perl-DBD-mysql \
perl-libwww-perl \
perl-XML-Simple \
perl-XML-SAX \
perl-NetAddr-IP \
perl-Scope-Guard \
net-snmp \
net-tools \
perl-IO-Socket-INET6 \
perl-Socket6 \
perl-Sys-Syslog \
nmap \
sudo \
xprobe2 \
make \
perl-CPAN \
perl-JSON \
net-snmp-perl \
perl-Time-HiRes \
perl-XML-Twig \
perl-Encode-Locale \
net-snmp-utils \
fontconfig \
freetype \
freetype-devel \
fontconfig-devel \
libstdc++ \
gettext \
cpanminus && \
cpanm Geo::IP && \
mkdir -p /opt/phantomjs/bin && cd /opt/phantomjs/bin && \
wget https://netcologne.dl.sourceforge.net/project/pandora/Tools%20and%20dependencies%20%28All%20versions%29/DEB%20Debian%2C%20Ubuntu/phantomjs && \
chmod +x phantomjs && \
ln -s /opt/phantomjs/bin/phantomjs /usr/bin/ && \
yum update -y && \
echo -e '#!/bin/bash\nhttpd -k $1\n' > /etc/init.d/httpd && \
chmod +x /etc/init.d/httpd && \
yum clean all
RUN dnf install -y vim wget bzip2 curl && \
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \
dnf install -y yum-utils && \
dnf install -y https://dev.mysql.com/get/mysql80-community-release-el8-2.noarch.rpm && \
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm && \
dnf config-manager --set-enabled powertools && \
dnf module reset -y php && \
dnf module install -y php:remi-8.0 && \
dnf update -y && \
dnf install -y gtk3 python39 python39-pip \
firefox \
xorg-x11-server-Xvfb \
x11vnc && \
wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz && \
tar xvzf geckodriver-v0.26.0-linux64.tar.gz && \
mv geckodriver /usr/bin/ && rm -f geckodriver-v0.26.0-linux64.tar.gz && \
pip3 install pyvirtualdisplay && \
pip3 install "selenium==3.141" && \
pip3 install unittest2 && \
pip3 install testtools && \
dnf install -y git \
httpd \
cronie \
openldap \
nfdump \
openldap \
plymouth \
xterm \
php \
php-gd \
graphviz \
php-mysqlnd \
php-pear \
php-pdo \
php-mbstring \
php-ldap \
php-snmp \
php-ldap \
php-common \
php-zip \
php-xmlrpc \
nmap \
xprobe2 \
mysql-server \
mysql \
htop \
nano \
postfix \
perl-HTML-Tree \
perl-DBI \
perl-DBD-mysql \
perl-libwww-perl \
perl-XML-Simple \
perl-XML-SAX \
perl-NetAddr-IP \
perl-Scope-Guard \
net-snmp \
net-tools \
perl-IO-Socket-INET6 \
perl-Socket6 \
perl-Sys-Syslog \
nmap \
sudo \
xprobe2 \
make \
perl-CPAN \
perl-JSON \
net-snmp-perl \
perl-Time-HiRes \
perl-XML-Twig \
perl-Encode-Locale \
net-snmp-utils \
fontconfig \
freetype \
freetype-devel \
fontconfig-devel \
libstdc++ \
gettext \
cpanminus && \
cpanm Geo::IP && \
mkdir -p /opt/phantomjs/bin && cd /opt/phantomjs/bin && \
wget https://netcologne.dl.sourceforge.net/project/pandora/Tools%20and%20dependencies%20%28All%20versions%29/DEB%20Debian%2C%20Ubuntu/phantomjs && \
chmod +x phantomjs && \
ln -s /opt/phantomjs/bin/phantomjs /usr/bin/ && \
yum update -y && \
echo -e '#!/bin/bash\nhttpd -k $1\n' > /etc/init.d/httpd && \
chmod +x /etc/init.d/httpd && \
setcap -r /usr/libexec/mysqld && \
yum clean all
ADD wmic /usr/bin/
# Install debugg dependencies.
RUN yum install -y \
php-devel \
php-pear \
gcc \
gcc-c++ \
autoconf \
file \
automake && \
pecl install Xdebug && \
git clone https://github.com/tideways/php-xhprof-extension && \
cd php-xhprof-extension && \
phpize && \
./configure && \
make && \
make install && \
cd .. && \
rm -rf php-xhprof-extension && \
yum clean all
RUN dnf install -y \
initscripts \
unzip tree \
php-devel \
php-pear \
gcc \
gcc-c++ \
autoconf \
file \
automake && \
pecl install Xdebug && \
git clone https://github.com/tideways/php-xhprof-extension && \
cd php-xhprof-extension && \
phpize && \
./configure && \
make && \
make install && \
cd .. && \
rm -rf php-xhprof-extension && \
yum clean all
#Exposing ports for: HTTP, SNMP Traps, Tentacle protocol
EXPOSE 80 162/udp 41121

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Script to install the Pandora FMS Console.
import os
from pyvirtualdisplay import Display

View File

@ -19,6 +19,11 @@ function check {
# Start the required services.
service mysqld start && /usr/bin/mysqladmin -u root password 'pandora'
check "Starting the MySQL Server" $?
mkdir -p /run/php-fpm/ 2>/dev/null
/usr/sbin/php-fpm
check "Starting PHP-FPM" $?
service httpd start
check "Starting the Apache Web Server" $?