mirror of https://github.com/MISP/MISP
chg: MISP version when needed
parent
3bc7c62b67
commit
4e60c3a66c
|
@ -1 +1 @@
|
|||
{"major":2, "minor":4, "hotfix":167}
|
||||
{"major":3, "minor":0, "hotfix":0}
|
||||
|
|
|
@ -132,7 +132,8 @@ class HttpTool extends CakeClient
|
|||
}
|
||||
|
||||
// Add user-agent
|
||||
$this->_defaultConfig['headers']['User-Agent'] = "MISP - Threat Intelligence & Sharing Platform"; // LATER add MISP version
|
||||
$this->_defaultConfig['headers']['User-Agent'] = "MISP - Threat Intelligence & Sharing Platform";
|
||||
// TODO add MISP version? or only do it for server to server communication? (see configFromServer())
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,9 +160,31 @@ class HttpTool extends CakeClient
|
|||
if (!empty($server['skip_proxy'])) {
|
||||
$this->_defaultConfig['skip_proxy'] = true;
|
||||
}
|
||||
if (!empty($server['authkey'])) {
|
||||
$this->_defaultConfig['headers']['Authorization'] = $server['authkey'];
|
||||
}
|
||||
$this->_defaultConfig['headers']['Accept'] = 'application/json';
|
||||
$this->_defaultConfig['headers']['Content-Type'] = 'application/json';
|
||||
// we're talking to another MISP server, it is therefore interesting to share out version and UUID to ensure compatible communication
|
||||
$this->shareMISPInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* shareMISPInfo - share MISP version and UUID in the headers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function shareMISPInfo()
|
||||
{
|
||||
$misp_version = implode('.', \App\Lib\Tools\MISPTool::getVersion());
|
||||
// FIXME set User-Agent is alread set, but without with MISP version: and co - 'User-Agent' => 'MISP ' . $version . (empty($commit) ? '' : ' - #' . $commit),
|
||||
$this->_defaultConfig['headers']['MISP-version'] = $misp_version;
|
||||
$this->_defaultConfig['headers']['MISP-uuid'] = Configure::read('MISP.uuid');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method for doing requests. This method is there to provide us a wrapper implementing custom MISP options.
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\Tools;
|
||||
|
||||
use App\Lib\Tools\FileAccessTool;
|
||||
use App\Lib\Tools\JsonTool;
|
||||
|
||||
class MISPTool
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns MISP version from VERSION.json file as array with major, minor and hotfix keys.
|
||||
*
|
||||
* @return array
|
||||
* @throws JsonException
|
||||
*/
|
||||
public static function getVersion()
|
||||
{
|
||||
|
||||
static $versionArray;
|
||||
if ($versionArray === null) {
|
||||
$content = FileAccessTool::readFromFile(ROOT . DS . 'VERSION.json');
|
||||
$versionArray = JsonTool::decode($content);
|
||||
}
|
||||
return $versionArray;
|
||||
}
|
||||
}
|
|
@ -303,4 +303,14 @@ class AppTable extends Table
|
|||
}
|
||||
return $this->Log;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated checkMISPVersion - use \App\Lib\Tools\MISPTool::getVersion() instead
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function checkMISPVersion()
|
||||
{
|
||||
return \App\Lib\Tools\MISPTool::getVersion();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"version": "1.8",
|
||||
"application": "Cerebrate"
|
||||
}
|
Loading…
Reference in New Issue