mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 03:19:05 +02:00
Merge branch 'ent-9154-ssl-mysql-parametros-consola-conexion-consola' into 'develop'
Ent 9154 ssl mysql parametros consola conexion consola See merge request artica/pandorafms!5107
This commit is contained in:
commit
ca80be5867
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuraton sample file.
|
* Configuraton sample file.
|
||||||
*
|
*
|
||||||
@ -38,6 +39,11 @@
|
|||||||
* $config["homedir"]="/var/www/pandora_console/";
|
* $config["homedir"]="/var/www/pandora_console/";
|
||||||
* $config["homeurl"]="/pandora_console/";
|
* $config["homeurl"]="/pandora_console/";
|
||||||
* $config["auth"]["scheme"] = "mysql";
|
* $config["auth"]["scheme"] = "mysql";
|
||||||
|
*
|
||||||
|
* This is used to configure MySQL SSL console connection
|
||||||
|
* $config["dbssl"]=0;
|
||||||
|
* $config["dbsslcafile"]="/path/ca-cert.pem";
|
||||||
|
* $config["sslverifyservercert"]=1;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// By default report any error but notices.
|
// By default report any error but notices.
|
||||||
|
@ -31,7 +31,9 @@ function mysql_connect_db(
|
|||||||
$user=null,
|
$user=null,
|
||||||
$pass=null,
|
$pass=null,
|
||||||
$port=null,
|
$port=null,
|
||||||
$charset=null
|
$charset=null,
|
||||||
|
$ssl=null,
|
||||||
|
$verify=null
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -55,6 +57,14 @@ function mysql_connect_db(
|
|||||||
$port = $config['dbport'];
|
$port = $config['dbport'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ssl === null && (bool) $config['dbssl'] === true) {
|
||||||
|
$ssl = $config['dbsslcafile'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($verify === null && (bool) $config['sslverifyservercert'] === true) {
|
||||||
|
$verify = 'verified';
|
||||||
|
}
|
||||||
|
|
||||||
// Check if mysqli is available
|
// Check if mysqli is available
|
||||||
if (!isset($config['mysqli'])) {
|
if (!isset($config['mysqli'])) {
|
||||||
$config['mysqli'] = extension_loaded(mysqli);
|
$config['mysqli'] = extension_loaded(mysqli);
|
||||||
@ -63,6 +73,7 @@ function mysql_connect_db(
|
|||||||
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
||||||
// If you want persistent connections change it to mysql_pconnect().
|
// If you want persistent connections change it to mysql_pconnect().
|
||||||
if ($config['mysqli']) {
|
if ($config['mysqli']) {
|
||||||
|
if (empty($ssl)) {
|
||||||
$connect_id = mysqli_connect($host, $user, $pass, $db, $port);
|
$connect_id = mysqli_connect($host, $user, $pass, $db, $port);
|
||||||
if (mysqli_connect_errno() > 0) {
|
if (mysqli_connect_errno() > 0) {
|
||||||
include 'general/mysqlerr.php';
|
include 'general/mysqlerr.php';
|
||||||
@ -76,6 +87,22 @@ function mysql_connect_db(
|
|||||||
}
|
}
|
||||||
|
|
||||||
mysqli_select_db($connect_id, $db);
|
mysqli_select_db($connect_id, $db);
|
||||||
|
} else {
|
||||||
|
$connect_id = mysqli_init();
|
||||||
|
|
||||||
|
mysqli_ssl_set($connect_id, null, null, $ssl, null, null);
|
||||||
|
|
||||||
|
if ($verify === 'verified') {
|
||||||
|
mysqli_real_connect($connect_id, $host, $user, $pass, $db, $port, null, MYSQLI_CLIENT_SSL);
|
||||||
|
} else {
|
||||||
|
mysqli_real_connect($connect_id, $host, $user, $pass, $db, $port, null, MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mysqli_connect_errno() > 0) {
|
||||||
|
include 'general/mysqlerr.php';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$connect_id = @mysql_connect($host.':'.$port, $user, $pass, true);
|
$connect_id = @mysql_connect($host.':'.$port, $user, $pass, true);
|
||||||
if (!$connect_id) {
|
if (!$connect_id) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main configuration of Pandora FMS
|
* Main configuration of Pandora FMS
|
||||||
*
|
*
|
||||||
@ -30,6 +31,7 @@
|
|||||||
require_once __DIR__.'/../vendor/autoload.php';
|
require_once __DIR__.'/../vendor/autoload.php';
|
||||||
require_once __DIR__.'/functions.php';
|
require_once __DIR__.'/functions.php';
|
||||||
enterprise_include_once('include/functions_config.php');
|
enterprise_include_once('include/functions_config.php');
|
||||||
|
|
||||||
use PandoraFMS\Core\DBMaintainer;
|
use PandoraFMS\Core\DBMaintainer;
|
||||||
use PandoraFMS\Core\Config;
|
use PandoraFMS\Core\Config;
|
||||||
|
|
||||||
@ -3399,7 +3401,6 @@ function config_check()
|
|||||||
$supervisor = new ConsoleSupervisor(false);
|
$supervisor = new ConsoleSupervisor(false);
|
||||||
$supervisor->runBasic();
|
$supervisor->runBasic();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3424,7 +3425,6 @@ function get_um_url()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user