mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
parent
eafb066024
commit
e10384770d
@ -43,7 +43,7 @@ class DbResourceForm extends Form
|
||||
$dbChoices['oci'] = 'Oracle (OCI8)';
|
||||
}
|
||||
|
||||
$encryptionChoices = array();
|
||||
$offerSsl = false;
|
||||
$offerPostgres = false;
|
||||
$offerMysql = false;
|
||||
$dbChoice = isset($formData['db']) ? $formData['db'] : key($dbChoices);
|
||||
@ -52,7 +52,7 @@ class DbResourceForm extends Form
|
||||
} elseif ($dbChoice === 'mysql') {
|
||||
$offerMysql = true;
|
||||
if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) {
|
||||
$encryptionChoices['ssl'] = 'SSL';
|
||||
$offerSsl = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,23 +156,19 @@ class DbResourceForm extends Form
|
||||
'label' => $this->translate('Persistent')
|
||||
)
|
||||
);
|
||||
if (! empty($encryptionChoices)) {
|
||||
if ($offerSsl) {
|
||||
$this->addElement(
|
||||
'select',
|
||||
'encryption',
|
||||
'checkbox',
|
||||
'use_ssl',
|
||||
array(
|
||||
'autosubmit' => true,
|
||||
'label' => $this->translate('Encryption'),
|
||||
'label' => $this->translate('Use SSL'),
|
||||
'description' => $this->translate(
|
||||
'Whether to encrypt the connection or to authenticate using certificates'
|
||||
),
|
||||
'multiOptions' => array_merge(
|
||||
array('none' => $this->translate('None', 'db connection encryption')),
|
||||
$encryptionChoices
|
||||
)
|
||||
)
|
||||
);
|
||||
if (isset($formData['encryption']) && $formData['encryption'] === 'ssl') {
|
||||
if (isset($formData['use_ssl']) && $formData['use_ssl']) {
|
||||
$this->addElement(
|
||||
'text',
|
||||
'ssl_key',
|
||||
|
@ -143,7 +143,7 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
||||
break;
|
||||
case 'mysql':
|
||||
$adapter = 'Pdo_Mysql';
|
||||
if ($this->config->encryption === 'ssl') {
|
||||
if ($this->config->use_ssl) {
|
||||
# The presence of these keys as empty strings or null cause non-ssl connections to fail
|
||||
if ($this->config->ssl_key) {
|
||||
$adapterParamaters['driver_options'][PDO::MYSQL_ATTR_SSL_KEY] = $this->config->ssl_key;
|
||||
|
@ -262,7 +262,7 @@ class DbTool
|
||||
);
|
||||
|
||||
if ($this->config['db'] === 'mysql') {
|
||||
if (isset($this->config['encryption']) && $this->config['encryption'] === 'ssl') {
|
||||
if (isset($this->config['use_ssl']) && $this->config['use_ssl']) {
|
||||
$this->config['driver_options'] = array();
|
||||
# The presence of these keys as empty strings or null cause non-ssl connections to fail
|
||||
if ($this->config['ssl_key']) {
|
||||
@ -312,8 +312,8 @@ class DbTool
|
||||
|
||||
if (
|
||||
$this->config['db'] === 'mysql'
|
||||
&& isset($this->config['encryption'])
|
||||
&& $this->config['encryption'] === 'ssl'
|
||||
&& isset($this->config['use_ssl'])
|
||||
&& $this->config['use_ssl']
|
||||
) {
|
||||
# The presence of these keys as empty strings or null cause non-ssl connections to fail
|
||||
if ($this->config['ssl_key']) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user