mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
N°1260 rename db_ssl* vars to db_tls (cause SSL is an old protocol and MySQL uses TLS)
Keep options label with SSL, to keep them aligned with the labels used in MySQL products and documentation SVN:trunk[5314]
This commit is contained in:
@@ -112,11 +112,11 @@ class CMDBSource
|
||||
protected static $m_sDBUser;
|
||||
protected static $m_sDBPwd;
|
||||
protected static $m_sDBName;
|
||||
protected static $m_sDBSSLKey;
|
||||
protected static $m_sDBSSLCert;
|
||||
protected static $m_sDBSSLCA;
|
||||
protected static $m_sDBSSLCaPath;
|
||||
protected static $m_sDBSSLCipher;
|
||||
protected static $m_sDBTlsKey;
|
||||
protected static $m_sDBTlsCert;
|
||||
protected static $m_sDBTlsCA;
|
||||
protected static $m_sDBTlsCaPath;
|
||||
protected static $m_sDBTlsCipher;
|
||||
/** @var mysqli $m_oMysqli */
|
||||
protected static $m_oMysqli;
|
||||
|
||||
@@ -133,13 +133,13 @@ class CMDBSource
|
||||
$sUser = $oConfig->Get('db_user');
|
||||
$sPwd = $oConfig->Get('db_pwd');
|
||||
$sSource = $oConfig->Get('db_name');
|
||||
$sSSLKey = $oConfig->Get('db_ssl.key');
|
||||
$sSSLCert = $oConfig->Get('db_ssl.cert');
|
||||
$sSSLCA = $oConfig->Get('db_ssl.ca');
|
||||
$sSSLCaPath = $oConfig->Get('db_ssl.capath');
|
||||
$sSSLCipher = $oConfig->Get('db_ssl.cipher');
|
||||
$sTlsKey = $oConfig->Get('db_tls.key');
|
||||
$sTlsCert = $oConfig->Get('db_tls.cert');
|
||||
$sTlsCA = $oConfig->Get('db_tls.ca');
|
||||
$sTlsCaPath = $oConfig->Get('db_tls.capath');
|
||||
$sTlsCipher = $oConfig->Get('db_tls.cipher');
|
||||
|
||||
self::Init($sServer, $sUser, $sPwd, $sSource, $sSSLKey, $sSSLCert, $sSSLCA, $sSSLCaPath, $sSSLCipher);
|
||||
self::Init($sServer, $sUser, $sPwd, $sSource, $sTlsKey, $sTlsCert, $sTlsCA, $sTlsCaPath, $sTlsCipher);
|
||||
|
||||
$sCharacterSet = $oConfig->Get('db_character_set');
|
||||
$sCollation = $oConfig->Get('db_collation');
|
||||
@@ -151,34 +151,34 @@ class CMDBSource
|
||||
* @param string $sUser
|
||||
* @param string $sPwd
|
||||
* @param string $sSource database to use
|
||||
* @param string $sSSLKey
|
||||
* @param string $sSSLCert
|
||||
* @param string $sSSLCA
|
||||
* @param string $sSSLCaPath
|
||||
* @param string $sSSLCipher
|
||||
* @param string $sTlsKey
|
||||
* @param string $sTlsCert
|
||||
* @param string $sTlsCA
|
||||
* @param string $sTlsCaPath
|
||||
* @param string $sTlsCipher
|
||||
*
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
public static function Init(
|
||||
$sServer, $sUser, $sPwd, $sSource = '', $sSSLKey = null, $sSSLCert = null, $sSSLCA = null, $sSSLCaPath = null,
|
||||
$sSSLCipher = null
|
||||
$sServer, $sUser, $sPwd, $sSource = '', $sTlsKey = null, $sTlsCert = null, $sTlsCA = null, $sTlsCaPath = null,
|
||||
$sTlsCipher = null
|
||||
)
|
||||
{
|
||||
self::$m_sDBHost = $sServer;
|
||||
self::$m_sDBUser = $sUser;
|
||||
self::$m_sDBPwd = $sPwd;
|
||||
self::$m_sDBName = $sSource;
|
||||
self::$m_sDBSSLKey = empty($sSSLKey) ? null : $sSSLKey;
|
||||
self::$m_sDBSSLCert = empty($sSSLCert) ? null : $sSSLCert;
|
||||
self::$m_sDBSSLCA = empty($sSSLCA) ? null : $sSSLCA;
|
||||
self::$m_sDBSSLCaPath = empty($sSSLCaPath) ? null : $sSSLCaPath;
|
||||
self::$m_sDBSSLCipher = empty($sSSLCipher) ? null : $sSSLCipher;
|
||||
self::$m_sDBTlsKey = empty($sTlsKey) ? null : $sTlsKey;
|
||||
self::$m_sDBTlsCert = empty($sTlsCert) ? null : $sTlsCert;
|
||||
self::$m_sDBTlsCA = empty($sTlsCA) ? null : $sTlsCA;
|
||||
self::$m_sDBTlsCaPath = empty($sTlsCaPath) ? null : $sTlsCaPath;
|
||||
self::$m_sDBTlsCipher = empty($sTlsCipher) ? null : $sTlsCipher;
|
||||
|
||||
// when using TLS add persistent connection to reduce overhead
|
||||
$bUsePersistentConnection = self::IsDbConnectionUsingSsl($sServer, $sServer, $sServer);
|
||||
$bUsePersistentConnection = self::IsDbConnectionUsingTls($sServer, $sServer, $sServer);
|
||||
|
||||
self::$m_oMysqli = self::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $sSSLKey, $sSSLCert, $sSSLCA,
|
||||
$sSSLCaPath, $sSSLCipher, $bUsePersistentConnection, true);
|
||||
self::$m_oMysqli = self::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $sTlsKey, $sTlsCert, $sTlsCA,
|
||||
$sTlsCaPath, $sTlsCipher, $bUsePersistentConnection, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,26 +186,26 @@ class CMDBSource
|
||||
* @param string $sUser
|
||||
* @param string $sPwd
|
||||
* @param string $sSource database to use
|
||||
* @param string $sSSLKey
|
||||
* @param string $sSSLCert
|
||||
* @param string $sSSLCA
|
||||
* @param string $sSSLCaPath
|
||||
* @param string $sSSLCipher
|
||||
* @param string $sTlsKey
|
||||
* @param string $sTlsCert
|
||||
* @param string $sTlsCa
|
||||
* @param string $sTlsCaPath
|
||||
* @param string $sTlsCipher
|
||||
* @param boolean $bUsePersistentConnection {@see http://php.net/manual/en/mysqli.persistconns.php}
|
||||
* @param boolean $bCheckSslAfterConnection
|
||||
* @param boolean $bCheckTlsAfterConnection
|
||||
*
|
||||
* @return \mysqli
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
public static function GetMysqliInstance(
|
||||
$sServer, $sUser, $sPwd, $sSource = '', $sSSLKey = null, $sSSLCert = null, $sSSLCA = null, $sSSLCaPath = null,
|
||||
$sSSLCipher = null, $bUsePersistentConnection = false, $bCheckSslAfterConnection = false
|
||||
$sServer, $sUser, $sPwd, $sSource = '', $sTlsKey = null, $sTlsCert = null, $sTlsCa = null, $sTlsCaPath = null,
|
||||
$sTlsCipher = null, $bUsePersistentConnection = false, $bCheckTlsAfterConnection = false
|
||||
) {
|
||||
$oMysqli = null;
|
||||
|
||||
$sServer = null;
|
||||
$iPort = null;
|
||||
$bSslEnabled = self::IsDbConnectionUsingSsl($sSSLKey, $sSSLCert, $sSSLCA);
|
||||
$bTlsEnabled = self::IsDbConnectionUsingTls($sTlsKey, $sTlsCert, $sTlsCa);
|
||||
self::InitServerAndPort($sServer, $iPort);
|
||||
if ($bUsePersistentConnection)
|
||||
{
|
||||
@@ -223,10 +223,10 @@ class CMDBSource
|
||||
$oMysqli = new mysqli();
|
||||
$oMysqli->init();
|
||||
|
||||
if ($bSslEnabled)
|
||||
if ($bTlsEnabled)
|
||||
{
|
||||
$iFlags = MYSQLI_CLIENT_SSL;
|
||||
$oMysqli->ssl_set($sSSLKey, $sSSLCert, $sSSLCA, $sSSLCaPath, $sSSLCipher);
|
||||
$oMysqli->ssl_set($sTlsKey, $sTlsCert, $sTlsCa, $sTlsCaPath, $sTlsCipher);
|
||||
}
|
||||
$oMysqli->real_connect($sServer, $sUser, $sPwd, '', $iPort,
|
||||
ini_get("mysqli.default_socket"), $iFlags);
|
||||
@@ -237,9 +237,9 @@ class CMDBSource
|
||||
array('host' => $sServer, 'user' => $sUser), $e);
|
||||
}
|
||||
|
||||
if ($bCheckSslAfterConnection
|
||||
&& self::IsDbConnectionUsingSsl($sSSLKey, $sSSLCert, $sSSLCA)
|
||||
&& !self::IsOpenedDbConnectionUsingSsl($oMysqli))
|
||||
if ($bCheckTlsAfterConnection
|
||||
&& self::IsDbConnectionUsingTls($sTlsKey, $sTlsCert, $sTlsCa)
|
||||
&& !self::IsOpenedDbConnectionUsingTls($oMysqli))
|
||||
{
|
||||
throw new MySQLException("Connection to the database is not encrypted whereas it was opened using TLS parameters",
|
||||
null, null, $oMysqli);
|
||||
@@ -289,25 +289,25 @@ class CMDBSource
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IsDbConnectionInConfigUsingSsl($oConfig)
|
||||
public static function IsDbConnectionInConfigUsingTls($oConfig)
|
||||
{
|
||||
$sSSLKey = $oConfig->Get('db_ssl.key');
|
||||
$sSSLCert = $oConfig->Get('db_ssl.cert');
|
||||
$sSSLCA = $oConfig->Get('db_ssl.ca');
|
||||
$sTlsKey = $oConfig->Get('db_tls.key');
|
||||
$sTlsCert = $oConfig->Get('db_tls.cert');
|
||||
$sTlsCA = $oConfig->Get('db_tls.ca');
|
||||
|
||||
return self::IsDbConnectionUsingSsl($sSSLKey, $sSSLCert, $sSSLCA);
|
||||
return self::IsDbConnectionUsingTls($sTlsKey, $sTlsCert, $sTlsCA);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSSLKey
|
||||
* @param string $sSSLCert
|
||||
* @param string $sSSLCA
|
||||
* @param string $sTlsKey
|
||||
* @param string $sTlsCert
|
||||
* @param string $sTlsCA
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function IsDbConnectionUsingSsl($sSSLKey, $sSSLCert, $sSSLCA)
|
||||
public static function IsDbConnectionUsingTls($sTlsKey, $sTlsCert, $sTlsCA)
|
||||
{
|
||||
return (!empty($sSSLKey) && !empty($sSSLCert) && !empty($sSSLCA));
|
||||
return (!empty($sTlsKey) && !empty($sTlsCert) && !empty($sTlsCA));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -324,7 +324,7 @@ class CMDBSource
|
||||
*
|
||||
* @uses IsMySqlVarNonEmpty
|
||||
*/
|
||||
private static function IsOpenedDbConnectionUsingSsl($oMysqli)
|
||||
private static function IsOpenedDbConnectionUsingTls($oMysqli)
|
||||
{
|
||||
if (self::$m_oMysqli == null)
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
),
|
||||
'db_ssl.key' => array(
|
||||
'db_tls.key' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Path to client key file for SSL',
|
||||
'default' => null,
|
||||
@@ -154,7 +154,7 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'db_ssl.cert' => array(
|
||||
'db_tls.cert' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Path to client certificate file for SSL',
|
||||
'default' => null,
|
||||
@@ -162,7 +162,7 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'db_ssl.ca' => array(
|
||||
'db_tls.ca' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Path to certificate authority file for SSL',
|
||||
'default' => null,
|
||||
@@ -170,7 +170,7 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'db_ssl.capath' => array(
|
||||
'db_tls.capath' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Path to a directory that contains trusted SSL CA certificates in PEM format',
|
||||
'default' => null,
|
||||
@@ -178,7 +178,7 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'db_ssl.cipher' => array(
|
||||
'db_tls.cipher' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Optional : separated list of permissible cyphers to use for SSL encryption',
|
||||
'default' => null,
|
||||
@@ -1083,6 +1083,13 @@ class Config
|
||||
return $this->m_aSettings[$sPropCode];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPropCode
|
||||
* @param mixed $value
|
||||
* @param string $sSourceDesc mandatory for variables with show_in_conf_sample=false
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function Set($sPropCode, $value, $sSourceDesc = 'unknown')
|
||||
{
|
||||
$sType = $this->m_aSettings[$sPropCode]['type'];
|
||||
@@ -1645,17 +1652,6 @@ class Config
|
||||
{
|
||||
$aSettings[$sPropCode] = $aSettingInfo['value'];
|
||||
}
|
||||
$aSettings['db_host'] = $this->m_sDBHost;
|
||||
$aSettings['db_user'] = $this->m_sDBUser;
|
||||
$aSettings['db_pwd'] = $this->m_sDBPwd;
|
||||
$aSettings['db_name'] = $this->m_sDBName;
|
||||
$aSettings['db_subname'] = $this->m_sDBSubname;
|
||||
$aSettings['db_ssl_key'] = $this->m_sDBSSLKey;
|
||||
$aSettings['db_ssl_cert'] = $this->m_sDBSSLCert;
|
||||
$aSettings['db_ssl_ca'] = $this->m_sDBSSLCA;
|
||||
$aSettings['db_ssl_cipher'] = $this->m_sDBSSLCipher;
|
||||
$aSettings['db_character_set'] = $this->m_sDBCharacterSet;
|
||||
$aSettings['db_collation'] = $this->m_sDBCollation;
|
||||
$aSettings['log_global'] = $this->m_bLogGlobal;
|
||||
$aSettings['log_notification'] = $this->m_bLogNotification;
|
||||
$aSettings['log_issue'] = $this->m_bLogIssue;
|
||||
@@ -1877,25 +1873,30 @@ class Config
|
||||
}
|
||||
$this->Set('db_name', $sDBName);
|
||||
$this->Set('db_subname', $aParamValues['db_prefix']);
|
||||
if (isset($aParamValues['db_ssl_key']))
|
||||
$sDbTlsKey = $aParamValues['db_tls_key'];
|
||||
if (isset($sDbTlsKey) && !empty($sDbTlsKey))
|
||||
{
|
||||
$this->Set('db_ssl.key', $aParamValues['db_ssl_key']);
|
||||
$this->Set('db_tls.key', $sDbTlsKey, 'UpdateFromParams');
|
||||
}
|
||||
if (isset($aParamValues['db_ssl_cert']))
|
||||
$sDbTlsCert = $aParamValues['db_tls_cert'];
|
||||
if (isset($sDbTlsCert) && !empty($sDbTlsCert))
|
||||
{
|
||||
$this->Set('db_ssl.cert', $aParamValues['db_ssl_cert']);
|
||||
$this->Set('db_tls.cert', $sDbTlsCert, 'UpdateFromParams');
|
||||
}
|
||||
if (isset($aParamValues['db_ssl_ca']))
|
||||
$sDbTlsCa = $aParamValues['db_tls_ca'];
|
||||
if (isset($sDbTlsCa) && !empty($sDbTlsCa))
|
||||
{
|
||||
$this->Set('db_ssl.ca', $aParamValues['db_ssl_ca']);
|
||||
$this->Set('db_tls.ca', $sDbTlsCa, 'UpdateFromParams');
|
||||
}
|
||||
if (isset($aParamValues['db_ssl_capath']))
|
||||
$sDbTlsCaPath = $aParamValues['db_tls_capath'];
|
||||
if (isset($sDbTlsCaPath) && !empty($sDbTlsCaPath))
|
||||
{
|
||||
$this->Set('db_ssl.capath', $aParamValues['db_ssl_capath']);
|
||||
$this->Set('db_tls.capath', $sDbTlsCaPath, 'UpdateFromParams');
|
||||
}
|
||||
if (isset($aParamValues['db_ssl_cipher']))
|
||||
$sDbTlsCipher = $aParamValues['db_tls_cipher'];
|
||||
if (isset($sDbTlsCipher) && !empty($sDbTlsCipher))
|
||||
{
|
||||
$this->Set('db_ssl.cipher', $aParamValues['db_ssl_cipher']);
|
||||
$this->Set('db_tls.cipher', $sDbTlsCipher, 'UpdateFromParams');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,16 +40,16 @@ class iTopMutex
|
||||
protected $sDBPwd;
|
||||
protected $sDBName;
|
||||
protected $sDBSubname;
|
||||
protected $sDBSSLKey;
|
||||
protected $sDBSSLCert;
|
||||
protected $sDBSSLCA;
|
||||
protected $sDBSSLCaPath;
|
||||
protected $sDBSSLCipher;
|
||||
protected $sDBTlsKey;
|
||||
protected $sDBTlsCert;
|
||||
protected $sDBTlsCA;
|
||||
protected $sDBTlsCaPath;
|
||||
protected $sDBTlsCipher;
|
||||
static protected $aAcquiredLocks = array(); // Number of instances of the Mutex, having the lock, in this page
|
||||
|
||||
public function __construct(
|
||||
$sName, $sDBHost = null, $sDBUser = null, $sDBPwd = null, $sDBSSLKey = null, $sDBSSLCert = null,
|
||||
$sDBSSLCA = null, $sDBSSLCaPath = null, $sDBSSLCypher = null
|
||||
$sName, $sDBHost = null, $sDBUser = null, $sDBPwd = null, $sDBTlsKey = null, $sDBTlsCert = null,
|
||||
$sDBTlsCA = null, $sDBTlsCaPath = null, $sDBTlsCypher = null
|
||||
)
|
||||
{
|
||||
// Compute the name of a lock for mysql
|
||||
@@ -65,11 +65,11 @@ class iTopMutex
|
||||
$this->sDBName = $oConfig->Get('db_name');
|
||||
$sDBSubname = $oConfig->Get('db_subname');
|
||||
|
||||
$this->sDBSSLKey = is_null($sDBSSLKey) ? $oConfig->Get('db_ssl.key') : $sDBSSLKey;
|
||||
$this->sDBSSLCert = is_null($sDBSSLCert) ? $oConfig->Get('db_ssl.key') : $sDBSSLCert;
|
||||
$this->sDBSSLCA = is_null($sDBSSLCA) ? $oConfig->Get('db_ssl.key') : $sDBSSLCA;
|
||||
$this->sDBSSLCaPath = is_null($sDBSSLCaPath) ? $oConfig->Get('db_ssl.key') : $sDBSSLCaPath;
|
||||
$this->sDBSSLCipher = is_null($sDBSSLCypher) ? $oConfig->Get('db_ssl.key') : $sDBSSLCypher;
|
||||
$this->sDBTlsKey = is_null($sDBTlsKey) ? $oConfig->Get('db_tls.key') : $sDBTlsKey;
|
||||
$this->sDBTlsCert = is_null($sDBTlsCert) ? $oConfig->Get('db_tls.cert') : $sDBTlsCert;
|
||||
$this->sDBTlsCA = is_null($sDBTlsCA) ? $oConfig->Get('db_tls.ca') : $sDBTlsCA;
|
||||
$this->sDBTlsCaPath = is_null($sDBTlsCaPath) ? $oConfig->Get('db_tls.capath') : $sDBTlsCaPath;
|
||||
$this->sDBTlsCipher = is_null($sDBTlsCypher) ? $oConfig->Get('db_tls.cipher') : $sDBTlsCypher;
|
||||
|
||||
$this->sName = 'itop.'.$sName;
|
||||
$this->sName = $sName;
|
||||
@@ -238,14 +238,14 @@ class iTopMutex
|
||||
$sUser = $this->sDBUser;
|
||||
$sPwd = $this->sDBPwd;
|
||||
$sSource = $this->sDBName;
|
||||
$sSSLKey = $this->sDBSSLKey;
|
||||
$sSSLCert = $this->sDBSSLCert;
|
||||
$sSSLCA = $this->sDBSSLCA;
|
||||
$sSSLCaPath = $this->sDBSSLCaPath;
|
||||
$sSSLCipher = $this->sDBSSLCipher;
|
||||
$sTlsKey = $this->sDBTlsKey;
|
||||
$sTlsCert = $this->sDBTlsCert;
|
||||
$sTlsCA = $this->sDBTlsCA;
|
||||
$sTlsCaPath = $this->sDBTlsCaPath;
|
||||
$sTlsCipher = $this->sDBTlsCipher;
|
||||
|
||||
$this->hDBLink = CMDBSource::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $sSSLKey, $sSSLCert, $sSSLCA,
|
||||
$sSSLCaPath, $sSSLCipher, false, false);
|
||||
$this->hDBLink = CMDBSource::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $sTlsKey, $sTlsCert, $sTlsCA,
|
||||
$sTlsCaPath, $sTlsCipher, false, false);
|
||||
|
||||
if (!$this->hDBLink)
|
||||
{
|
||||
|
||||
@@ -383,11 +383,11 @@ class ApplicationInstaller
|
||||
'db_name' => $aDBParams['name'],
|
||||
'new_db_name' => $aDBParams['name'],
|
||||
'db_prefix' => $aDBParams['prefix'],
|
||||
'db_ssl_key' => $aDBParams['db_ssl_key'],
|
||||
'db_ssl_cert' => $aDBParams['db_ssl_cert'],
|
||||
'db_ssl_ca' => $aDBParams['db_ssl_ca'],
|
||||
'db_ssl_capath' => $aDBParams['db_ssl_capath'],
|
||||
'db_ssl_cipher' => $aDBParams['db_ssl_cipher'],
|
||||
'db_tls_key' => $aDBParams['db_tls_key'],
|
||||
'db_tls_cert' => $aDBParams['db_tls_cert'],
|
||||
'db_tls_ca' => $aDBParams['db_tls_ca'],
|
||||
'db_tls_capath' => $aDBParams['db_tls_capath'],
|
||||
'db_tls_cipher' => $aDBParams['db_tls_cipher'],
|
||||
'application_path' => $oParams->Get('url', ''),
|
||||
'language' => $oParams->Get('language', ''),
|
||||
'graphviz_path' => $oParams->Get('graphviz_path', ''),
|
||||
|
||||
@@ -525,16 +525,16 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
$sUser = $oConfig->Get('db_user');
|
||||
$sPwd = $oConfig->Get('db_pwd');
|
||||
$sSource = $oConfig->Get('db_name');
|
||||
$sSSLKey = $oConfig->Get('db_ssl.key');
|
||||
$sSSLCert = $oConfig->Get('db_ssl.cert');
|
||||
$sSSLCA = $oConfig->Get('db_ssl.ca');
|
||||
$sSSLCaPath = $oConfig->Get('db_ssl.capath');
|
||||
$sSSLCipher = $oConfig->Get('db_ssl.cipher');
|
||||
$sTlsKey = $oConfig->Get('db_tls.key');
|
||||
$sTlsCert = $oConfig->Get('db_tls.cert');
|
||||
$sTlsCA = $oConfig->Get('db_tls.ca');
|
||||
$sTlsCaPath = $oConfig->Get('db_tls.capath');
|
||||
$sTlsCipher = $oConfig->Get('db_tls.cipher');
|
||||
|
||||
try
|
||||
{
|
||||
$oMysqli = CMDBSource::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $sSSLKey, $sSSLCert,
|
||||
$sSSLCA, $sSSLCaPath, $sSSLCipher, true, false);
|
||||
$oMysqli = CMDBSource::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $sTlsKey, $sTlsCert,
|
||||
$sTlsCA, $sTlsCaPath, $sTlsCipher, true, false);
|
||||
|
||||
if ($oMysqli->connect_errno)
|
||||
{
|
||||
|
||||
@@ -818,9 +818,6 @@ class SetupUtils
|
||||
{
|
||||
$oPrevConf = new Config($sConfigFile);
|
||||
|
||||
$sDbSslKey = $oPrevConf->Get('db_ssl.key');
|
||||
$sDbSslCert = $oPrevConf->Get('db_ssl.cert');
|
||||
$sDbSslCa = $oPrevConf->Get('db_ssl.ca');
|
||||
$aResult = array(
|
||||
'found' => true,
|
||||
'source_dir' => $sSourceDir,
|
||||
@@ -831,16 +828,13 @@ class SetupUtils
|
||||
'db_pwd' => $oPrevConf->Get('db_pwd'),
|
||||
'db_name' => $oPrevConf->Get('db_name'),
|
||||
'db_prefix' => $oPrevConf->Get('db_subname'),
|
||||
'db_ssl_key' => $sDbSslKey,
|
||||
'db_ssl_cert' => $sDbSslCert,
|
||||
'db_ssl_ca' => $sDbSslCa,
|
||||
'db_ssl_capath' => $oPrevConf->Get('db_ssl.capath'),
|
||||
'db_ssl_cipher' => $oPrevConf->Get('db_ssl.cipher'),
|
||||
'db_tls_key' => $oPrevConf->Get('db_tls.key'),
|
||||
'db_tls_cert' => $oPrevConf->Get('db_tls.cert'),
|
||||
'db_tls_ca' => $oPrevConf->Get('db_tls.ca'),
|
||||
'db_tls_capath' => $oPrevConf->Get('db_tls.capath'),
|
||||
'db_tls_cipher' => $oPrevConf->Get('db_tls.cipher'),
|
||||
'graphviz_path' => $oPrevConf->Get('graphviz_path'),
|
||||
);
|
||||
|
||||
// SSL options checkbox
|
||||
$aResult['db_ssl'] = (CMDBSource::IsDbConnectionUsingSsl($sDbSslKey, $sDbSslCert, $sDbSslCa));
|
||||
}
|
||||
|
||||
return $aResult;
|
||||
@@ -879,16 +873,16 @@ class SetupUtils
|
||||
* @param string $sDBPwd
|
||||
* @param string $sDBName
|
||||
* @param string $sDBPrefix
|
||||
* @param string $sSSLKey
|
||||
* @param string $sSSLCert
|
||||
* @param string $sSSLCA
|
||||
* @param string $sSSLCaPath
|
||||
* @param string $sSSLCypher
|
||||
* @param string $sTlsKey
|
||||
* @param string $sTlsCert
|
||||
* @param string $sTlsCA
|
||||
* @param string $sTlsCaPath
|
||||
* @param string $sTlsCypher
|
||||
* @param string $sNewDBName
|
||||
*/
|
||||
static function DisplayDBParameters(
|
||||
$oPage, $bAllowDBCreation, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $sSSLKey, $sSSLCert, $sSSLCA,
|
||||
$sSSLCaPath, $sSSLCypher, $sNewDBName = ''
|
||||
$oPage, $bAllowDBCreation, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $sTlsKey, $sTlsCert, $sTlsCA,
|
||||
$sTlsCaPath, $sTlsCypher, $sNewDBName = ''
|
||||
) {
|
||||
$oPage->add('<tr><td colspan="2">');
|
||||
$oPage->add('<fieldset><legend>Database Server Connection</legend>');
|
||||
@@ -901,28 +895,28 @@ class SetupUtils
|
||||
$oPage->add('<tr><td>Password:</td><td><input id="db_pwd" autocomplete="off" type="password" name="db_pwd" value="'.htmlentities($sDBPwd, ENT_QUOTES, 'UTF-8').'" size="15"/></td></tr>');
|
||||
$oPage->add('</tbody>');
|
||||
|
||||
//-- SSL params (N°1260)
|
||||
$oPage->add('<tbody id="ssl_options">');
|
||||
$oPage->add('<tr><th colspan="3"><label><img id="db_ssl_img"> Connect using SSL</label></th></tr>');
|
||||
$oPage->add('<tr><td colspan="3" style="font-weight: bold; background-color: #f97e75; padding: 1em;">Warning: please make sure of all the system requirements, and test the connection using the simple test page available <a href="https://wiki.openitop.org/doku.php?id=2_4_0:install:php_and_mysql_tls">on Combodo\'s Wiki</a></td>');
|
||||
//-- TLS params (N°1260)
|
||||
$oPage->add('<tbody id="tls_options">');
|
||||
$oPage->add('<tr><th colspan="3"><label><img id="db_tls_img">Use encrypted connection with TLS</label></th></tr>');
|
||||
$oPage->add('<tr><td colspan="3" style="font-weight: bold; background-color: #f97e75; padding: 1em;">Warning: please make sure that your configuration meet all of the system requirements, and before configuring iTop validate the connection using the simple test page available <a href="https://wiki.openitop.org/doku.php?id=2_4_0:install:php_and_mysql_tls">on Combodo\'s Wiki</a></td>');
|
||||
$oPage->add('<tr><td>SSL Key:</td>');
|
||||
$oPage->add('<td><input id="db_ssl_key" autocomplete="off" type="text" name="db_ssl_key" value="'.htmlentities($sSSLKey,
|
||||
$oPage->add('<td><input id="db_tls_key" autocomplete="off" type="text" name="db_tls_key" value="'.htmlentities($sTlsKey,
|
||||
ENT_QUOTES, 'UTF-8').'" size="15"/></td>');
|
||||
$oPage->add('<td>Path to client key file for SSL</td></tr>');
|
||||
$oPage->add('<tr><td>SSL CERT:</td>');
|
||||
$oPage->add('<td><input id="db_ssl_cert" autocomplete="off" type="text" name="db_ssl_cert" value="'.htmlentities($sSSLCert,
|
||||
$oPage->add('<td><input id="db_tls_cert" autocomplete="off" type="text" name="db_tls_cert" value="'.htmlentities($sTlsCert,
|
||||
ENT_QUOTES, 'UTF-8').'" size="15"/></td>');
|
||||
$oPage->add('<td>Path to client certificate file for SSL</td></tr>');
|
||||
$oPage->add('<tr><td>SSL CA:</td>');
|
||||
$oPage->add('<td><input id="db_ssl_ca" autocomplete="off" type="text" name="db_ssl_ca" value="'.htmlentities($sSSLCA,
|
||||
$oPage->add('<td><input id="db_tls_ca" autocomplete="off" type="text" name="db_tls_ca" value="'.htmlentities($sTlsCA,
|
||||
ENT_QUOTES, 'UTF-8').'" size="15"/></td>');
|
||||
$oPage->add('<td>Path to certificate authority file for SSL</td></tr>');
|
||||
$oPage->add('<tr><td>SSL CA path:</td>');
|
||||
$oPage->add('<td><input id="db_ssl_capath" autocomplete="off" type="text" name="db_ssl_capath" value="'.htmlentities($sSSLCaPath,
|
||||
$oPage->add('<td><input id="db_tls_capath" autocomplete="off" type="text" name="db_tls_capath" value="'.htmlentities($sTlsCaPath,
|
||||
ENT_QUOTES, 'UTF-8').'" size="15"/></td>');
|
||||
$oPage->add('<td></td></td></tr>');
|
||||
$oPage->add('<tr><td>SSL cypher:</td>');
|
||||
$oPage->add('<td><input id="db_ssl_cipher" autocomplete="off" type="text" name="db_ssl_cipher" value="'.htmlentities($sSSLCypher,
|
||||
$oPage->add('<td><input id="db_tls_cipher" autocomplete="off" type="text" name="db_tls_cipher" value="'.htmlentities($sTlsCypher,
|
||||
ENT_QUOTES, 'UTF-8').'" size="15"/></td>');
|
||||
$oPage->add('<td>Optional : separated list of permissible cyphers to use for SSL encryption</td></tr>');
|
||||
$oPage->add('</tbody>');
|
||||
@@ -954,33 +948,33 @@ class SetupUtils
|
||||
$oPage->add('<tr><td colspan="2"><span id="table_info"> </span></td></tr>');
|
||||
$oPage->add('</td></tr>');
|
||||
|
||||
// SSL checkbox toggle
|
||||
// TLS checkbox toggle
|
||||
$oPage->add_script(<<<'EOF'
|
||||
function toggleSslOptions() {
|
||||
$("tbody#ssl_options>tr").not("tr:first-child").toggle();
|
||||
updateSslImage();
|
||||
function toggleTlsOptions() {
|
||||
$("tbody#tls_options>tr").not("tr:first-child").toggle();
|
||||
updateTlsImage();
|
||||
}
|
||||
function updateSslImage() {
|
||||
$dbSslImg = $("img#db_ssl_img");
|
||||
function updateTlsImage() {
|
||||
$dbTlsImg = $("img#db_tls_img");
|
||||
imgPath = "../images/";
|
||||
dbImgUrl = ($("tbody#ssl_options>tr:nth-child(2)>td:visible").length > 0)
|
||||
dbImgUrl = ($("tbody#tls_options>tr:nth-child(2)>td:visible").length > 0)
|
||||
? "minus.gif"
|
||||
: "plus.gif";
|
||||
$dbSslImg.attr("src", imgPath+dbImgUrl);
|
||||
$dbTlsImg.attr("src", imgPath+dbImgUrl);
|
||||
}
|
||||
EOF
|
||||
);
|
||||
$bSslEnabled = CMDBSource::IsDbConnectionUsingSsl($sSSLKey, $sSSLCert, $sSSLCA);
|
||||
if (!$bSslEnabled)
|
||||
$bTlsEnabled = CMDBSource::IsDbConnectionUsingTls($sTlsKey, $sTlsCert, $sTlsCA);
|
||||
if (!$bTlsEnabled)
|
||||
{
|
||||
$oPage->add_ready_script('toggleSslOptions();');
|
||||
$oPage->add_ready_script('toggleTlsOptions();');
|
||||
}
|
||||
$oPage->add_ready_script(
|
||||
<<<EOF
|
||||
$("tbody#ssl_options>tr>th>label").click(function() {
|
||||
toggleSslOptions();
|
||||
$("tbody#tls_options>tr>th>label").click(function() {
|
||||
toggleTlsOptions();
|
||||
});
|
||||
updateSslImage();
|
||||
updateTlsImage();
|
||||
EOF
|
||||
);
|
||||
|
||||
@@ -1008,11 +1002,11 @@ function DoCheckDBConnection()
|
||||
'db_user': $("#db_user").val(),
|
||||
'db_pwd': $("#db_pwd").val(),
|
||||
'db_name': $("#db_name").val(),
|
||||
'db_ssl_key': $("input#db_ssl_key").val(),
|
||||
'db_ssl_cert': $("input#db_ssl_cert").val(),
|
||||
'db_ssl_ca': $("input#db_ssl_ca").val(),
|
||||
'db_ssl_capath': $("input#db_ssl_capath").val(),
|
||||
'db_ssl_cypher': $("input#db_ssl_cypher").val()
|
||||
'db_tls_key': $("input#db_tls_key").val(),
|
||||
'db_tls_cert': $("input#db_tls_cert").val(),
|
||||
'db_tls_ca': $("input#db_tls_ca").val(),
|
||||
'db_tls_capath': $("input#db_tls_capath").val(),
|
||||
'db_tls_cypher': $("input#db_tls_cypher").val()
|
||||
}
|
||||
if ((oXHRCheckDB != null) && (oXHRCheckDB != undefined))
|
||||
{
|
||||
@@ -1119,33 +1113,33 @@ EOF
|
||||
* @param string $sDBServer
|
||||
* @param string $sDBUser
|
||||
* @param string $sDBPwd
|
||||
* @param string $sSSLKey
|
||||
* @param string $sSSLCert
|
||||
* @param string $sSSLCA
|
||||
* @param string $sSSLCaPath
|
||||
* @param string $sSSLCipher
|
||||
* @param string $sTlsKey
|
||||
* @param string $sTlsCert
|
||||
* @param string $sTlsCA
|
||||
* @param string $sTlsCaPath
|
||||
* @param string $sTlsCipher
|
||||
*
|
||||
* @return bool|array false if the connection failed or array('checks' => Array of CheckResult, 'databases' =>
|
||||
* Array of database names (as strings) or null if not allowed)
|
||||
*/
|
||||
static function CheckDbServer(
|
||||
$sDBServer, $sDBUser, $sDBPwd, $sSSLKey = null, $sSSLCert = null, $sSSLCA = null, $sSSLCaPath = null,
|
||||
$sSSLCipher = null
|
||||
$sDBServer, $sDBUser, $sDBPwd, $sTlsKey = null, $sTlsCert = null, $sTlsCA = null, $sTlsCaPath = null,
|
||||
$sTlsCipher = null
|
||||
)
|
||||
{
|
||||
$aResult = array('checks' => array(), 'databases' => null);
|
||||
|
||||
if (CMDBSource::IsDbConnectionUsingSsl($sSSLKey, $sSSLCert, $sSSLCA))
|
||||
if (CMDBSource::IsDbConnectionUsingTls($sTlsKey, $sTlsCert, $sTlsCA))
|
||||
{
|
||||
if (!self::CheckFileExists($sSSLKey, $aResult, 'Can\'t open SSL Key file'))
|
||||
if (!self::CheckFileExists($sTlsKey, $aResult, 'Can\'t open SSL Key file'))
|
||||
{
|
||||
return $aResult;
|
||||
}
|
||||
if (!self::CheckFileExists($sSSLCert, $aResult, 'Can\'t open SSL Cert file'))
|
||||
if (!self::CheckFileExists($sTlsCert, $aResult, 'Can\'t open SSL Cert file'))
|
||||
{
|
||||
return $aResult;
|
||||
}
|
||||
if (!self::CheckFileExists($sSSLCA, $aResult, 'Can\'t open SSL CA file'))
|
||||
if (!self::CheckFileExists($sTlsCA, $aResult, 'Can\'t open SSL CA file'))
|
||||
{
|
||||
return $aResult;
|
||||
}
|
||||
@@ -1154,7 +1148,7 @@ EOF
|
||||
try
|
||||
{
|
||||
$oDBSource = new CMDBSource;
|
||||
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd, '', $sSSLKey, $sSSLCert, $sSSLCA, $sSSLCipher);
|
||||
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd, '', $sTlsKey, $sTlsCert, $sTlsCA, $sTlsCipher);
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "Connection to '$sDBServer' as '$sDBUser' successful.");
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "Info - User privileges: ".($oDBSource->GetRawPrivileges()));
|
||||
|
||||
@@ -1202,7 +1196,7 @@ EOF
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to test MySQL SSL files (key, cert, ca)
|
||||
* Use to test access to MySQL SSL files (key, cert, ca)
|
||||
*
|
||||
* @param string $sPath
|
||||
* @param array $aResult passed by reference, will by updated in case of error
|
||||
@@ -1256,11 +1250,13 @@ EOF
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static public function GetMySQLVersion($sDBServer, $sDBUser, $sDBPwd, $sSSLKey = NULL, $sSSLCert = NULL, $sSSLCA = NULL, $sSSLCipher = NULL )
|
||||
|
||||
static public function GetMySQLVersion(
|
||||
$sDBServer, $sDBUser, $sDBPwd, $sTlsKey = null, $sTlsCert = null, $sTlsCa = null, $sTlsCipher = null
|
||||
)
|
||||
{
|
||||
$oDBSource = new CMDBSource;
|
||||
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd, '', $sSSLKey, $sSSLCert, $sSSLCA, $sSSLCipher);
|
||||
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd, '', $sTlsKey, $sTlsCert, $sTlsCa, $sTlsCipher);
|
||||
$sDBVersion = $oDBSource->GetDBVersion();
|
||||
return $sDBVersion;
|
||||
}
|
||||
@@ -1271,16 +1267,16 @@ EOF
|
||||
$sDBUser = $aParameters['db_user'];
|
||||
$sDBPwd = $aParameters['db_pwd'];
|
||||
$sDBName = $aParameters['db_name'];
|
||||
$sSSLKey = (isset($aParameters['db_ssl_key'])) ? $aParameters['db_ssl_key'] : null;
|
||||
$sSSLCert = isset($aParameters['db_ssl_cert']) ? $aParameters['db_ssl_cert'] : null;
|
||||
$sSSLCA = (isset($aParameters['db_ssl_ca'])) ? $aParameters['db_ssl_ca'] : null;
|
||||
$sSSLCaPath = (isset($aParameters['db_ssl_capath'])) ? $aParameters['db_ssl_capath'] : null;
|
||||
$sSSLCipher = (isset($aParameters['db_ssl_cipher'])) ? $aParameters['db_ssl_cipher'] : null;
|
||||
$sTlsKey = (isset($aParameters['db_tls_key'])) ? $aParameters['db_tls_key'] : null;
|
||||
$sTlsCert = isset($aParameters['db_tls_cert']) ? $aParameters['db_tls_cert'] : null;
|
||||
$sTlsCA = (isset($aParameters['db_tls_ca'])) ? $aParameters['db_tls_ca'] : null;
|
||||
$sTlsCaPath = (isset($aParameters['db_tls_capath'])) ? $aParameters['db_tls_capath'] : null;
|
||||
$sTlsCipher = (isset($aParameters['db_tls_cipher'])) ? $aParameters['db_tls_cipher'] : null;
|
||||
|
||||
$oPage->add_ready_script('oXHRCheckDB = null;');
|
||||
|
||||
$checks = SetupUtils::CheckDbServer($sDBServer, $sDBUser, $sDBPwd, $sSSLKey, $sSSLCert, $sSSLCA, $sSSLCaPath,
|
||||
$sSSLCipher);
|
||||
$checks = SetupUtils::CheckDbServer($sDBServer, $sDBUser, $sDBPwd, $sTlsKey, $sTlsCert, $sTlsCA, $sTlsCaPath,
|
||||
$sTlsCipher);
|
||||
|
||||
if ($checks === false)
|
||||
{
|
||||
@@ -1423,11 +1419,11 @@ EOF
|
||||
'db_pwd' => $oWizard->GetParameter('db_pwd', ''),
|
||||
'db_name' => $oWizard->GetParameter('db_name', ''),
|
||||
'db_prefix' => $oWizard->GetParameter('db_prefix', ''),
|
||||
'db_ssl_key' => $oWizard->GetParameter('db_ssl_key', ''),
|
||||
'db_ssl_cert' => $oWizard->GetParameter('db_ssl_cert', ''),
|
||||
'db_ssl_ca' => $oWizard->GetParameter('db_ssl_ca', ''),
|
||||
'db_ssl_capath' => $oWizard->GetParameter('db_ssl_capath', ''),
|
||||
'db_ssl_cipher' => $oWizard->GetParameter('db_ssl_cipher', ''),
|
||||
'db_tls_key' => $oWizard->GetParameter('db_tls_key', ''),
|
||||
'db_tls_cert' => $oWizard->GetParameter('db_tls_cert', ''),
|
||||
'db_tls_ca' => $oWizard->GetParameter('db_tls_ca', ''),
|
||||
'db_tls_capath' => $oWizard->GetParameter('db_tls_capath', ''),
|
||||
'db_tls_cipher' => $oWizard->GetParameter('db_tls_cipher', ''),
|
||||
'source_dir' => $sRelativeSourceDir,
|
||||
);
|
||||
$oConfig->UpdateFromParams($aParamValues, null);
|
||||
@@ -1478,11 +1474,11 @@ EOF
|
||||
'db_pwd' => $oWizard->GetParameter('db_pwd', ''),
|
||||
'db_name' => $oWizard->GetParameter('db_name', ''),
|
||||
'db_prefix' => $oWizard->GetParameter('db_prefix', ''),
|
||||
'db_ssl_key' => $oWizard->GetParameter('db_ssl_key', ''),
|
||||
'db_ssl_cert' => $oWizard->GetParameter('db_ssl_cert', ''),
|
||||
'db_ssl_ca' => $oWizard->GetParameter('db_ssl_ca', ''),
|
||||
'db_ssl_capath' => $oWizard->GetParameter('db_ssl_capath', ''),
|
||||
'db_ssl_cipher' => $oWizard->GetParameter('db_ssl_cipher', ''),
|
||||
'db_tls_key' => $oWizard->GetParameter('db_tls_key', ''),
|
||||
'db_tls_cert' => $oWizard->GetParameter('db_tls_cert', ''),
|
||||
'db_tls_ca' => $oWizard->GetParameter('db_tls_ca', ''),
|
||||
'db_tls_capath' => $oWizard->GetParameter('db_tls_capath', ''),
|
||||
'db_tls_cipher' => $oWizard->GetParameter('db_tls_cipher', ''),
|
||||
'source_dir' => '',
|
||||
);
|
||||
$oConfig->UpdateFromParams($aParamValues, null);
|
||||
|
||||
@@ -177,11 +177,11 @@ class WizStepInstallOrUpgrade extends WizardStep
|
||||
$this->oWizard->SaveParameter('db_prefix', '');
|
||||
$this->oWizard->SaveParameter('db_backup', false);
|
||||
$this->oWizard->SaveParameter('db_backup_path', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_key', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_cert', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_ca', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_capath', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_cipher', '');
|
||||
$this->oWizard->SaveParameter('db_tls_key', '');
|
||||
$this->oWizard->SaveParameter('db_tls_cert', '');
|
||||
$this->oWizard->SaveParameter('db_tls_ca', '');
|
||||
$this->oWizard->SaveParameter('db_tls_capath', '');
|
||||
$this->oWizard->SaveParameter('db_tls_cipher', '');
|
||||
|
||||
if ($sInstallMode == 'install')
|
||||
{
|
||||
@@ -210,11 +210,11 @@ class WizStepInstallOrUpgrade extends WizardStep
|
||||
$sDBPrefix = $this->oWizard->GetParameter('db_prefix', '');
|
||||
$bDBBackup = $this->oWizard->GetParameter('db_backup', false);
|
||||
$sDBBackupPath = $this->oWizard->GetParameter('db_backup_path', '');
|
||||
$sSSLKey = $this->oWizard->GetParameter('db_ssl_key');
|
||||
$sSSLCert = $this->oWizard->GetParameter('db_ssl_cert');
|
||||
$sSSLCA = $this->oWizard->GetParameter('db_ssl_ca');
|
||||
$sSSLCaPath = $this->oWizard->GetParameter('db_ssl_capath', '');
|
||||
$sSSLCypher = $this->oWizard->GetParameter('db_ssl_cipher', '');
|
||||
$sTlsKey = $this->oWizard->GetParameter('db_tls_key', '');
|
||||
$sTlsCert = $this->oWizard->GetParameter('db_tls_cert', '');
|
||||
$sTlsCA = $this->oWizard->GetParameter('db_tls_ca', '');
|
||||
$sTlsCaPath = $this->oWizard->GetParameter('db_tls_capath', '');
|
||||
$sTlsCypher = $this->oWizard->GetParameter('db_tls_cipher', '');
|
||||
$sPreviousVersionDir = '';
|
||||
if ($sInstallMode == '')
|
||||
{
|
||||
@@ -224,19 +224,17 @@ class WizStepInstallOrUpgrade extends WizardStep
|
||||
if ($aPreviousInstance['found'])
|
||||
{
|
||||
$sInstallMode = 'upgrade';
|
||||
$sSourceDir = APPROOT;
|
||||
$sDBServer = $aPreviousInstance['db_server'];
|
||||
$sDBUser = $aPreviousInstance['db_user'];
|
||||
$sDBPwd = $aPreviousInstance['db_pwd'];
|
||||
$sDBName = $aPreviousInstance['db_name'];
|
||||
$sDBPrefix = $aPreviousInstance['db_prefix'];
|
||||
$sSSLKey = $aPreviousInstance['db_ssl_key'];
|
||||
$sSSLCert = $aPreviousInstance['db_ssl_cert'];
|
||||
$sSSLCA = $aPreviousInstance['db_ssl_ca'];
|
||||
$sSSLCaPath = $aPreviousInstance['db_ssl_capath'];
|
||||
$sSSLCypher = $aPreviousInstance['db_ssl_cipher'];
|
||||
$sTlsKey = $aPreviousInstance['db_tls_key'];
|
||||
$sTlsCert = $aPreviousInstance['db_tls_cert'];
|
||||
$sTlsCA = $aPreviousInstance['db_tls_ca'];
|
||||
$sTlsCaPath = $aPreviousInstance['db_tls_capath'];
|
||||
$sTlsCypher = $aPreviousInstance['db_tls_cipher'];
|
||||
$this->oWizard->SaveParameter('graphviz_path', $aPreviousInstance['graphviz_path']);
|
||||
$sStyle = '';
|
||||
$sPreviousVersionDir = APPROOT;
|
||||
}
|
||||
else
|
||||
@@ -261,8 +259,8 @@ class WizStepInstallOrUpgrade extends WizardStep
|
||||
$oPage->add('<table id="upgrade_info"'.$sUpgradeInfoStyle.'>');
|
||||
$oPage->add('<tr><td>Location on the disk:</td><td><input id="previous_version_dir" type="text" name="previous_version_dir" value="'.htmlentities($sPreviousVersionDir,
|
||||
ENT_QUOTES, 'UTF-8').'" style="width: 98%;"/></td></tr>');
|
||||
SetupUtils::DisplayDBParameters($oPage, false, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $sSSLKey,
|
||||
$sSSLCert, $sSSLCA, $sSSLCaPath, $sSSLCypher, null);
|
||||
SetupUtils::DisplayDBParameters($oPage, false, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $sTlsKey,
|
||||
$sTlsCert, $sTlsCA, $sTlsCaPath, $sTlsCypher, null);
|
||||
|
||||
$aBackupChecks = SetupUtils::CheckBackupPrerequisites($sDBBackupPath);
|
||||
$bCanBackup = true;
|
||||
@@ -641,11 +639,11 @@ EOF
|
||||
$this->oWizard->GetParameter('db_server', ''),
|
||||
$this->oWizard->GetParameter('db_user', ''),
|
||||
$this->oWizard->GetParameter('db_pwd', ''),
|
||||
$this->oWizard->GetParameter('db_ssl_key', ''),
|
||||
$this->oWizard->GetParameter('db_ssl_cert', ''),
|
||||
$this->oWizard->GetParameter('db_ssl_ca', ''),
|
||||
$this->oWizard->GetParameter('db_ssl_capath', ''),
|
||||
$this->oWizard->GetParameter('db_ssl_cypher', '')
|
||||
$this->oWizard->GetParameter('db_tls_key', ''),
|
||||
$this->oWizard->GetParameter('db_tls_cert', ''),
|
||||
$this->oWizard->GetParameter('db_tls_ca', ''),
|
||||
$this->oWizard->GetParameter('db_tls_capath', ''),
|
||||
$this->oWizard->GetParameter('db_tls_cypher', '')
|
||||
);
|
||||
if ($oMutex->IsLocked())
|
||||
{
|
||||
@@ -779,11 +777,11 @@ class WizStepDBParams extends WizardStep
|
||||
$this->oWizard->SaveParameter('new_db_name', '');
|
||||
$this->oWizard->SaveParameter('create_db', '');
|
||||
$this->oWizard->SaveParameter('db_new_name', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_key', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_cert', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_ca', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_capath', '');
|
||||
$this->oWizard->SaveParameter('db_ssl_cipher', '');
|
||||
$this->oWizard->SaveParameter('db_tls_key', '');
|
||||
$this->oWizard->SaveParameter('db_tls_cert', '');
|
||||
$this->oWizard->SaveParameter('db_tls_ca', '');
|
||||
$this->oWizard->SaveParameter('db_tls_capath', '');
|
||||
$this->oWizard->SaveParameter('db_tls_cipher', '');
|
||||
|
||||
return array('class' => 'WizStepAdminAccount', 'state' => '');
|
||||
}
|
||||
@@ -797,15 +795,15 @@ class WizStepDBParams extends WizardStep
|
||||
$sDBName = $this->oWizard->GetParameter('db_name', '');
|
||||
$sDBPrefix = $this->oWizard->GetParameter('db_prefix', '');
|
||||
$sNewDBName = $this->oWizard->GetParameter('db_new_name', false);
|
||||
$sSSLKey = $this->oWizard->GetParameter('db_ssl_key', '');
|
||||
$sSSLCert = $this->oWizard->GetParameter('db_ssl_cert', '');
|
||||
$sSSLCA = $this->oWizard->GetParameter('db_ssl_ca', '');
|
||||
$sSSLCaPath = $this->oWizard->GetParameter('db_ssl_capath', '');
|
||||
$sSSLCypher = $this->oWizard->GetParameter('db_ssl_cipher', '');
|
||||
$sTlsKey = $this->oWizard->GetParameter('db_tls_key', '');
|
||||
$sTlsCert = $this->oWizard->GetParameter('db_tls_cert', '');
|
||||
$sTlsCA = $this->oWizard->GetParameter('db_tls_ca', '');
|
||||
$sTlsCaPath = $this->oWizard->GetParameter('db_tls_capath', '');
|
||||
$sTlsCypher = $this->oWizard->GetParameter('db_tls_cipher', '');
|
||||
|
||||
$oPage->add('<table>');
|
||||
SetupUtils::DisplayDBParameters($oPage, true, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $sSSLKey,
|
||||
$sSSLCert, $sSSLCA, $sSSLCaPath, $sSSLCypher, $sNewDBName);
|
||||
SetupUtils::DisplayDBParameters($oPage, true, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $sTlsKey,
|
||||
$sTlsCert, $sTlsCA, $sTlsCaPath, $sTlsCypher, $sNewDBName);
|
||||
$oPage->add('</table>');
|
||||
$sCreateDB = $this->oWizard->GetParameter('create_db', 'yes');
|
||||
if ($sCreateDB == 'no')
|
||||
@@ -1242,24 +1240,11 @@ class WizStepModulesChoice extends WizardStep
|
||||
$sConfigPath = utils::GetConfigFilePath('production');
|
||||
}
|
||||
|
||||
$oConfig = ($sConfigPath !== null) ? new Config($sConfigPath) : new Config();
|
||||
// setting values from the wizard data, as the config file has not been saved yet
|
||||
$aParamValues = array(
|
||||
'db_server' => $this->oWizard->GetParameter('db_server', ''),
|
||||
'db_user' => $this->oWizard->GetParameter('db_user', ''),
|
||||
'db_pwd' => $this->oWizard->GetParameter('db_pwd', ''),
|
||||
'db_name' => $this->oWizard->GetParameter('db_name', ''),
|
||||
'db_prefix' => $this->oWizard->GetParameter('db_prefix', ''),
|
||||
'db_ssl_key' => $this->oWizard->GetParameter('db_ssl_key', ''),
|
||||
'db_ssl_cert' => $this->oWizard->GetParameter('db_ssl_cert', ''),
|
||||
'db_ssl_ca' => $this->oWizard->GetParameter('db_ssl_ca', ''),
|
||||
'db_ssl_capath' => $this->oWizard->GetParameter('db_ssl_capath', ''),
|
||||
'db_ssl_cipher' => $this->oWizard->GetParameter('db_ssl_cipher', ''),
|
||||
);
|
||||
|
||||
$oConfig->UpdateFromParams($aParamValues);
|
||||
$this->bChoicesFromDatabase = $this->oExtensionsMap->LoadChoicesFromDatabase($oConfig);
|
||||
//echo '<div style="display:block;position:fixed;width:100px;height:20px;top:0;left:0;font-size:10pt;">Default: '.($this->bChoicesFromDatabase ? 'DB' : 'Guess').'</div>';
|
||||
if ($sConfigPath !== null) // only called if the config file exists : we are updating a previous installation !
|
||||
{
|
||||
$oConfig = new Config($sConfigPath);
|
||||
$this->bChoicesFromDatabase = $this->oExtensionsMap->LoadChoicesFromDatabase($oConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public function GetTitle()
|
||||
@@ -2358,11 +2343,11 @@ EOF
|
||||
'user' => $this->oWizard->GetParameter('db_user'),
|
||||
'pwd' => $this->oWizard->GetParameter('db_pwd'),
|
||||
'name' => $sDBName,
|
||||
'db_ssl_key' => $this->oWizard->GetParameter('db_ssl_key'),
|
||||
'db_ssl_cert' => $this->oWizard->GetParameter('db_ssl_cert'),
|
||||
'db_ssl_ca' => $this->oWizard->GetParameter('db_ssl_ca'),
|
||||
'db_ssl_capath' => $this->oWizard->GetParameter('db_ssl_capath'),
|
||||
'db_ssl_cipher' => $this->oWizard->GetParameter('db_ssl_cipher'),
|
||||
'db_tls_key' => $this->oWizard->GetParameter('db_tls_key'),
|
||||
'db_tls_cert' => $this->oWizard->GetParameter('db_tls_cert'),
|
||||
'db_tls_ca' => $this->oWizard->GetParameter('db_tls_ca'),
|
||||
'db_tls_capath' => $this->oWizard->GetParameter('db_tls_capath'),
|
||||
'db_tls_cipher' => $this->oWizard->GetParameter('db_tls_cipher'),
|
||||
'prefix' => $this->oWizard->GetParameter('db_prefix'),
|
||||
),
|
||||
'url' => $this->oWizard->GetParameter('application_url'),
|
||||
|
||||
Reference in New Issue
Block a user