mirror of https://github.com/MISP/MISP
chg: [diagnostics] Make the STIX diagnostics a bit less cryptic
parent
2a91ed2876
commit
2aaf2c54c4
|
@ -754,7 +754,7 @@ class ServersController extends AppController {
|
|||
$gpgErrors = array(0 => 'OK', 1 => 'FAIL: settings not set', 2 => 'FAIL: Failed to load GnuPG', 3 => 'FAIL: Issues with the key/passphrase', 4 => 'FAIL: encrypt failed');
|
||||
$proxyErrors = array(0 => 'OK', 1 => 'not configured (so not tested)', 2 => 'Getting URL via proxy failed');
|
||||
$zmqErrors = array(0 => 'OK', 1 => 'not enabled (so not tested)', 2 => 'Python ZeroMQ library not installed correctly.', 3 => 'ZeroMQ script not running.');
|
||||
$stixOperational = array(0 => 'STIX or CyBox or mixbox or maec library not installed correctly', 1 => 'OK');
|
||||
$stixOperational = array(0 => 'Some of the libraries related to STIX are not installed. Make sure that all libraries listed below are correctly installed.', 1 => 'OK');
|
||||
$stixVersion = array(0 => 'Incorrect STIX version installed, found $current, expecting $expected', 1 => 'OK');
|
||||
$cyboxVersion = array(0 => 'Incorrect CyBox version installed, found $current, expecting $expected', 1 => 'OK');
|
||||
$mixboxVersion = array(0 => 'Incorrect mixbox version installed, found $current, expecting $expected', 1 => 'OK');
|
||||
|
|
|
@ -3214,15 +3214,13 @@ class Server extends AppModel {
|
|||
// check if the STIX and Cybox libraries are working using the test script stixtest.py
|
||||
$scriptResult = shell_exec('python3 ' . APP . 'files' . DS . 'scripts' . DS . 'stixtest.py');
|
||||
$scriptResult = json_decode($scriptResult, true);
|
||||
if ($scriptResult !== null) {
|
||||
$scriptResult['operational'] = $scriptResult['success'];
|
||||
if ($scriptResult['operational'] == 0) {
|
||||
$diagnostic_errors++;
|
||||
return array('operational' => 0, 'stix' => array('expected' => $expected['stix']), 'cybox' => array('expected' => $expected['cybox']), 'mixbox' => array('expected' => $expected['mixbox']), 'maec' => array('expected' => $expected['maec']), 'pymisp' => array('expected' => $expected['pymisp']));
|
||||
}
|
||||
} else {
|
||||
if ($scriptResult == null) {
|
||||
return array('operational' => 0, 'stix' => array('expected' => $expected['stix']), 'cybox' => array('expected' => $expected['cybox']), 'mixbox' => array('expected' => $expected['mixbox']), 'maec' => array('expected' => $expected['maec']), 'pymisp' => array('expected' => $expected['pymisp']));
|
||||
}
|
||||
$scriptResult['operational'] = $scriptResult['success'];
|
||||
if ($scriptResult['operational'] == 0) {
|
||||
$diagnostic_errors++;
|
||||
}
|
||||
$result['operational'] = $scriptResult['operational'];
|
||||
foreach ($expected as $package => $version) {
|
||||
$result[$package]['version'] = $scriptResult[$package];
|
||||
|
|
|
@ -221,29 +221,28 @@
|
|||
}
|
||||
}
|
||||
if (!$testReadError) {
|
||||
$error_count = 0;
|
||||
$libraries = '';
|
||||
foreach (array('stix', 'cybox', 'mixbox', 'maec', 'pymisp') as $package) {
|
||||
$lib_colour = 'green';
|
||||
if ($stix[$package]['status'] == 0) {
|
||||
$lib_colour = 'red';
|
||||
$error_count += 1;
|
||||
}
|
||||
$libraries = $libraries . strtoupper($package) . __(' library version') . '…<span style="color:' . $lib_colour . ';">' . ${$package . 'Version'}[$stix[$package]['status']] . '</span><br />';
|
||||
}
|
||||
if ($stix['operational'] == 0) {
|
||||
$colour = 'red';
|
||||
echo '<b>Current libraries status</b>…<span style="color:' . $colour . ';">' . $stixOperational[$stix['operational']] . '</span><br />';
|
||||
}
|
||||
if ($stix['operational'] == 1) {
|
||||
$error_count = 0;
|
||||
$libraries = '';
|
||||
foreach (array('stix', 'cybox', 'mixbox', 'maec', 'pymisp') as $package) {
|
||||
$lib_colour = 'green';
|
||||
if ($stix[$package]['status'] == 0) {
|
||||
$lib_colour = 'red';
|
||||
$error_count += 1;
|
||||
}
|
||||
$libraries = $libraries . strtoupper($package) . __(' library version') . '…<span style="color:' . $lib_colour . ';">' . ${$package . 'Version'}[$stix[$package]['status']] . '</span><br />';
|
||||
}
|
||||
} else {
|
||||
if ($error_count > 0) {
|
||||
$colour = 'orange';
|
||||
echo '<b>Current libraries status</b>…<span style="color:' . $colour . ';">Some versions should be updated</span>:<br />';
|
||||
} else {
|
||||
echo '<b>Current libraries status</b>…<span style="color:' . $colour . ';">' . $stixOperational[$stix['operational']] . '</span><br />';
|
||||
}
|
||||
echo $libraries;
|
||||
}
|
||||
echo $libraries;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue