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. // Process user targets.
$insertion_string = ''; $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) { foreach ($this->targetUsers as $user) {
$insertion_string .= sprintf( $insertion_string .= sprintf(
'(%d,"%s")', '(%d,"%s")',
@ -590,7 +590,7 @@ class ConsoleSupervisor
) { ) {
// Process group targets. // Process group targets.
$insertion_string = ''; $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) { foreach ($this->targetGroups as $group) {
$insertion_string .= sprintf( $insertion_string .= sprintf(
'(%d,"%s")', '(%d,"%s")',

View File

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

View File

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