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 a464b2d288..aaba742659 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-240422 +Version: 7.0NG.776-240506 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 9ea3d0f4cb..c2fa12960c 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-240422" +pandora_version="7.0NG.776-240506" 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 503a7923ae..b784189567 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 => '240422'; +use constant AGENT_BUILD => '240506'; # 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 67b976de1e..ee143f48f4 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 240422 +%define release 240506 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 81c7fcb8a8..543ecf5db8 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 240422 +%define release 240506 %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 ba42b79531..bce5bc22c9 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 240422 +%define release 240506 %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 a2fdf1c9c7..c195e54d12 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 240422 +%define release 240506 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 27fe3760b7..943cfc54f1 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 240422 +%define release 240506 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 1044414ea0..cb23e3bd30 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="240422" +PI_BUILD="240506" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 2016ed42d3..435fd2861e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{240422} +{240506} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 1840bdc537..d02064850c 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 240422") +#define PANDORA_VERSION ("7.0NG.776 Build 240506") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 4b2ecd6170..c3df89f6c4 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 240422))" + VALUE "ProductVersion", "(7.0NG.776(Build 240506))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 684262fa0e..25ad1edcad 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.776-240422 +Version: 7.0NG.776-240506 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 b86606e3bf..570166590b 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-240422" +pandora_version="7.0NG.776-240506" 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/api_checker.php b/pandora_console/extensions/api_checker.php index 38488fc9e4..557ec82e1b 100755 --- a/pandora_console/extensions/api_checker.php +++ b/pandora_console/extensions/api_checker.php @@ -69,38 +69,41 @@ function api_execute( if (empty($url) === true) { $url = 'http://'.$ip.$pandora_url.'/include/api.php?'; + } else { + $url_schema = parse_url($url); + $url = $url_schema['scheme'].'://'.$url_schema['host'].$pandora_url.'/include/api.php?'; + } - if (empty($op) === false) { - $data['op'] = $op; - } + if (empty($op) === false) { + $data['op'] = $op; + } - if (empty($op2) === false) { - $data['op2'] = $op2; - } + if (empty($op2) === false) { + $data['op2'] = $op2; + } - if (empty($id) === false) { - $data['id'] = $id; - } + if (empty($id) === false) { + $data['id'] = $id; + } - if (empty($id2) === false) { - $data['id2'] = $id2; - } + if (empty($id2) === false) { + $data['id2'] = $id2; + } - if (empty($return_type) === false) { - $data['return_type'] = $return_type; - } + if (empty($return_type) === false) { + $data['return_type'] = $return_type; + } - if (empty($other) === false) { - $data['other_mode'] = $other_mode; - $data['other'] = $other; - } + if (empty($other) === false) { + $data['other_mode'] = $other_mode; + $data['other'] = $other; + } - // If token is not reported,use old method. - if (empty($token) === true) { - $data['apipass'] = $apipass; - $data['user'] = $user; - $data['pass'] = $password; - } + // If token is not reported,use old method. + if (empty($token) === true) { + $data['apipass'] = $apipass; + $data['user'] = $user; + $data['pass'] = $password; } $url_protocol = parse_url($url)['scheme']; 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 1482540f91..4d1d2e816f 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -27,7 +27,7 @@ switch ($graph) { if ($os == 'windows') { $data = exec('wmic cpu get loadpercentage|find /I /V "Loadpercentage" | findstr /r "[0-9]" '); } else { - $data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'"); + $data = exec("top -bn 2 -d 0.01 | grep 'Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'"); } break; @@ -55,7 +55,8 @@ 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 { - $data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); + $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; @@ -63,7 +64,7 @@ switch ($graph) { if ($os == 'windows') { $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(pandora_server)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); } else { - $data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'"); + $data = exec("ps aux | grep pandora_server | 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 2fcd79a8ce..5cbd75d0de 100644 --- a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini +++ b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini @@ -1,4 +1,4 @@ -pandorafms.vmware=a272ee00a9b5f201bb708bef72bbe276 +pandorafms.vmware=999bbda7bbcc313aee81d6816f8a5c0e pandorafms.mysql=33d470c7492214d4b384ed307e81adf4 pandorafms.vmware=1deafce1d55d3574645d8b136104e9ad pandorafms.mysql=ca7dd8b80a1a03a25eb0fb077818ad63 diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql index b27f4ee495..fc08eb8b12 100644 --- a/pandora_console/extras/mr/68.sql +++ b/pandora_console/extras/mr/68.sql @@ -64,7 +64,7 @@ ALTER TABLE `tmerge_queries` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_09 -- Update version for plugin oracle UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle'; -- Update version for plugin oracle -UPDATE `tdiscovery_apps` SET `version` = '1.3' WHERE `short_name` = 'pandorafms.vmware'; +UPDATE `tdiscovery_apps` SET `version` = '1.4' WHERE `short_name` = 'pandorafms.vmware'; ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL; ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL; diff --git a/pandora_console/extras/mr/69.sql b/pandora_console/extras/mr/69.sql index c2d2fc3288..534cef73ef 100644 --- a/pandora_console/extras/mr/69.sql +++ b/pandora_console/extras/mr/69.sql @@ -1,5 +1,11 @@ START TRANSACTION; +-- Remove column id_usuario_destino from tmensajes -- +SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmensajes' AND COLUMN_NAME='id_usuario_destino' AND table_schema = DATABASE()); +SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmensajes` DROP COLUMN `id_usuario_destino`', 'SELECT ""'); +prepare stmt from @sqlstmt; +execute stmt; + DROP TABLE IF EXISTS tskin; ALTER TABLE tfavmenu_user CONVERT TO CHARACTER SET UTF8MB4; @@ -7748,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 2d3d95a77e..73c5fcc90b 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -52,7 +52,7 @@ echo sprintf('
', $menuTypeClass); } // ======= Servers List =============================================== - if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { + if ((bool) check_acl($config['id_user'], 0, 'PM') !== false) { $servers = []; $servers_info = servers_get_info(); @@ -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 = ''; } // Enterprise string. @@ -1142,42 +1129,25 @@ class SnmpConsole extends HTML $whereSubquery .= ' AND alerted = '.$$alert; } - if ($severity != -1) { + $severity = (int) $severity; + if ($severity !== -1) { // There are two special severity values aimed to match two different trap standard severities // in database: warning/critical and critical/normal. - if ($severity != EVENT_CRIT_OR_NORMAL - && $severity != EVENT_CRIT_WARNING_OR_CRITICAL + if ($severity !== EVENT_CRIT_OR_NORMAL + && $severity !== EVENT_CRIT_WARNING_OR_CRITICAL + && $severity !== EVENT_CRIT_NOT_NORMAL ) { // Test if enterprise is installed to search oid in text or oid field in ttrap. - if ($config['enterprise_installed']) { - $whereSubquery .= ' AND ( - (alerted = 0 AND severity = '.$severity.') OR - (alerted = 1 AND priority = '.$severity.'))'; - } else { - $whereSubquery .= ' AND ( - (alerted = 0 AND 1 = '.$severity.') OR - (alerted = 1 AND priority = '.$severity.'))'; - } + $whereSubquery .= ' AND severity = '.$severity; } else if ($severity === EVENT_CRIT_WARNING_OR_CRITICAL) { // Test if enterprise is installed to search oid in text or oid field in ttrap. - if ($config['enterprise_installed']) { - $whereSubquery .= ' AND ( - (alerted = 0 AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR - (alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))'; - } else { - $whereSubquery .= ' AND ( - (alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))'; - } + $whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_WARNING_OR_CRITICAL.')'; } else if ($severity === EVENT_CRIT_OR_NORMAL) { // Test if enterprise is installed to search oid in text or oid field in ttrap. - if ($config['enterprise_installed']) { - $whereSubquery .= ' AND ( - (alerted = 0 AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR - (alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))'; - } else { - $whereSubquery .= ' AND ( - (alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))'; - } + $whereSubquery .= ' AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_OR_NORMAL.')'; + } else if ($severity === EVENT_CRIT_NOT_NORMAL) { + // Test if enterprise is installed to search oid in text or oid field in ttrap. + $whereSubquery .= ' AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.' OR severity = '.EVENT_CRIT_NOT_NORMAL.')'; } } diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index f13f18f05a..7a215f9070 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ use DI\ContainerBuilder; /* * Pandora build version and version */ -$build_version = 'PC240422'; +$build_version = 'PC240506'; $pandora_version = 'v7.0NG.776'; // Do not overwrite default timezone set if defined. @@ -185,6 +185,7 @@ if (session_status() === PHP_SESSION_NONE) { config_process_config(); config_prepare_session(); +config_prepare_jwt_signature(); if ((bool) $config['console_log_enabled'] === true) { error_reporting(E_ALL ^ E_NOTICE); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 3da3e2bfba..083fda60d8 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1006,10 +1006,10 @@ function get_parameter($name, $default='') function get_parameter_date($name, $default='', $date_format='Y/m/d') { - // TODO: Configure default value. $date_end = get_parameter('date_end', 0); $time_end = get_parameter('time_end'); $datetime_end = strtotime($date_end.' '.$time_end); + $date_none = get_parameter($name, $default); $custom_date = get_parameter('custom_date', 0); $range = get_parameter($name, SECONDS_1DAY); @@ -1055,6 +1055,9 @@ function get_parameter_date($name, $default='', $date_format='Y/m/d') $date_init = $first_of_week; $period = (strtotime($date_end) - strtotime($first_of_week)); } + } else if ($date_none === 'none') { + // Prioritize the report item period based on the current local date/time. + $date_end = date('Y/m/d H:i:s'); } else { $date_end = date('Y/m/d H:i:s'); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range)); diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 12f79aa680..42e864afb9 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1544,7 +1544,9 @@ function agents_get_modules( $indexed=true, $get_not_init_modules=true, $force_tags=false, - $filter_include_sql=true + $filter_include_sql=true, + $pagination=false, + $offset=0, ) { global $config; @@ -1717,7 +1719,17 @@ function agents_get_modules( $sql_tags_join, $where ); - $result = db_get_all_rows_sql($sql); + + $limit = ''; + if ($pagination === true && isset($config['paginate_module']) === true) { + if ($offset === 0) { + $limit = ' LIMIT '.$config['block_size'].' OFFSET 0'; + } else { + $limit = ' LIMIT '.$config['block_size'].' OFFSET '.$offset; + } + } + + $result = db_get_all_rows_sql($sql.$limit); if (empty($result)) { return []; @@ -3333,7 +3345,7 @@ function agents_update_gis( * * @return array A list of network interfaces information by agents. */ -function agents_get_network_interfaces($agents=false, $agents_filter=false) +function agents_get_network_interfaces($agents=false, $agents_filter=false, $pagination=false, $offset=0, $count=false) { global $config; @@ -3432,8 +3444,17 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false) $columns, $filter, true, - false + false, + false, + true, + $pagination, + $offset ); + + if ($count === true) { + return (count($modules) ?? 0); + } + if (!empty($modules)) { $interfaces = []; @@ -4755,7 +4776,10 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent) 'force_checks', false, 'window.location.assign("'.$url.'&flag_agent=1")', - [ 'mode' => 'link' ], + [ + 'mode' => 'link', + 'class' => 'mrgn_lft_20px ', + ], true ); } @@ -4934,7 +4958,7 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent) $module_score = modules_get_agentmodule_id(io_safe_input('Hardening - Score'), $agent['id_agente']); $hardening = ''; if (is_array($module_score) === true && key_exists('id_agente_modulo', $module_score) == true) { - $raw_data_score = modules_get_raw_data($module_score['id_agente_modulo'], 0, time()); + $raw_data_score = modules_get_raw_data($module_score['id_agente_modulo'], 0, time(), false); $hardening = format_numeric($raw_data_score[0]['datos'], 2); $data = []; $data[0] = ''.__('Hardening').''; diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index f9a3cb64ed..048fea7f9e 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -13175,10 +13175,12 @@ function api_set_create_event($id, $trash1, $other, $returnType) $values['id_extra'] = ''; } - if ($other['data'][21] != '') { - $values['event_custom_id'] = $other['data'][21]; - } else { - $values['event_custom_id'] = ''; + if (empty($values['event_custom_id']) === true) { + if ($other['data'][21] != '') { + $values['event_custom_id'] = $other['data'][21]; + } else { + $values['event_custom_id'] = ''; + } } $custom_data = base64_decode($values['custom_data']); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index b80fe726c8..d4c71597fc 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -30,6 +30,7 @@ // Config functions. require_once __DIR__.'/../vendor/autoload.php'; require_once __DIR__.'/functions.php'; +require_once __DIR__.'/class/JWTRepository.class.php'; enterprise_include_once('include/functions_config.php'); use PandoraFMS\Core\DBMaintainer; @@ -207,10 +208,6 @@ function config_update_config() $error_update[] = __('Chromium config directory'); } - if (config_update_value('loginhash_pwd', (string) get_parameter('loginhash_pwd'), true, true) === false) { - $error_update[] = __('Auto login (hash) password'); - } - if (config_update_value('timesource', (string) get_parameter('timesource'), true) === false) { $error_update[] = __('Time source'); } @@ -706,8 +703,10 @@ function config_update_config() $error_update[] = __('Admin LDAP login'); } - if (config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'), true, true) === false) { - $error_update[] = __('Admin LDAP password'); + if ((bool) get_parameter('ldap_admin_pass_password_changed', false) === true) { + if (config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'), true, true) === false) { + $error_update[] = __('Admin LDAP password'); + } } if (config_update_value('ldap_search_timeout', (int) get_parameter('ldap_search_timeout', 5), true) === false) { @@ -742,8 +741,10 @@ function config_update_config() $error_update[] = __('Admin secondary LDAP login'); } - if (config_update_value('ldap_admin_pass_secondary', get_parameter('ldap_admin_pass_secondary'), true, true) === false) { - $error_update[] = __('Admin secondary LDAP password'); + if ((bool) get_parameter('ldap_admin_pass_secondary_password_changed', false) === true) { + if (config_update_value('ldap_admin_pass_secondary', get_parameter('ldap_admin_pass_secondary'), true, true) === false) { + $error_update[] = __('Admin LDAP password secondary'); + } } if (config_update_value('fallback_local_auth', get_parameter('fallback_local_auth'), true) === false) { @@ -2224,10 +2225,6 @@ function config_process_config() config_update_value('events_per_query', 5000); } - if (!isset($config['loginhash_pwd'])) { - config_update_value('loginhash_pwd', (rand(0, 1000) * rand(0, 1000)).'pandorahash', false, true); - } - if (!isset($config['trap2agent'])) { config_update_value('trap2agent', 0); } @@ -2491,6 +2488,10 @@ function config_process_config() config_update_value('number_modules_queue', 500); } + if (!isset($config['JWT_signature'])) { + config_update_value('JWT_signature', 1); + } + if (!isset($config['eastern_eggs_disabled'])) { config_update_value('eastern_eggs_disabled', 1); } @@ -4224,3 +4225,13 @@ function config_prepare_session() ini_set('post_max_size', $config['max_file_size']); ini_set('upload_max_filesize', $config['max_file_size']); } + + +function config_prepare_jwt_signature() +{ + global $config; + if (is_metaconsole() === true && $config['JWT_signature'] == 1) { + $signature = JWTRepository::generateSignature(); + JWTRepository::syncSignatureWithNodes($signature); + } +} diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 6e6068f386..bf10fc8eb6 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1119,11 +1119,13 @@ function events_get_all( } } - if (!$user_is_admin && users_can_manage_group_all('ER') === false) { - $ER_groups = users_get_groups($config['id_user'], 'ER', true); + if (!$user_is_admin && users_can_manage_group_all('EM') === false) { $EM_groups = users_get_groups($config['id_user'], 'EM', true, true); $EW_groups = users_get_groups($config['id_user'], 'EW', true, true); + } + if (!$user_is_admin && users_can_manage_group_all('ER') === false) { + $ER_groups = users_get_groups($config['id_user'], 'ER', true); // Get groups where user have ER grants. if ((bool) $filter['search_secondary_groups'] === true) { $sql_filters[] = sprintf( @@ -1155,7 +1157,7 @@ function events_get_all( } // Free search. - if (empty($filter['search']) === false && (bool) $filter['regex'] === false) { + if (empty($filter['search']) === false) { if (isset($config['dbconnection']->server_version) === true && $config['dbconnection']->server_version > 50600 ) { @@ -1185,23 +1187,39 @@ function events_get_all( $array_search[] = 'lower(ta.alias)'; } - // Disregard repeated whitespaces when searching. - $collapsed_spaces_search = preg_replace('/( )+/', ' ', $filter['search']); + if ((bool) $filter['regex'] === true) { + $sql_search = ' AND ('; + foreach ($array_search as $key => $field) { + $sql_search .= sprintf( + '%s %s %s REGEXP "%s" ', + ($key === 0) ? '' : $nexo, + $field, + $not_search, + preg_replace('/(? $field) { - $sql_search .= sprintf( - '%s LOWER(REGEXP_REPLACE(%s, "( )+", " ")) %s like LOWER("%%%s%%")', - ($key === 0) ? '' : $nexo, - $field, - $not_search, - $collapsed_spaces_search - ); - $sql_search .= ' '; + $sql_search .= ' )'; + } else { + // Disregard repeated whitespaces when searching. + $collapsed_spaces_search = preg_replace('/( )+/', ' ', $filter['search']); + + $sql_search = ' AND ('; + foreach ($array_search as $key => $field) { + $sql_search .= sprintf( + '%s LOWER(REGEXP_REPLACE(%s, "( )+", " ")) %s like LOWER("%%%s%%")', + ($key === 0) ? '' : $nexo, + $field, + $not_search, + $collapsed_spaces_search + ); + $sql_search .= ' '; + } + + $sql_search .= ' )'; } - $sql_search .= ' )'; - $sql_filters[] = $sql_search; } @@ -1674,7 +1692,7 @@ function events_get_all( } } - if (!$user_is_admin && users_can_manage_group_all('ER') === false) { + if (!$user_is_admin && users_can_manage_group_all('EM') === false) { $exists_id_grupo = false; foreach ($fields as $field) { if (str_contains($field, 'te.id_grupo') === true || str_contains($field, 'te.*') === true) { @@ -1798,7 +1816,7 @@ function events_get_all( return $sql; } - if (!$user_is_admin && users_can_manage_group_all('ER') === false) { + if (!$user_is_admin && users_can_manage_group_all('EM') === false) { $can_manage = '0 as user_can_manage'; if (empty($EM_groups) === false) { $can_manage = sprintf( @@ -4375,12 +4393,9 @@ function events_page_details($event, $server_id=0) global $config; // If metaconsole switch to node to get details and custom fields. - $hashstring = ''; $serverstring = ''; if (is_metaconsole() === true && empty($server_id) === false) { $server = metaconsole_get_connection_by_id($server_id); - $hashdata = metaconsole_get_server_hashdata($server); - $hashstring = '&loginhash=auto&loginhash_data='.$hashdata.'&loginhash_user='.str_rot13($config['id_user']); $serverstring = $server['server_url'].'/'; if (metaconsole_connect($server) !== NOERR) { @@ -4421,28 +4436,7 @@ function events_page_details($event, $server_id=0) true ).ui_print_help_tip(__('This agent belongs to metaconsole, is not possible display it'), true); } else if (can_user_access_node() && is_metaconsole()) { - // Workaround to pass login hash data in POST body instead of directly in the URL. - parse_str($hashstring, $url_hash_array); - $redirection_form = ""; - $redirection_form .= html_print_input_hidden( - 'loginhash', - $url_hash_array['loginhash'], - true - ); - $redirection_form .= html_print_input_hidden( - 'loginhash_data', - $url_hash_array['loginhash_data'], - true - ); - $redirection_form .= html_print_input_hidden( - 'loginhash_user', - $url_hash_array['loginhash_user'], - true - ); - $redirection_form .= ''; - - $data[1] = $redirection_form; - $data[1] .= ""; + $data[1] = ''; $data[1] .= ''.$agent['alias'].''; $data[1] .= ''; } else if (can_user_access_node()) { @@ -4453,7 +4447,7 @@ function events_page_details($event, $server_id=0) '', false, $serverstring, - $hashstring, + '', $agent['alias'] ); } else { @@ -4586,7 +4580,7 @@ function events_page_details($event, $server_id=0) 'id_mg', $id_module_group ); - $data[1] = ''; + $data[1] = ''; $data[1] .= $module_group; $data[1] .= ''; } @@ -4652,7 +4646,7 @@ function events_page_details($event, $server_id=0) if ($event['id_alert_am'] != 0) { $data = []; $data[0] = '
'.__('Source').'
'; - $data[1] = ''; + $data[1] = ''; $standby = db_get_value('standby', 'talert_template_modules', 'id', $event['id_alert_am']); if (!$standby) { $data[1] .= html_print_image( @@ -5928,17 +5922,30 @@ function events_get_instructions($event, $max_text_length=300) return $value; } + $event_name = ui_print_truncate_text( + io_safe_output($event['evento']), + GENERIC_SIZE_TEXT, + false, + true, + false, + '...' + ); + + $over_event_name = base64_encode($event_name); $output = '
'; $output .= ''; - $output .= ''; + $output .= ''; $output .= html_print_image( 'images/default_list.png', true, - ['title' => $over_text] + [ + 'title' => $over_text, + 'class' => 'invert_filter', + ] ).''; return $output; diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 7e3d566cdc..51e2932f31 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -1032,7 +1032,7 @@ function filemanager_file_explorer( false, 'show_form_create_folder()', [ - 'class' => 'margin-right-2 invert_filter secondary', + 'class' => 'margin-right-2 primary buttonButton', 'icon' => 'create_directory', ], true, @@ -1047,7 +1047,7 @@ function filemanager_file_explorer( false, 'show_create_text_file()', [ - 'class' => 'margin-right-2 invert_filter secondary', + 'class' => 'margin-right-2 primary buttonButton', 'icon' => 'create_file', ], true, @@ -1061,7 +1061,7 @@ function filemanager_file_explorer( false, 'show_upload_file()', [ - 'class' => 'margin-right-2 invert_filter secondary', + 'class' => 'margin-right-2 primary buttonButton', 'icon' => 'upload_file', ], true, diff --git a/pandora_console/include/functions_forecast.php b/pandora_console/include/functions_forecast.php index 1f0d1e59d9..e4fb43a7c5 100644 --- a/pandora_console/include/functions_forecast.php +++ b/pandora_console/include/functions_forecast.php @@ -134,11 +134,14 @@ function forecast_projection_graph( // 3.1 Standard deviation for X: sqrt((Sum(Xi²)/Obs) - (avg X)²) // 3.2 Standard deviation for Y: sqrt((Sum(Yi²)/Obs) - (avg Y)²) // Linear correlation coefficient: - // Agent interval could be zero, 300 is the predefined + // Agent interval could be zero, 300 is the predefined. if ($sum_obs == 0) { $agent_interval = SECONDS_5MINUTES; } else { $agent_interval = ($sum_diff_dates / $sum_obs); + if ($agent_interval < 60) { + $agent_interval = SECONDS_1MINUTE; + } } // Could be a inverse correlation coefficient @@ -170,7 +173,7 @@ function forecast_projection_graph( $a = 0; } - // Data inicialization + // Data inicialization. $output_data = []; if ($prediction_period != false) { $limit_timestamp = ($last_timestamp + $prediction_period); @@ -199,50 +202,54 @@ function forecast_projection_graph( $time_format = 'M d'; } - // Aplying linear regression to module data in order to do the prediction - $idx = 0; - // Create data in graph format like - while ($in_range) { - $now = time(); + try { + // Aplying linear regression to module data in order to do the prediction. + $idx = 0; + // Create data in graph format like. + while ($in_range) { + $now = time(); - // Check that exec time is not greater than half max exec server time - if ($max_exec_time != false) { - if (($begin_time + ($max_exec_time / 2)) < $now) { - return false; - } - } - - $timestamp_f = ($current_ts * 1000); - - if ($csv) { - $output_data[$idx]['date'] = $current_ts; - $output_data[$idx]['data'] = ($a + ($b * $current_ts)); - } else { - $output_data[$idx][0] = $timestamp_f; - $output_data[$idx][1] = ($a + ($b * $current_ts)); - } - - // Using this function for prediction_date - if ($prediction_period == false) { - // These statements stop the prediction when interval is greater than 2 years - if (($current_ts - $last_timestamp) >= 94608000 - || $max_value == $min_value - ) { - return false; + // Check that exec time is not greater than half max exec server time. + if ($max_exec_time != false) { + if (($begin_time + ($max_exec_time / 2)) < $now) { + return false; + } } - // Found it - if (($max_value >= $output_data[$idx][1]) - && ($min_value <= $output_data[$idx][0]) - ) { - return ($current_ts + ($sum_diff_dates * $agent_interval)); - } - } else if ($current_ts > $limit_timestamp) { - $in_range = false; - } + $timestamp_f = ($current_ts * 1000); - $current_ts = ($current_ts + $agent_interval); - $idx++; + if ($csv) { + $output_data[$idx]['date'] = $current_ts; + $output_data[$idx]['data'] = ($a + ($b * $current_ts)); + } else { + $output_data[$idx][0] = $timestamp_f; + $output_data[$idx][1] = ($a + ($b * $current_ts)); + } + + // Using this function for prediction_date. + if ($prediction_period == false) { + // These statements stop the prediction when interval is greater than 2 years. + if (($current_ts - $last_timestamp) >= 94608000 + || $max_value == $min_value + ) { + return false; + } + + // Found it. + if (($max_value >= $output_data[$idx][1]) + && ($min_value <= $output_data[$idx][0]) + ) { + return ($current_ts + ($sum_diff_dates * $agent_interval)); + } + } else if ($current_ts > $limit_timestamp) { + $in_range = false; + } + + $current_ts = ($current_ts + $agent_interval); + $idx++; + } + } catch (\Exception $e) { + return false; } return $output_data; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 0a0b66f5c9..64e7ed2063 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3308,7 +3308,8 @@ function graph_custom_sql_graph( $only_image=false, $homeurl='', $ttl=1, - $max_num_elements=8 + $max_num_elements=8, + $layout=false ) { global $config; diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 5dd99ebce9..079aaa555a 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -2662,7 +2662,20 @@ function tactical_groups_get_agents_and_monitoring($id_groups, $data='') $tdata[1] = ''.$tdata[1].''; if ($data['total_agents'] > 500 && !enterprise_installed()) { - $tdata[2] = "
"; + $tdata[2] = "
"; + $tdata[2] .= html_print_image( + 'images/alert_enterprise.png', + true, + [ + 'title' => __('Enterprise version not installed'), + 'class' => 'img_help' + ], + false, + false, + false, + true + ); + $tdata[2] .= '
'; } $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Monitor checks'), 'class' => 'invert_filter'], false, false, false, true); @@ -2676,7 +2689,20 @@ function tactical_groups_get_agents_and_monitoring($id_groups, $data='') */ if ($data['total_agents']) { if (($data['monitor_total'] / $data['total_agents'] > 100) && !enterprise_installed()) { - $tdata[5] = "
"; + $tdata[5] = "
"; + $tdata[5] .= html_print_image( + 'images/alert_enterprise.png', + true, + [ + 'title' => __('Enterprise version not installed'), + 'class' => 'img_help' + ], + false, + false, + false, + true + ); + $tdata[5] .= '
'; } } @@ -2728,7 +2754,20 @@ function tactical_groups_get_stats_alerts($id_groups, $data='') */ if ($data['monitor_alerts'] > $data['total_agents'] && !enterprise_installed()) { - $tdata[2] = "
"; + $tdata[2] = "
"; + $tdata[2] .= html_print_image( + 'images/alert_enterprise.png', + true, + [ + 'title' => __('Enterprise version not installed'), + 'class' => 'img_help' + ], + false, + false, + false, + true + ); + $tdata[2] .= '
'; } $tdata[3] = html_print_image( diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index bee6de0c11..6de4467d83 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1686,34 +1686,56 @@ function html_print_select_multiple_modules_filtered(array $data):string ); $output .= '
'; + $agent_class = ''; if (empty($data['searchBar']) === false && $data['searchBar'] === true) { - $output .= '
'; + $output .= ''; } @@ -1770,6 +1792,7 @@ function html_print_select_multiple_modules_filtered(array $data):string 'style' => 'min-width: 200px;max-width:200px;', 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', 'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '', + 'input_class' => $agent_class, ] ); } else { @@ -1786,6 +1809,7 @@ function html_print_select_multiple_modules_filtered(array $data):string 'style' => 'min-width: 200px;max-width:200px;', 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', 'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '', + 'input_class' => $agent_class, ] ); } @@ -1929,7 +1953,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin 'return' => true, 'nothing' => __('All'), 'nothing_value' => 0, - 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', + 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)', ] ); $output .= '
'; @@ -1965,7 +1989,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin 'name' => 'filtered-module-show-common-modules-'.$uniqId, 'id' => 'filtered-module-show-common-modules-'.$uniqId, 'return' => true, - 'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', + 'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)', ] ); @@ -2053,7 +2077,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin 'return' => true, 'multiple' => true, 'style' => 'min-width: 200px;max-width:200px;', - 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', + 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)', 'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '', 'truncate_size' => 300, ] @@ -2070,7 +2094,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin 'return' => true, 'multiple' => true, 'style' => 'min-width: 200px;max-width:200px;', - 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', + 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)', 'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '', 'truncate_size' => 300, ] @@ -2505,7 +2529,8 @@ function html_print_extended_select_for_time( $no_change=false, $allow_zero=0, $units=null, - $script_input='' + $script_input='', + $units_select2=false ) { global $config; $admin = is_user_admin($config['id_user']); @@ -2595,7 +2620,19 @@ function html_print_extended_select_for_time( echo '
'; echo '
'; - html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class, $script_input); + html_print_input_text( + $uniq_name.'_text', + $selected, + '', + $size, + 255, + false, + $readonly, + false, + '', + $class.(($units_select2 === true) ? ' w100p' : ''), + $script_input + ); html_print_input_hidden($name, $selected, false, $uniq_name); html_print_select( @@ -2619,7 +2656,7 @@ function html_print_extended_select_for_time( false, false, false, - false + $units_select2 ); echo '  '.html_print_image( 'images/logs@svg.svg', @@ -2632,6 +2669,7 @@ function html_print_extended_select_for_time( ] ).''; echo '
'; + echo ""; + + if ($units_select2 === true) { + echo ' + + '; + } + $returnString = ob_get_clean(); if ($return) { @@ -3440,13 +3490,19 @@ function html_print_anchor( * * The element will have an id like: "password-$name" * - * @param string $name Input name. - * @param string $value Input value. - * @param string $alt Alternative HTML string (optional). - * @param integer $size Size of the input (optional). - * @param integer $maxlength Maximum length allowed (optional). - * @param boolean $return Whether to return an output string or echo now (optional, echo by default). - * @param boolean $disabled Disable the button (optional, button enabled by default). + * @param string $name Input name. + * @param string $value Input value. + * @param string $alt Alternative HTML string (optional). + * @param integer $size Size of the input (optional). + * @param integer $maxlength Maximum length allowed (optional). + * @param boolean $return Whether to return an output string or echo now (optional, echo by default). + * @param boolean $disabled Disable the button (optional, button enabled by default). + * @param boolean $required Whether the input is required (optional, not required by default). + * @param string $class Additional CSS classes for the input (optional). + * @param string $autocomplete Autocomplete attribute value (optional, off by default). + * @param boolean $hide_div_eye Whether to hide the div with the eye icon (optional, false by default). + * @param string $div_class Additional CSS classes for the div (optional). + * @param boolean $not_show_value Whether to not show the value in the input (optional, false by default), FOR USE THIS VALUE YOU NEED CONTROL THE INPUT 'password_changed'. * * @return string HTML code if return parameter is true. */ @@ -3462,7 +3518,8 @@ function html_print_input_password( $class='', $autocomplete='off', $hide_div_eye=false, - $div_class='' + $div_class='', + $not_show_value=false, ) { if ($maxlength == 0) { $maxlength = 255; @@ -3493,7 +3550,40 @@ function html_print_input_password( } } - return '
'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'
'; + $extra_output = ''; + if ($not_show_value === true) { + $unique_id = 'flag_password_'.uniqid(); + $extra_output = html_print_input_hidden($name.'_password_changed', 0, true, false, false, $unique_id); + $attr['class'] .= ' bg-image-none'; + $extra_output .= ''; + } + + return '
'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'
'.$extra_output; } @@ -3535,7 +3625,8 @@ function html_print_input_text( $disabled=false, $list='', $placeholder=null, - $pattern=null + $pattern=null, + $id=false ) { if ($maxlength == 0) { $maxlength = 255; @@ -3593,7 +3684,7 @@ function html_print_input_text( return html_print_input_text_extended( $name, $value, - 'text-'.$name, + (($id === false) ? 'text-'.$name : $id), $alt, $size, $maxlength, @@ -6334,7 +6425,8 @@ function html_print_input($data, $wrapper='div', $input_only=false) ((isset($data['no_change']) === true) ? $data['no_change'] : ''), ((isset($data['allow_zero']) === true) ? $data['allow_zero'] : ''), ((isset($data['units']) === true) ? $data['units'] : null), - ((isset($data['script_input']) === true) ? $data['script_input'] : '') + ((isset($data['script_input']) === true) ? $data['script_input'] : ''), + ((isset($data['units_select2']) === true) ? $data['units_select2'] : '') ); break; @@ -6861,6 +6953,11 @@ function html_print_input($data, $wrapper='div', $input_only=false) (isset($data['time_end']) === true) ? $data['time_end'] : '', (isset($data['date_text']) === true) ? $data['date_text'] : SECONDS_1DAY, (isset($data['class']) === true) ? $data['class'] : 'w100p', + (isset($data['date_format_php']) === true) ? $data['date_format_php'] : 'Y/m/d', + (isset($data['time_format_php']) === true) ? $data['time_format_php'] : 'H:i:s', + (isset($data['date_format_js']) === true) ? $data['date_format_js'] : 'yy/mm/dd', + (isset($data['time_format_js']) === true) ? $data['time_format_js'] : 'HH/mm/ss', + (isset($data['id']) === true) ? $data['id'] : '', ); break; @@ -7843,7 +7940,8 @@ function html_print_select_date_range( $date_format_php='Y/m/d', $time_format_php='H:i:s', $date_format_js='yy/mm/dd', - $time_format_js='HH:mm:ss' + $time_format_js='HH:mm:ss', + $id='', ) { global $config; @@ -7894,7 +7992,7 @@ function html_print_select_date_range( $fields['chose_range'] = __('Chose start/end date period'); $fields['none'] = __('None'); - $output = html_print_input_hidden('custom_date', $custom_date, true); + $output = html_print_input_hidden('custom_date', $custom_date, true, false, false, 'hidden-custom_date'.$id); $output .= '
'; $output .= html_print_select( $fields, @@ -7914,13 +8012,101 @@ function html_print_select_date_range( $table->data = []; $table->class = 'table-adv-filter'; $table->data[0][0] = '
'.__('From').':
'; - $table->data[0][0] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' '; - $table->data[0][0] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' '; + $table->data[0][0] .= html_print_input_text( + 'date_init', + $date_init, + '', + 12, + 10, + true, + false, + false, + '', + '', + '', + 'off', + false, + '', + '', + '', + false, + '', + null, + null, + (empty($id) === false) ? 'text-date_init'.$id : false, + ).' '; + $table->data[0][0] .= html_print_input_text( + 'time_init', + $time_init, + '', + 10, + 7, + true, + false, + false, + '', + '', + '', + 'off', + false, + '', + '', + '', + false, + '', + null, + null, + (empty($id) === false) ? 'text-time_init'.$id : false, + ).' '; $table->data[0][0] .= '
'; $table->data[0][0] .= '
'.__('to').':
'; - $table->data[0][0] .= html_print_input_text('date_end', $date_end, '', 12, 10, true).' '; + $table->data[0][0] .= html_print_input_text( + 'date_end', + $date_end, + '', + 12, + 10, + true, + false, + false, + '', + '', + '', + 'off', + false, + '', + '', + '', + false, + '', + null, + null, + (empty($id) === false) ? 'text-date_end'.$id : false, + ).' '; $table->data[0][0] .= '
'; - $table->data[0][0] .= html_print_input_text('time_end', $time_end, '', 10, 7, true).' '; + $table->data[0][0] .= html_print_input_text( + 'time_end', + $time_end, + '', + 10, + 7, + true, + false, + false, + '', + '', + '', + 'off', + false, + '', + '', + '', + false, + '', + null, + null, + (empty($id) === false) ? 'text-time_end'.$id : false, + ).' '; $table->data[0][0] .= ' '.html_print_image( 'images/logs@svg.svg', true, @@ -7991,13 +8177,13 @@ function html_print_select_date_range( $('#".$name."_range').show(); $('#".$name."_default').hide(); $('#".$name."_extend').hide(); - $('#hidden-custom_date').val('1'); + $('#hidden-custom_date".$id."').val('1'); $('.filter_label_position_before').addClass('filter_label_position_after'); } else if ($(this).val() === 'custom') { $('#".$name."_range').hide(); $('#".$name."_default').hide(); $('#".$name."_extend').show(); - $('#hidden-custom_date').val('2'); + $('#hidden-custom_date".$id."').val('2'); $('.filter_label_position_before').removeClass('filter_label_position_after'); } else { $('.filter_label_position_before').removeClass('filter_label_position_after'); @@ -8015,8 +8201,8 @@ function html_print_select_date_range( $('#".$name."_range').show(); $('#".$name."_default').hide(); $('#".$name."_extend').hide(); - position_top_init = $('#text-date_init').offset().top + $('#text-date_init').outerHeight(); - position_top_end = $('#text-date_end').offset().top + $('#text-date_end').outerHeight(); + position_top_init = $('[id^=text-date_init".$id."]').offset().top + $('[id^=text-date_init".$id."]').outerHeight(); + position_top_end = $('[id^=text-date_end".$id."]').offset().top + $('[id^=text-date_end".$id."]').outerHeight(); if(def_state_range){ $('#".$name."_range').show(); } else { @@ -8042,7 +8228,7 @@ function html_print_select_date_range( $('#".$name."_range').hide(); $('#".$name."_extend').hide(); $('#".$name."').val('".SECONDS_1DAY."').trigger('change'); - $('#hidden-custom_date').val('0'); + $('#hidden-custom_date".$id."').val('0'); } $('#text-date').datepicker({ @@ -8052,7 +8238,7 @@ function html_print_select_date_range( showAnim: 'slideDown' }); - $('[id^=text-time_init]').timepicker({ + $('[id^=text-time_init".$id."]').timepicker({ showSecond: true, timeFormat: '".$time_format_js."', timeOnlyTitle: '".__('Choose time')."', @@ -8064,7 +8250,7 @@ function html_print_select_date_range( closeText: '".__('Close')."' }); - $('[id^=text-date_init]').datepicker ({ + $('[id^=text-date_init".$id."]').datepicker ({ dateFormat: '".$date_format_js."', changeMonth: true, changeYear: true, @@ -8073,9 +8259,9 @@ function html_print_select_date_range( beforeShowDay: function (date) { show_datepicker = 'date_init'; var date_now = date.getTime(); - var date_ini_split = $('[id^=text-date_init]').val().split('/'); + var date_ini_split = $('[id^=text-date_init".$id."]').val().split('/'); var date_ini = new Date(date_ini_split[1]+'/'+date_ini_split[2]+'/'+date_ini_split[0]).getTime(); - var date_end_split = $('[id^=text-date_end]').val().split('/'); + var date_end_split = $('[id^=text-date_end".$id."]').val().split('/'); var date_end = new Date(date_end_split[1]+'/'+date_end_split[2]+'/'+date_end_split[0]).getTime(); if (date_now > date_ini && date_now < date_end) { return [true, 'ui-date-range-in', 'prueba']; @@ -8086,7 +8272,7 @@ function html_print_select_date_range( } }); - $('[id^=text-date_end]').datepicker ({ + $('[id^=text-date_end".$id."]').datepicker ({ dateFormat: '".$date_format_js."', changeMonth: true, changeYear: true, @@ -8095,9 +8281,9 @@ function html_print_select_date_range( beforeShowDay: function (date) { show_datepicker = 'date_end'; var date_now = date.getTime(); - var date_ini_split = $('[id^=text-date_init]').val().split('/'); + var date_ini_split = $('[id^=text-date_init".$id."]').val().split('/'); var date_ini = new Date(date_ini_split[1]+'/'+date_ini_split[2]+'/'+date_ini_split[0]).getTime(); - var date_end_split = $('[id^=text-date_end]').val().split('/'); + var date_end_split = $('[id^=text-date_end".$id."]').val().split('/'); var date_end = new Date(date_end_split[1]+'/'+date_end_split[2]+'/'+date_end_split[0]).getTime(); if (date_now > date_ini && date_now < date_end) { return [true, 'ui-date-range-in', 'prueba']; @@ -8105,10 +8291,10 @@ function html_print_select_date_range( return [true, 'ui-datepicker-current-day', '']; } return [true, '', '']; - } + }, }); - $('[id^=text-time_end]').timepicker({ + $('[id^=text-time_end".$id."]').timepicker({ showSecond: true, timeFormat: '".$time_format_js."', timeOnlyTitle: '".__('Choose time')."', diff --git a/pandora_console/include/functions_inventory.php b/pandora_console/include/functions_inventory.php index e710039e85..5e5726d96f 100644 --- a/pandora_console/include/functions_inventory.php +++ b/pandora_console/include/functions_inventory.php @@ -418,12 +418,10 @@ function inventory_get_data( // Setting for link the agent with the proper server. if (is_metaconsole() === true && empty($node) === false) { - $loginHash = metaconsole_get_servers_url_hash($node); $urlToAgent = sprintf( - '%sindex.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s%s', + '%sindex.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s', $node['server_url'], - $row['id_agente'], - $loginHash + $row['id_agente'] ); } else { $urlToAgent = sprintf( @@ -440,8 +438,9 @@ function inventory_get_data( $table->data[$rowTable][0] = html_print_anchor( [ - 'href' => $urlToAgent, + 'href' => (is_metaconsole() === true) ? '#' : $urlToAgent, 'content' => ''.$agent_name.'', + 'onClick' => (is_metaconsole() === true) ? 'redirectNode(\''.$urlToAgent.'\')' : '', ], true ); @@ -1196,7 +1195,7 @@ function get_inventory_basic_info_sql($params, $count=false) $result = 0; } } - + return $result; } diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 9bca063e6e..dc417c191b 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -169,6 +169,10 @@ function menu_print_menu(&$menu) $sec2 = 'godmode/users/profile_list'; } else if ($sec2 === 'godmode/users/configure_token') { $sec2 = 'godmode/users/token_list'; + } else if ($sec2 === 'godmode/servers/modificar_server' && check_acl($config['id_user'], 0, 'AW') && (bool) check_acl($config['id_user'], 0, 'PM') === false) { + $sec2 = 'enterprise/godmode/servers/list_satellite'; + } else if ($sec2 === 'enterprise/godmode/snmpconsole/snmp_trap_editor_form') { + $sec2 = 'enterprise/godmode/snmpconsole/snmp_trap_editor'; } else { $sec2 = (string) get_parameter('sec2'); } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 6c9efb999b..3c00cf12b6 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1148,12 +1148,12 @@ function modules_get_table_data(?int $id_agent_module, ?int $id_type) } -function modules_get_raw_data($id_agent_module, $date_init, $date_end) +function modules_get_raw_data($id_agent_module, $date_init, $date_end, $search_in_history_db=true) { $table = modules_get_table_data($id_agent_module, null); $datelimit = ($date_init - $date_end); - $search_in_history_db = db_search_in_history_db($datelimit); + $search_in_history_db = (($search_in_history_db === true) ? db_search_in_history_db($datelimit) : false); $data = db_get_all_rows_sql( ' diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index e4d76387bc..247b81a816 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -1389,6 +1389,7 @@ function netflow_draw_item( $show_summary=true, $show_table=true ) { + global $config; $aggregate = $filter['aggregate']; $interval = ($end_date - $start_date); if (is_metaconsole() === true) { @@ -1568,13 +1569,24 @@ function netflow_draw_item( $data_top_n ); + // Theme. + $user_info = get_user_info($config['id_user']); + if (isset($user_info['id_skin']) === true && (int) $user_info['id_skin'] === 2) { + $text_color = '#ffffff'; + } else { + $text_color = '#333333'; + } + $graph_output = pie_graph( $pie_data, [ 'width' => 200, 'height' => 200, 'ttl' => ($output === 'PDF') ? 2 : 1, - 'dataLabel' => ['display' => 'auto'], + 'dataLabel' => [ + 'display' => 'auto', + 'color' => $text_color, + ], 'layout' => [ 'padding' => [ 'top' => 15, diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index f5115a73e9..23a09feabb 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -773,13 +773,11 @@ function networkmap_create_agent_node( if (empty($server_data) === true) { $server_name = ''; $server_id = ''; - $url_hash = ''; $console_url = ''; } else { $server_name = $server_data['server_name']; $server_id = $server_data['id']; $console_url = $server_data['server_url'].'/'; - $url_hash = metaconsole_get_servers_url_hash($server_data); } // Set node status. @@ -870,7 +868,7 @@ function networkmap_create_agent_node( } if (can_user_access_node()) { - $url_node_link = ', URL="'.$console_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].$url_hash.'"'; + $url_node_link = ', URL="'.$console_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"'; } else { $url_node_link = ''; } diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index 772611fa29..a7d5015aba 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -961,7 +961,7 @@ function planned_downtimes_items($filter) function delete_planned_downtimes($filter) { - $downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'execute'); + $downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'executed'); if ($downtime_execute) { $return = __("This scheduled downtime are executed now. Can't delete in this moment."); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 4ef6baff96..13a21f3fb0 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2736,7 +2736,8 @@ function reporting_event_report_module( $ttl, $id_server, $metaconsole_dbtable, - $filter_event_filter_exclude + $filter_event_filter_exclude, + $content['id_agent_module'] ); if (empty($data)) { @@ -6686,6 +6687,7 @@ function reporting_sql_graph( $type_sql_graph ) { global $config; + $layout = false; switch ($type_sql_graph) { case 'sql_graph_hbar': @@ -6695,6 +6697,7 @@ function reporting_sql_graph( break; case 'sql_graph_vbar': + $layout = ['padding' => ['top' => '40']]; $return['type'] = 'sql_graph_vbar'; break; @@ -6769,7 +6772,8 @@ function reporting_sql_graph( $only_image, ui_get_full_url(false, false, false, false), $ttl, - $content['top_n_value'] + $content['top_n_value'], + $layout ); break; @@ -11726,7 +11730,8 @@ function reporting_get_module_detailed_event( $ttl=1, $id_server=false, $metaconsole_dbtable=false, - $filter_event_filter_exclude=false + $filter_event_filter_exclude=false, + $id_agent=false ) { global $config; @@ -11749,7 +11754,7 @@ function reporting_get_module_detailed_event( foreach ($id_modules as $id_module) { $event['data'] = events_get_agent( - false, + $id_agent, (int) $period, (int) $date, $history, diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index fc44b65910..1238609915 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -112,8 +112,8 @@ function reporting_html_header( } $data[] = $title.$sizhfin; - $data[] = $sizh.$subtitle.$sizhfin; - $data[] = "
".$sizh.$date_text.$sizhfin.'
'; + $data[] = $sizh.__('Group').': '.$subtitle.$sizhfin; + $data[] = '
'.$sizh.__('Data time').': '.$sizhfin."
".$sizh.$date_text.$sizhfin.'
'; } array_push($table->data, $data); @@ -194,6 +194,9 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust $table->head = []; $table->colspan = []; $table->rowstyle = ['background-color: #686868']; + $table->size[0] = '33%'; + $table->size[1] = '33%'; + $table->size[2] = '33%'; if (isset($item['label']) && $item['label'] != '') { $id_agent = $item['id_agent']; @@ -1709,7 +1712,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0) $table1->head[3] = __('Name'); $table1->head[4] = __('Agent'); $table1->head[5] = __('Severity'); - $table1->head[6] = __('Val. by'); + $table1->head[6] = __('Validated by'); $table1->head[7] = __('Timestamp'); } else { $table1->head[0] = __('Status'); @@ -1717,7 +1720,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0) $table1->head[2] = __('Name'); $table1->head[3] = __('Agent'); $table1->head[4] = __('Severity'); - $table1->head[5] = __('Val. by'); + $table1->head[5] = __('Validated by'); $table1->head[6] = __('Timestamp'); } @@ -1798,7 +1801,11 @@ function reporting_html_event_report_group($table, $item, $pdf=0) 'id_user', $event['id_usuario'] ); - $data[] = io_safe_output($user_name); + if (isset($event['id_usuario']) === true && empty($event['id_usuario']) === false) { + $data[] = io_safe_output($user_name).' ('.$event['id_usuario'].')'; + } else { + $data[] = ''; + } } if ($item['show_summary_group']) { @@ -3606,7 +3613,7 @@ function reporting_html_group_report($table, $item, $pdf=0) } $graph_width = 280; - $graph_height = 250; + $graph_height = 300; $out = ''; $out .= ''; @@ -3688,7 +3695,7 @@ function reporting_html_group_report($table, $item, $pdf=0) $out .= '
'; if ((int) $ttl === 2) { - $out .= ''; } @@ -3730,7 +3737,7 @@ function reporting_html_group_report($table, $item, $pdf=0) $out .= '
'; if ((int) $ttl === 2) { - $out .= ''; } @@ -3842,7 +3849,7 @@ function reporting_html_event_report_agent($table, $item, $pdf=0) $table1->head[2] = __('Name'); $table1->head[4] = __('Severity'); - $table1->head[5] = __('Val. by'); + $table1->head[5] = __('Validated by'); $table1->head[6] = __('Timestamp'); if ((bool) $item['show_custom_data'] === true) { $table1->head[7] = __('Custom data'); @@ -3901,7 +3908,11 @@ function reporting_html_event_report_agent($table, $item, $pdf=0) $data[] = ''.__('System').''; } else { $user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['validated_by']); - $data[] = io_safe_output($user_name); + if (isset($event['id_usuario']) === true && empty($event['id_usuario']) === false) { + $data[] = io_safe_output($user_name).' ('.$event['id_usuario'].')'; + } else { + $data[] = ''; + } } if ($item['show_summary_group']) { @@ -4104,7 +4115,7 @@ function reporting_html_historical_data($table, $item, $pdf=0) // Center every row foreach ($table1->data[0] as $k => $v) { - for ($i = 0; $i < count($table1->data); $i++){ + for ($i = 0; $i < count($table1->data); $i++) { $table1->cellstyle[$i][$k] = 'text-align: center;'; } } @@ -4187,7 +4198,7 @@ function reporting_html_database_serialized($table, $item, $pdf=0) // Center every row foreach ($table1->data[0] as $k => $v) { - for ($i = 0; $i < count($table1->data); $i++){ + for ($i = 0; $i < count($table1->data); $i++) { $table1->cellstyle[$i][$k] = 'text-align: center;'; } } @@ -6432,7 +6443,7 @@ function reporting_html_sql($table, $item, $pdf=0) // Center every row foreach ($table2->data[0] as $k => $v) { - for ($i = 0; $i < count($table2->data); $i++){ + for ($i = 0; $i < count($table2->data); $i++) { $table2->cellstyle[$i][$k] = 'text-align: center;'; } } @@ -7883,6 +7894,12 @@ function reporting_html_ncm_list($table, $item, $pdf=0) */ function reporting_html_ncm_backups($table, $item, $pdf=0) { + global $config; + + if ($config['style'] === 'pandora_black') { + ui_require_css_file('pandora_black'); + } + ui_require_css_file('diff2html.min'); ui_require_css_file('highlight.min'); ui_require_css_file('highlight/vs.min'); diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index d545ff102b..8328307d24 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -1588,7 +1588,12 @@ function snmp_browser_create_modules_snmp( enterprise_include_once('include/functions_policies.php'); foreach ($id_target as $policy) { - $ids[] = policies_create_module($oid['oid'], $policy, 2, $values); + $exist = db_get_row_filter('tpolicy_modules', ['name' => $oid['oid'], 'id_policy' => $policy], '*'); + if ($exist !== false) { + $ids[] = false; + } else { + $ids[] = policies_create_module($oid['oid'], $policy, 2, $values); + } } } } diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index ada7841ab7..c240c527e8 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -18,13 +18,11 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals if (empty($server_data)) { $server_name = ''; $server_id = ''; - $url_hash = ''; $console_url = ui_get_full_url('/'); } else { $server_name = $server_data['server_name']; $server_id = $server_data['id']; $console_url = $server_data['server_url'].'/'; - $url_hash = metaconsole_get_servers_url_hash($server_data); } include_once $config['homedir'].'/include/functions_agents.php'; @@ -69,10 +67,11 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals $row['title'] = __('Name'); $row['data'] = html_print_anchor( [ - 'href' => $console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash, + 'href' => '#', 'title' => __('Click here for view this module'), 'class' => 'font_11', 'content' => $cellName, + 'onClick' => 'redirectNode(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'\');', ], true ); @@ -325,45 +324,9 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals echo '
'; if (is_metaconsole() === true) { - echo "
"; - - parse_str($url_hash, $url_hash_array); - - html_print_input_hidden( - 'id_agente', - $module['id_agente'], - false - ); - html_print_input_hidden( - 'edit_module', - 1, - false - ); - html_print_input_hidden( - 'id_agent_module', - $module['id_agente_modulo'], - false - ); - html_print_input_hidden( - 'loginhash', - $url_hash_array['loginhash'], - false - ); - html_print_input_hidden( - 'loginhash_data', - $url_hash_array['loginhash_data'], - false - ); - html_print_input_hidden( - 'loginhash_user', - $url_hash_array['loginhash_user'], - false - ); - - echo ''; - echo ""; + echo ''; } else { - echo ''; + echo ''; } html_print_submit_button( @@ -399,13 +362,11 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false) if (empty($server_data)) { $server_name = ''; $server_id = ''; - $url_hash = ''; $console_url = ''; } else { $server_name = $server_data['server_name']; $server_id = $server_data['id']; $console_url = $server_data['server_url'].'/'; - $url_hash = metaconsole_get_servers_url_hash($server_data); } $user_access_node = can_user_access_node(); @@ -512,7 +473,7 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false) __('Go to alerts edition'), 'upd_button', false, - 'window.location.assign("'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'")', + 'redirectNode("'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.'")', ['icon' => 'alert'], true ), @@ -533,15 +494,11 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) global $config; if (empty($server_data)) { - $server_name = ''; $server_id = ''; - $url_hash = ''; $console_url = ui_get_full_url('/'); } else { - $server_name = $server_data['server_name']; $server_id = $server_data['id']; $console_url = $server_data['server_url'].'/'; - $url_hash = metaconsole_get_servers_url_hash($server_data); } include_once $config['homedir'].'/include/functions_agents.php'; @@ -623,15 +580,6 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) $cellName = ((bool) $agent['disabled'] === true) ? '' : ''; if (is_metaconsole() === true) { - $pwd = $server_data['auth_token']; - // Create HASH login info. - $user = $config['id_user']; - - // Extract auth token from serialized field. - $pwd_deserialiced = json_decode($pwd, true); - $hashdata = $user.$pwd_deserialiced['auth_token']; - - $hashdata = md5($hashdata); if ((bool) $grants_on_node === true && (bool) $user_access_node !== false) { $urlAgent = $server_data['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente']; } else { @@ -657,7 +605,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) 'title' => __('Click here for view this agent'), 'class' => 'font_11', 'content' => $cellName, - 'onClick' => "sendHash('".$urlAgent."')", + 'onClick' => "redirectNode('".$urlAgent."')", ], true ); @@ -998,7 +946,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) $cluster = PandoraFMS\Cluster::loadFromAgentId( $agent['id_agente'] ); - $buttons_act .= ''; + $buttons_act .= ''; $buttons_act .= html_print_submit_button( __('Go to cluster edition'), 'upd_button', @@ -1007,7 +955,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) true ); } else { - $buttons_act .= ''; + $buttons_act .= ''; $buttons_act .= html_print_submit_button( __('Go to module creation'), 'upd_button', @@ -1016,7 +964,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) true ); - $buttons_act .= ''; + $buttons_act .= ''; $buttons_act .= html_print_submit_button( __('Go to agent edition'), 'upd_button', @@ -1038,11 +986,6 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) echo " diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index e417f345fc..97c4f3918a 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -1026,11 +1026,18 @@ if (is_ajax() === true) { return; } - $data = networkmap_refresh_holding_area($networkmap_id, $x, $y); + $filter = db_get_value('filter', 'tmap', 'id', $networkmap_id); + $filter = json_decode($filter, true); - if (!empty($data)) { - $return['correct'] = true; - $return['holding_area'] = $data; + if (isset($filter['empty_map']) === false + || (isset($filter['empty_map']) === true && $filter['empty_map'] !== 1) + ) { + $data = networkmap_refresh_holding_area($networkmap_id, $x, $y); + + if (!empty($data)) { + $return['correct'] = true; + $return['holding_area'] = $data; + } } ob_end_clean(); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 2a5ffd5b7a..3eec561ea3 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1389,7 +1389,15 @@ if ($autosearch) { if ($result === false) { $result = []; } else { - $tablePagination = ui_pagination($count, false, $offset, 0, true, 'offset', false); + $tablePagination = ui_pagination( + $count, + 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params, + $offset, + 0, + true, + 'offset', + false + ); } } else { // For each server defined and not disabled. @@ -1460,7 +1468,15 @@ if ($autosearch) { $show_count = true; } - $tablePagination = ui_pagination($count_modules, false, $offset, 0, true, 'offset', $show_count); + $tablePagination = ui_pagination( + $count_modules, + 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params, + $offset, + 0, + true, + 'offset', + $show_count + ); } // Get number of elements of the pagination. @@ -1721,26 +1737,8 @@ if (empty($result) === false) { if (in_array('agent', $show_fields) || is_metaconsole()) { $agent_alias = !empty($row['agent_alias']) ? $row['agent_alias'] : $row['agent_name']; - // TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view if (is_metaconsole() === true) { - echo "
"; - html_print_input_hidden( - 'loginhash', - 'auto', - false - ); - html_print_input_hidden( - 'loginhash_data', - $row['hashdata'], - false - ); - html_print_input_hidden( - 'loginhash_user', - str_rot13($row['user']), - false - ); - echo ''; - $agent_link = "
"; + $agent_link = ''; $agent_alias = ui_print_truncate_text( $agent_alias, @@ -1773,18 +1771,20 @@ if (empty($result) === false) { $show_edit_icon = false; } - $url_edit_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1'.'&loginhash=auto&loginhash_data='.$row['hashdata'].'&loginhash_user='.str_rot13($row['user']); + $url_edit_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1'; } else { $url_edit_module = 'index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1'; } } } + $url_edit_module = ($url_edit_module ?? '#'); if (in_array('module_name', $show_fields) === true || is_metaconsole() === true) { $data[3] = html_print_anchor( [ 'target' => '_blank', - 'href' => ($url_edit_module ?? '#'), + 'href' => '#', + 'onClick' => ((is_metaconsole() === true) ? 'redirectNode(\''.$url_edit_module.'\',\'_self\')' : ''), 'content' => ui_print_truncate_text($row['module_name'], 'module_small', false, true, true), ], true @@ -2273,43 +2273,12 @@ if (empty($result) === false) { $table->cellclass[][12] = 'table_action_buttons'; if (is_metaconsole() === true) { - echo "
"; - html_print_input_hidden( - 'id_agente', - $row['id_agent'], - false - ); - html_print_input_hidden( - 'id_agent_module', - $row['id_agente_modulo'], - false - ); - html_print_input_hidden( - 'loginhash', - 'auto', - false - ); - html_print_input_hidden( - 'loginhash_data', - $row['hashdata'], - false - ); - html_print_input_hidden( - 'loginhash_user', - str_rot13($row['user']), - false - ); - - echo ''; - $url_edit_module = $row['server_url']; $url_edit_module .= 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&'; $url_edit_module .= '&id_agente='.$row['id_agent']; $url_edit_module .= '&tab=module&id_agent_module='.$row['id_agente_modulo'].'&edit_module=1'; - $url_edit_module .= '&loginhash=auto&loginhash_data='.$row['hashdata']; - $url_edit_module .= '&loginhash_user='.str_rot13($row['user']); - $agent_link = "
"; + $agent_link = ''; $agent_alias = ui_print_truncate_text( $agent_alias, @@ -2384,10 +2353,22 @@ if (empty($result) === false) { $show_count = true; } - $tablePagination = ui_pagination($count_modules, false, $offset, 0, true, 'offset', $show_count); + $tablePagination = ui_pagination( + $count_modules, + 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params, + $offset, + 0, + true, + 'offset', + $show_count + ); } } else { - ui_print_info_message(['no_close' => true, 'message' => __('Please apply a filter to display the data')]); + if (get_parameter('ag_group', false) !== false) { + ui_print_info_message(['no_close' => true, 'message' => __('There are no monitors with these features or status')]); + } else { + ui_print_info_message(['no_close' => true, 'message' => __('Please apply a filter to display the data')]); + } } if (isset($tablePagination) === false) { diff --git a/pandora_console/operation/dashboard/public_dashboard.php b/pandora_console/operation/dashboard/public_dashboard.php index 7ef9f07d4a..b53c4b80b8 100644 --- a/pandora_console/operation/dashboard/public_dashboard.php +++ b/pandora_console/operation/dashboard/public_dashboard.php @@ -38,6 +38,13 @@ ob_start(); // Fullscreen by default. $config['pure'] = get_parameter('pure', 1); +$dashboardId = get_parameter('dashboardId', null); +if ($dashboardId !== null) { + include 'general/noaccess.php'; + return; +} + + require_once 'dashboard.php'; // Clean session to avoid direct access. diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 7c5f1b1210..563472ce31 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -483,7 +483,6 @@ if (is_ajax() === true) { } if (empty($events) === false) { - $redirection_form_id = 0; if ((int) $filter['group_rep'] > 0) { $events_comments = []; } else { @@ -492,7 +491,7 @@ if (is_ajax() === true) { $data = array_reduce( $events, - function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event, $regex, $events_comments) { + function ($carry, $item) use ($table_id, $filter, $compact_date, $external_url, $compact_name_event, $regex, $events_comments) { global $config; $tmp = (object) $item; @@ -500,7 +499,6 @@ if (is_ajax() === true) { // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps $server_url = ''; - $hashdata = ''; if ($tmp->meta === true) { if ($tmp->server_name !== null) { $data_server = metaconsole_get_servers( @@ -512,9 +510,6 @@ if (is_ajax() === true) { && $data_server !== false ) { $server_url = $data_server['server_url']; - $hashdata = metaconsole_get_servers_url_hash( - $data_server - ); } } } @@ -1166,40 +1161,18 @@ if (is_ajax() === true) { $url_link = ui_get_full_url( 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' ); - $url_link_hash = ''; + if ($tmp->meta === true) { $url_link = $server_url; $url_link .= '/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='; - $url_link_hash = $hashdata; - - parse_str($url_link_hash, $url_hash_array); - - $redirection_form = ""; - $redirection_form .= html_print_input_hidden( - 'loginhash', - $url_hash_array['loginhash'], - true - ); - $redirection_form .= html_print_input_hidden( - 'loginhash_data', - $url_hash_array['loginhash_data'], - true - ); - $redirection_form .= html_print_input_hidden( - 'loginhash_user', - $url_hash_array['loginhash_user'], - true - ); - $redirection_form .= ''; } // Agent name link. if ($tmp->id_agente > 0) { if ($tmp->meta === true) { - $draw_agent_name = $redirection_form; - $draw_agent_name .= ""; + $draw_agent_name = ''; } else { - $draw_agent_name = ''; + $draw_agent_name = ''; } $draw_agent_name .= $tmp->agent_name; @@ -1212,10 +1185,9 @@ if (is_ajax() === true) { // Agent ID link. if ($tmp->id_agente > 0) { if ($tmp->meta === true) { - $draw_agent_id = ""; - $redirection_form_id++; + $draw_agent_id = ''; } else { - $draw_agent_id = ''; + $draw_agent_id = ''; } $draw_agent_id .= $tmp->id_agente; @@ -1249,27 +1221,7 @@ if (is_ajax() === true) { } } - $regex_validation = false; - if (empty($tmp) === false && $regex !== '') { - foreach (json_decode(json_encode($tmp), true) as $key => $field) { - if ($key === 'b64') { - continue; - } - - $field = strip_tags($field); - - if (preg_match('/'.io_safe_output($regex).'/', $field)) { - $regex_validation = true; - } - } - - if ($regex_validation === true) { - $carry[] = $tmp; - } - } else { - $carry[] = $tmp; - } - + $carry[] = $tmp; return $carry; } ); @@ -1289,11 +1241,10 @@ if (is_ajax() === true) { // RecordsTotal && recordsfiltered resultados totales. echo json_encode( [ - 'data' => ($data ?? []), - 'buffers' => $buffers, - 'recordsTotal' => $count, - 'recordsFiltered' => $count, - 'showAlwaysPagination' => (empty($regex) === false) ? true : false, + 'data' => ($data ?? []), + 'buffers' => $buffers, + 'recordsTotal' => $count, + 'recordsFiltered' => $count, ] ); } catch (Exception $e) { @@ -2666,20 +2617,22 @@ try { // Always add options column. - $fields = array_merge( - $fields, - [ + if ((bool) check_acl($config['id_user'], 0, 'EW') === true) { + $fields = array_merge( + $fields, [ - 'text' => 'options', - 'class' => 'table_action_buttons mw100px', - ], - [ - 'text' => 'm', - 'extra' => $checkbox_all, - 'class' => 'w20px no-text-imp', - ], - ] - ); + [ + 'text' => 'options', + 'class' => 'table_action_buttons mw100px', + ], + [ + 'text' => 'm', + 'extra' => $checkbox_all, + 'class' => 'w20px no-text-imp', + ], + ] + ); + } // Get column names. $column_names = events_get_column_names($fields, true); @@ -2890,8 +2843,8 @@ try { 'column_names' => $column_names, 'columns' => $fields, 'no_sortable_columns' => [ - -1, - -2, + 'options', + 'm', 'column-instructions', 'user_comment', ], @@ -3715,11 +3668,19 @@ function datetime_picker_callback() { datetime_picker_callback(); -function show_instructions(id){ +function show_instructions(id, title_event){ title = ""; $('#hidden_event_instructions_' + id).dialog({ - title: title, - width: 600 + title: `${title+' '+atob(title_event)}`, + width: 650, + draggable: true, + modal: true, + closeOnEscape: true, + open: function(){ + $('.ui-widget-overlay').bind('click',function(){ + $('#hidden_event_instructions_' + id).dialog('close'); + }) + } }); } diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index 42ff6af0cb..50dae7b9af 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -96,7 +96,7 @@ if ($config['style'] === 'pandora_black' && !is_metaconsole()) { echo ''; echo ''; -$output = '
'; +$output = '
'; // Header tabs. $output .= '
    '; $output .= '
  • '; @@ -264,7 +264,7 @@ $output = '
    '; true, [ 'title' => __('No alerts discovered'), - 'class' => 'invert_filter', + 'class' => '', ] ); $output .= ''; diff --git a/pandora_console/operation/inventory/inventory.php b/pandora_console/operation/inventory/inventory.php index 4d86c63558..bb4236da25 100755 --- a/pandora_console/operation/inventory/inventory.php +++ b/pandora_console/operation/inventory/inventory.php @@ -200,7 +200,8 @@ if (is_ajax() === true) { 'status' => $status_agent, ]; - $data = get_inventory_basic_info_sql($params); // Aca se retorna + $data = get_inventory_basic_info_sql($params); + // Aca se retorna $count = get_inventory_basic_info_sql($params, true); try { diff --git a/pandora_console/operation/network/network_report.php b/pandora_console/operation/network/network_report.php index bc72602fd0..069b8f99f3 100644 --- a/pandora_console/operation/network/network_report.php +++ b/pandora_console/operation/network/network_report.php @@ -483,6 +483,9 @@ $table->data = []; $chart_data = []; $labels = []; $hide_filter = !empty($main_value) && ($action === 'udp' || $action === 'tcp'); +$row_icon_color_filters = ($config['style'] === 'pandora') ? '' : 'filter: invert(100%) !important;'; +$row_icon_color_eye = ($config['style'] === 'pandora') ? '' : 'filter: invert(100%) !important; background-color: transparent !important;'; + foreach ($data as $item) { $row = []; $row['main'] = '
    '; @@ -491,9 +494,17 @@ foreach ($data as $item) { $row['main'] .= html_print_link_with_params( 'images/filters@svg.svg', array_merge($hidden_main_link, ['main_value' => $item['host']]), - 'image' + 'image', + $row_icon_color_filters, + ); + $row['main'] .= html_print_input_image( + 'whois', + 'images/eye.png', + 'whois', + $row_icon_color_eye, + true, + ['onclick' => 'whois(\''.$item['host'].'\')'], ); - $row['main'] .= html_print_input_image('whois', 'images/eye.png', 'whois', '', true, ['onclick' => 'whois(\''.$item['host'].'\')']); } $row['main'] .= '
    '; diff --git a/pandora_console/operation/reporting/graph_analytics.php b/pandora_console/operation/reporting/graph_analytics.php index 4b5facb139..e5c910bb43 100644 --- a/pandora_console/operation/reporting/graph_analytics.php +++ b/pandora_console/operation/reporting/graph_analytics.php @@ -55,11 +55,12 @@ if (is_ajax()) { $search = io_safe_input($search_left); // Agents. - // Concatenate AW and AD permisions to get all the possible groups where the user can manage. + // Concatenate AR, AW and AD permisions to get all the possible groups where the user can manage. $user_groupsAW = users_get_groups($config['id_user'], 'AW'); $user_groupsAD = users_get_groups($config['id_user'], 'AD'); + $user_groupsAR = users_get_groups($config['id_user'], 'AR'); - $user_groups = ($user_groupsAW + $user_groupsAD); + $user_groups = ($user_groupsAW + $user_groupsAD + $user_groupsAR); $user_groups_to_sql = implode(',', array_keys($user_groups)); $search_sql = ' AND (nombre LIKE "%%'.$search.'%%" OR alias LIKE "%%'.$search.'%%")'; @@ -197,6 +198,9 @@ if (is_ajax()) { 'graph_analytics' => true, ]; + // Included dependencies when is an ajax request. + include_javascript_dependencies_flot_graph(false); + $graph_return = graphic_combined_module( $modules, $params, diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index c59805beda..75eeacdefd 100755 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -43,7 +43,7 @@ if (!reporting_user_can_see_report($id_report)) { exit; } -$date_params = get_parameter_date('date', '', 'U'); +$date_params = get_parameter_date('date', 'none', 'U'); $date_end = date('Y/m/d', $date_params['date_end']); $time_end = date('H:i:s', $date_params['date_end']); @@ -53,6 +53,8 @@ $time_start = date('H:i:s', $date_params['date_init']); $date_init = date('Y/m/d', $date_params['date_init']); $time_init = date('H:i:s', $date_params['date_init']); +$time = $time_end; + $custom_date_end = date('Y/m/d H:i:s', $date_params['date_end']); $period = $date_params['period']; @@ -94,6 +96,9 @@ if (empty($schedule_report) === false) { echo '
    '; } +if (empty($time) === true) { + $time = date(TIME_FORMAT); +} // ------------------- INIT HEADER -------------------------------------- $url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time&pure=$pure"; diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index c565007e2f..099409bcf7 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -133,16 +133,16 @@ $table->data[0][3] = "
    " . // ~ sprintf(__("%s Found"), $totalAlerts) . ""; // --------------------------------------------------------------------- -$table->data[0][6] = html_print_image('images/input_user.png', true, ['title' => __('Users found'), 'class' => 'invert_filter']); +$table->data[0][6] = html_print_image('images/input_user.png', true, ['title' => __('Users found')]); $table->data[0][7] = "".sprintf(__('%s Found'), $totalUsers).''; $table->data[0][8] = html_print_image('images/chart_curve.png', true, ['title' => __('Graphs found'), 'class' => 'invert_filter']); $table->data[0][9] = "".sprintf(__('%s Found'), $totalGraphs).''; $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' => __('Reports found'), 'class' => 'invert_filter']); $table->data[0][11] = "".sprintf(__('%s Found'), $totalReports).''; -$table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Visual consoles')]); +$table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Visual consoles'), 'class' => 'main_menu_icon invert_filter']); $table->data[0][13] = "".sprintf(__('%s Found'), $totalMaps).''; if (enterprise_installed()) { - $table->data[0][14] = html_print_image('images/policy@svg.svg', true, ['title' => __('Policies'), 'class' => 'main_menu_icon']); + $table->data[0][14] = html_print_image('images/policy@svg.svg', true, ['title' => __('Policies'), 'class' => 'main_menu_icon invert_filter']); $table->data[0][15] = "".sprintf(__('%s Found'), $totalPolicies).''; } diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index 38ae15be1c..6bf3e7766e 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -66,7 +66,10 @@ if ($searchMain) { 'text' => "".html_print_image( 'images/zoom_mc.png', true, - ['title' => __('Global search')] + [ + 'title' => __('Global search'), + 'class' => 'main_menu_icon invert_filter', + ] ).'', 'active' => $searchTab == 'main', ]; @@ -79,7 +82,10 @@ if ($searchAgents) { 'text' => "".html_print_image( 'images/op_monitoring.png', true, - ['title' => __('Agents')] + [ + 'title' => __('Agents'), + 'class' => 'main_menu_icon invert_filter', + ] ).'', 'active' => $searchTab == 'agents', ]; @@ -92,7 +98,10 @@ if ($searchUsers) { 'text' => "".html_print_image( 'images/op_workspace.png', true, - ['title' => __('Users')] + [ + 'title' => __('Users'), + 'class' => 'main_menu_icon invert_filter', + ] ).'', 'active' => $searchTab == 'users', ]; @@ -105,7 +114,10 @@ if ($searchAlerts) { 'text' => "".html_print_image( 'images/op_alerts.png', true, - ['title' => __('Alerts')] + [ + 'title' => __('Alerts'), + 'class' => 'main_menu_icon invert_filter', + ] ).'', 'active' => $searchTab == 'alerts', ]; @@ -118,7 +130,10 @@ if ($searchGraphs) { 'text' => "".html_print_image( 'images/chart.png', true, - ['title' => __('Graphs')] + [ + 'title' => __('Graphs'), + 'class' => 'main_menu_icon invert_filter', + ] ).'', 'active' => $searchTab == 'graphs', ]; @@ -131,7 +146,10 @@ if ($searchReports) { 'text' => "".html_print_image( 'images/op_reporting.png', true, - ['title' => __('Reports')] + [ + 'title' => __('Reports'), + 'class' => 'main_menu_icon invert_filter', + ] ).'', 'active' => $searchTab == 'reports', ]; @@ -144,7 +162,10 @@ if ($searchMaps) { 'text' => "".html_print_image( 'images/visual_console.png', true, - ['title' => __('Visual consoles')] + [ + 'title' => __('Visual consoles'), + 'class' => 'main_menu_icon invert_filter', + ] ).'', 'active' => $searchTab == 'maps', ]; @@ -157,7 +178,10 @@ if ($searchModules) { 'text' => "".html_print_image( 'images/brick.png', true, - ['title' => __('Modules')] + [ + 'title' => __('Modules'), + 'class' => 'main_menu_icon invert_filter', + ] ).'', 'active' => $searchTab == 'modules', ]; @@ -172,7 +196,7 @@ if ($searchPolicies) { true, [ 'title' => __('Policies'), - 'class' => 'main_menu_icon', + 'class' => 'main_menu_icon invert_filter', ] ).'', 'active' => $searchTab == 'policies', diff --git a/pandora_console/operation/visual_console/public_view.php b/pandora_console/operation/visual_console/public_view.php index d7e85f88bc..e95495ccb1 100644 --- a/pandora_console/operation/visual_console/public_view.php +++ b/pandora_console/operation/visual_console/public_view.php @@ -13,6 +13,12 @@ // GNU General Public License for more details. require_once '../../include/config.php'; +$id_layout = get_parameter('id_layout', null); +if ($id_layout !== null) { + include '../../general/noaccess.php'; + return; +} + use PandoraFMS\User; // Set root on homedir, as defined in setup. @@ -73,6 +79,17 @@ foreach ($vcs as $key => $data) { } } +$id_user_url = get_parameter('id_user', $config['id_user']); +if (empty($visualConsoleId) === true) { + foreach ($vcs as $key => $data) { + $hash_compare = User::generatePublicHashUser($key, $id_user_url); + if (hash_equals($hash_compare, $hash)) { + $visualConsoleId = (int) $key; + break; + } + } +} + if (empty($visualConsoleId) === true) { db_pandora_audit( AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT, diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 028a2a7d41..5c5d6f64f8 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -6,7 +6,7 @@ %define debug_package %{nil} %define name pandorafms_console %define version 7.0NG.776 -%define release 240422 +%define release 240506 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index 36e412a5a8..9c5fe55672 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -6,7 +6,7 @@ %define debug_package %{nil} %define name pandorafms_console %define version 7.0NG.776 -%define release 240422 +%define release 240506 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 384c9d161e..166703eb94 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.776 -%define release 240422 +%define release 240506 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index a6abf17754..83f017d531 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -71,7 +71,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('trap2agent', '0'), ('date_format', 'F j, Y, g:i a'), ('event_view_hr', 8), -('loginhash_pwd', ''), +('JWT_signature', 1), ('trap2agent', 0), ('prominent_time', 'comparation'), ('timesource', 'system'), @@ -2863,7 +2863,7 @@ SET @short_name = 'pandorafms.vmware'; SET @name = 'VMware'; SET @section = 'app'; SET @description = 'Monitor ESXi hosts, datastores and VMs from a specific datacenter'; -SET @version = '1.3'; +SET @version = '1.5'; INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version); SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name; @@ -2947,7 +2947,7 @@ SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_na INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_proxmox'); -- Insert into tdiscovery_apps_executions -INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' -g '__taskGroup__' --host '_host_' --port '_port_' --user '_user_' --password '_password_' --vm '_scanVM_' --lxc '_scanLXC_' --backups '_scanBackups_' --nodes '_scanNodes_' --transfer_mode tentacle --tentacle_address '_tentacleIP_' --tentacle_port '_tentaclePort_' --as_discovery_plugin 1'); +INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' --conf '_tempfileProxmox_''); -- Insert new SAP APP SET @short_name = 'pandorafms.sap.deset'; diff --git a/pandora_console/vendor/artica/phpchartjs/src/Options.php b/pandora_console/vendor/artica/phpchartjs/src/Options.php index b1b5c91ad3..eecd8fa935 100644 --- a/pandora_console/vendor/artica/phpchartjs/src/Options.php +++ b/pandora_console/vendor/artica/phpchartjs/src/Options.php @@ -92,6 +92,11 @@ class Options implements ChartOwnedInterface, ArraySerializableInterface, JsonSe */ protected $indexAxis; + /** + * @var string + */ + protected $theme; + /** * @return Layout @@ -194,7 +199,7 @@ class Options implements ChartOwnedInterface, ArraySerializableInterface, JsonSe /** - * @return bool + * @return boolean */ public function disableAnimation() { @@ -323,6 +328,32 @@ class Options implements ChartOwnedInterface, ArraySerializableInterface, JsonSe } + /** + * Get font color. + * + * @return string + */ + public function getTheme() + { + return $this->theme; + } + + + /** + * Set font color. + * + * @param string $Theme Global font color. + * + * @return $this + */ + public function setTheme($theme) + { + $this->theme = $theme; + + return $this; + } + + /** * @return array */ diff --git a/pandora_console/vendor/artica/phpchartjs/src/Renderer/JavaScript.php b/pandora_console/vendor/artica/phpchartjs/src/Renderer/JavaScript.php index 3a0144bd9a..9462f5c803 100644 --- a/pandora_console/vendor/artica/phpchartjs/src/Renderer/JavaScript.php +++ b/pandora_console/vendor/artica/phpchartjs/src/Renderer/JavaScript.php @@ -30,7 +30,7 @@ class JavaScript extends Renderer // Watermark. if (empty($this->chart->defaults()->getWatermark()) === false) { - $script[] = 'const chart_watermark_'.$this->chart->getId().' = { + $script[] = 'const chart_watermark_'.$this->chart->getId().' = { id: "chart_watermark_'.$this->chart->getId().'", beforeDraw: (chart) => { if (Object.prototype.hasOwnProperty.call(chart, "config") && @@ -128,10 +128,15 @@ class JavaScript extends Renderer } } };'; - $script[] = 'Chart.register(chart_watermark_'.$this->chart->getId().');'; - } - + if ($this->chart->options()->getTheme() !== null) { + if ((int) $this->chart->options()->getTheme() === 2) { + $script[] = 'Chart.defaults.color = "#ffffff";'; + } + } + + $script[] = 'Chart.register(chart_watermark_'.$this->chart->getId().');'; + } // Create chart. $script[] = 'try {'; @@ -143,6 +148,36 @@ class JavaScript extends Renderer $script[] = ' Chart.defaults.font.style = "'.($this->chart->defaults()->getFonts()->getStyle() ?? 'normal').'";'; $script[] = ' Chart.defaults.font.weight = "'.($this->chart->defaults()->getFonts()->getWeight() ?? '').'";'; + if ($this->chart->options()->getTheme() !== null) { + if ((int) $this->chart->options()->getTheme() === 2) { + $script[] = ' Chart.defaults.color = "#ffffff";'; + + $script[] = ' + if (chart.config.options.scales !== undefined + && chart.config.options.scales.x !== undefined + && chart.config.options.scales.x.ticks !== undefined + ) { + chart.config.options.scales.x.ticks.color = "#ffffff"; + } + + if (chart.config.options.scales !== undefined && + chart.config.options.scales.y !== undefined && + chart.config.options.scales.y.ticks !== undefined + ) { + chart.config.options.scales.y.ticks.color = "#ffffff"; + } + + if (chart.config.options.title !== undefined ) { + chart.config.options.title.fontColor = "#ffffff"; + } + + if (chart.config.options.plugins.legend.labels.font !== undefined ) { + chart.config.options.plugins.legend.labels.font.color = "#ffffff"; + } + '; + } + } + $script[] = '} catch (error) {'; $script[] = ' console.error(error);'; $script[] = '}'; diff --git a/pandora_console/vendor/autoload.php b/pandora_console/vendor/autoload.php index cac482501f..11b193c3ab 100644 --- a/pandora_console/vendor/autoload.php +++ b/pandora_console/vendor/autoload.php @@ -2,24 +2,6 @@ // autoload.php @generated by Composer -if (PHP_VERSION_ID < 50600) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, $err); - } elseif (!headers_sent()) { - echo $err; - } - } - trigger_error( - $err, - E_USER_ERROR - ); -} - require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit94a17e624d873685991e8ae888e00eb9::getLoader(); diff --git a/pandora_console/vendor/composer/ClassLoader.php b/pandora_console/vendor/composer/ClassLoader.php index a72151c77c..afef3fa2ad 100644 --- a/pandora_console/vendor/composer/ClassLoader.php +++ b/pandora_console/vendor/composer/ClassLoader.php @@ -42,9 +42,6 @@ namespace Composer\Autoload; */ class ClassLoader { - /** @var \Closure(string):void */ - private static $includeFile; - /** @var ?string */ private $vendorDir; @@ -109,7 +106,6 @@ class ClassLoader public function __construct($vendorDir = null) { $this->vendorDir = $vendorDir; - self::initializeIncludeClosure(); } /** @@ -429,8 +425,7 @@ class ClassLoader public function loadClass($class) { if ($file = $this->findFile($class)) { - $includeFile = self::$includeFile; - $includeFile($file); + includeFile($file); return true; } @@ -560,26 +555,18 @@ class ClassLoader return false; } - - /** - * @return void - */ - private static function initializeIncludeClosure() - { - if (self::$includeFile !== null) { - return; - } - - /** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - */ - self::$includeFile = \Closure::bind(static function($file) { - include $file; - }, null, null); - } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private + */ +function includeFile($file) +{ + include $file; } diff --git a/pandora_console/vendor/composer/InstalledVersions.php b/pandora_console/vendor/composer/InstalledVersions.php index 39e55eab59..d50e0c9fcc 100644 --- a/pandora_console/vendor/composer/InstalledVersions.php +++ b/pandora_console/vendor/composer/InstalledVersions.php @@ -21,14 +21,12 @@ use Composer\Semver\VersionParser; * See also https://getcomposer.org/doc/07-runtime.md#installed-versions * * To require its presence, you can require `composer-runtime-api ^2.0` - * - * @final */ class InstalledVersions { /** * @var mixed[]|null - * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null */ private static $installed; @@ -39,7 +37,7 @@ class InstalledVersions /** * @var array[] - * @psalm-var array}> + * @psalm-var array}> */ private static $installedByVendor = array(); @@ -98,7 +96,7 @@ class InstalledVersions { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); } } @@ -119,7 +117,7 @@ class InstalledVersions */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints((string) $constraint); + $constraint = $parser->parseConstraints($constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -243,7 +241,7 @@ class InstalledVersions /** * @return array - * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} */ public static function getRootPackage() { @@ -257,7 +255,7 @@ class InstalledVersions * * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @return array[] - * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} */ public static function getRawData() { @@ -266,7 +264,7 @@ class InstalledVersions if (null === self::$installed) { // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C' && is_file(__DIR__ . '/installed.php')) { + if (substr(__DIR__, -8, 1) !== 'C') { self::$installed = include __DIR__ . '/installed.php'; } else { self::$installed = array(); @@ -280,7 +278,7 @@ class InstalledVersions * Returns the raw data of all installed.php which are currently loaded for custom implementations * * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ public static function getAllRawData() { @@ -303,7 +301,7 @@ class InstalledVersions * @param array[] $data A vendor/composer/installed.php data set * @return void * - * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} $data */ public static function reload($data) { @@ -313,7 +311,7 @@ class InstalledVersions /** * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ private static function getInstalled() { @@ -328,9 +326,7 @@ class InstalledVersions if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -341,18 +337,13 @@ class InstalledVersions if (null === self::$installed) { // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C' && is_file(__DIR__ . '/installed.php')) { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require __DIR__ . '/installed.php'; - self::$installed = $required; + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = require __DIR__ . '/installed.php'; } else { self::$installed = array(); } } - - if (self::$installed !== array()) { - $installed[] = self::$installed; - } + $installed[] = self::$installed; return $installed; } diff --git a/pandora_console/vendor/composer/autoload_classmap.php b/pandora_console/vendor/composer/autoload_classmap.php index cae0fc2f27..53268f2a43 100644 --- a/pandora_console/vendor/composer/autoload_classmap.php +++ b/pandora_console/vendor/composer/autoload_classmap.php @@ -2,7 +2,7 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( diff --git a/pandora_console/vendor/composer/autoload_files.php b/pandora_console/vendor/composer/autoload_files.php index 6d15dcb42d..ebde7fd0d4 100644 --- a/pandora_console/vendor/composer/autoload_files.php +++ b/pandora_console/vendor/composer/autoload_files.php @@ -2,33 +2,28 @@ // autoload_files.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( 'e8aa6e4b5a1db2f56ae794f1505391a8' => $vendorDir . '/amphp/amp/lib/functions.php', '76cd0796156622033397994f25b0d8fc' => $vendorDir . '/amphp/amp/lib/Internal/functions.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', - '6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => $vendorDir . '/amphp/byte-stream/lib/functions.php', + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => $vendorDir . '/amphp/byte-stream/lib/functions.php', + '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', + 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '3da389f428d8ee50333e4391c3f45046' => $vendorDir . '/amphp/serialization/src/functions.php', 'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php', - 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '8dc56fe697ca93c4b40d876df1c94584' => $vendorDir . '/amphp/process/lib/functions.php', 'bcb7d4fc55f4b1a7e10f5806723e9892' => $vendorDir . '/amphp/sync/src/functions.php', 'e187e371b30897d6dc51cac6a8c94ff6' => $vendorDir . '/amphp/sync/src/ConcurrentIterator/functions.php', - '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '430de19db8b7ee88fdbe5c545d82d33d' => $vendorDir . '/amphp/parallel/lib/Context/functions.php', '888e1afeed2e8d13ef5a662692091e6e' => $vendorDir . '/amphp/parallel/lib/Sync/functions.php', '384cf4f2eb4d2f896db72315a76066ad' => $vendorDir . '/amphp/parallel/lib/Worker/functions.php', - '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', - '253c157292f75eb38082b5acb06f3f01' => $vendorDir . '/nikic/fast-route/src/functions.php', - '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', - 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php', - '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', - '861372841bb4b8ba9fdd215894666f40' => $vendorDir . '/amphp/parallel-functions/src/functions.php', '07d7f1a47144818725fd8d91a907ac57' => $vendorDir . '/laminas/laminas-diactoros/src/functions/create_uploaded_file.php', 'da94ac5d3ca7d2dbab84ce561ce72bfd' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php', '3d97c8dcdfba8cb85d3b34f116bb248b' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php', @@ -36,6 +31,11 @@ return array( 'de95e0ac670b27c84ef8c5ac41fc1b34' => $vendorDir . '/laminas/laminas-diactoros/src/functions/normalize_server.php', 'b6c2870932b0250c10334a86dcb33c7f' => $vendorDir . '/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php', 'd02cf21124526632320d6f20b1bbf905' => $vendorDir . '/laminas/laminas-diactoros/src/functions/parse_cookie_header.php', + '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + '253c157292f75eb38082b5acb06f3f01' => $vendorDir . '/nikic/fast-route/src/functions.php', + '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', + 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php', + '861372841bb4b8ba9fdd215894666f40' => $vendorDir . '/amphp/parallel-functions/src/functions.php', 'db356362850385d08a5381de2638b5fd' => $vendorDir . '/mpdf/mpdf/src/functions.php', 'b33e3d135e5d9e47d845c576147bda89' => $vendorDir . '/php-di/php-di/src/functions.php', 'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php', diff --git a/pandora_console/vendor/composer/autoload_namespaces.php b/pandora_console/vendor/composer/autoload_namespaces.php index 15a2ff3ad6..b7fc0125db 100644 --- a/pandora_console/vendor/composer/autoload_namespaces.php +++ b/pandora_console/vendor/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( diff --git a/pandora_console/vendor/composer/autoload_psr4.php b/pandora_console/vendor/composer/autoload_psr4.php index 2b2cd523ee..e841d7bd8d 100644 --- a/pandora_console/vendor/composer/autoload_psr4.php +++ b/pandora_console/vendor/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( @@ -31,6 +31,7 @@ return array( 'Psr\\Http\\Server\\' => array($vendorDir . '/psr/http-server-handler/src', $vendorDir . '/psr/http-server-middleware/src'), 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), + 'Psr\\Clock\\' => array($vendorDir . '/psr/clock/src'), 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), 'PandoraFMS\\Enterprise\\' => array($baseDir . '/enterprise/include/lib'), 'PandoraFMS\\' => array($baseDir . '/include/lib'), @@ -42,6 +43,8 @@ return array( 'Mpdf\\' => array($vendorDir . '/mpdf/mpdf/src'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 'Models\\' => array($baseDir . '/include/rest-api/models'), + 'Lcobucci\\JWT\\' => array($vendorDir . '/lcobucci/jwt/src'), + 'Lcobucci\\Clock\\' => array($vendorDir . '/lcobucci/clock/src'), 'Laravel\\SerializableClosure\\' => array($vendorDir . '/laravel/serializable-closure/src'), 'Laminas\\Json\\' => array($vendorDir . '/laminas/laminas-json/src'), 'Laminas\\Diactoros\\' => array($vendorDir . '/laminas/laminas-diactoros/src'), diff --git a/pandora_console/vendor/composer/autoload_real.php b/pandora_console/vendor/composer/autoload_real.php index 12944ee0da..5a1c32f8a7 100644 --- a/pandora_console/vendor/composer/autoload_real.php +++ b/pandora_console/vendor/composer/autoload_real.php @@ -25,26 +25,56 @@ class ComposerAutoloaderInit94a17e624d873685991e8ae888e00eb9 require __DIR__ . '/platform_check.php'; spl_autoload_register(array('ComposerAutoloaderInit94a17e624d873685991e8ae888e00eb9', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); spl_autoload_unregister(array('ComposerAutoloaderInit94a17e624d873685991e8ae888e00eb9', 'loadClassLoader')); - require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit94a17e624d873685991e8ae888e00eb9::getInitializer($loader)); + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit94a17e624d873685991e8ae888e00eb9::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit94a17e624d873685991e8ae888e00eb9::$files; - $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - - require $file; - } - }, null, null); - foreach ($filesToLoad as $fileIdentifier => $file) { - $requireFile($fileIdentifier, $file); + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInit94a17e624d873685991e8ae888e00eb9::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire94a17e624d873685991e8ae888e00eb9($fileIdentifier, $file); } return $loader; } } + +/** + * @param string $fileIdentifier + * @param string $file + * @return void + */ +function composerRequire94a17e624d873685991e8ae888e00eb9($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } +} diff --git a/pandora_console/vendor/composer/autoload_static.php b/pandora_console/vendor/composer/autoload_static.php index 7338ae1edc..711deb2b69 100644 --- a/pandora_console/vendor/composer/autoload_static.php +++ b/pandora_console/vendor/composer/autoload_static.php @@ -10,26 +10,21 @@ class ComposerStaticInit94a17e624d873685991e8ae888e00eb9 'e8aa6e4b5a1db2f56ae794f1505391a8' => __DIR__ . '/..' . '/amphp/amp/lib/functions.php', '76cd0796156622033397994f25b0d8fc' => __DIR__ . '/..' . '/amphp/amp/lib/Internal/functions.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - '6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => __DIR__ . '/..' . '/amphp/byte-stream/lib/functions.php', + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => __DIR__ . '/..' . '/amphp/byte-stream/lib/functions.php', + '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', + 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '3da389f428d8ee50333e4391c3f45046' => __DIR__ . '/..' . '/amphp/serialization/src/functions.php', 'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php', - 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '8dc56fe697ca93c4b40d876df1c94584' => __DIR__ . '/..' . '/amphp/process/lib/functions.php', 'bcb7d4fc55f4b1a7e10f5806723e9892' => __DIR__ . '/..' . '/amphp/sync/src/functions.php', 'e187e371b30897d6dc51cac6a8c94ff6' => __DIR__ . '/..' . '/amphp/sync/src/ConcurrentIterator/functions.php', - '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '430de19db8b7ee88fdbe5c545d82d33d' => __DIR__ . '/..' . '/amphp/parallel/lib/Context/functions.php', '888e1afeed2e8d13ef5a662692091e6e' => __DIR__ . '/..' . '/amphp/parallel/lib/Sync/functions.php', '384cf4f2eb4d2f896db72315a76066ad' => __DIR__ . '/..' . '/amphp/parallel/lib/Worker/functions.php', - '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', - '253c157292f75eb38082b5acb06f3f01' => __DIR__ . '/..' . '/nikic/fast-route/src/functions.php', - '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', - 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php', - '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', - '861372841bb4b8ba9fdd215894666f40' => __DIR__ . '/..' . '/amphp/parallel-functions/src/functions.php', '07d7f1a47144818725fd8d91a907ac57' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/create_uploaded_file.php', 'da94ac5d3ca7d2dbab84ce561ce72bfd' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php', '3d97c8dcdfba8cb85d3b34f116bb248b' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php', @@ -37,6 +32,11 @@ class ComposerStaticInit94a17e624d873685991e8ae888e00eb9 'de95e0ac670b27c84ef8c5ac41fc1b34' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/normalize_server.php', 'b6c2870932b0250c10334a86dcb33c7f' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php', 'd02cf21124526632320d6f20b1bbf905' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/parse_cookie_header.php', + '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + '253c157292f75eb38082b5acb06f3f01' => __DIR__ . '/..' . '/nikic/fast-route/src/functions.php', + '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php', + '861372841bb4b8ba9fdd215894666f40' => __DIR__ . '/..' . '/amphp/parallel-functions/src/functions.php', 'db356362850385d08a5381de2638b5fd' => __DIR__ . '/..' . '/mpdf/mpdf/src/functions.php', 'b33e3d135e5d9e47d845c576147bda89' => __DIR__ . '/..' . '/php-di/php-di/src/functions.php', 'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php', @@ -90,6 +90,7 @@ class ComposerStaticInit94a17e624d873685991e8ae888e00eb9 'Psr\\Http\\Server\\' => 16, 'Psr\\Http\\Message\\' => 17, 'Psr\\Container\\' => 14, + 'Psr\\Clock\\' => 10, 'Psr\\Cache\\' => 10, 'PandoraFMS\\Enterprise\\' => 22, 'PandoraFMS\\' => 11, @@ -113,6 +114,8 @@ class ComposerStaticInit94a17e624d873685991e8ae888e00eb9 ), 'L' => array ( + 'Lcobucci\\JWT\\' => 13, + 'Lcobucci\\Clock\\' => 15, 'Laravel\\SerializableClosure\\' => 28, 'Laminas\\Json\\' => 13, 'Laminas\\Diactoros\\' => 18, @@ -271,6 +274,10 @@ class ComposerStaticInit94a17e624d873685991e8ae888e00eb9 array ( 0 => __DIR__ . '/..' . '/psr/container/src', ), + 'Psr\\Clock\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/clock/src', + ), 'Psr\\Cache\\' => array ( 0 => __DIR__ . '/..' . '/psr/cache/src', @@ -315,6 +322,14 @@ class ComposerStaticInit94a17e624d873685991e8ae888e00eb9 array ( 0 => __DIR__ . '/../..' . '/include/rest-api/models', ), + 'Lcobucci\\JWT\\' => + array ( + 0 => __DIR__ . '/..' . '/lcobucci/jwt/src', + ), + 'Lcobucci\\Clock\\' => + array ( + 0 => __DIR__ . '/..' . '/lcobucci/clock/src', + ), 'Laravel\\SerializableClosure\\' => array ( 0 => __DIR__ . '/..' . '/laravel/serializable-closure/src', diff --git a/pandora_console/vendor/composer/installed.json b/pandora_console/vendor/composer/installed.json index 3ba9ef68d3..ae3230b939 100644 --- a/pandora_console/vendor/composer/installed.json +++ b/pandora_console/vendor/composer/installed.json @@ -1616,6 +1616,149 @@ }, "install-path": "../laravel/serializable-closure" }, + { + "name": "lcobucci/clock", + "version": "3.2.0", + "version_normalized": "3.2.0.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" + }, + "time": "2023-11-17T17:00:27+00:00", + "type": "library", + "installation-source": "dist", + "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" + } + ], + "install-path": "../lcobucci/clock" + }, + { + "name": "lcobucci/jwt", + "version": "5.2.0", + "version_normalized": "5.2.0.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" + }, + "time": "2023-11-20T21:17:42+00:00", + "type": "library", + "installation-source": "dist", + "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" + } + ], + "install-path": "../lcobucci/jwt" + }, { "name": "monolog/monolog", "version": "3.5.0", @@ -2406,6 +2549,57 @@ }, "install-path": "../psr/cache" }, + { + "name": "psr/clock", + "version": "1.0.0", + "version_normalized": "1.0.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" + }, + "time": "2022-11-25T14:36:26+00:00", + "type": "library", + "installation-source": "dist", + "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" + }, + "install-path": "../psr/clock" + }, { "name": "psr/container", "version": "2.0.2", diff --git a/pandora_console/vendor/composer/installed.php b/pandora_console/vendor/composer/installed.php index 132d3269a2..852e3921ad 100644 --- a/pandora_console/vendor/composer/installed.php +++ b/pandora_console/vendor/composer/installed.php @@ -1,328 +1,346 @@ array( - 'name' => 'pandorafms/console', 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', - 'reference' => '8bf414b51f3333555f84df8b23614ca4b68c7fd4', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), + 'reference' => '670829fa5833a6f666ebf4c78669ca6fdac476c9', + 'name' => 'pandorafms/console', 'dev' => true, ), 'versions' => array( 'amphp/amp' => array( 'pretty_version' => 'v2.6.2', 'version' => '2.6.2.0', - 'reference' => '9d5100cebffa729aaffecd3ad25dc5aeea4f13bb', 'type' => 'library', 'install_path' => __DIR__ . '/../amphp/amp', 'aliases' => array(), + 'reference' => '9d5100cebffa729aaffecd3ad25dc5aeea4f13bb', 'dev_requirement' => false, ), 'amphp/byte-stream' => array( 'pretty_version' => 'v1.8.1', 'version' => '1.8.1.0', - 'reference' => 'acbd8002b3536485c997c4e019206b3f10ca15bd', 'type' => 'library', 'install_path' => __DIR__ . '/../amphp/byte-stream', 'aliases' => array(), + 'reference' => 'acbd8002b3536485c997c4e019206b3f10ca15bd', 'dev_requirement' => false, ), 'amphp/parallel' => array( 'pretty_version' => 'v1.4.3', 'version' => '1.4.3.0', - 'reference' => '3aac213ba7858566fd83d38ccb85b91b2d652cb0', 'type' => 'library', 'install_path' => __DIR__ . '/../amphp/parallel', 'aliases' => array(), + 'reference' => '3aac213ba7858566fd83d38ccb85b91b2d652cb0', 'dev_requirement' => false, ), 'amphp/parallel-functions' => array( 'pretty_version' => 'v1.1.0', 'version' => '1.1.0.0', - 'reference' => '04e92fcacfc921a56dfe12c23b3265e62593a7cb', 'type' => 'library', 'install_path' => __DIR__ . '/../amphp/parallel-functions', 'aliases' => array(), + 'reference' => '04e92fcacfc921a56dfe12c23b3265e62593a7cb', 'dev_requirement' => false, ), 'amphp/parser' => array( 'pretty_version' => 'v1.1.0', 'version' => '1.1.0.0', - 'reference' => 'ff1de4144726c5dad5fab97f66692ebe8de3e151', 'type' => 'library', 'install_path' => __DIR__ . '/../amphp/parser', 'aliases' => array(), + 'reference' => 'ff1de4144726c5dad5fab97f66692ebe8de3e151', 'dev_requirement' => false, ), 'amphp/process' => array( 'pretty_version' => 'v1.1.4', 'version' => '1.1.4.0', - 'reference' => '76e9495fd6818b43a20167cb11d8a67f7744ee0f', 'type' => 'library', 'install_path' => __DIR__ . '/../amphp/process', 'aliases' => array(), + 'reference' => '76e9495fd6818b43a20167cb11d8a67f7744ee0f', 'dev_requirement' => false, ), 'amphp/serialization' => array( 'pretty_version' => 'v1.0.0', 'version' => '1.0.0.0', - 'reference' => '693e77b2fb0b266c3c7d622317f881de44ae94a1', 'type' => 'library', 'install_path' => __DIR__ . '/../amphp/serialization', 'aliases' => array(), + 'reference' => '693e77b2fb0b266c3c7d622317f881de44ae94a1', 'dev_requirement' => false, ), 'amphp/sync' => array( 'pretty_version' => 'v1.4.2', 'version' => '1.4.2.0', - 'reference' => '85ab06764f4f36d63b1356b466df6111cf4b89cf', 'type' => 'library', 'install_path' => __DIR__ . '/../amphp/sync', 'aliases' => array(), + 'reference' => '85ab06764f4f36d63b1356b466df6111cf4b89cf', 'dev_requirement' => false, ), 'artica/phpchartjs' => array( 'pretty_version' => 'v1.0.2', 'version' => '1.0.2.0', - 'reference' => '681980c084ad505f9dc811d3d1f02ffc9442ccee', 'type' => 'package', 'install_path' => __DIR__ . '/../artica/phpchartjs', 'aliases' => array(), + 'reference' => '681980c084ad505f9dc811d3d1f02ffc9442ccee', 'dev_requirement' => false, ), 'brick/math' => array( 'pretty_version' => '0.11.0', 'version' => '0.11.0.0', - 'reference' => '0ad82ce168c82ba30d1c01ec86116ab52f589478', 'type' => 'library', 'install_path' => __DIR__ . '/../brick/math', 'aliases' => array(), + 'reference' => '0ad82ce168c82ba30d1c01ec86116ab52f589478', 'dev_requirement' => false, ), 'chrome-php/chrome' => array( 'pretty_version' => 'v1.10.0', 'version' => '1.10.0.0', - 'reference' => '2b7cb13e618602d13bdede20b6b7ae478f3f6eaa', 'type' => 'library', 'install_path' => __DIR__ . '/../chrome-php/chrome', 'aliases' => array(), + 'reference' => '2b7cb13e618602d13bdede20b6b7ae478f3f6eaa', 'dev_requirement' => false, ), 'chrome-php/wrench' => array( 'pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', - 'reference' => '725246324339e5fd5d798361b561e81004324f96', 'type' => 'library', 'install_path' => __DIR__ . '/../chrome-php/wrench', 'aliases' => array(), + 'reference' => '725246324339e5fd5d798361b561e81004324f96', 'dev_requirement' => false, ), 'doctrine/annotations' => array( 'pretty_version' => '2.0.1', 'version' => '2.0.1.0', - 'reference' => 'e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/annotations', 'aliases' => array(), + 'reference' => 'e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f', 'dev_requirement' => false, ), 'doctrine/deprecations' => array( 'pretty_version' => '1.1.3', 'version' => '1.1.3.0', - 'reference' => 'dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/deprecations', 'aliases' => array(), + 'reference' => 'dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab', 'dev_requirement' => false, ), 'doctrine/lexer' => array( 'pretty_version' => '2.1.0', 'version' => '2.1.0.0', - 'reference' => '39ab8fcf5a51ce4b85ca97c7a7d033eb12831124', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/lexer', 'aliases' => array(), + 'reference' => '39ab8fcf5a51ce4b85ca97c7a7d033eb12831124', 'dev_requirement' => false, ), 'egulias/email-validator' => array( 'pretty_version' => '3.2.6', 'version' => '3.2.6.0', - 'reference' => 'e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7', 'type' => 'library', 'install_path' => __DIR__ . '/../egulias/email-validator', 'aliases' => array(), + 'reference' => 'e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7', 'dev_requirement' => false, ), 'evenement/evenement' => array( 'pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', - 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), + 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'dev_requirement' => false, ), 'fig/http-message-util' => array( 'pretty_version' => '1.1.5', 'version' => '1.1.5.0', - 'reference' => '9d94dc0154230ac39e5bf89398b324a86f63f765', 'type' => 'library', 'install_path' => __DIR__ . '/../fig/http-message-util', 'aliases' => array(), + 'reference' => '9d94dc0154230ac39e5bf89398b324a86f63f765', 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( 'pretty_version' => '2.6.2', 'version' => '2.6.2.0', - 'reference' => '45b30f99ac27b5ca93cb4831afe16285f57b8221', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), + 'reference' => '45b30f99ac27b5ca93cb4831afe16285f57b8221', 'dev_requirement' => false, ), 'halfpastfouram/collection' => array( 'pretty_version' => 'v1.0.0', 'version' => '1.0.0.0', - 'reference' => '0862d0b431fef9dc2245518dc06b86ff00dcd102', 'type' => 'package', 'install_path' => __DIR__ . '/../halfpastfouram/collection', 'aliases' => array(), + 'reference' => '0862d0b431fef9dc2245518dc06b86ff00dcd102', 'dev_requirement' => false, ), 'laminas/laminas-diactoros' => array( 'pretty_version' => '3.3.0', 'version' => '3.3.0.0', - 'reference' => '4db52734837c60259c9b2d7caf08eef8f7f9b9ac', 'type' => 'library', 'install_path' => __DIR__ . '/../laminas/laminas-diactoros', 'aliases' => array(), + 'reference' => '4db52734837c60259c9b2d7caf08eef8f7f9b9ac', 'dev_requirement' => false, ), 'laminas/laminas-json' => array( 'pretty_version' => '3.6.0', 'version' => '3.6.0.0', - 'reference' => '53ff787b20b77197f38680c737e8dfffa846b85b', 'type' => 'library', 'install_path' => __DIR__ . '/../laminas/laminas-json', 'aliases' => array(), + 'reference' => '53ff787b20b77197f38680c737e8dfffa846b85b', 'dev_requirement' => false, ), 'laravel/serializable-closure' => array( 'pretty_version' => 'v1.3.3', 'version' => '1.3.3.0', - 'reference' => '3dbf8a8e914634c48d389c1234552666b3d43754', 'type' => 'library', 'install_path' => __DIR__ . '/../laravel/serializable-closure', 'aliases' => array(), + 'reference' => '3dbf8a8e914634c48d389c1234552666b3d43754', + 'dev_requirement' => false, + ), + 'lcobucci/clock' => array( + 'pretty_version' => '3.2.0', + 'version' => '3.2.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../lcobucci/clock', + 'aliases' => array(), + 'reference' => '6f28b826ea01306b07980cb8320ab30b966cd715', + 'dev_requirement' => false, + ), + 'lcobucci/jwt' => array( + 'pretty_version' => '5.2.0', + 'version' => '5.2.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../lcobucci/jwt', + 'aliases' => array(), + 'reference' => '0ba88aed12c04bd2ed9924f500673f32b67a6211', 'dev_requirement' => false, ), 'monolog/monolog' => array( 'pretty_version' => '3.5.0', 'version' => '3.5.0.0', - 'reference' => 'c915e2634718dbc8a4a15c61b0e62e7a44e14448', 'type' => 'library', 'install_path' => __DIR__ . '/../monolog/monolog', 'aliases' => array(), + 'reference' => 'c915e2634718dbc8a4a15c61b0e62e7a44e14448', 'dev_requirement' => false, ), 'mpdf/mpdf' => array( 'pretty_version' => 'v8.2.2', 'version' => '8.2.2.0', - 'reference' => '596a87b876d7793be7be060a8ac13424de120dd5', 'type' => 'library', 'install_path' => __DIR__ . '/../mpdf/mpdf', 'aliases' => array(), + 'reference' => '596a87b876d7793be7be060a8ac13424de120dd5', 'dev_requirement' => false, ), 'mpdf/psr-http-message-shim' => array( 'pretty_version' => '1.0.0', 'version' => '1.0.0.0', - 'reference' => '3206e6b80b6d2479e148ee497e9f2bebadc919db', 'type' => 'library', 'install_path' => __DIR__ . '/../mpdf/psr-http-message-shim', 'aliases' => array(), + 'reference' => '3206e6b80b6d2479e148ee497e9f2bebadc919db', 'dev_requirement' => false, ), 'mpdf/psr-log-aware-trait' => array( 'pretty_version' => 'v3.0.0', 'version' => '3.0.0.0', - 'reference' => 'a633da6065e946cc491e1c962850344bb0bf3e78', 'type' => 'library', 'install_path' => __DIR__ . '/../mpdf/psr-log-aware-trait', 'aliases' => array(), + 'reference' => 'a633da6065e946cc491e1c962850344bb0bf3e78', 'dev_requirement' => false, ), 'myclabs/deep-copy' => array( 'pretty_version' => '1.11.1', 'version' => '1.11.1.0', - 'reference' => '7284c22080590fb39f2ffa3e9057f10a4ddd0e0c', 'type' => 'library', 'install_path' => __DIR__ . '/../myclabs/deep-copy', 'aliases' => array(), + 'reference' => '7284c22080590fb39f2ffa3e9057f10a4ddd0e0c', 'dev_requirement' => false, ), 'nikic/fast-route' => array( 'pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', - 'reference' => '181d480e08d9476e61381e04a71b34dc0432e812', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/fast-route', 'aliases' => array(), + 'reference' => '181d480e08d9476e61381e04a71b34dc0432e812', 'dev_requirement' => false, ), 'nyholm/psr7' => array( 'pretty_version' => '1.8.1', 'version' => '1.8.1.0', - 'reference' => 'aa5fc277a4f5508013d571341ade0c3886d4d00e', 'type' => 'library', 'install_path' => __DIR__ . '/../nyholm/psr7', 'aliases' => array(), + 'reference' => 'aa5fc277a4f5508013d571341ade0c3886d4d00e', 'dev_requirement' => false, ), 'nyholm/psr7-server' => array( 'pretty_version' => '1.1.0', 'version' => '1.1.0.0', - 'reference' => '4335801d851f554ca43fa6e7d2602141538854dc', 'type' => 'library', 'install_path' => __DIR__ . '/../nyholm/psr7-server', 'aliases' => array(), + 'reference' => '4335801d851f554ca43fa6e7d2602141538854dc', 'dev_requirement' => false, ), 'pandorafms/console' => array( 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', - 'reference' => '8bf414b51f3333555f84df8b23614ca4b68c7fd4', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), + 'reference' => '670829fa5833a6f666ebf4c78669ca6fdac476c9', 'dev_requirement' => false, ), 'paragonie/random_compat' => array( 'pretty_version' => 'v9.99.100', 'version' => '9.99.100.0', - 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', 'type' => 'library', 'install_path' => __DIR__ . '/../paragonie/random_compat', 'aliases' => array(), + 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', 'dev_requirement' => false, ), 'php-di/invoker' => array( 'pretty_version' => '2.3.4', 'version' => '2.3.4.0', - 'reference' => '33234b32dafa8eb69202f950a1fc92055ed76a86', 'type' => 'library', 'install_path' => __DIR__ . '/../php-di/invoker', 'aliases' => array(), + 'reference' => '33234b32dafa8eb69202f950a1fc92055ed76a86', 'dev_requirement' => false, ), 'php-di/php-di' => array( 'pretty_version' => '7.0.6', 'version' => '7.0.6.0', - 'reference' => '8097948a89f6ec782839b3e958432f427cac37fd', 'type' => 'library', 'install_path' => __DIR__ . '/../php-di/php-di', 'aliases' => array(), + 'reference' => '8097948a89f6ec782839b3e958432f427cac37fd', 'dev_requirement' => false, ), 'php-http/message-factory-implementation' => array( @@ -334,19 +352,34 @@ 'psr/cache' => array( 'pretty_version' => '3.0.0', 'version' => '3.0.0.0', - 'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/cache', 'aliases' => array(), + 'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf', 'dev_requirement' => false, ), + 'psr/clock' => array( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/clock', + 'aliases' => array(), + 'reference' => 'e41a24703d4560fd0acb709162f73b8adfc3aa0d', + 'dev_requirement' => false, + ), + 'psr/clock-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), 'psr/container' => array( 'pretty_version' => '2.0.2', 'version' => '2.0.2.0', - 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), + 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'dev_requirement' => false, ), 'psr/container-implementation' => array( @@ -358,10 +391,10 @@ 'psr/http-factory' => array( 'pretty_version' => '1.0.2', 'version' => '1.0.2.0', - 'reference' => 'e616d01114759c4c489f93b099585439f795fe35', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-factory', 'aliases' => array(), + 'reference' => 'e616d01114759c4c489f93b099585439f795fe35', 'dev_requirement' => false, ), 'psr/http-factory-implementation' => array( @@ -374,10 +407,10 @@ 'psr/http-message' => array( 'pretty_version' => '1.1', 'version' => '1.1.0.0', - 'reference' => 'cb6ce4845ce34a8ad9e68117c10ee90a29919eba', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-message', 'aliases' => array(), + 'reference' => 'cb6ce4845ce34a8ad9e68117c10ee90a29919eba', 'dev_requirement' => false, ), 'psr/http-message-implementation' => array( @@ -390,28 +423,28 @@ 'psr/http-server-handler' => array( 'pretty_version' => '1.0.2', 'version' => '1.0.2.0', - 'reference' => '84c4fb66179be4caaf8e97bd239203245302e7d4', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-server-handler', 'aliases' => array(), + 'reference' => '84c4fb66179be4caaf8e97bd239203245302e7d4', 'dev_requirement' => false, ), 'psr/http-server-middleware' => array( 'pretty_version' => '1.0.2', 'version' => '1.0.2.0', - 'reference' => 'c1481f747daaa6a0782775cd6a8c26a1bf4a3829', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-server-middleware', 'aliases' => array(), + 'reference' => 'c1481f747daaa6a0782775cd6a8c26a1bf4a3829', 'dev_requirement' => false, ), 'psr/log' => array( 'pretty_version' => '3.0.0', 'version' => '3.0.0.0', - 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), + 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001', 'dev_requirement' => false, ), 'psr/log-implementation' => array( @@ -423,28 +456,28 @@ 'ralouphie/getallheaders' => array( 'pretty_version' => '3.0.3', 'version' => '3.0.3.0', - 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 'type' => 'library', 'install_path' => __DIR__ . '/../ralouphie/getallheaders', 'aliases' => array(), + 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 'dev_requirement' => false, ), 'ramsey/collection' => array( 'pretty_version' => '2.0.0', 'version' => '2.0.0.0', - 'reference' => 'a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/collection', 'aliases' => array(), + 'reference' => 'a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5', 'dev_requirement' => false, ), 'ramsey/uuid' => array( 'pretty_version' => '4.7.5', 'version' => '4.7.5.0', - 'reference' => '5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/uuid', 'aliases' => array(), + 'reference' => '5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e', 'dev_requirement' => false, ), 'rhumsaa/uuid' => array( @@ -456,172 +489,172 @@ 'setasign/fpdi' => array( 'pretty_version' => 'v2.6.0', 'version' => '2.6.0.0', - 'reference' => 'a6db878129ec6c7e141316ee71872923e7f1b7ad', 'type' => 'library', 'install_path' => __DIR__ . '/../setasign/fpdi', 'aliases' => array(), + 'reference' => 'a6db878129ec6c7e141316ee71872923e7f1b7ad', 'dev_requirement' => false, ), 'slim/psr7' => array( 'pretty_version' => '1.6.1', 'version' => '1.6.1.0', - 'reference' => '72d2b2bac94ab4575d369f605dbfafbe168d3163', 'type' => 'library', 'install_path' => __DIR__ . '/../slim/psr7', 'aliases' => array(), + 'reference' => '72d2b2bac94ab4575d369f605dbfafbe168d3163', 'dev_requirement' => false, ), 'slim/slim' => array( 'pretty_version' => '4.12.0', 'version' => '4.12.0.0', - 'reference' => 'e9e99c2b24398b967841c6c4c3048622cc7e2b18', 'type' => 'library', 'install_path' => __DIR__ . '/../slim/slim', 'aliases' => array(), + 'reference' => 'e9e99c2b24398b967841c6c4c3048622cc7e2b18', 'dev_requirement' => false, ), 'swiftmailer/swiftmailer' => array( 'pretty_version' => 'v6.3.0', 'version' => '6.3.0.0', - 'reference' => '8a5d5072dca8f48460fce2f4131fcc495eec654c', 'type' => 'library', 'install_path' => __DIR__ . '/../swiftmailer/swiftmailer', 'aliases' => array(), + 'reference' => '8a5d5072dca8f48460fce2f4131fcc495eec654c', 'dev_requirement' => false, ), 'symfony/deprecation-contracts' => array( 'pretty_version' => 'v3.4.0', 'version' => '3.4.0.0', - 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), + 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', 'dev_requirement' => false, ), 'symfony/filesystem' => array( 'pretty_version' => 'v7.0.3', 'version' => '7.0.3.0', - 'reference' => '2890e3a825bc0c0558526c04499c13f83e1b6b12', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), + 'reference' => '2890e3a825bc0c0558526c04499c13f83e1b6b12', 'dev_requirement' => false, ), 'symfony/finder' => array( 'pretty_version' => 'v7.0.0', 'version' => '7.0.0.0', - 'reference' => '6e5688d69f7cfc4ed4a511e96007e06c2d34ce56', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), + 'reference' => '6e5688d69f7cfc4ed4a511e96007e06c2d34ce56', 'dev_requirement' => false, ), 'symfony/polyfill-ctype' => array( 'pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', - 'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'aliases' => array(), + 'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb', 'dev_requirement' => false, ), 'symfony/polyfill-iconv' => array( 'pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', - 'reference' => '6de50471469b8c9afc38164452ab2b6170ee71c1', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-iconv', 'aliases' => array(), + 'reference' => '6de50471469b8c9afc38164452ab2b6170ee71c1', 'dev_requirement' => false, ), 'symfony/polyfill-intl-idn' => array( 'pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', - 'reference' => 'ecaafce9f77234a6a449d29e49267ba10499116d', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-intl-idn', 'aliases' => array(), + 'reference' => 'ecaafce9f77234a6a449d29e49267ba10499116d', 'dev_requirement' => false, ), 'symfony/polyfill-intl-normalizer' => array( 'pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', - 'reference' => '8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer', 'aliases' => array(), + 'reference' => '8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92', 'dev_requirement' => false, ), 'symfony/polyfill-mbstring' => array( 'pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', - 'reference' => '42292d99c55abe617799667f454222c54c60e229', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), + 'reference' => '42292d99c55abe617799667f454222c54c60e229', 'dev_requirement' => false, ), 'symfony/polyfill-php72' => array( 'pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', - 'reference' => '70f4aebd92afca2f865444d30a4d2151c13c3179', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php72', 'aliases' => array(), + 'reference' => '70f4aebd92afca2f865444d30a4d2151c13c3179', 'dev_requirement' => false, ), 'symfony/polyfill-php80' => array( 'pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', - 'reference' => '6caa57379c4aec19c0a12a38b59b26487dcfe4b5', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'aliases' => array(), + 'reference' => '6caa57379c4aec19c0a12a38b59b26487dcfe4b5', 'dev_requirement' => false, ), 'symfony/process' => array( 'pretty_version' => 'v7.0.3', 'version' => '7.0.3.0', - 'reference' => '937a195147e0c27b2759ade834169ed006d0bc74', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), + 'reference' => '937a195147e0c27b2759ade834169ed006d0bc74', 'dev_requirement' => false, ), 'symfony/var-dumper' => array( 'pretty_version' => 'v3.4.47', 'version' => '3.4.47.0', - 'reference' => '0719f6cf4633a38b2c1585140998579ce23b4b7d', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/var-dumper', 'aliases' => array(), + 'reference' => '0719f6cf4633a38b2c1585140998579ce23b4b7d', 'dev_requirement' => false, ), 'symfony/yaml' => array( 'pretty_version' => 'v7.0.3', 'version' => '7.0.3.0', - 'reference' => '2d4fca631c00700597e9442a0b2451ce234513d3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), + 'reference' => '2d4fca631c00700597e9442a0b2451ce234513d3', 'dev_requirement' => false, ), 'tinymce/tinymce' => array( 'pretty_version' => '6.8.2', 'version' => '6.8.2.0', - 'reference' => 'b0073db409746748af4fc06fbee337bb99f462d9', 'type' => 'component', 'install_path' => __DIR__ . '/../tinymce/tinymce', 'aliases' => array(), + 'reference' => 'b0073db409746748af4fc06fbee337bb99f462d9', 'dev_requirement' => false, ), 'zircote/swagger-php' => array( 'pretty_version' => '4.8.3', 'version' => '4.8.3.0', - 'reference' => '598958d8a83cfbd44ba36388b2f9ed69e8b86ed4', 'type' => 'library', 'install_path' => __DIR__ . '/../zircote/swagger-php', 'aliases' => array(), + 'reference' => '598958d8a83cfbd44ba36388b2f9ed69e8b86ed4', 'dev_requirement' => false, ), ), diff --git a/pandora_console/vendor/composer/platform_check.php b/pandora_console/vendor/composer/platform_check.php index 51c545e82f..d32d90c6a9 100644 --- a/pandora_console/vendor/composer/platform_check.php +++ b/pandora_console/vendor/composer/platform_check.php @@ -16,35 +16,7 @@ if ($issues) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); } elseif (!headers_sent()) { - require_once __DIR__.'/../../include/functions_ui.php'; - - $url = str_replace('/var/www/html/', '', __DIR__); - $url = str_replace('/vendor/composer', '', $url); - - echo ''; - ?> - - - - '; - echo '
    '; - echo '

    Composer detected issues in your platform:

    '; - echo '
    '; - echo sprintf( - 'PandoraFMS requires PHP 8.2 to work properly and the version %s has been detected. Please update the PHP version of the system.', - PHP_VERSION, - ); - echo '
    '; + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; } } trigger_error( diff --git a/pandora_console/vendor/lcobucci/clock/LICENSE b/pandora_console/vendor/lcobucci/clock/LICENSE new file mode 100644 index 0000000000..58ea9440eb --- /dev/null +++ b/pandora_console/vendor/lcobucci/clock/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Luís Cobucci + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/pandora_console/vendor/lcobucci/clock/composer.json b/pandora_console/vendor/lcobucci/clock/composer.json new file mode 100644 index 0000000000..f2cd93b76f --- /dev/null +++ b/pandora_console/vendor/lcobucci/clock/composer.json @@ -0,0 +1,48 @@ +{ + "name": "lcobucci/clock", + "description": "Yet another clock abstraction", + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com" + } + ], + "require": { + "php": "~8.2.0 || ~8.3.0", + "psr/clock": "^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" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "autoload": { + "psr-4": { + "Lcobucci\\Clock\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Lcobucci\\Clock\\": "test" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "infection/extension-installer": true, + "phpstan/extension-installer": true + }, + "preferred-install": "dist", + "sort-packages": true + } +} diff --git a/pandora_console/vendor/lcobucci/clock/src/Clock.php b/pandora_console/vendor/lcobucci/clock/src/Clock.php new file mode 100644 index 0000000000..45a033b875 --- /dev/null +++ b/pandora_console/vendor/lcobucci/clock/src/Clock.php @@ -0,0 +1,12 @@ +now = $now; + } + + public function now(): DateTimeImmutable + { + return $this->now; + } +} diff --git a/pandora_console/vendor/lcobucci/clock/src/SystemClock.php b/pandora_console/vendor/lcobucci/clock/src/SystemClock.php new file mode 100644 index 0000000000..6b65dfa53e --- /dev/null +++ b/pandora_console/vendor/lcobucci/clock/src/SystemClock.php @@ -0,0 +1,32 @@ +timezone); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/.readthedocs.yaml b/pandora_console/vendor/lcobucci/jwt/.readthedocs.yaml new file mode 100644 index 0000000000..aa49c94360 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/.readthedocs.yaml @@ -0,0 +1,9 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3" + +mkdocs: + configuration: mkdocs.yml diff --git a/pandora_console/vendor/lcobucci/jwt/LICENSE b/pandora_console/vendor/lcobucci/jwt/LICENSE new file mode 100644 index 0000000000..cc7e28f16b --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2014, Luís Cobucci +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the {organization} nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pandora_console/vendor/lcobucci/jwt/composer.json b/pandora_console/vendor/lcobucci/jwt/composer.json new file mode 100644 index 0000000000..a61868948d --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/composer.json @@ -0,0 +1,63 @@ +{ + "name": "lcobucci/jwt", + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "license": [ + "BSD-3-Clause" + ], + "type": "library", + "keywords": [ + "JWT", + "JWS" + ], + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "ext-openssl": "*", + "ext-sodium": "*", + "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" + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Lcobucci\\JWT\\Tests\\": "tests" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "infection/extension-installer": true, + "ocramius/package-versions": true, + "phpstan/extension-installer": true + }, + "platform": { + "php": "8.1.99" + }, + "preferred-install": "dist", + "sort-packages": true + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/renovate.json b/pandora_console/vendor/lcobucci/jwt/renovate.json new file mode 100644 index 0000000000..d0adcc3ae4 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "local>lcobucci/.github:renovate-config" + ] +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Builder.php b/pandora_console/vendor/lcobucci/jwt/src/Builder.php new file mode 100644 index 0000000000..4295e3f0b6 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Builder.php @@ -0,0 +1,85 @@ + $claims + * + * @return array + */ + public function formatClaims(array $claims): array; +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Configuration.php b/pandora_console/vendor/lcobucci/jwt/src/Configuration.php new file mode 100644 index 0000000000..488ea3e232 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Configuration.php @@ -0,0 +1,131 @@ +parser = new Token\Parser($decoder); + $this->validator = new Validation\Validator(); + + $this->builderFactory = static function (ClaimsFormatter $claimFormatter) use ($encoder): Builder { + return new Token\Builder($encoder, $claimFormatter); + }; + } + + public static function forAsymmetricSigner( + Signer $signer, + Key $signingKey, + Key $verificationKey, + Encoder $encoder = new JoseEncoder(), + Decoder $decoder = new JoseEncoder(), + ): self { + return new self( + $signer, + $signingKey, + $verificationKey, + $encoder, + $decoder, + ); + } + + public static function forSymmetricSigner( + Signer $signer, + Key $key, + Encoder $encoder = new JoseEncoder(), + Decoder $decoder = new JoseEncoder(), + ): self { + return new self( + $signer, + $key, + $key, + $encoder, + $decoder, + ); + } + + /** @param callable(ClaimsFormatter): Builder $builderFactory */ + public function setBuilderFactory(callable $builderFactory): void + { + $this->builderFactory = $builderFactory(...); + } + + public function builder(?ClaimsFormatter $claimFormatter = null): Builder + { + return ($this->builderFactory)($claimFormatter ?? ChainedFormatter::default()); + } + + public function parser(): Parser + { + return $this->parser; + } + + public function setParser(Parser $parser): void + { + $this->parser = $parser; + } + + public function signer(): Signer + { + return $this->signer; + } + + public function signingKey(): Key + { + return $this->signingKey; + } + + public function verificationKey(): Key + { + return $this->verificationKey; + } + + public function validator(): Validator + { + return $this->validator; + } + + public function setValidator(Validator $validator): void + { + $this->validator = $validator; + } + + /** @return Constraint[] */ + public function validationConstraints(): array + { + return $this->validationConstraints; + } + + public function setValidationConstraints(Constraint ...$validationConstraints): void + { + $this->validationConstraints = $validationConstraints; + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Decoder.php b/pandora_console/vendor/lcobucci/jwt/src/Decoder.php new file mode 100644 index 0000000000..6b24b9268d --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Decoder.php @@ -0,0 +1,29 @@ + */ + private array $formatters; + + public function __construct(ClaimsFormatter ...$formatters) + { + $this->formatters = $formatters; + } + + public static function default(): self + { + return new self(new UnifyAudience(), new MicrosecondBasedDateConversion()); + } + + public static function withUnixTimestampDates(): self + { + return new self(new UnifyAudience(), new UnixTimestampDates()); + } + + /** @inheritdoc */ + public function formatClaims(array $claims): array + { + foreach ($this->formatters as $formatter) { + $claims = $formatter->formatClaims($claims); + } + + return $claims; + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Encoding/JoseEncoder.php b/pandora_console/vendor/lcobucci/jwt/src/Encoding/JoseEncoder.php new file mode 100644 index 0000000000..0d9044427e --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Encoding/JoseEncoder.php @@ -0,0 +1,56 @@ +convertDate($claims[$claim]); + } + + return $claims; + } + + private function convertDate(DateTimeImmutable $date): int|float + { + if ($date->format('u') === '000000') { + return (int) $date->format('U'); + } + + return (float) $date->format('U.u'); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Encoding/UnifyAudience.php b/pandora_console/vendor/lcobucci/jwt/src/Encoding/UnifyAudience.php new file mode 100644 index 0000000000..cf57252e9e --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Encoding/UnifyAudience.php @@ -0,0 +1,29 @@ +convertDate($claims[$claim]); + } + + return $claims; + } + + private function convertDate(DateTimeImmutable $date): int + { + return $date->getTimestamp(); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Exception.php b/pandora_console/vendor/lcobucci/jwt/src/Exception.php new file mode 100644 index 0000000000..4b3916e691 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Exception.php @@ -0,0 +1,10 @@ +clock = $clock ?? new class implements Clock { + public function now(): DateTimeImmutable + { + return new DateTimeImmutable(); + } + }; + } + + /** @param Closure(Builder, DateTimeImmutable):Builder $customiseBuilder */ + public function issue( + Signer $signer, + Key $signingKey, + Closure $customiseBuilder, + ): UnencryptedToken { + $builder = new Token\Builder(new JoseEncoder(), ChainedFormatter::withUnixTimestampDates()); + + $now = $this->clock->now(); + $builder = $builder + ->issuedAt($now) + ->canOnlyBeUsedAfter($now) + ->expiresAt($now->modify('+5 minutes')); + + return $customiseBuilder($builder, $now)->getToken($signer, $signingKey); + } + + /** @param non-empty-string $jwt */ + public function parse( + string $jwt, + SignedWith $signedWith, + ValidAt $validAt, + Constraint ...$constraints, + ): UnencryptedToken { + $token = $this->parser->parse($jwt); + assert($token instanceof UnencryptedToken); + + (new Validator())->assert( + $token, + $signedWith, + $validAt, + ...$constraints, + ); + + return $token; + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Parser.php b/pandora_console/vendor/lcobucci/jwt/src/Parser.php new file mode 100644 index 0000000000..fa77f04efc --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Parser.php @@ -0,0 +1,22 @@ +contents()); + + if ($actualKeyLength < self::MINIMUM_KEY_LENGTH_IN_BITS) { + throw InvalidKeyProvided::tooShort(self::MINIMUM_KEY_LENGTH_IN_BITS, $actualKeyLength); + } + + return sodium_crypto_generichash($payload, $key->contents()); + } + + public function verify(string $expected, string $payload, Key $key): bool + { + return hash_equals($expected, $this->sign($payload, $key)); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Signer/CannotSignPayload.php b/pandora_console/vendor/lcobucci/jwt/src/Signer/CannotSignPayload.php new file mode 100644 index 0000000000..35cc4d6ddc --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Signer/CannotSignPayload.php @@ -0,0 +1,15 @@ +converter->fromAsn1( + $this->createSignature($key->contents(), $key->passphrase(), $payload), + $this->pointLength(), + ); + } + + final public function verify(string $expected, string $payload, Key $key): bool + { + return $this->verifySignature( + $this->converter->toAsn1($expected, $this->pointLength()), + $payload, + $key->contents(), + ); + } + + /** {@inheritDoc} */ + final protected function guardAgainstIncompatibleKey(int $type, int $lengthInBits): void + { + if ($type !== OPENSSL_KEYTYPE_EC) { + throw InvalidKeyProvided::incompatibleKeyType( + self::KEY_TYPE_MAP[OPENSSL_KEYTYPE_EC], + self::KEY_TYPE_MAP[$type], + ); + } + + $expectedKeyLength = $this->expectedKeyLength(); + + if ($lengthInBits !== $expectedKeyLength) { + throw InvalidKeyProvided::incompatibleKeyLength($expectedKeyLength, $lengthInBits); + } + } + + /** + * @internal + * + * @return positive-int + */ + abstract public function expectedKeyLength(): int; + + /** + * Returns the length of each point in the signature, so that we can calculate and verify R and S points properly + * + * @internal + * + * @return positive-int + */ + abstract public function pointLength(): int; +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Signer/Ecdsa/ConversionFailed.php b/pandora_console/vendor/lcobucci/jwt/src/Signer/Ecdsa/ConversionFailed.php new file mode 100644 index 0000000000..d9ca751d4e --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Signer/Ecdsa/ConversionFailed.php @@ -0,0 +1,25 @@ + self::ASN1_MAX_SINGLE_BYTE ? self::ASN1_LENGTH_2BYTES : ''; + + $asn1 = hex2bin( + self::ASN1_SEQUENCE + . $lengthPrefix . dechex($totalLength) + . self::ASN1_INTEGER . dechex($lengthR) . $pointR + . self::ASN1_INTEGER . dechex($lengthS) . $pointS, + ); + assert(is_string($asn1)); + assert($asn1 !== ''); + + return $asn1; + } + + private static function octetLength(string $data): int + { + return (int) (strlen($data) / self::BYTE_SIZE); + } + + private static function preparePositiveInteger(string $data): string + { + if (substr($data, 0, self::BYTE_SIZE) > self::ASN1_BIG_INTEGER_LIMIT) { + return self::ASN1_NEGATIVE_INTEGER . $data; + } + + while ( + substr($data, 0, self::BYTE_SIZE) === self::ASN1_NEGATIVE_INTEGER + && substr($data, 2, self::BYTE_SIZE) <= self::ASN1_BIG_INTEGER_LIMIT + ) { + $data = substr($data, 2, null); + } + + return $data; + } + + public function fromAsn1(string $signature, int $length): string + { + $message = bin2hex($signature); + $position = 0; + + if (self::readAsn1Content($message, $position, self::BYTE_SIZE) !== self::ASN1_SEQUENCE) { + throw ConversionFailed::incorrectStartSequence(); + } + + // @phpstan-ignore-next-line + if (self::readAsn1Content($message, $position, self::BYTE_SIZE) === self::ASN1_LENGTH_2BYTES) { + $position += self::BYTE_SIZE; + } + + $pointR = self::retrievePositiveInteger(self::readAsn1Integer($message, $position)); + $pointS = self::retrievePositiveInteger(self::readAsn1Integer($message, $position)); + + $points = hex2bin(str_pad($pointR, $length, '0', STR_PAD_LEFT) . str_pad($pointS, $length, '0', STR_PAD_LEFT)); + assert(is_string($points)); + assert($points !== ''); + + return $points; + } + + private static function readAsn1Content(string $message, int &$position, int $length): string + { + $content = substr($message, $position, $length); + $position += $length; + + return $content; + } + + private static function readAsn1Integer(string $message, int &$position): string + { + if (self::readAsn1Content($message, $position, self::BYTE_SIZE) !== self::ASN1_INTEGER) { + throw ConversionFailed::integerExpected(); + } + + $length = (int) hexdec(self::readAsn1Content($message, $position, self::BYTE_SIZE)); + + return self::readAsn1Content($message, $position, $length * self::BYTE_SIZE); + } + + private static function retrievePositiveInteger(string $data): string + { + while ( + substr($data, 0, self::BYTE_SIZE) === self::ASN1_NEGATIVE_INTEGER + && substr($data, 2, self::BYTE_SIZE) > self::ASN1_BIG_INTEGER_LIMIT + ) { + $data = substr($data, 2, null); + } + + return $data; + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php b/pandora_console/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php new file mode 100644 index 0000000000..ff00f4d47a --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php @@ -0,0 +1,31 @@ +contents()); + } catch (SodiumException $sodiumException) { + throw new InvalidKeyProvided($sodiumException->getMessage(), 0, $sodiumException); + } + } + + public function verify(string $expected, string $payload, Key $key): bool + { + try { + return sodium_crypto_sign_verify_detached($expected, $payload, $key->contents()); + } catch (SodiumException $sodiumException) { + throw new InvalidKeyProvided($sodiumException->getMessage(), 0, $sodiumException); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Signer/Hmac.php b/pandora_console/vendor/lcobucci/jwt/src/Signer/Hmac.php new file mode 100644 index 0000000000..815f84c30f --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Signer/Hmac.php @@ -0,0 +1,44 @@ +contents()); + $expectedKeyLength = $this->minimumBitsLengthForKey(); + + if ($actualKeyLength < $expectedKeyLength) { + throw InvalidKeyProvided::tooShort($expectedKeyLength, $actualKeyLength); + } + + return hash_hmac($this->algorithm(), $payload, $key->contents(), true); + } + + final public function verify(string $expected, string $payload, Key $key): bool + { + return hash_equals($expected, $this->sign($payload, $key)); + } + + /** + * @internal + * + * @return non-empty-string + */ + abstract public function algorithm(): string; + + /** + * @internal + * + * @return positive-int + */ + abstract public function minimumBitsLengthForKey(): int; +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php b/pandora_console/vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php new file mode 100644 index 0000000000..e19992ec33 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php @@ -0,0 +1,24 @@ +getSize(); + $contents = $fileSize > 0 ? $file->fread($file->getSize()) : ''; + assert(is_string($contents)); + + self::guardAgainstEmptyKey($contents); + + return new self($contents, $passphrase); + } + + /** @phpstan-assert non-empty-string $contents */ + private static function guardAgainstEmptyKey(string $contents): void + { + if ($contents === '') { + throw InvalidKeyProvided::cannotBeEmpty(); + } + } + + public function contents(): string + { + return $this->contents; + } + + public function passphrase(): string + { + return $this->passphrase; + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Signer/OpenSSL.php b/pandora_console/vendor/lcobucci/jwt/src/Signer/OpenSSL.php new file mode 100644 index 0000000000..bcc7065c19 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Signer/OpenSSL.php @@ -0,0 +1,126 @@ + 'RSA', + OPENSSL_KEYTYPE_DSA => 'DSA', + OPENSSL_KEYTYPE_DH => 'DH', + OPENSSL_KEYTYPE_EC => 'EC', + ]; + + /** + * @return non-empty-string + * + * @throws CannotSignPayload + * @throws InvalidKeyProvided + */ + final protected function createSignature( + string $pem, + string $passphrase, + string $payload, + ): string { + $key = $this->getPrivateKey($pem, $passphrase); + + $signature = ''; + + if (! openssl_sign($payload, $signature, $key, $this->algorithm())) { + throw CannotSignPayload::errorHappened($this->fullOpenSSLErrorString()); + } + + return $signature; + } + + /** @throws CannotSignPayload */ + private function getPrivateKey(string $pem, string $passphrase): OpenSSLAsymmetricKey + { + return $this->validateKey(openssl_pkey_get_private($pem, $passphrase)); + } + + /** @throws InvalidKeyProvided */ + final protected function verifySignature( + string $expected, + string $payload, + string $pem, + ): bool { + $key = $this->getPublicKey($pem); + $result = openssl_verify($payload, $expected, $key, $this->algorithm()); + + return $result === 1; + } + + /** @throws InvalidKeyProvided */ + private function getPublicKey(string $pem): OpenSSLAsymmetricKey + { + return $this->validateKey(openssl_pkey_get_public($pem)); + } + + /** + * Raises an exception when the key type is not the expected type + * + * @throws InvalidKeyProvided + */ + private function validateKey(OpenSSLAsymmetricKey|bool $key): OpenSSLAsymmetricKey + { + if (is_bool($key)) { + throw InvalidKeyProvided::cannotBeParsed($this->fullOpenSSLErrorString()); + } + + $details = openssl_pkey_get_details($key); + assert(is_array($details)); + + assert(array_key_exists('bits', $details)); + assert(is_int($details['bits'])); + assert(array_key_exists('type', $details)); + assert(is_int($details['type'])); + + $this->guardAgainstIncompatibleKey($details['type'], $details['bits']); + + return $key; + } + + private function fullOpenSSLErrorString(): string + { + $error = ''; + + while ($msg = openssl_error_string()) { + $error .= PHP_EOL . '* ' . $msg; + } + + return $error; + } + + /** @throws InvalidKeyProvided */ + abstract protected function guardAgainstIncompatibleKey(int $type, int $lengthInBits): void; + + /** + * Returns which algorithm to be used to create/verify the signature (using OpenSSL constants) + * + * @internal + */ + abstract public function algorithm(): int; +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Signer/Rsa.php b/pandora_console/vendor/lcobucci/jwt/src/Signer/Rsa.php new file mode 100644 index 0000000000..ba7d72d5e6 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Signer/Rsa.php @@ -0,0 +1,35 @@ +createSignature($key->contents(), $key->passphrase(), $payload); + } + + final public function verify(string $expected, string $payload, Key $key): bool + { + return $this->verifySignature($expected, $payload, $key->contents()); + } + + final protected function guardAgainstIncompatibleKey(int $type, int $lengthInBits): void + { + if ($type !== OPENSSL_KEYTYPE_RSA) { + throw InvalidKeyProvided::incompatibleKeyType( + self::KEY_TYPE_MAP[OPENSSL_KEYTYPE_RSA], + self::KEY_TYPE_MAP[$type], + ); + } + + if ($lengthInBits < self::MINIMUM_KEY_LENGTH) { + throw InvalidKeyProvided::tooShort(self::MINIMUM_KEY_LENGTH, $lengthInBits); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php b/pandora_console/vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php new file mode 100644 index 0000000000..9e56c70f1a --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php @@ -0,0 +1,21 @@ + */ + private array $headers = ['typ' => 'JWT', 'alg' => null]; + + /** @var array */ + private array $claims = []; + + public function __construct(private readonly Encoder $encoder, private readonly ClaimsFormatter $claimFormatter) + { + } + + public function permittedFor(string ...$audiences): BuilderInterface + { + $configured = $this->claims[RegisteredClaims::AUDIENCE] ?? []; + $toAppend = array_diff($audiences, $configured); + + return $this->setClaim(RegisteredClaims::AUDIENCE, array_merge($configured, $toAppend)); + } + + public function expiresAt(DateTimeImmutable $expiration): BuilderInterface + { + return $this->setClaim(RegisteredClaims::EXPIRATION_TIME, $expiration); + } + + public function identifiedBy(string $id): BuilderInterface + { + return $this->setClaim(RegisteredClaims::ID, $id); + } + + public function issuedAt(DateTimeImmutable $issuedAt): BuilderInterface + { + return $this->setClaim(RegisteredClaims::ISSUED_AT, $issuedAt); + } + + public function issuedBy(string $issuer): BuilderInterface + { + return $this->setClaim(RegisteredClaims::ISSUER, $issuer); + } + + public function canOnlyBeUsedAfter(DateTimeImmutable $notBefore): BuilderInterface + { + return $this->setClaim(RegisteredClaims::NOT_BEFORE, $notBefore); + } + + public function relatedTo(string $subject): BuilderInterface + { + return $this->setClaim(RegisteredClaims::SUBJECT, $subject); + } + + public function withHeader(string $name, mixed $value): BuilderInterface + { + $new = clone $this; + $new->headers[$name] = $value; + + return $new; + } + + public function withClaim(string $name, mixed $value): BuilderInterface + { + if (in_array($name, RegisteredClaims::ALL, true)) { + throw RegisteredClaimGiven::forClaim($name); + } + + return $this->setClaim($name, $value); + } + + /** @param non-empty-string $name */ + private function setClaim(string $name, mixed $value): BuilderInterface + { + $new = clone $this; + $new->claims[$name] = $value; + + return $new; + } + + /** + * @param array $items + * + * @throws CannotEncodeContent When data cannot be converted to JSON. + */ + private function encode(array $items): string + { + return $this->encoder->base64UrlEncode( + $this->encoder->jsonEncode($items), + ); + } + + public function getToken(Signer $signer, Key $key): UnencryptedToken + { + $headers = $this->headers; + $headers['alg'] = $signer->algorithmId(); + + $encodedHeaders = $this->encode($headers); + $encodedClaims = $this->encode($this->claimFormatter->formatClaims($this->claims)); + + $signature = $signer->sign($encodedHeaders . '.' . $encodedClaims, $key); + $encodedSignature = $this->encoder->base64UrlEncode($signature); + + return new Plain( + new DataSet($headers, $encodedHeaders), + new DataSet($this->claims, $encodedClaims), + new Signature($signature, $encodedSignature), + ); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Token/DataSet.php b/pandora_console/vendor/lcobucci/jwt/src/Token/DataSet.php new file mode 100644 index 0000000000..6c0b98ab14 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Token/DataSet.php @@ -0,0 +1,37 @@ + $data */ + public function __construct(private readonly array $data, private readonly string $encoded) + { + } + + /** @param non-empty-string $name */ + public function get(string $name, mixed $default = null): mixed + { + return $this->data[$name] ?? $default; + } + + /** @param non-empty-string $name */ + public function has(string $name): bool + { + return array_key_exists($name, $this->data); + } + + /** @return array */ + public function all(): array + { + return $this->data; + } + + public function toString(): string + { + return $this->encoded; + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Token/InvalidTokenStructure.php b/pandora_console/vendor/lcobucci/jwt/src/Token/InvalidTokenStructure.php new file mode 100644 index 0000000000..abba344b75 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Token/InvalidTokenStructure.php @@ -0,0 +1,41 @@ +splitJwt($jwt); + + if ($encodedHeaders === '') { + throw InvalidTokenStructure::missingHeaderPart(); + } + + if ($encodedClaims === '') { + throw InvalidTokenStructure::missingClaimsPart(); + } + + if ($encodedSignature === '') { + throw InvalidTokenStructure::missingSignaturePart(); + } + + $header = $this->parseHeader($encodedHeaders); + + return new Plain( + new DataSet($header, $encodedHeaders), + new DataSet($this->parseClaims($encodedClaims), $encodedClaims), + $this->parseSignature($encodedSignature), + ); + } + + /** + * Splits the JWT string into an array + * + * @param non-empty-string $jwt + * + * @return string[] + * + * @throws InvalidTokenStructure When JWT doesn't have all parts. + */ + private function splitJwt(string $jwt): array + { + $data = explode('.', $jwt); + + if (count($data) !== 3) { + throw InvalidTokenStructure::missingOrNotEnoughSeparators(); + } + + return $data; + } + + /** + * Parses the header from a string + * + * @param non-empty-string $data + * + * @return array + * + * @throws UnsupportedHeaderFound When an invalid header is informed. + * @throws InvalidTokenStructure When parsed content isn't an array. + */ + private function parseHeader(string $data): array + { + $header = $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data)); + + if (! is_array($header)) { + throw InvalidTokenStructure::arrayExpected('headers'); + } + + $this->guardAgainstEmptyStringKeys($header, 'headers'); + + if (array_key_exists('enc', $header)) { + throw UnsupportedHeaderFound::encryption(); + } + + if (! array_key_exists('typ', $header)) { + $header['typ'] = 'JWT'; + } + + return $header; + } + + /** + * Parses the claim set from a string + * + * @param non-empty-string $data + * + * @return array + * + * @throws InvalidTokenStructure When parsed content isn't an array or contains non-parseable dates. + */ + private function parseClaims(string $data): array + { + $claims = $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data)); + + if (! is_array($claims)) { + throw InvalidTokenStructure::arrayExpected('claims'); + } + + $this->guardAgainstEmptyStringKeys($claims, 'claims'); + + if (array_key_exists(RegisteredClaims::AUDIENCE, $claims)) { + $claims[RegisteredClaims::AUDIENCE] = (array) $claims[RegisteredClaims::AUDIENCE]; + } + + foreach (RegisteredClaims::DATE_CLAIMS as $claim) { + if (! array_key_exists($claim, $claims)) { + continue; + } + + $claims[$claim] = $this->convertDate($claims[$claim]); + } + + return $claims; + } + + /** + * @param array $array + * @param non-empty-string $part + * + * @phpstan-assert array $array + */ + private function guardAgainstEmptyStringKeys(array $array, string $part): void + { + foreach ($array as $key => $value) { + if ($key === '') { + throw InvalidTokenStructure::arrayExpected($part); + } + } + } + + /** @throws InvalidTokenStructure */ + private function convertDate(int|float|string $timestamp): DateTimeImmutable + { + if (! is_numeric($timestamp)) { + throw InvalidTokenStructure::dateIsNotParseable($timestamp); + } + + $normalizedTimestamp = number_format((float) $timestamp, self::MICROSECOND_PRECISION, '.', ''); + + $date = DateTimeImmutable::createFromFormat('U.u', $normalizedTimestamp); + + if ($date === false) { + throw InvalidTokenStructure::dateIsNotParseable($normalizedTimestamp); + } + + return $date; + } + + /** + * Returns the signature from given data + * + * @param non-empty-string $data + */ + private function parseSignature(string $data): Signature + { + $hash = $this->decoder->base64UrlDecode($data); + + return new Signature($hash, $data); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Token/Plain.php b/pandora_console/vendor/lcobucci/jwt/src/Token/Plain.php new file mode 100644 index 0000000000..6af388d5f5 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Token/Plain.php @@ -0,0 +1,85 @@ +headers; + } + + public function claims(): DataSet + { + return $this->claims; + } + + public function signature(): Signature + { + return $this->signature; + } + + public function payload(): string + { + return $this->headers->toString() . '.' . $this->claims->toString(); + } + + public function isPermittedFor(string $audience): bool + { + return in_array($audience, $this->claims->get(RegisteredClaims::AUDIENCE, []), true); + } + + public function isIdentifiedBy(string $id): bool + { + return $this->claims->get(RegisteredClaims::ID) === $id; + } + + public function isRelatedTo(string $subject): bool + { + return $this->claims->get(RegisteredClaims::SUBJECT) === $subject; + } + + public function hasBeenIssuedBy(string ...$issuers): bool + { + return in_array($this->claims->get(RegisteredClaims::ISSUER), $issuers, true); + } + + public function hasBeenIssuedBefore(DateTimeInterface $now): bool + { + return $now >= $this->claims->get(RegisteredClaims::ISSUED_AT); + } + + public function isMinimumTimeBefore(DateTimeInterface $now): bool + { + return $now >= $this->claims->get(RegisteredClaims::NOT_BEFORE); + } + + public function isExpired(DateTimeInterface $now): bool + { + if (! $this->claims->has(RegisteredClaims::EXPIRATION_TIME)) { + return false; + } + + return $now >= $this->claims->get(RegisteredClaims::EXPIRATION_TIME); + } + + public function toString(): string + { + return $this->headers->toString() . '.' + . $this->claims->toString() . '.' + . $this->signature->toString(); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Token/RegisteredClaimGiven.php b/pandora_console/vendor/lcobucci/jwt/src/Token/RegisteredClaimGiven.php new file mode 100644 index 0000000000..ce40a6abdc --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Token/RegisteredClaimGiven.php @@ -0,0 +1,21 @@ +hash; + } + + /** + * Returns the encoded version of the signature + * + * @return non-empty-string + */ + public function toString(): string + { + return $this->encoded; + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Token/UnsupportedHeaderFound.php b/pandora_console/vendor/lcobucci/jwt/src/Token/UnsupportedHeaderFound.php new file mode 100644 index 0000000000..1824078449 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Token/UnsupportedHeaderFound.php @@ -0,0 +1,15 @@ +claims(); + + if (! $claims->has($this->claim)) { + throw ConstraintViolation::error('The token does not have the claim "' . $this->claim . '"', $this); + } + + if ($claims->get($this->claim) !== $this->expectedValue) { + throw ConstraintViolation::error( + 'The claim "' . $this->claim . '" does not have the expected value', + $this, + ); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/IdentifiedBy.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/IdentifiedBy.php new file mode 100644 index 0000000000..44541a75bd --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/IdentifiedBy.php @@ -0,0 +1,26 @@ +isIdentifiedBy($this->id)) { + throw ConstraintViolation::error( + 'The token is not identified with the expected ID', + $this, + ); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/IssuedBy.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/IssuedBy.php new file mode 100644 index 0000000000..8ba3890db5 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/IssuedBy.php @@ -0,0 +1,30 @@ +issuers = $issuers; + } + + public function assert(Token $token): void + { + if (! $token->hasBeenIssuedBy(...$this->issuers)) { + throw ConstraintViolation::error( + 'The token was not issued by the given issuers', + $this, + ); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/LeewayCannotBeNegative.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/LeewayCannotBeNegative.php new file mode 100644 index 0000000000..53abc0d4ef --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/LeewayCannotBeNegative.php @@ -0,0 +1,15 @@ +leeway = $this->guardLeeway($leeway); + } + + private function guardLeeway(?DateInterval $leeway): DateInterval + { + if ($leeway === null) { + return new DateInterval('PT0S'); + } + + if ($leeway->invert === 1) { + throw LeewayCannotBeNegative::create(); + } + + return $leeway; + } + + public function assert(Token $token): void + { + $now = $this->clock->now(); + + $this->assertIssueTime($token, $now->add($this->leeway)); + $this->assertMinimumTime($token, $now->add($this->leeway)); + $this->assertExpiration($token, $now->sub($this->leeway)); + } + + /** @throws ConstraintViolation */ + private function assertExpiration(Token $token, DateTimeInterface $now): void + { + if ($token->isExpired($now)) { + throw ConstraintViolation::error('The token is expired', $this); + } + } + + /** @throws ConstraintViolation */ + private function assertMinimumTime(Token $token, DateTimeInterface $now): void + { + if (! $token->isMinimumTimeBefore($now)) { + throw ConstraintViolation::error('The token cannot be used yet', $this); + } + } + + /** @throws ConstraintViolation */ + private function assertIssueTime(Token $token, DateTimeInterface $now): void + { + if (! $token->hasBeenIssuedBefore($now)) { + throw ConstraintViolation::error('The token was issued in the future', $this); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/PermittedFor.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/PermittedFor.php new file mode 100644 index 0000000000..48544c9a18 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/PermittedFor.php @@ -0,0 +1,26 @@ +isPermittedFor($this->audience)) { + throw ConstraintViolation::error( + 'The token is not allowed to be used by this audience', + $this, + ); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/RelatedTo.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/RelatedTo.php new file mode 100644 index 0000000000..164936234d --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/RelatedTo.php @@ -0,0 +1,26 @@ +isRelatedTo($this->subject)) { + throw ConstraintViolation::error( + 'The token is not related to the expected subject', + $this, + ); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWith.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWith.php new file mode 100644 index 0000000000..5c8e265617 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWith.php @@ -0,0 +1,32 @@ +headers()->get('alg') !== $this->signer->algorithmId()) { + throw ConstraintViolation::error('Token signer mismatch', $this); + } + + if (! $this->signer->verify($token->signature()->hash(), $token->payload(), $this->key)) { + throw ConstraintViolation::error('Token signature mismatch', $this); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWithOneInSet.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWithOneInSet.php new file mode 100644 index 0000000000..fb542fb3d4 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWithOneInSet.php @@ -0,0 +1,38 @@ + */ + private readonly array $constraints; + + public function __construct(SignedWithUntilDate ...$constraints) + { + $this->constraints = $constraints; + } + + public function assert(Token $token): void + { + $errorMessage = 'It was not possible to verify the signature of the token, reasons:'; + + foreach ($this->constraints as $constraint) { + try { + $constraint->assert($token); + + return; + } catch (ConstraintViolation $violation) { + $errorMessage .= PHP_EOL . '- ' . $violation->getMessage(); + } + } + + throw ConstraintViolation::error($errorMessage, $this); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWithUntilDate.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWithUntilDate.php new file mode 100644 index 0000000000..85429e8900 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/SignedWithUntilDate.php @@ -0,0 +1,47 @@ +verifySignature = new SignedWith($signer, $key); + + $this->clock = $clock ?? new class () implements ClockInterface { + public function now(): DateTimeImmutable + { + return new DateTimeImmutable(); + } + }; + } + + public function assert(Token $token): void + { + if ($this->validUntil < $this->clock->now()) { + throw ConstraintViolation::error( + 'This constraint was only usable until ' + . $this->validUntil->format(DateTimeInterface::RFC3339), + $this, + ); + } + + $this->verifySignature->assert($token); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/StrictValidAt.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/StrictValidAt.php new file mode 100644 index 0000000000..93db0a3a3e --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/Constraint/StrictValidAt.php @@ -0,0 +1,84 @@ +leeway = $this->guardLeeway($leeway); + } + + private function guardLeeway(?DateInterval $leeway): DateInterval + { + if ($leeway === null) { + return new DateInterval('PT0S'); + } + + if ($leeway->invert === 1) { + throw LeewayCannotBeNegative::create(); + } + + return $leeway; + } + + public function assert(Token $token): void + { + if (! $token instanceof UnencryptedToken) { + throw ConstraintViolation::error('You should pass a plain token', $this); + } + + $now = $this->clock->now(); + + $this->assertIssueTime($token, $now->add($this->leeway)); + $this->assertMinimumTime($token, $now->add($this->leeway)); + $this->assertExpiration($token, $now->sub($this->leeway)); + } + + /** @throws ConstraintViolation */ + private function assertExpiration(UnencryptedToken $token, DateTimeInterface $now): void + { + if (! $token->claims()->has(Token\RegisteredClaims::EXPIRATION_TIME)) { + throw ConstraintViolation::error('"Expiration Time" claim missing', $this); + } + + if ($token->isExpired($now)) { + throw ConstraintViolation::error('The token is expired', $this); + } + } + + /** @throws ConstraintViolation */ + private function assertMinimumTime(UnencryptedToken $token, DateTimeInterface $now): void + { + if (! $token->claims()->has(Token\RegisteredClaims::NOT_BEFORE)) { + throw ConstraintViolation::error('"Not Before" claim missing', $this); + } + + if (! $token->isMinimumTimeBefore($now)) { + throw ConstraintViolation::error('The token cannot be used yet', $this); + } + } + + /** @throws ConstraintViolation */ + private function assertIssueTime(UnencryptedToken $token, DateTimeInterface $now): void + { + if (! $token->claims()->has(Token\RegisteredClaims::ISSUED_AT)) { + throw ConstraintViolation::error('"Issued At" claim missing', $this); + } + + if (! $token->hasBeenIssuedBefore($now)) { + throw ConstraintViolation::error('The token was issued in the future', $this); + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/ConstraintViolation.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/ConstraintViolation.php new file mode 100644 index 0000000000..17c7546827 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/ConstraintViolation.php @@ -0,0 +1,24 @@ +|null $constraint */ + public function __construct( + string $message = '', + public readonly ?string $constraint = null, + ) { + parent::__construct($message); + } + + /** @param non-empty-string $message */ + public static function error(string $message, Constraint $constraint): self + { + return new self(message: $message, constraint: $constraint::class); + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/NoConstraintsGiven.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/NoConstraintsGiven.php new file mode 100644 index 0000000000..0ef80d259f --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/NoConstraintsGiven.php @@ -0,0 +1,11 @@ +getMessage(); + }, + $violations, + ); + + $message = "The token violates some mandatory constraints, details:\n"; + $message .= implode("\n", $violations); + + return $message; + } + + /** @return ConstraintViolation[] */ + public function violations(): array + { + return $this->violations; + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validation/SignedWith.php b/pandora_console/vendor/lcobucci/jwt/src/Validation/SignedWith.php new file mode 100644 index 0000000000..e721095f30 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validation/SignedWith.php @@ -0,0 +1,8 @@ +checkConstraint($constraint, $token, $violations); + } + + if ($violations) { + throw RequiredConstraintsViolated::fromViolations(...$violations); + } + } + + /** @param ConstraintViolation[] $violations */ + private function checkConstraint( + Constraint $constraint, + Token $token, + array &$violations, + ): void { + try { + $constraint->assert($token); + } catch (ConstraintViolation $e) { + $violations[] = $e; + } + } + + public function validate(Token $token, Constraint ...$constraints): bool + { + if ($constraints === []) { + throw new NoConstraintsGiven('No constraint given.'); + } + + try { + foreach ($constraints as $constraint) { + $constraint->assert($token); + } + + return true; + } catch (ConstraintViolation) { + return false; + } + } +} diff --git a/pandora_console/vendor/lcobucci/jwt/src/Validator.php b/pandora_console/vendor/lcobucci/jwt/src/Validator.php new file mode 100644 index 0000000000..d0ce4b8c76 --- /dev/null +++ b/pandora_console/vendor/lcobucci/jwt/src/Validator.php @@ -0,0 +1,20 @@ +clock = $clock; + } + + public function doSomething() + { + /** @var DateTimeImmutable $currentDateAndTime */ + $currentDateAndTime = $this->clock->now(); + // do something useful with that information + } +} +``` + +You can then pick one of the [implementations][implementation-url] of the interface to get a clock. + +If you want to implement the interface, you can require this package and +implement `Psr\Clock\ClockInterface` in your code. + +Don't forget to add `psr/clock-implementation` to your `composer.json`s `provides`-section like this: + +```json +{ + "provides": { + "psr/clock-implementation": "1.0" + } +} +``` + +And please read the [specification text][specification-url] for details on the interface. + +[psr-url]: https://www.php-fig.org/psr/psr-20 +[package-url]: https://packagist.org/packages/psr/clock +[implementation-url]: https://packagist.org/providers/psr/clock-implementation +[specification-url]: https://github.com/php-fig/fig-standards/blob/master/proposed/clock.md diff --git a/pandora_console/vendor/psr/clock/composer.json b/pandora_console/vendor/psr/clock/composer.json new file mode 100644 index 0000000000..77992eda75 --- /dev/null +++ b/pandora_console/vendor/psr/clock/composer.json @@ -0,0 +1,21 @@ +{ + "name": "psr/clock", + "description": "Common interface for reading the clock.", + "keywords": ["psr", "psr-20", "time", "clock", "now"], + "homepage": "https://github.com/php-fig/clock", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "require": { + "php": "^7.0 || ^8.0" + }, + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + } +} diff --git a/pandora_console/vendor/psr/clock/src/ClockInterface.php b/pandora_console/vendor/psr/clock/src/ClockInterface.php new file mode 100644 index 0000000000..7b6d8d8aae --- /dev/null +++ b/pandora_console/vendor/psr/clock/src/ClockInterface.php @@ -0,0 +1,13 @@ +/dev/null 2>&1") != 0) { - logger (\%Config, " [E] Could not start nfcapd: $command", 1); - print_message (\%Config, " [E] Could not start nfcapd: $command", 1); - return; + $command = $Config{'netflow_daemon'} . ' -D -t ' . $Config{'netflow_interval'} . ' -P ' . $pid_file . ' -w ' . $Config{'netflow_path'}; + if (system ("$command >/dev/null 2>&1") != 0) { + logger (\%Config, " [E] Could not start nfcapd: $command", 1); + print_message (\%Config, " [E] Could not start nfcapd: $command", 1); + return; + } } logger (\%Config, "[*] NetFlow daemon started.", 1); diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index eded19d4db..c40746ff70 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -308,10 +308,8 @@ dataserver_threads 1 # Set 0 if want eMail deliver shared mail by all destination. mail_in_separate 1 -# nmap: If provided, is used to detect OS type with recon server using -# advanded OS fingerprint technique. Xprobe2 gives more accurate results -# Nmap is also used to do TCP port scanning in detected host. - +# nmap: used to detect OS type with recon server using advanced OS fingerprint technique. +# Nmap is also used to do TCP port scanning for host detection. nmap /usr/bin/nmap # Default path is /usr/sbin/fping for installation default in distro Centos , if you are installing in other distribution, diff --git a/pandora_server/conf/pandora_server_sec.conf.template b/pandora_server/conf/pandora_server_sec.conf.template index b070938187..088e2adf6e 100644 --- a/pandora_server/conf/pandora_server_sec.conf.template +++ b/pandora_server/conf/pandora_server_sec.conf.template @@ -302,10 +302,8 @@ dataserver_threads 1 # Set 0 if want eMail deliver shared mail by all destination. mail_in_separate 1 -# nmap: If provided, is used to detect OS type with recon server using -# advanded OS fingerprint technique. Xprobe2 gives more accurate results -# Nmap is also used to do TCP port scanning in detected host. - +# nmap: used to detect OS type with recon server using advanced OS fingerprint technique. +# Nmap is also used to do TCP port scanning for host detection. nmap /usr/bin/nmap # Default path is /usr/sbin/fping for installation default in distro Centos , if you are installing in other distribution, diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 85b152a392..df7a2d022c 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -46,7 +46,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.776"; -my $pandora_build = "240422"; +my $pandora_build = "240506"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 1f78ab8079..f67496be77 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -3674,12 +3674,12 @@ Updates the keep_alive module for the given agent. sub pandora_module_keep_alive ($$$$$) { my ($pa_config, $id_agent, $agent_name, $server_id, $dbh) = @_; - logger($pa_config, "Updating keep_alive module for agent '" . safe_output($agent_name) . "'.", 10); + logger($pa_config, "Updating keep_alive modules for agent '" . safe_output($agent_name) . "'.", 10); - # Update keepalive module - my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND delete_pending = 0 AND id_tipo_modulo = 100', $id_agent); - if (defined ($module)) { - my %data = ('data' => 1); + # Update keepalive modules + my @modules = get_db_rows($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND delete_pending = 0 AND id_tipo_modulo = 100', $id_agent); + my %data = ('data' => 1); + foreach my $module (@modules) { pandora_process_module ($pa_config, \%data, '', $module, 'keep_alive', '', time(), $server_id, $dbh); } } @@ -7010,8 +7010,21 @@ Returns 1 if this server is the current master, 0 otherwise. =cut ########################################################################## -sub pandora_is_master ($) { - my ($pa_config) = @_; +sub pandora_is_master ($;$) { + my ($pa_config, $dbh) = @_; + + # When multiprocess is enabled the variable $Master is not shared between + # servers. + if (defined($dbh) && $pa_config->{'multiprocess'} == 1) { + my $current_master = get_db_value_limit ($dbh, 'SELECT name FROM tserver + WHERE master <> 0 AND status = 1 + ORDER BY master DESC', 1); + if (defined($current_master) && $current_master eq $pa_config->{'servername'}) { + return 1; + } + + return 0; + } if ($Master eq $pa_config->{'servername'}) { return 1; diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 3dc3d44f17..cc9b8fe963 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -143,7 +143,7 @@ sub data_producer ($) { # By default, after create a tasks it takes the utimestamp to 0 # Status -1 means "done". my @rows; - if (pandora_is_master($pa_config) == 0) { + if (pandora_is_master($pa_config, $dbh) == 0) { @rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task WHERE id_recon_server = ? AND disabled = 0 diff --git a/pandora_server/lib/PandoraFMS/InventoryServer.pm b/pandora_server/lib/PandoraFMS/InventoryServer.pm index e6b070f4d8..daab7f624f 100644 --- a/pandora_server/lib/PandoraFMS/InventoryServer.pm +++ b/pandora_server/lib/PandoraFMS/InventoryServer.pm @@ -83,7 +83,7 @@ sub data_producer ($) { my @tasks; my @rows; - if (pandora_is_master($pa_config) == 0) { + if (pandora_is_master($pa_config, $dbh) == 0) { if ($pa_config->{'dbengine'} ne 'oracle') { @rows = get_db_rows ($dbh, 'SELECT tagent_module_inventory.id_agent_module_inventory, tagent_module_inventory.flag, tagent_module_inventory.timestamp diff --git a/pandora_server/lib/PandoraFMS/NetworkServer.pm b/pandora_server/lib/PandoraFMS/NetworkServer.pm index 87ef0fe2c7..6d0b848fb1 100644 --- a/pandora_server/lib/PandoraFMS/NetworkServer.pm +++ b/pandora_server/lib/PandoraFMS/NetworkServer.pm @@ -96,7 +96,7 @@ sub data_producer ($) { my @rows; my $network_filter = enterprise_hook ('get_network_filter', [$pa_config]); - if (pandora_is_master($pa_config) == 0) { + if (pandora_is_master($pa_config, $dbh) == 0) { @rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, tagente_estado.current_interval + tagente_estado.last_execution_try AS time_left, last_execution_try FROM tagente, tagente_modulo, tagente_estado WHERE server_name = ? diff --git a/pandora_server/lib/PandoraFMS/PluginServer.pm b/pandora_server/lib/PandoraFMS/PluginServer.pm index 9751372d04..a8cbd159b5 100644 --- a/pandora_server/lib/PandoraFMS/PluginServer.pm +++ b/pandora_server/lib/PandoraFMS/PluginServer.pm @@ -96,7 +96,7 @@ sub data_producer ($) { my @tasks; my @rows; - if (pandora_is_master($pa_config) == 0) { + if (pandora_is_master($pa_config, $dbh) == 0) { @rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, tagente_estado.current_interval + tagente_estado.last_execution_try AS time_left, last_execution_try FROM tagente, tagente_modulo, tagente_estado WHERE server_name = ? diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 0774b9781b..9f37dd62e2 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.776"; -my $pandora_build = "240422"; +my $pandora_build = "240506"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/lib/PandoraFMS/PredictionServer.pm b/pandora_server/lib/PandoraFMS/PredictionServer.pm index 282a8eeb20..dfa70f38db 100644 --- a/pandora_server/lib/PandoraFMS/PredictionServer.pm +++ b/pandora_server/lib/PandoraFMS/PredictionServer.pm @@ -93,7 +93,7 @@ sub data_producer ($) { my @tasks; my @rows; - if (pandora_is_master($pa_config) == 0) { + if (pandora_is_master($pa_config, $dbh) == 0) { @rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, last_execution_try FROM tagente, tagente_modulo, tagente_estado diff --git a/pandora_server/lib/PandoraFMS/WMIServer.pm b/pandora_server/lib/PandoraFMS/WMIServer.pm index 2b053c7ce0..2a01cf89dd 100644 --- a/pandora_server/lib/PandoraFMS/WMIServer.pm +++ b/pandora_server/lib/PandoraFMS/WMIServer.pm @@ -94,7 +94,7 @@ sub data_producer ($) { my @tasks; my @rows; - if (pandora_is_master($pa_config) == 0) { + if (pandora_is_master($pa_config, $dbh) == 0) { @rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, tagente_estado.current_interval + tagente_estado.last_execution_try AS time_left, last_execution_try FROM tagente, tagente_modulo, tagente_estado WHERE server_name = ? diff --git a/pandora_server/lib/PandoraFMS/WebServer.pm b/pandora_server/lib/PandoraFMS/WebServer.pm index 7f66d8ad89..40b4af3073 100644 --- a/pandora_server/lib/PandoraFMS/WebServer.pm +++ b/pandora_server/lib/PandoraFMS/WebServer.pm @@ -124,7 +124,7 @@ sub data_producer ($) { my @tasks; my @rows; - if (pandora_is_master($pa_config) == 0) { + if (pandora_is_master($pa_config, $dbh) == 0) { @rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, tagente_estado.current_interval + tagente_estado.last_execution_try AS time_left, last_execution_try FROM tagente, tagente_modulo, tagente_estado WHERE server_name = ? diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index a5c283abe2..2928d1e365 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -7,7 +7,7 @@ %define debug_package %{nil} %define name pandorafms_server %define version 7.0NG.776 -%define release 240422 +%define release 240506 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 5afe867d01..d58d1fc072 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.776 -%define release 240422 +%define release 240506 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 8ecdfd3f34..bd176b3fc7 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.776" -PI_BUILD="240422" +PI_BUILD="240506" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 77eaf5d411..c3d616f0a5 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -38,7 +38,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.776 Build 240422"; +my $version = "7.0NG.776 Build 240506"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index bf309f49d2..131be6734d 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.776 Build 240422"; +my $version = "7.0NG.776 Build 240506"; # save program name for logging my $progname = basename($0); @@ -6166,7 +6166,7 @@ sub cli_create_group() { $icon = '' unless defined($icon); $description = '' unless defined($description); - $group_id = pandora_create_group ($group_name, $icon, $parent_group_id, 0, 0, '', 0, $description, $dbh); + $group_id = pandora_create_group ($group_name, $icon, $parent_group_id, 0, 0, '', 0, safe_input($description), $dbh); if($group_id == -1) { print_log "[ERROR] A problem has been ocurred creating group '$group_name'\n\n"; @@ -6191,7 +6191,7 @@ sub cli_create_group() { eval { $group_id_nodo = db_insert ($dbh_metaconsole, 'id_grupo', 'INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', $group_name, safe_input($group_name), $icon, - $parent_group_id, 0, 0, '', 0, $description); + $parent_group_id, 0, 0, '', 0, safe_input($description)); }; if ($@) { print_log "[ERROR] Problems with IDS and doesn't created group\n\n"; @@ -6293,15 +6293,15 @@ sub cli_update_group() { if(defined($icon)){ if(defined($description)){ - db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? , icon=? , description=? WHERE id_grupo=?',$group_name,$parent_group_id,$icon,$description,$group_id); + db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? , icon=? , description=? WHERE id_grupo=?',safe_input($group_name),$parent_group_id,$icon, safe_input($description) ,$group_id); }else{ - db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? , icon=? WHERE id_grupo=?',$group_name,$parent_group_id,$icon,$group_id); + db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? , icon=? WHERE id_grupo=?',safe_input($group_name),$parent_group_id,$icon,$group_id); } }else{ - db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? WHERE id_grupo=?',$group_name,$parent_group_id,$group_id); + db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? WHERE id_grupo=?',safe_input($group_name),$parent_group_id,$group_id); } }else{ - db_do ($dbh,'UPDATE tgrupo SET nombre=? WHERE id_grupo=?',$group_name,$group_id); + db_do ($dbh,'UPDATE tgrupo SET nombre=? WHERE id_grupo=?',safe_input($group_name),$group_id); } print_log "[INFO] Updated group '$group_id'\n\n"; } diff --git a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl index 15fcf58f73..579d7da716 100755 --- a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl +++ b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl @@ -165,7 +165,7 @@ sub prepare_tree { } else { $snmp_call{'oid'} = $config->{'oid_base'} . $config->{'x86_indexes'}{'__idx__'}.$ifIndex; } - + my $raw = snmp_walk(\%snmp_call); return $raw if (ref($raw) eq "HASH"); @@ -518,6 +518,9 @@ $filename =~ tr/./_/; $config->{'tmp_file'} = $filename.'.idx' if empty($config->{'tmp_file'}); $config->{'log'} = $filename.'.log' if empty($config->{'log'}); +# Escape special characters +$config->{'community'} =~ s/([^\/\w])/\\$1/g; + # Check snmp connectivity my $sysobjectid = snmp_get({%{$config}, 'oid' => '.1.3.6.1.2.1.1.2.0'});