diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index 72c33fccaa..873b9a3068 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -285,11 +285,16 @@ server_dependencies=" \ java \ bind-utils \ whois \ + cpanminus \ 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 \ https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" +# install cpan dependencies +execute_cmd "cpanm -i Thread::Semaphore" "Installing Thread::Semaphore" + + # SDK VMware perl dependencies vmware_dependencies=" \ http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \ diff --git a/extras/deploy-scripts/pandora_deploy_community_el8.sh b/extras/deploy-scripts/pandora_deploy_community_el8.sh index 083669ed29..794e11f8fe 100644 --- a/extras/deploy-scripts/pandora_deploy_community_el8.sh +++ b/extras/deploy-scripts/pandora_deploy_community_el8.sh @@ -4,7 +4,7 @@ ####################################################### ## Tested versions ## # Centos 8.4, 8.5 -# Rocky 8.4, 8.5 +# Rocky 8.4, 8.5, 8.6, 8.7 # Almalinuz 8.4, 8.5 # RedHat 8.5 @@ -14,24 +14,25 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf -S_VERSION='202209231' +S_VERSION='202301251' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" # define default variables -[ "$TZ" ] || TZ="Europe/Madrid" -[ "$MYVER" ] || MYVER=57 -[ "$PHPVER" ] || PHPVER=8 -[ "$DBHOST" ] || DBHOST=127.0.0.1 -[ "$DBNAME" ] || DBNAME=pandora -[ "$DBUSER" ] || DBUSER=pandora -[ "$DBPASS" ] || DBPASS=pandora -[ "$DBPORT" ] || DBPORT=3306 +[ "$TZ" ] || TZ="Europe/Madrid" +[ "$MYVER" ] || MYVER=57 +[ "$PHPVER" ] || PHPVER=8 +[ "$DBHOST" ] || DBHOST=127.0.0.1 +[ "$DBNAME" ] || DBNAME=pandora +[ "$DBUSER" ] || DBUSER=pandora +[ "$DBPASS" ] || DBPASS=pandora +[ "$DBPORT" ] || DBPORT=3306 [ "$DBROOTUSER" ] || DBROOTUSER=root [ "$DBROOTPASS" ] || DBROOTPASS=pandora [ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0 -[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 +[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 -[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") +[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") +[ "$PANDORA_LTS" ] || PANDORA_LTS=1 [ "$PANDORA_BETA" ] || PANDORA_BETA=0 # Ansi color code variables @@ -41,7 +42,6 @@ cyan="\e[0;36m" reset="\e[0m" # Functions - execute_cmd () { local cmd="$1" local msg="$2" @@ -76,7 +76,7 @@ check_cmd_status () { check_pre_pandora () { echo -en "${cyan}Checking environment ... ${reset}" - rpm -qa | grep 'pandorafms_' &>> /dev/null && local fail=true + rpm -qa | grep -v "pandorawmic" | grep 'pandorafms_' &>> /dev/null && local fail=true [ -d "$PANDORA_CONSOLE" ] && local fail=true [ -f /usr/bin/pandora_server ] && local fail=true @@ -137,7 +137,10 @@ check_root_permissions [ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora #advicing BETA PROGRAM -[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}" +INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}" +[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}" +[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}" +echo -e $INSTALLING_VER # Connectivity check_repo_connection @@ -467,6 +470,8 @@ query_cache_size = 64M query_cache_min_res_unit = 2k query_cache_limit = 256K +#skip-log-bin + sql_mode="" [mysqld_safe] @@ -477,6 +482,7 @@ EO_CONFIG_F if [ "$MYVER" -eq '80' ] ; then sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf + sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf fi execute_cmd "systemctl restart mysqld" "Configuring database engine" @@ -485,11 +491,18 @@ fi export MYSQL_PWD=$DBPASS #Define packages -if [ "$PANDORA_BETA" -eq '0' ] ; then +if [ "$PANDORA_LTS" -eq '1' ] ; then + [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm" + [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm" +elif [ "$PANDORA_LTS" -ne '1' ] ; then [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" -elif [ "$PANDORA_BETA" -ne '0' ] ; then +fi + +# if beta is enable +if [ "$PANDORA_BETA" -eq '1' ] ; then [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" diff --git a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh index 4272290c9d..f52eb625e2 100644 --- a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh +++ b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh @@ -16,7 +16,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf WORKDIR=/opt/pandora/deploy -S_VERSION='2022052501' +S_VERSION='202301251' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" rm -f $LOGFILE &> /dev/null # remove last log before start @@ -34,6 +34,8 @@ rm -f $LOGFILE &> /dev/null # remove last log before start [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 [ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") [ "$PANDORA_BETA" ] || PANDORA_BETA=0 +[ "$PANDORA_LTS" ] || PANDORA_LTS=1 + # Ansi color code variables red="\e[0;91m" @@ -134,7 +136,10 @@ check_root_permissions [ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora #advicing BETA PROGRAM -[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}" +INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}" +[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}" +[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}" +echo -e $INSTALLING_VER # Connectivity check_repo_connection @@ -272,14 +277,19 @@ echo -en "${cyan}Installing phantomjs...${reset}" /usr/bin/phantomjs --version &>> "$LOGFILE" check_cmd_status "Error Installing phanromjs" +# create symlink for fping +rm -f /usr/sbin/fping &>> "$LOGFILE" +ln -s /usr/bin/fping /usr/sbin/fping &>> "$LOGFILE" + # Chrome +rm -f /usr/bin/chromium-browser &>> "$LOGFILE" execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome" execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome" execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink" # SDK VMware perl dependencies -vmware_dependencies=" \ - lib32z1 \ +vmware_dependencies="\ + lib32z1 \ lib32z1 \ build-essential \ uuid uuid-dev \ @@ -350,16 +360,22 @@ systemctl stop apparmor &>> "$LOGFILE" systemctl disable apparmor &>> "$LOGFILE" #install mysql -debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password password $DBROOTPASS") &>> "$LOGFILE" -debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password_again password $DBROOTPASS") &>> "$LOGFILE" -echo -en "${cyan}Installing MySql Server...${reset}" - env DEBIAN_FRONTEND=noninteractive apt install -y mysql-server &>> "$LOGFILE" +execute_cmd "curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb" "Downloading Percona repository for MySQL8" +execute_cmd "apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb" "Installing Percona repository for MySQL8" +execute_cmd "percona-release setup ps80" "Configuring Percona repository for MySQL8" + +echo -en "${cyan}Installing Percona Server for MySQL8...${reset}" + env DEBIAN_FRONTEND=noninteractive apt install -y percona-server-server &>> "$LOGFILE" check_cmd_status "Error Installing MySql Server" #Configuring Database if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then execute_cmd "systemctl start mysql" "Starting database engine" + + echo """ + ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DBROOTPASS'; + """ | mysql -uroot &>> "$LOGFILE" export MYSQL_PWD=$DBROOTPASS echo -en "${cyan}Creating Pandora FMS database...${reset}" @@ -399,11 +415,12 @@ max_connections = 100 key_buffer_size=4M read_buffer_size=128K - read_rnd_buffer_size=128K sort_buffer_size=128K join_buffer_size=4M +skip-log-bin + sql_mode="" log-error=/var/log/mysql/error.log @@ -417,11 +434,17 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin #Define packages -if [ "$PANDORA_BETA" -eq '0' ] ; then +if [ "$PANDORA_LTS" -eq '1' ] ; then + [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz" + [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_agent_linux-7.0NG.tar.gz" +elif [ "$PANDORA_LTS" -ne '1' ] ; then [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz" -elif [ "$PANDORA_BETA" -ne '0' ] ; then +fi + +if [ "$PANDORA_BETA" -eq '1' ] ; then [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz" diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 00c6dd95ea..011b4d3e1b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.768-230123 +Version: 7.0NG.768-230127 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 361e858e19..171beea0e4 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.768-230123" +pandora_version="7.0NG.768-230127" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 8b13649b53..c956de8fa1 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.768'; -use constant AGENT_BUILD => '230123'; +use constant AGENT_BUILD => '230127'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index b93be417e8..ec4b5113a6 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_linux %define version 7.0NG.768 -%define release 230123 +%define release 230127 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 5b62fc540d..81cc177279 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_linux %define version 7.0NG.768 -%define release 230123 +%define release 230127 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 0fc4134142..6298d66778 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.768" -PI_BUILD="230123" +PI_BUILD="230127" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 33f2064060..ff14de3131 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230123} +{230127} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index ad6d24860e..bf75c28761 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.768 Build 230123") +#define PANDORA_VERSION ("7.0NG.768 Build 230127") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 879a1bba31..5c69ab8149 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.768(Build 230123))" + VALUE "ProductVersion", "(7.0NG.768(Build 230127))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 97944b2f2a..9546607787 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.768-230123 +Version: 7.0NG.768-230127 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 2b0c1ff503..f6d940c63f 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.768-230123" +pandora_version="7.0NG.768-230127" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/61.sql b/pandora_console/extras/mr/61.sql new file mode 100644 index 0000000000..e6dc902733 --- /dev/null +++ b/pandora_console/extras/mr/61.sql @@ -0,0 +1,14 @@ +START TRANSACTION; + +CREATE TABLE IF NOT EXISTS `tsesion_filter` ( + `id_filter` INT NOT NULL AUTO_INCREMENT, + `id_name` TEXT NULL, + `text` TEXT NULL, + `period` TEXT NULL, + `ip` TEXT NULL, + `type` TEXT NULL, + `user` TEXT NULL, + PRIMARY KEY (`id_filter`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +COMMIT; diff --git a/pandora_console/fonts/CircularStd-Book.woff b/pandora_console/fonts/CircularStd-Book.woff new file mode 100644 index 0000000000..0333ec1842 Binary files /dev/null and b/pandora_console/fonts/CircularStd-Book.woff differ diff --git a/pandora_console/fonts/CircularStd-Medium.woff b/pandora_console/fonts/CircularStd-Medium.woff new file mode 100644 index 0000000000..6c72611a3b Binary files /dev/null and b/pandora_console/fonts/CircularStd-Medium.woff differ diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index e315ec3d16..f2045bf7a1 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -1283,9 +1283,13 @@ foreach ($modules as $module) { } if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { + // Check module relatonships to show warning message. + $url = htmlentities('index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo']); + // Delete module. - $data[9] = ''; + $data[9] = ''; + $data[9] .= html_print_image( 'images/cross.png', true, @@ -1309,8 +1313,7 @@ foreach ($modules as $module) { } if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { - echo '
'; + echo ''; } html_print_table($table); @@ -1344,6 +1347,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { false, 'class="sub next"' ); + + echo ''; echo '
'; } @@ -1352,7 +1357,18 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index cd80d79caa..fc3b992a6e 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -290,7 +290,7 @@ $search_text = (string) get_parameter('search_text'); $date_from = (string) get_parameter('date_from'); $date_to = (string) get_parameter('date_to'); $execution_type = (string) get_parameter('execution_type'); -$show_archived = (bool) get_parameter('archived'); +$show_archived = (bool) get_parameter_switch('archived', false); $agent_id = (int) get_parameter('agent_id'); $agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : ''); $module_id = (int) get_parameter('module_name_hidden'); @@ -313,12 +313,20 @@ $table_form = new StdClass(); $table_form->class = 'databox filters'; $table_form->width = '100%'; $table_form->rowstyle = []; +$table_form->cellstyle[0] = ['width: 100px;']; +$table_form->cellstyle[1] = ['width: 100px;']; +$table_form->cellstyle[1][2] = 'display: flex; align-items: center;'; +$table_form->cellstyle[2] = ['width: 100px;']; +$table_form->cellstyle[3] = ['text-align: right;']; +$table_form->colspan[3][0] = 3; $table_form->data = []; $row = []; // Search text. -$row[] = __('Search').' '.html_print_input_text( +$row[] = __('Search'); + +$row[] = html_print_input_text( 'search_text', $search_text, '', @@ -356,7 +364,8 @@ $execution_type_fields = [ 'periodically' => __('Periodically'), 'cron' => __('Cron'), ]; -$row[] = __('Execution type').' '.html_print_select( +$row[] = __('Execution type'); +$row[] = html_print_select( $execution_type_fields, 'execution_type', $execution_type, @@ -368,11 +377,11 @@ $row[] = __('Execution type').' '.html_print_select( false ); // Show past downtimes. -$row[] = __('Show past downtimes').' '.html_print_checkbox( - 'archived', - 1, - $show_archived, - true +$row[] = __('Show past downtimes').'    '.html_print_switch( + [ + 'name' => 'archived', + 'value' => $show_archived, + ] ); $table_form->data[] = $row; @@ -388,8 +397,8 @@ $params['return'] = true; $params['print_hidden_input_idagent'] = true; $params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_value'] = $agent_id; -$agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params); -$row[] = $agent_input; +$row[] = __('Agent'); +$row[] = ui_print_agent_autocomplete_input($params); // Module. $row[] = __('Module').' '.html_print_autocomplete_modules( @@ -402,6 +411,10 @@ $row[] = __('Module').' '.html_print_autocomplete_modules( true ); +$table_form->data[] = $row; + +$row = []; + $row[] = html_print_submit_button( __('Search'), 'search', diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 382371a38e..24216c8f3a 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -177,7 +177,7 @@ switch ($activeTab) { $background_color = (string) get_parameter('background_color'); $width = (int) get_parameter('width'); $height = (int) get_parameter('height'); - $visualConsoleName = (string) get_parameter('name'); + $visualConsoleName = io_safe_input((string) get_parameter('name')); $is_favourite = (int) get_parameter('is_favourite_sent'); $auto_adjust = (int) get_parameter('auto_adjust_sent'); diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index a217718960..513f7c83de 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -1353,11 +1353,8 @@ $values = [ 'Alert detail' => __('Alert detail'), 'External link' => __('External link'), 'Other' => __('Other'), + 'Dashboard' => __('Dashboard'), ]; -if (!is_metaconsole()) { - $values['Dashboard'] = __('Dashboard'); -} - $home_screen .= html_print_select( $values, @@ -1372,7 +1369,14 @@ $home_screen .= html_print_select( ).''; -$dashboards = Manager::getDashboards(-1, -1); +$dashboards = Manager::getDashboards( + -1, + -1, + false, + false, + $id_usr +); + $dashboards_aux = []; if ($dashboards === false) { $dashboards = ['None' => 'None']; diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 3af06054a4..e5d15006fe 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -333,6 +333,7 @@ if ($delete_user === true) { $result = delete_user($id_user); if ($result) { + delete_session_user($id_user); db_pandora_audit( AUDIT_LOG_USER_MANAGEMENT, __('Deleted user %s', io_safe_output($id_user)) diff --git a/pandora_console/images/Pandora-FMS-installer-gear.png b/pandora_console/images/Pandora-FMS-installer-gear.png new file mode 100644 index 0000000000..22912ff101 Binary files /dev/null and b/pandora_console/images/Pandora-FMS-installer-gear.png differ diff --git a/pandora_console/images/Pandora-FMS-installer.png b/pandora_console/images/Pandora-FMS-installer.png new file mode 100644 index 0000000000..4186258465 Binary files /dev/null and b/pandora_console/images/Pandora-FMS-installer.png differ diff --git a/pandora_console/images/installer-background.jpg b/pandora_console/images/installer-background.jpg new file mode 100644 index 0000000000..9005aca945 Binary files /dev/null and b/pandora_console/images/installer-background.jpg differ diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php index fd1d832618..46ab88951a 100644 --- a/pandora_console/include/ajax/alert_list.ajax.php +++ b/pandora_console/include/ajax/alert_list.ajax.php @@ -721,7 +721,7 @@ if ($get_agent_alerts_datatable === true) { } break; - case 'lastFired': + case 'last_fired': switch ($sort) { case 'asc': $selectLastFiredasc = $selected; diff --git a/pandora_console/include/ajax/audit_log.php b/pandora_console/include/ajax/audit_log.php new file mode 100644 index 0000000000..3bf5e09d24 --- /dev/null +++ b/pandora_console/include/ajax/audit_log.php @@ -0,0 +1,457 @@ + $values['id_name']] + ); + + if ($exists) { + echo 'duplicate'; + } else { + $result = db_process_sql_insert('tsesion_filter', $values); + + if ($result === false) { + echo 'error'; + } else { + echo $result; + } + } +} + + +if ($recover_aduit_log_select) { + echo json_encode(audit_get_audit_filter_select()); +} + +if ($update_log_filter) { + $values = []; + $id = get_parameter('id'); + $values['text'] = get_parameter('text', ''); + $values['period'] = get_parameter('period', ''); + $values['ip'] = get_parameter('ip', ''); + $values['type'] = get_parameter('type', -1); + $values['user'] = get_parameter('user', -1); + + $result = db_process_sql_update( + 'tsesion_filter', + $values, + ['id_filter' => $id] + ); + + if ($result === false) { + echo 'error'; + } else { + echo 'ok'; + } +} + + +if ($get_filter_values) { + $id_filter = get_parameter('id'); + + $event_filter = audit_get_audit_log_filter($id_filter); + echo json_encode($event_filter); +} + + +if ($load_filter_modal) { + $filters = audit_get_audit_filter_select(); + $user_groups_array = users_get_groups_for_select( + $config['id_user'], + $access, + true, + true, + false + ); + + echo '
'; + + $table = new StdClass; + $table->id = 'load_filter_form'; + $table->width = '100%'; + $table->cellspacing = 4; + $table->cellpadding = 4; + $table->class = 'databox'; + if (is_metaconsole()) { + $table->cellspacing = 0; + $table->cellpadding = 0; + $table->class = 'databox filters'; + } + + $table->styleTable = 'font-weight: bold; color: #555; text-align:left;'; + $filter_id_width = '200px'; + if (is_metaconsole()) { + $filter_id_width = '150px'; + } + + $data = []; + $table->rowid[3] = 'update_filter_row1'; + $data[0] = __('Load filter').$jump; + $data[0] .= html_print_select( + $filters, + 'filter_id', + '', + '', + __('None'), + 0, + true, + false, + true, + '', + false, + 'margin-left:5px; width:'.$filter_id_width.';' + ); + $data[1] = html_print_submit_button( + __('Load filter'), + 'load_filter', + false, + 'class="sub upd" onclick="load_filter_values()"', + true + ); + $data[1] .= html_print_input_hidden('load_filter', 1, true); + $table->data[] = $data; + $table->rowclass[] = ''; + + html_print_table($table); + echo '
'; + ?> + + '; + + if (check_acl($config['id_user'], 0, 'EW') === 1 || check_acl($config['id_user'], 0, 'EM') === 1) { + echo '
'; + $table = new StdClass; + $table->id = 'save_filter_form'; + $table->width = '100%'; + $table->cellspacing = 4; + $table->cellpadding = 4; + $table->class = 'databox'; + if (is_metaconsole()) { + $table->class = 'databox filters'; + $table->cellspacing = 0; + $table->cellpadding = 0; + } + + $table->styleTable = 'font-weight: bold; text-align:left;'; + if (!is_metaconsole()) { + $table->style[0] = 'width: 50%; width:50%;'; + } + + $data = []; + $table->rowid[0] = 'update_save_selector'; + $data[0] = html_print_radio_button( + 'filter_mode', + 'new', + __('New filter'), + true, + true + ); + + $data[1] = html_print_radio_button( + 'filter_mode', + 'update', + __('Update filter'), + false, + true + ); + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[1] = 'save_filter_row1'; + $data[0] = __('Filter name').$jump; + $data[0] .= html_print_input_text('id_name', '', '', 15, 255, true); + + $data[1] = html_print_submit_button( + __('Save filter'), + 'save_filter', + false, + 'class="sub wand" onclick="save_new_filter();"', + true + ); + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[2] = 'save_filter_row2'; + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[3] = 'update_filter_row1'; + $data[0] = __('Overwrite filter').$jump; + + $_filters_update = audit_get_audit_filter_select(); + + $data[0] .= html_print_select( + $_filters_update, + 'overwrite_filter', + '', + '', + '', + 0, + true + ); + $data[1] = html_print_submit_button( + __('Update filter'), + 'update_filter', + false, + 'class="sub upd" onclick="save_update_filter();"', + true + ); + + $table->data[] = $data; + $table->rowclass[] = ''; + + html_print_table($table); + } else { + include 'general/noaccess.php'; + } + + echo ''; + ?> + + 0 + ) { + $node = new Node($server_id); + $node->connect(); + } + + echo events_page_general_acknowledged($event_id); + } catch (\Exception $e) { + // Unexistent agent. + if (is_metaconsole() === true + && $server_id > 0 + ) { + $node->disconnect(); + } + + $return = false; + } finally { + if (is_metaconsole() === true + && $server_id > 0 + ) { + $node->disconnect(); + } + } + + return $return; } if ($change_owner === true) { diff --git a/pandora_console/include/ajax/heatmap.ajax.php b/pandora_console/include/ajax/heatmap.ajax.php index c33b0015aa..abfcd39e45 100644 --- a/pandora_console/include/ajax/heatmap.ajax.php +++ b/pandora_console/include/ajax/heatmap.ajax.php @@ -340,7 +340,7 @@ if (is_ajax() === true) { // Group. $secondary_groups = ''; - $secondary = agents_get_secondary_groups($data['id_agente']); + $secondary = enterprise_hook('agents_get_secondary_groups', [$data['id_agente']]); if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) { $secondary_groups = implode(', ', $secondary['for_select']); $secondary_groups = ', '.$secondary_groups; @@ -353,19 +353,26 @@ if (is_ajax() === true) { // Events. - echo '
'; - echo graph_graphic_agentevents( - $id, - 100, - 40, - SECONDS_1DAY, - '', - true, - false, - false, - 1 + $result_graph_event = enterprise_hook( + 'graph_graphic_agentevents', + [ + $id, + 100, + 40, + SECONDS_1DAY, + '', + true, + false, + false, + 1, + ] ); - echo '
'; + + if ($result_graph_event !== -1) { + echo '
'; + echo $result_graph_event; + echo '
'; + } break; } } diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 293977f51f..baf18ab41b 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -61,6 +61,8 @@ if (check_login()) { 0 ); + $get_children_modules = (bool) get_parameter('get_children_modules', false); + $get_data_dataMatrix = (bool) get_parameter( 'get_data_dataMatrix', 0 @@ -1629,4 +1631,36 @@ if (check_login()) { return; } + + if ($get_children_modules === true) { + $parent_modules = get_parameter('parent_modulues', false); + $children_selected = []; + + if ($parent_modules === false) { + $children_selected = false; + } else { + foreach ($parent_modules as $parent) { + $child_modules = get_children_module($parent_modules, ['nombre', 'id_agente_modulo'], true); + if ((bool) $child_modules === false) { + continue; + } + + foreach ($child_modules as $child) { + $module_exist = in_array($child['id_agente_modulo'], $parent_modules); + $child_exist = in_array($child, $children_selected); + + if ($module_exist === false && $child_exist === false) { + array_push($children_selected, $child); + } + } + } + } + + if (empty($children_selected) === true) { + $children_selected = false; + } + + echo json_encode($children_selected); + return; + } } diff --git a/pandora_console/include/class/AuditLog.class.php b/pandora_console/include/class/AuditLog.class.php index 0fa0e62cb1..235652711c 100644 --- a/pandora_console/include/class/AuditLog.class.php +++ b/pandora_console/include/class/AuditLog.class.php @@ -156,6 +156,26 @@ class AuditLog extends HTML open_meta_frame(); } + $buttons = []; + + $buttons[] = [ + 'id' => 'load-filter', + 'class' => 'float-left margin-right-2 margin-left-2 sub config', + 'text' => __('Load filter'), + 'onclick' => '', + ]; + + $buttons[] = [ + 'id' => 'save-filter', + 'class' => 'float-left margin-right-2 sub wand', + 'text' => __('Save filter'), + 'onclick' => '', + ]; + + // Modal for save/load filters. + echo ''; + echo ''; + // Load datatables user interface. ui_print_datatable( [ @@ -174,9 +194,10 @@ class AuditLog extends HTML ], 'search_button_class' => 'sub filter float-right', 'form' => [ - 'inputs' => [ + 'extra_buttons' => $buttons, + 'inputs' => [ [ - 'label' => __('Search'), + 'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true), 'type' => 'text', 'class' => 'w200px', 'id' => 'filter_text', @@ -211,7 +232,9 @@ class AuditLog extends HTML 'type' => 'select_from_sql', 'nothing' => __('All'), 'nothing_value' => '-1', - 'sql' => 'SELECT id_user, id_user AS text FROM tusuario', + 'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM" + AS id_user, "SYSTEM" AS text UNION SELECT "N/A" + AS id_user, "N/A" AS text', 'class' => 'mw250px', 'id' => 'filter_user', 'name' => 'filter_user', @@ -269,7 +292,10 @@ class AuditLog extends HTML if (empty($this->filterText) === false) { $filter .= sprintf( - " AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", + " AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR id_usuario LIKE '%%%s%%' OR fecha LIKE '%%%s%%' OR ip_origen LIKE '%%%s%%')", + $this->filterText, + $this->filterText, + $this->filterText, $this->filterText, $this->filterText ); @@ -366,38 +392,149 @@ class AuditLog extends HTML // Javascript content. ?> - + 0) { - return number_format($number, $decimals, $config['decimal_separator'], $config['thousand_separator']); + return number_format( + $number, + $decimals, + $config['decimal_separator'], + ($config['thousand_separator'] ?? ',') + ); } - return number_format($number, 0, $config['decimal_separator'], $config['thousand_separator']); + return number_format( + $number, + 0, + $config['decimal_separator'], + ($config['thousand_separator'] ?? ',') + ); } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index fc2c0eb7d9..3740257717 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -496,9 +496,13 @@ function events_update_status($id_evento, $status, $filter=null) // No groups option direct update. $update_sql = sprintf( 'UPDATE tevento - SET estado = %d + SET estado = %d, + ack_utimestamp = %d, + id_usuario = "%s" WHERE id_evento = %d', $status, + time(), + $config['id_user'], $id_evento ); break; @@ -4732,7 +4736,7 @@ function events_page_general($event) $data = []; $data[0] = __('Owner'); - if (empty($event['owner_user']) === true) { + if ($event['owner_user'] == -1) { $data[1] = ''.__('N/A').''; } else { $user_owner = db_get_value( @@ -4797,14 +4801,15 @@ function events_page_general($event) $data = []; - $table_general->rowid[7] = 'general_status'; + $table_general->rowid[count($table_general->data)] = 'general_status'; + $table_general->cellclass[count($table_general->data)][1] = 'general_status'; $data[0] = __('Status'); $data[1] = $event_st['title']; $data[2] = html_print_image($event_st['img'], true); $table_general->data[] = $data; // If event is validated, show who and when acknowleded it. - $table_general->cellclass[8][1] = 'general_acknowleded'; + $table_general->cellclass[count($table_general->data)][1] = 'general_acknowleded'; $data = []; $data[0] = __('Acknowledged by'); @@ -4825,7 +4830,17 @@ function events_page_general($event) } } - $data[1] = $user_ack.' ( '.date($config['date_format'], $event['ack_utimestamp_raw']).' ) '; + $data[1] = $user_ack.' ( '; + if ($event['ack_utimestamp_raw'] !== false + && $event['ack_utimestamp_raw'] !== 'false' + ) { + $data[1] .= date( + $config['date_format'], + $event['ack_utimestamp_raw'] + ); + } + + $data[1] .= ' ) '; } else { $data[1] = ''.__('N/A').''; } @@ -4932,9 +4947,9 @@ function events_page_general_acknowledged($event_id) { global $config; $Acknowledged = ''; - $event = db_get_all_rows_filter('tevento', 'id_evento', $event_id); - - if ($event) { + $event = db_get_row('tevento', 'id_evento', $event_id); + hd($event['ack_utimestamp'], true); + if ($event !== false && $event['estado'] == 1) { $user_ack = db_get_value( 'fullname', 'tusuario', @@ -4946,7 +4961,17 @@ function events_page_general_acknowledged($event_id) $user_ack = $config['id_user']; } - $Acknowledged = $user_ack.' ( '.date($config['date_format'], $event['ack_utimestamp_raw']).' ) '; + $Acknowledged = $user_ack.' ( '; + if ($event['ack_utimestamp'] !== false + && $event['ack_utimestamp'] !== 'false' + ) { + $Acknowledged .= date( + $config['date_format'], + $event['ack_utimestamp'] + ); + } + + $Acknowledged .= ' ) '; } else { $Acknowledged = 'N/A'; } diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index dd1da40410..1f85902a14 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -811,6 +811,27 @@ if (is_ajax()) { ); } + $image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms.png', false, false, false); + if (enterprise_installed() === false) { + if ($config['style'] === 'pandora_black') { + $image_about = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC; + } else if ($config['style'] === 'pandora') { + $image_about = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC; + } + } else { + if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) { + $config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC; + } else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) { + $config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC; + } + + $image_about = 'images/custom_logo/'.$config['custom_logo']; + + if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) { + $image_about = ENTERPRISE_DIR.'/'.$image_about; + } + } + $dialog = ' '; + + echo ''; + echo ''; + echo "
+