diff --git a/extras/deploy-scripts/deploy_ext_database_el8.sh b/extras/deploy-scripts/deploy_ext_database_el8.sh index 422887b0e2..52bad444fe 100644 --- a/extras/deploy-scripts/deploy_ext_database_el8.sh +++ b/extras/deploy-scripts/deploy_ext_database_el8.sh @@ -9,7 +9,7 @@ # RedHat 8.5 #Constants -S_VERSION='202302081' +S_VERSION='202302201' LOGFILE="/tmp/deploy-ext-db-$(date +%F).log" @@ -275,6 +275,8 @@ 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 + sed -i -e "s/character-set-server=utf8/character-set-server=utf8mb4/g" /etc/my.cnf + fi execute_cmd "systemctl restart mysqld" "Configuring database engine" diff --git a/extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh b/extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh index a82244c3b6..45a99783ab 100644 --- a/extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh +++ b/extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh @@ -4,6 +4,7 @@ ############################################################################################################## ## Tested versions ## # Ubuntu 22.04.1 +# Ubuntu 22.04.2 #avoid promps export DEBIAN_FRONTEND=noninteractive @@ -16,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf WORKDIR=/opt/pandora/deploy -S_VERSION='202302081' +S_VERSION='202302201' LOGFILE="/tmp/deploy-ext-db-$(date +%F).log" rm -f $LOGFILE &> /dev/null # remove last log before start @@ -181,7 +182,7 @@ cat > /etc/mysql/my.cnf << EOF_DB [mysqld] datadir=/var/lib/mysql user=mysql -character-set-server=utf8 +character-set-server=utf8mb4 skip-character-set-client-handshake # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 @@ -196,7 +197,7 @@ 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 +innodb_io_capacity = 300 thread_cache_size = 8 thread_stack = 256K max_connections = 100 diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index 78f1ef0e41..9386d55647 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -431,7 +431,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDOR execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" # Copy gotty utility -execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' +execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/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' diff --git a/extras/deploy-scripts/pandora_deploy_community_el8.sh b/extras/deploy-scripts/pandora_deploy_community_el8.sh index 13f90fcf85..cc14ad1ffa 100644 --- a/extras/deploy-scripts/pandora_deploy_community_el8.sh +++ b/extras/deploy-scripts/pandora_deploy_community_el8.sh @@ -5,7 +5,7 @@ ## Tested versions ## # Centos 8.4, 8.5 # Rocky 8.4, 8.5, 8.6, 8.7 -# Almalinuz 8.4, 8.5 +# Almalinux 8.4, 8.5 # RedHat 8.5 #Constants @@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf -S_VERSION='202301251' +S_VERSION='202302201' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" # define default variables @@ -107,6 +107,17 @@ check_root_permissions () { fi } +installing_docker () { + #Installing docker for debug + echo "Start installig docker" &>> "$LOGFILE" + dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &>> "$LOGFILE" + dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &>> "$LOGFILE" + systemctl disable --now docker &>> "$LOGFILE" + systemctl disable docker.socket --now &>> "$LOGFILE" + echo "End installig docker" &>> "$LOGFILE" +} + + ## Main echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION" @@ -207,6 +218,7 @@ else execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools" fi +execute_cmd "installing_docker" "Installing Docker for debug" #Installing wget execute_cmd "dnf install -y wget" "Installing wget" @@ -454,7 +466,7 @@ 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 +innodb_io_capacity = 300 thread_cache_size = 8 thread_stack = 256K max_connections = 100 @@ -483,6 +495,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 + sed -i -e "s/character-set-server=utf8/character-set-server=utf8mb4/g" /etc/my.cnf fi execute_cmd "systemctl restart mysqld" "Configuring database engine" @@ -517,7 +530,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDOR execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages" # Copy gotty utility -execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' +execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/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' @@ -743,7 +756,7 @@ execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent" cat > /etc/issue.net << EOF_banner -Welcome to Pandora FMS appliance on CentOS +Welcome to Pandora FMS appliance on RHEL/Rocky Linux 8 ------------------------------------------ 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"}') diff --git a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh index b22d5d163f..1446abfab3 100644 --- a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh +++ b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh @@ -4,6 +4,7 @@ ############################################################################################################## ## Tested versions ## # Ubuntu 22.04.1 +# Ubuntu 22.04.2 #avoid promps export DEBIAN_FRONTEND=noninteractive @@ -16,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf WORKDIR=/opt/pandora/deploy -S_VERSION='202301251' +S_VERSION='202302201' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" rm -f $LOGFILE &> /dev/null # remove last log before start @@ -106,6 +107,21 @@ check_root_permissions () { fi } +installing_docker () { + #Installing docker for debug + echo "Start installig docker" &>> "$LOGFILE" + mkdir -m 0755 -p /etc/apt/keyrings &>> "$LOGFILE" + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --yes --dearmor -o /etc/apt/keyrings/docker.gpg &>> "$LOGFILE" + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list &>> "$LOGFILE" + apt update -y &>> "$LOGFILE" + apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &>> "$LOGFILE" + systemctl disable docker --now &>> "$LOGFILE" + systemctl disable docker.socket --now &>> "$LOGFILE" + echo "End installig docker" &>> "$LOGFILE" +} + ## Main echo "Starting PandoraFMS Community deployment Ubuntu 22.04 ver. $S_VERSION" @@ -173,7 +189,7 @@ execute_cmd "cd $WORKDIR" "Moving to workdir: $WORKDIR" ## Install utils execute_cmd "apt update" "Updating repos" -execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https" "Installing utils" +execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https ca-certificates gnupg lsb-release" "Installing utils" #Installing Apache and php-fpm [ -e "/etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list" ] || execute_cmd "add-apt-repository ppa:ondrej/php -y" "Enable ppa:ondrej/php repo" @@ -221,7 +237,8 @@ systemctl restart php$PHPVER-fpm &>> "$LOGFILE" php$PHPVER-xml \ php$PHPVER-yaml \ libnet-telnet-perl \ - whois" + whois \ + cron" execute_cmd "apt install -y $console_dependencies" "Installing Pandora FMS Console dependencies" # Server dependencies @@ -254,10 +271,13 @@ server_dependencies=" \ libnet-telnet-perl \ libjson-perl \ libencode-perl \ + cron \ libgeo-ip-perl \ openjdk-8-jdk " execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies" +execute_cmd "installing_docker" "Installing Docker for debug" + # wmic and pandorawmic execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/wmic" "Downloading wmic" execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/pandorawmic" "Downloading pandorawmic" @@ -393,7 +413,7 @@ cat > /etc/mysql/my.cnf << EOF_DB [mysqld] datadir=/var/lib/mysql user=mysql -character-set-server=utf8 +character-set-server=utf8mb4 skip-character-set-client-handshake # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 @@ -408,7 +428,7 @@ 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 +innodb_io_capacity = 300 thread_cache_size = 8 thread_stack = 256K max_connections = 100 @@ -477,7 +497,7 @@ check_cmd_status "Error installing PandoraFMS Agent" # Copy gotty utility cd $WORKDIR &>> "$LOGFILE" -execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' +execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/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' @@ -731,10 +751,15 @@ systemctl enable pandora_server &>> "$LOGFILE" execute_cmd "service tentacle_serverd start" "Starting Tentacle Server" systemctl enable tentacle_serverd &>> "$LOGFILE" -# Enabling condole cron +# Enabling console cron execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies 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 --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab +# Enabling pandoradb cron +execute_cmd "echo 'enabling pandoradb cron' >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS pandoradb cron" +echo "@hourly root bash -c /etc/cron.hourly/pandora_db" >> /etc/crontab + + ## Enabling agent adn configuring Agente sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE" execute_cmd "/etc/init.d/pandora_agent_daemon start" "Starting PandoraFSM Agent" @@ -748,7 +773,7 @@ sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = open cat > /etc/issue.net << EOF_banner -Welcome to Pandora FMS appliance on CentOS +Welcome to Pandora FMS appliance on Ubuntu ------------------------------------------ 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"}') diff --git a/pandora_agents/pc/pandora_agent.redhat.spec b/pandora_agents/pc/pandora_agent.redhat.spec index ae481e3403..ce60c8841f 100644 --- a/pandora_agents/pc/pandora_agent.redhat.spec +++ b/pandora_agents/pc/pandora_agent.redhat.spec @@ -1,6 +1,7 @@ # #Pandora FMS Linux Agent # +%global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 4.0 %define release 1 diff --git a/pandora_agents/pc/pandora_agent.spec b/pandora_agents/pc/pandora_agent.spec index 1bfc289d52..5ad481315a 100644 --- a/pandora_agents/pc/pandora_agent.spec +++ b/pandora_agents/pc/pandora_agent.spec @@ -1,6 +1,7 @@ # #Pandora FMS Linux Agent # +%global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 4.0.1 %define release 1 diff --git a/pandora_agents/shellscript/linux/pandora_agent.spec b/pandora_agents/shellscript/linux/pandora_agent.spec index 64b33bfecf..9c5e0296c6 100755 --- a/pandora_agents/shellscript/linux/pandora_agent.spec +++ b/pandora_agents/shellscript/linux/pandora_agent.spec @@ -1,6 +1,7 @@ # #Pandora FMS Linux Agent # +%global __os_install_post %{nil} %define name pandorafms_agent %define version 3.2 Summary: Pandora FMS Linux agent diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 5f29343d22..7a6aeff356 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.769-230217 +Version: 7.0NG.769-230303 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 07e42a8119..fa61aa49c9 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.769-230217" +pandora_version="7.0NG.769-230303" 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 33f9b75177..0a12df1c9f 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230217'; +use constant AGENT_BUILD => '230303'; # 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 fa965af096..89ea2a0b9f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -1,9 +1,10 @@ # #Pandora FMS Linux Agent # +%global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230217 +%define release 230303 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 f1091e07d9..aed2381793 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -1,9 +1,10 @@ # #Pandora FMS Linux Agent # +%global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230217 +%define release 230303 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 0955293f59..c63a4a6cfc 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230217" +PI_BUILD="230303" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 9d180788d6..2c51bc2a4b 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230217} +{230303} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b6a69e5783..acf6b701e5 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.769 Build 230217") +#define PANDORA_VERSION ("7.0NG.769 Build 230303") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 61bf76a879..c6e79f7d24 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.769(Build 230217))" + VALUE "ProductVersion", "(7.0NG.769(Build 230303))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 7eaf7524ea..57d645e9b5 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230217 +Version: 7.0NG.769-230303 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 d6e24860e3..f701f80ec0 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.769-230217" +pandora_version="7.0NG.769-230303" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index db92dda0a9..3f36935e5c 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -227,7 +227,7 @@ function dbmgr_extension_main() 'dbport' => $node->dbport(), 'dbname' => $node->dbname(), 'dbuser' => $node->dbuser(), - 'dbpass' => $node->dbpass(), + 'dbpass' => io_output_password($node->dbpass()), ] ); $error = ''; diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql index 14baa793af..e8f0cc2810 100644 --- a/pandora_console/extras/mr/62.sql +++ b/pandora_console/extras/mr/62.sql @@ -14,4 +14,31 @@ CREATE TABLE IF NOT EXISTS `tconsole` ( ALTER TABLE `tuser_task_scheduled` ADD COLUMN `id_console` BIGINT NOT NULL DEFAULT 0; +CREATE TABLE IF NOT EXISTS `tagent_filter` ( + `id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `id_name` VARCHAR(600) NOT NULL, + `id_group_filter` INT NOT NULL DEFAULT 0, + `group_id` INT NOT NULL DEFAULT 0, + `recursion` TEXT, + `status` INT NOT NULL DEFAULT -1, + `search` TEXT, + `id_os` INT NOT NULL DEFAULT 0, + `policies` TEXT, + `search_custom` TEXT, + `ag_custom_fields` TEXT, + PRIMARY KEY (`id_filter`) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; + +CREATE TABLE `tevent_sound` ( + `id` INT NOT NULL AUTO_INCREMENT, + `name` TEXT NULL, + `sound` TEXT NULL, + `active` TINYINT NOT NULL DEFAULT '1', +PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE INDEX agente_modulo_estado ON tevento (estado, id_agentmodule); +CREATE INDEX idx_disabled ON talert_template_modules (disabled); + +INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select alias from tagente where safe_mode_module = 0'); + COMMIT; diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index bb9fa19185..cd45f34f48 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -359,6 +359,10 @@ if ($config['enterprise_installed']) { } // CSRF validation. +if (isset($_SESSION['csrf_code']) === true) { + unset($_SESSION['csrf_code']); +} + html_print_csrf_hidden(); echo ''; diff --git a/pandora_console/godmode/agentes/module_manager_editor_plugin.php b/pandora_console/godmode/agentes/module_manager_editor_plugin.php index 2cc0ec3d8e..9477091e95 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_plugin.php +++ b/pandora_console/godmode/agentes/module_manager_editor_plugin.php @@ -89,8 +89,7 @@ $password_fields = []; // If there are $macros, we create the form fields if (!empty($macros)) { - $macros = json_decode($macros, true); - + $macros = json_decode(io_safe_output($macros), true); foreach ($macros as $k => $m) { $data = []; $data[0] = $m['desc']; diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index 873d91598c..2089dc5900 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -391,7 +391,7 @@ foreach ($actions as $action) { $data = []; - $data[0] = ''.$action['name'].''; + $data[0] = ''.$action['name'].''; if ($action['id_group'] == 0 && $can_edit_all == false) { $data[0] .= ui_print_help_tip(__('You cannot edit this action, You don\'t have the permission to edit All group.'), true); } @@ -467,7 +467,7 @@ if (isset($data)) { if (is_management_allowed() === true) { echo '
'; + ?> + + 'StarTrek emergency simulation', ]; + $eventsounds = mysql_db_get_all_rows_sql('SELECT * FROM tevent_sound WHERE active = 1'); + foreach ($eventsounds as $key => $row) { + $sounds[$row['sound']] = $row['name']; + } + $inputs[] = [ 'class' => 'test-sounds', 'direct' => 1, diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 3857c5d6b2..ec87996805 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -73,6 +73,7 @@ if (check_login()) { $get_monitor_filters = get_parameter('get_monitor_filters', 0); $save_monitor_filter = get_parameter('save_monitor_filter', 0); $update_monitor_filter = get_parameter('update_monitor_filter', 0); + $delete_monitor_filter = get_parameter('delete_monitor_filter', 0); if ($get_agent_modules_json_by_name === true) { $agent_name = get_parameter('agent_name'); @@ -1740,6 +1741,29 @@ if (check_login()) { } } + if ($delete_monitor_filter) { + $id = get_parameter('id'); + + $user_groups = users_get_groups( + $config['id_user'], + 'AW', + users_can_manage_group_all('AW'), + true + ); + + $sql = 'DELETE + FROM tmonitor_filter + WHERE id_filter = '.$id.' AND id_group_filter IN ('.implode(',', array_keys($user_groups)).')'; + + $monitor_filters = db_process_sql($sql); + + if ($monitor_filters === false) { + echo 'error'; + } else { + echo 'ok'; + } + } + if ($get_monitor_filters) { $sql = 'SELECT id_filter, id_name FROM tmonitor_filter'; @@ -1760,7 +1784,7 @@ if (check_login()) { $user_groups = users_get_groups( $config['id_user'], 'AR', - users_can_manage_group_all(), + users_can_manage_group_all('AR'), true ); @@ -1886,7 +1910,7 @@ if (check_login()) { '', false, true - ).__('Update filter').''; + ).__('Update/delete filter').''; $table->data[] = $data; $table->rowclass[] = ''; @@ -1904,7 +1928,7 @@ if (check_login()) { $user_groups_array = users_get_groups_for_select( $config['id_user'], 'AW', - users_can_manage_group_all(), + users_can_manage_group_all('AW'), true ); @@ -1954,21 +1978,30 @@ if (check_login()) { 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); - echo ''.$sys_info->data->ipInfo->value.'
+'.$system_date->data->date->name.'
+'.$system_date->data->date->value.'
+';
+ $output .= $count;
+ $output .= ' '; + $output .= $text; + $output .= ' | ';
+ }
+
+ $output .= '
'; +//echo ' | ||||||
';
-echo __('Group').' '.' '.' ';
+// Start Build Search Form.
+//
+$table = new StdClass();
+$table->width = '100%';
+$table->cellspacing = 0;
+$table->cellpadding = 0;
+$table->class = 'databox filters';
+$table->style[0] = 'font-weight: bold;';
+$table->style[1] = 'font-weight: bold;';
+$table->style[2] = 'font-weight: bold;';
+$table->style[3] = 'font-weight: bold;';
+$table->style[4] = 'font-weight: bold;';
+
+$table->data[0][0] = __('Group');
+$table->data[0][0] .= ' ';
$groups = users_get_groups(false, $access);
-html_print_select_groups(false, $access, true, 'group_id', $group_id, 'this.form.submit()', '', '', false, false, true, '', false);
+$table->data[0][0] .= html_print_select_groups(false, $access, true, 'group_id', $group_id, '', '', '', true, false, true, '', false);
-echo ' | '.' '.' '.' '.' '.' ';
+//$table->data[0][1] .= ' ';
-echo __('Recursion').' '.' '.' ';
-html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()');
+$table->data[0][0] .= ' '.__('Recursion').' '.' '.' '; +$table->data[0][0] .= html_print_input( + [ + 'type' => 'checkbox', + 'name' => 'recursion', + 'return' => true, + 'checked' => $recursion, + 'checked' => ($recursion === true || $recursion === 'true' || $recursion === '1') ? 'checked' : false, + 'value' => 1, + ] +); -echo ' | '; + + +//echo ' | '; $fields = []; $fields[AGENT_STATUS_NORMAL] = __('Normal'); @@ -272,31 +347,125 @@ $fields[AGENT_STATUS_UNKNOWN] = __('Unknown'); $fields[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $fields[AGENT_STATUS_NOT_INIT] = __('Not init'); -echo __('Status').' '.' '.' '; -html_print_select($fields, 'status', $status, 'this.form.submit()', __('All'), AGENT_STATUS_ALL, false, false, true, '', false, 'width: 90px;'); +$table->data[0][1] = __('Status').' '.' '.' '; +$table->data[0][1] .= html_print_select($fields, 'status', $status, '', __('All'), AGENT_STATUS_ALL, true, false, true, '', false, 'width: 90px;'); -echo ' | '; +$table->data[0][2] = __('Search').' '.' '.' '; +$table->data[0][2] .= html_print_input_text('search', $search, '', 15, 255, true); -echo __('Search').' '.' '.' '; -html_print_input_text('search', $search, '', 15); +$table->data[1][0] = __('Operating System').' '; -echo ' | '; +$pre_fields = db_get_all_rows_sql( + 'select distinct(tagente.id_os),tconfig_os.name from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os' +); +$fields = []; -echo __('Search in custom fields').' '.' '.' '; -html_print_input_text('search_custom', $search_custom, '', 15); +foreach ($pre_fields as $key => $value) { + $fields[$value['id_os']] = $value['name']; +} -echo ' | ';
+$table->data[1][0] .= html_print_select($fields, 'os', $os, '', 'All', 0, true);
-html_print_submit_button(
+$table->data[1][1] = __('Policies').' ';
+
+$pre_fields = policies_get_policies(false, ['id', 'name']);
+$fields = [];
+
+foreach ($pre_fields as $value) {
+ $fields[$value['id']] = $value['name'];
+}
+
+$table->data[1][1] .= html_print_select($fields, 'policies[]', $policies, '', 'All', 0, true, true);
+
+$table->data[1][2] = __('Search in custom fields').' '.' '.' ';
+$table->data[1][2] .= html_print_input_text('search_custom', $search_custom, '', 15, 255, true);
+
+
+$custom_fields = db_get_all_fields_in_table('tagent_custom_fields');
+if ($custom_fields === false) {
+ $custom_fields = [];
+}
+
+$div_custom_fields = ' ';
+foreach ($custom_fields as $custom_field) {
+ $custom_field_value = '';
+ if (empty($ag_custom_fields) === false) {
+ $custom_field_value = $ag_custom_fields[$custom_field['id_field']];
+ if (empty($custom_field_value) === true) {
+ $custom_field_value = '';
+ }
+ }
+
+ $div_custom_fields .= ' ';
+
+ $div_custom_fields .= ' ';
+}
+
+$table->colspan[2][0] = 7;
+$table->cellstyle[2][0] = 'padding-left: 10px;';
+$table->data[2][0] = ui_toggle(
+ $div_custom_fields,
+ __('Agent custom fields'),
+ '',
+ '',
+ true,
+ true,
+ '',
+ 'white-box-content',
+ 'white_table_graph'
+);
+
+
+$table->colspan[4][0] = 4;
+$table->cellstyle[4][0] = 'padding-top: 0px;';
+$table->data[4][0] = html_print_button(
+ __('Load filter'),
+ 'load-filter',
+ false,
+ '',
+ 'class="float-left margin-right-2 sub config"',
+ true
+);
+
+$table->cellstyle[4][0] .= 'padding-top: 0px;';
+$table->data[4][0] .= html_print_button(
+ __('Manage filter'),
+ 'save-filter',
+ false,
+ '',
+ 'class="float-left margin-right-2 sub wand"',
+ true
+);
+
+$table->cellstyle[4][2] = 'padding-top: 0px;';
+$table->data[4][2] = html_print_submit_button(
__('Search'),
'srcbutton',
'',
- ['class' => 'sub search']
+ ['class' => 'sub search'],
+ true
);
-echo '';
+ $div_custom_fields .= ''.$custom_field['name'].'';
+ $div_custom_fields .= ' ';
+
+ $div_custom_fields .= '';
+ $div_custom_fields .= html_print_input_text(
+ 'ag_custom_fields['.$custom_field['id_field'].']',
+ $custom_field_value,
+ '',
+ 0,
+ 300,
+ true,
+ false,
+ false,
+ '',
+ 'div-input'
+ );
+ $div_custom_fields .= ' | ';
+html_print_table($table);
-echo '