mirror of https://github.com/MISP/MISP
new: Added improvements to the Cortex settings
- allow for configuring SSL options for Cortex - previously the API key was not passed to Cortex on GET requests only on POST, breaking Cortex 2 compatibilitypull/3152/head
parent
edc116bf40
commit
570fe32764
|
@ -151,10 +151,21 @@ class Module extends AppModel {
|
|||
if (!$url) return false;
|
||||
App::uses('HttpSocket', 'Network/Http');
|
||||
if ($hover) {
|
||||
$httpSocket = new HttpSocket(array('timeout' => Configure::read('Plugin.' . $moduleFamily . '_hover_timeout') ? Configure::read('Plugin.' . $moduleFamily . '_hover_timeout') : 5));
|
||||
$settings = array(
|
||||
'timeout' => Configure::read('Plugin.' . $moduleFamily . '_hover_timeout') ? Configure::read('Plugin.' . $moduleFamily . '_hover_timeout') : 5
|
||||
);
|
||||
} else {
|
||||
$httpSocket = new HttpSocket(array('timeout' => Configure::read('Plugin.' . $moduleFamily . '_timeout') ? Configure::read('Plugin.' . $moduleFamily . '_timeout') : 10));
|
||||
$settings = array(
|
||||
'timeout' => Configure::read('Plugin.' . $moduleFamily . '_timeout') ? Configure::read('Plugin.' . $moduleFamily . '_timeout') : 10
|
||||
);
|
||||
}
|
||||
$sslSettings = array('ssl_verify_peer', 'ssl_verify_host', 'ssl_allow_self_signed', 'ssl_verify_peer', 'ssl_cafile');
|
||||
foreach ($sslSettings as $sslSetting) {
|
||||
if (!empty(Configure::read('Plugin.' . $moduleFamily . '_' . $sslSetting))) {
|
||||
$settings[$sslSetting] = Configure::read('Plugin.' . $moduleFamily . '_' . $sslSetting);
|
||||
}
|
||||
}
|
||||
$httpSocket = new HttpSocket($settings);
|
||||
$request = array(
|
||||
'header' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
|
@ -167,7 +178,7 @@ class Module extends AppModel {
|
|||
}
|
||||
try {
|
||||
if ($post) $response = $httpSocket->post($url . $uri, $post, $request);
|
||||
else $response = $httpSocket->get($url . $uri);
|
||||
else $response = $httpSocket->get($url . $uri, false, $request);
|
||||
return json_decode($response->body, true);
|
||||
} catch (Exception $e) {
|
||||
$exception = $e->getMessage();
|
||||
|
|
|
@ -1534,6 +1534,42 @@ class Server extends AppModel {
|
|||
'test' => 'testForEmpty',
|
||||
'type' => 'numeric'
|
||||
),
|
||||
'Cortex_ssl_verify_peer' => array(
|
||||
'level' => 1,
|
||||
'description' => 'Set to false to disable SSL verification. This is not recommended.',
|
||||
'value' => true,
|
||||
'errorMessage' => '',
|
||||
'test' => 'testBool',
|
||||
'type' => 'boolean',
|
||||
'null' => true
|
||||
),
|
||||
'Cortex_ssl_verify_host' => array(
|
||||
'level' => 1,
|
||||
'description' => 'Set to false if you wish to ignore hostname match errors when validating certificates.',
|
||||
'value' => true,
|
||||
'errorMessage' => '',
|
||||
'test' => 'testBool',
|
||||
'type' => 'boolean',
|
||||
'null' => true
|
||||
),
|
||||
'Cortex_ssl_allow_self_signed' => array(
|
||||
'level' => 1,
|
||||
'description' => 'Set to true to enable self-signed certificates to be accepted. This requires Cortex_ssl_verify_peer to be enabled.',
|
||||
'value' => false,
|
||||
'errorMessage' => '',
|
||||
'test' => 'testBool',
|
||||
'type' => 'boolean',
|
||||
'null' => true
|
||||
),
|
||||
'Cortex_ssl_cafile' => array(
|
||||
'level' => 1,
|
||||
'description' => 'Set to the absolute path of the Certificate Authority file that you wish to use for verifying SSL certificates.',
|
||||
'value' => '',
|
||||
'errorMessage' => '',
|
||||
'test' => 'testForEmpty',
|
||||
'type' => 'string',
|
||||
'null' => true
|
||||
),
|
||||
'CustomAuth_custom_password_reset' => array(
|
||||
'level' => 2,
|
||||
'description' => 'Provide your custom authentication users with an external URL to the authentication system to reset their passwords.',
|
||||
|
|
Loading…
Reference in New Issue