diff --git a/README.md b/README.md index 9077c7dbc3..4d00713cd4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Pandora FMS gives you the agility to find and solve problems quickly, scaling th ### Support -For community support you can visit our forums at https://pandorafms.com/community/ +For community support you can visit our forums at https://pandorafms.com/community/ Pandora FMS has a "commercial" solution, with different features, oriented to companies that do not want to spend time using open source solutions, but closed packaged products, with periodic updates and professional support. Its name is Pandora FMS Enterprise, and you can find more information about it at https://pandorafms.com. @@ -18,11 +18,11 @@ Installing Pandora FMS from sources is a complex task. Please visit our wiki and ### What is Pandora FMS? -Pandora FMS is an open source monitoring application whose origin dates back to 2004. It integrates in the same application the monitoring of different infrastructure elements: networks, applications, servers, web, and other specific data sources such as logs, WMI, Netflow or SNMP traps. +Pandora FMS is an open source monitoring application whose origin dates back to 2004. It integrates in the same application the monitoring of different infrastructure elements: networks, applications, servers, web, and other specific data sources such as logs, WMI, Netflow or SNMP traps. -It allows you to supervise systems and applications of all types, through remote monitoring or with software agents installed on the equipment to be monitored. +It allows you to supervise systems and applications of all types, through remote monitoring or with software agents installed on the equipment to be monitored. -Pandora FMS monitors your hardware, software, your multilayer system and, of course, your operating system. Pandora FMS can detect if a network interface is down or the movement of the market value of any new NASDAQ technology. If desired, Pandora FMS can send an SMS message when your system or application fails or when the value of Tesla's stock drops below $180. Pandora FMS will adapt to your systems and requirements, because it has been designed to be open, modular, multiplatform and easy to customize. +Pandora FMS monitors your hardware, software, your multilayer system and, of course, your operating system. Pandora FMS can detect if a network interface is down or the movement of the market value of any new NASDAQ technology. If desired, Pandora FMS can send an SMS message when your system or application fails or when the value of Tesla's stock drops below \$180. Pandora FMS will adapt to your systems and requirements, because it has been designed to be open, modular, multiplatform and easy to customize. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks. diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 97127595c6..be9d9841ec 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.776-240425 +Version: 7.0NG.776-240430 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 f1bab9e313..c425fcd5bc 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.776-240425" +pandora_version="7.0NG.776-240430" 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 845c0f6dad..95bbe6691a 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.776'; -use constant AGENT_BUILD => '240425'; +use constant AGENT_BUILD => '240430'; # 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 9d4799e151..091790c5ff 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240425 +%define release 240430 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index 34d3587bea..3c101c0720 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240425 +%define release 240430 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index 303e02bc9d..6fe85a1b90 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240425 +%define release 240430 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index 132519c329..e0609e9635 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240425 +%define release 240430 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 01c8527c18..e84c66b80e 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.776 -%define release 240425 +%define release 240430 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 5735720eeb..4c896413d3 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.776" -PI_BUILD="240425" +PI_BUILD="240430" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 4bf744c992..8ad9d367dc 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{240425} +{240430} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index aa67dc414b..865d72840d 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.776 Build 240425") +#define PANDORA_VERSION ("7.0NG.776 Build 240430") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d895a6fae0..547ed73abc 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.776(Build 240425))" + VALUE "ProductVersion", "(7.0NG.776(Build 240430))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 13f9fe2275..5e94808891 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.776-240425 +Version: 7.0NG.776-240430 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 7089dd8c0f..245da14514 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.776-240425" +pandora_version="7.0NG.776-240430" package_pear=0 package_pandora=1 diff --git a/pandora_console/ajax.php b/pandora_console/ajax.php index a5dcf2cb0d..db90fe2fe4 100644 --- a/pandora_console/ajax.php +++ b/pandora_console/ajax.php @@ -75,23 +75,19 @@ if (empty($_REQUEST) === true) { } // Hash login process. -if (isset($_GET['loginhash']) === true) { - $loginhash_data = get_parameter('loginhash_data', ''); - $loginhash_user = str_rot13(get_parameter('loginhash_user', '')); - - if ($config['loginhash_pwd'] != '' - && $loginhash_data == md5( - $loginhash_user.io_output_password($config['loginhash_pwd']) - ) - ) { - db_logon($loginhash_user, $_SERVER['REMOTE_ADDR']); - $_SESSION['id_usuario'] = $loginhash_user; - $config['id_user'] = $loginhash_user; +if (isset($_POST['auth_token']) === true && (bool) $config['JWT_signature'] !== false) { + include_once $config['homedir'].'/include/class/JWTRepository.class.php'; + $jwt = new JWTRepository($config['JWT_signature']); + if ($jwt->setToken($_POST['auth_token']) && $jwt->validate()) { + $id_user = $jwt->payload()->get('id_user'); + db_logon($id_user, $_SERVER['REMOTE_ADDR']); + $_SESSION['id_usuario'] = $id_user; + $config['id_user'] = $id_user; } else { include_once 'general/login_page.php'; db_pandora_audit( AUDIT_LOG_USER_REGISTRATION, - 'Loginhash failed', + 'Login token failed', 'system' ); while (ob_get_length() > 0) { diff --git a/pandora_console/composer.json b/pandora_console/composer.json index 3b05d0f000..8514865f2d 100644 --- a/pandora_console/composer.json +++ b/pandora_console/composer.json @@ -28,7 +28,9 @@ "php-di/php-di": "^7.0", "zircote/swagger-php": "^4.8", "doctrine/annotations": "^2.0", - "ramsey/uuid": "^4.7" + "ramsey/uuid": "^4.7", + "lcobucci/jwt": "^5.2", + "lcobucci/clock": "^3.2" }, "repositories": { "phpchartjs": { diff --git a/pandora_console/composer.lock b/pandora_console/composer.lock index 171c94a267..3ec4ac1312 100644 --- a/pandora_console/composer.lock +++ b/pandora_console/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0d777bd9c0ca68c9ec0fe911e71b1b2a", + "content-hash": "c7549451bb31a635714731144a995123", "packages": [ { "name": "amphp/amp", @@ -1553,6 +1553,143 @@ }, "time": "2023-11-08T14:08:06+00:00" }, + { + "name": "lcobucci/clock", + "version": "3.2.0", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/clock.git", + "reference": "6f28b826ea01306b07980cb8320ab30b966cd715" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/clock/zipball/6f28b826ea01306b07980cb8320ab30b966cd715", + "reference": "6f28b826ea01306b07980cb8320ab30b966cd715", + "shasum": "" + }, + "require": { + "php": "~8.2.0 || ~8.3.0", + "psr/clock": "^1.0" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "require-dev": { + "infection/infection": "^0.27", + "lcobucci/coding-standard": "^11.0.0", + "phpstan/extension-installer": "^1.3.1", + "phpstan/phpstan": "^1.10.25", + "phpstan/phpstan-deprecation-rules": "^1.1.3", + "phpstan/phpstan-phpunit": "^1.3.13", + "phpstan/phpstan-strict-rules": "^1.5.1", + "phpunit/phpunit": "^10.2.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Lcobucci\\Clock\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com" + } + ], + "description": "Yet another clock abstraction", + "support": { + "issues": "https://github.com/lcobucci/clock/issues", + "source": "https://github.com/lcobucci/clock/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2023-11-17T17:00:27+00:00" + }, + { + "name": "lcobucci/jwt", + "version": "5.2.0", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "0ba88aed12c04bd2ed9924f500673f32b67a6211" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/0ba88aed12c04bd2ed9924f500673f32b67a6211", + "reference": "0ba88aed12c04bd2ed9924f500673f32b67a6211", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-sodium": "*", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "psr/clock": "^1.0" + }, + "require-dev": { + "infection/infection": "^0.27.0", + "lcobucci/clock": "^3.0", + "lcobucci/coding-standard": "^11.0", + "phpbench/phpbench": "^1.2.9", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.10.7", + "phpstan/phpstan-deprecation-rules": "^1.1.3", + "phpstan/phpstan-phpunit": "^1.3.10", + "phpstan/phpstan-strict-rules": "^1.5.0", + "phpunit/phpunit": "^10.2.6" + }, + "suggest": { + "lcobucci/clock": ">= 3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ], + "support": { + "issues": "https://github.com/lcobucci/jwt/issues", + "source": "https://github.com/lcobucci/jwt/tree/5.2.0" + }, + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2023-11-20T21:17:42+00:00" + }, { "name": "monolog/monolog", "version": "3.5.0", @@ -2307,6 +2444,54 @@ }, "time": "2021-02-03T23:26:27+00:00" }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -4338,5 +4523,5 @@ "platform-overrides": { "php": "8.2" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php index d62ea49561..6fc5085e5b 100755 --- a/pandora_console/extensions/db_status.php +++ b/pandora_console/extensions/db_status.php @@ -50,14 +50,7 @@ function extension_db_status() } ui_print_info_message( - " - " . - __('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.') . - "
" . - " - " . - __('At the moment the checks is for MySQL/MariaDB.') . - "
" . - " - " . - __('User must have Select, Drop, Create and References privileges.') + ' - '.__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.').'
'.' - '.__('At the moment the checks is for MySQL/MariaDB.').'
'.' - '.__('User must have Select, Drop, Create and References privileges.') ); echo "
"; @@ -195,7 +188,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d try { $query = "SELECT IF(EXISTS(SELECT 1 FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'), 'true', 'false') AS result"; - if ($config['mysqli']) { + if ($config['mysqli']) { $exist_db = mysqli_fetch_assoc(mysqli_query($connection_test, $query))['result']; } else { $exist_db = mysql_fetch_assoc(mysqli_query($connection_test, $query))['result']; @@ -204,7 +197,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d ui_print_error_message(__("There was a problem during verification of the existence of the `$db_name` table")); return; } - + if ($exist_db == 'true') { ui_print_error_message(__("The testing DB `$db_name` already exists")); return; @@ -231,13 +224,13 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d if (check_ref_privileges($connection_test) == 0) { drop_database($connection_test, $db_name); - ui_print_error_message(__("Unable to create references with the provided user please check its privileges")); + ui_print_error_message(__('Unable to create references with the provided user please check its privileges')); return; } if (check_explain_privileges($connection_test) == 0) { drop_database($connection_test, $db_name); - ui_print_error_message(__("Unable to explain with the provided user please check its privileges")); + ui_print_error_message(__('Unable to explain with the provided user please check its privileges')); return; } @@ -261,7 +254,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d if (!$install_tables) { ui_print_error_message(__('Unsuccessful installed tables into the testing DB')); return; - } + } extension_db_check_tables_differences( $connection_test, @@ -269,7 +262,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d $db_name, $config['dbname'] ); - + drop_database($connection_test, $db_name); } @@ -348,7 +341,7 @@ function extension_db_check_tables_differences( if ($config['mysqli'] === true) { mysqli_select_db($connection_test, $db_name_test); $result = mysqli_query($connection_test, 'SHOW CREATE TABLE '.$table); - $create_query = mysqli_fetch_assoc($result)["Create Table"]; + $create_query = mysqli_fetch_assoc($result)['Create Table']; mysqli_free_result($result); ui_print_info_message( __('You can execute this SQL query for to fix.').'
'.'
'.$create_query.'
' @@ -356,7 +349,7 @@ function extension_db_check_tables_differences( } else { mysql_select_db($db_name_test, $connection_test); $result = mysql_query('SHOW CREATE TABLE '.$table, $connection_test); - $create_query = mysqli_fetch_assoc($result)["Create Table"]; + $create_query = mysqli_fetch_assoc($result)['Create Table']; mysql_free_result($result); ui_print_info_message( __('You can execute this SQL query for to fix.').'
'.'
'.$create_query.'
' @@ -539,6 +532,7 @@ function extension_db_status_execute_sql_file($url, $connection) } else { $result = mysql_query($query, $connection); } + if (!$result) { echo mysqli_error($connection); // Uncomment for debug @@ -563,19 +557,19 @@ function check_explain_privileges($connection) global $config; $has_privileges = 1; - $explain_check= "EXPLAIN tb1"; + $explain_check = 'EXPLAIN tb1'; - $create_tb1= "CREATE TABLE tb1 ( + $create_tb1 = 'CREATE TABLE tb1 ( id INT AUTO_INCREMENT PRIMARY KEY - )"; + )'; drop_database($connection, 'pandora_tmp_privilege_check'); try { if ($config['mysqli']) { - mysqli_query($connection, "CREATE DATABASE `pandora_tmp_privilege_check`"); + mysqli_query($connection, 'CREATE DATABASE `pandora_tmp_privilege_check`'); } else { - mysql_query("CREATE DATABASE `pandora_tmp_privilege_check`", $connection); + mysql_query('CREATE DATABASE `pandora_tmp_privilege_check`', $connection); } } catch (Exception $e) { ui_print_error_message(__('There was an error creating the DB during reference check')); @@ -584,9 +578,9 @@ function check_explain_privileges($connection) try { if ($config['mysqli'] === true) { - mysqli_select_db($connection, "pandora_tmp_privilege_check"); + mysqli_select_db($connection, 'pandora_tmp_privilege_check'); } else { - mysql_select_db("reference_check", $connection); + mysql_select_db('reference_check', $connection); } } catch (Exception $e) { ui_print_error_message(__('There was an error selecting the DB during reference check')); @@ -600,8 +594,8 @@ function check_explain_privileges($connection) $result = mysql_query($create_tb1, $connection); } - if(!$result){ - throw new Exception("Error on explain check: " . $connection->error); + if (!$result) { + throw new Exception('Error on explain check: '.$connection->error); } if ($config['mysqli'] === true) { @@ -610,10 +604,9 @@ function check_explain_privileges($connection) $result = mysql_query($explain_check, $connection); } - if(!$result){ - throw new Exception("Error on explain check: " . $connection->error); + if (!$result) { + throw new Exception('Error on explain check: '.$connection->error); } - } catch (Exception $e) { $has_privileges = 0; } finally { @@ -630,31 +623,31 @@ function check_drop_privileges($connection) try { if ($config['mysqli']) { - $create_db = mysqli_query($connection, "CREATE DATABASE IF NOT EXISTS`pandora_tmp_privilege_check`"); + $create_db = mysqli_query($connection, 'CREATE DATABASE IF NOT EXISTS`pandora_tmp_privilege_check`'); } else { - $create_db = mysql_query("CREATE DATABASE IF NOT EXISTS `pandora_tmp_privilege_check`", $connection); + $create_db = mysql_query('CREATE DATABASE IF NOT EXISTS `pandora_tmp_privilege_check`', $connection); } } catch (Exception $e) { $error_message = $e->getMessage(); } if (!$create_db) { - if (stripos($error_message, "access denied for user") !== false) { + if (stripos($error_message, 'access denied for user') !== false) { preg_match("/'.+?'\@'.+?'/", $error_message, $error_user); $error_user = $error_user[0]; - ui_print_error_message(__("Unable to create databases with the provided user please check its privileges")); + ui_print_error_message(__('Unable to create databases with the provided user please check its privileges')); return 0; } - + ui_print_error_message(__('There was an error creating the DB during drop check')); return 0; } - + try { if ($config['mysqli'] === true) { - mysqli_select_db($connection, "pandora_tmp_privilege_check"); + mysqli_select_db($connection, 'pandora_tmp_privilege_check'); } else { - mysql_select_db("reference_check", $connection); + mysql_select_db('reference_check', $connection); } } catch (Exception $e) { ui_print_error_message(__('There was an error selecting the DB during drop check')); @@ -666,9 +659,7 @@ function check_drop_privileges($connection) } catch (Exception $e) { $has_privileges = 0; ui_print_error_message( - __("Unable to drop databases with the provided user please check its privileges.") . - "
" . - __("Test databases may have been left over due to lack of drop privileges.") + __('Unable to drop databases with the provided user please check its privileges.').'
'.__('Test databases may have been left over due to lack of drop privileges.') ); } finally { return $has_privileges; @@ -683,21 +674,21 @@ function check_ref_privileges($connection) drop_database($connection, 'pandora_tmp_privilege_check'); - $create_tb1= "CREATE TABLE tb1 ( + $create_tb1 = 'CREATE TABLE tb1 ( id INT AUTO_INCREMENT PRIMARY KEY - )"; + )'; - $create_tb2 = "CREATE TABLE tb2 ( + $create_tb2 = 'CREATE TABLE tb2 ( id INT AUTO_INCREMENT PRIMARY KEY, id_tb1 INT, FOREIGN KEY (id_tb1) REFERENCES tb2(id) - )"; - + )'; + try { if ($config['mysqli']) { - mysqli_query($connection, "CREATE DATABASE `pandora_tmp_privilege_check`"); + mysqli_query($connection, 'CREATE DATABASE `pandora_tmp_privilege_check`'); } else { - mysql_query("CREATE DATABASE `pandora_tmp_privilege_check`", $connection); + mysql_query('CREATE DATABASE `pandora_tmp_privilege_check`', $connection); } } catch (Exception $e) { ui_print_error_message(__('There was an error creating the DB during reference check')); @@ -706,9 +697,9 @@ function check_ref_privileges($connection) try { if ($config['mysqli'] === true) { - mysqli_select_db($connection, "pandora_tmp_privilege_check"); + mysqli_select_db($connection, 'pandora_tmp_privilege_check'); } else { - mysql_select_db("reference_check", $connection); + mysql_select_db('reference_check', $connection); } } catch (Exception $e) { ui_print_error_message(__('There was an error selecting the DB during reference check')); @@ -722,8 +713,8 @@ function check_ref_privileges($connection) $result = mysql_query($create_tb1, $connection); } - if(!$result){ - throw new Exception("Error on reference check: " . $connection->error); + if (!$result) { + throw new Exception('Error on reference check: '.$connection->error); } if ($config['mysqli'] === true) { @@ -732,10 +723,9 @@ function check_ref_privileges($connection) $result = mysql_query($create_tb2, $connection); } - if(!$result){ - throw new Exception("Error on reference check: " . $connection->error); + if (!$result) { + throw new Exception('Error on reference check: '.$connection->error); } - } catch (Exception $e) { $has_privileges = 0; } finally { diff --git a/pandora_console/extensions/realtime_graphs/ajax.php b/pandora_console/extensions/realtime_graphs/ajax.php index f6dcfc508d..4d1d2e816f 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -55,7 +55,7 @@ switch ($graph) { if ($os == 'windows') { $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(httpd)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); } else { - $apache = exec("ps aux | grep apache2 | grep -v safe | grep -v grep && echo 1 || echo 0") == 1 ? "apache2" : "apache"; + $apache = exec('ps aux | grep apache2 | grep -v safe | grep -v grep && echo 1 || echo 0') == 1 ? 'apache2' : 'apache'; $data = exec("ps aux | grep $apache | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); } break; diff --git a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini index c4b4591ce2..5cbd75d0de 100644 --- a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini +++ b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini @@ -1,4 +1,4 @@ -pandorafms.vmware=3d1785e1baa07db0a40b9e47bb30472c +pandorafms.vmware=999bbda7bbcc313aee81d6816f8a5c0e pandorafms.mysql=33d470c7492214d4b384ed307e81adf4 pandorafms.vmware=1deafce1d55d3574645d8b136104e9ad pandorafms.mysql=ca7dd8b80a1a03a25eb0fb077818ad63 diff --git a/pandora_console/extras/mr/69.sql b/pandora_console/extras/mr/69.sql index ea49c68624..534cef73ef 100644 --- a/pandora_console/extras/mr/69.sql +++ b/pandora_console/extras/mr/69.sql @@ -7754,4 +7754,14 @@ ALTER TABLE `tdeployment_hosts` DROP COLUMN `arch`; -- Update all deployment recon tasks port UPDATE `trecon_task` SET `field4` = 41121 WHERE `type` = 9; +-- Update execution in proxmox discovery plugin +SET @short_name = 'pandorafms.proxmox'; +SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name; +UPDATE `tdiscovery_apps_executions` SET `execution` = ''_exec1_' --conf '_tempfileProxmox_'' WHERE `id_app` = @id_app; + +INSERT INTO `tconfig` (`token`, `value`) VALUES ('JWT_signature', 1); +DELETE FROM tconfig WHERE `token` = 'loginhash_pwd'; + +UPDATE `tdiscovery_apps` SET `version` = '1.5' WHERE `short_name` = 'pandorafms.vmware'; + COMMIT; \ No newline at end of file diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index a396964166..73c5fcc90b 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -363,20 +363,6 @@ echo sprintf('
', $menuTypeClass); $display_counter = 'display:none'; } - if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { - $header_setup .= ''; - } - $header_autorefresh = '
'; $header_autorefresh .= $autorefresh_link_open_img; $header_autorefresh .= $autorefresh_img; @@ -391,6 +377,20 @@ echo sprintf('
', $menuTypeClass); $header_autorefresh_counter .= '
'; } + if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { + $header_setup .= ''; + } + $modal_box = '