Cleanup, MISP health tool

- cleanup of a lot of deprecated settings
- tool to help assess and alter issues with the instance settings
- new mechanism to store settings
pull/304/merge
iglocska 2014-09-10 09:43:22 +02:00
parent 982727819b
commit 79127902b7
40 changed files with 805 additions and 172 deletions

View File

@ -93,30 +93,23 @@ if (!Configure::read('MISP.baseurl')) {
}
}
Configure::write('MISP.name', 'MISP');
Configure::write('MISP.version', '2.2');
Configure::write('MISP.header', 'MISP: Malware Information Sharing Platform');
Configure::write('MISP.footerpart1', 'Powered by MISP');
Configure::write('MISP.footerpart2', '© Belgian Defense CERT & NCIRC');
Configure::write('MISP.footer', Configure::read('MISP.footerpart1') . ' ' . Configure::read('MISP.footerpart2'));
Configure::write('MISP.footerversion', Configure::read('MISP.footerpart1') . ' version ' . Configure::read('MISP.version') . ' ' . Configure::read('MISP.footerpart2'));
// The following field is optional
// Configure::write('MISP.footer_logo', 'imagename'); // Logo for the bottom right corner of the screen. Place a .png image into your app/webroot/img folder
Configure::write('MISP.org', 'ORGNAME'); // if sync this will be Event.org content on the peer side
Configure::write('MISP.logo', 'orgs/ORGNAME.png'); // used in Events::index for owned events
Configure::write('MISP.showorg', 'true'); // show the name/flag of the organisation that uploaded the data
Configure::write('MISP.showorg', true); // show the name/flag of the organisation that uploaded the data
Configure::write('MISP.sync', 'true'); // (Warning, do not disable this!!!) enable features related to syncing with other MISP instances - should be always on because of the current distribution model.
Configure::write('MISP.taxii_sync', 'false'); // Use the taxii demon to offload the synchronisation to a background process - see https://github.com/MISP/MISP-TAXII
Configure::write('MISP.taxii_client_path', '/usr/local/taxii-client-vanilla');
Configure::write('MISP.background_jobs', false); // Use CakeResque to delegate jobs to a background worker and to schedule jobs (synchronisation, e-mailing, caching of exports) - Please also enable CakeResque (at the end of this file)
Configure::write('MISP.cached_attachments', false); // Include the attachments in the xml exports
Configure::write('MISP.email', 'email@address.com'); // email from for all the mails
Configure::write('MISP.contact', 'email@address.com'); // contact address for this instance's support person / group
Configure::write('GnuPG.onlyencrypted', 'true'); // only allow encrypted email, do not allow plaintext mails
Configure::write('GnuPG.onlyencrypted', true); // only allow encrypted email, do not allow plaintext mails
Configure::write('GnuPG.email', 'email@address.com');
Configure::write('GnuPG.password', 'yourpassword');
Configure::write('GnuPG.homedir', '/path/to/your/.gnupg/');

View File

@ -116,6 +116,7 @@ class AppController extends Controller {
// instead of using checkAction(), like we normally do from controllers when trying to find out about a permission flag, we can use getActions()
// getActions returns all the flags in a single SQL query
if ($this->Auth->user()) {
$this->set('mispVersion', $this->mispVersion);
$role = $this->getActions();
$this->set('me', $this->Auth->user());
$this->set('isAdmin', $role['perm_admin']);

View File

@ -920,10 +920,8 @@ class AttributesController extends AppController {
'fields' => array('Event.id', 'Event.orgc', 'Event.org', 'Event.locked')
)),
));
if ('true' == Configure::read('MISP.sync')) {
// find the uuid
$uuid = $result['Attribute']['uuid'];
}
// find the uuid
$uuid = $result['Attribute']['uuid'];
// check for permissions
if (!$this->_isSiteAdmin()) {
@ -941,10 +939,7 @@ class AttributesController extends AppController {
// attachment will be deleted with the beforeDelete() function in the Model
if ($this->Attribute->delete()) {
// delete the attribute from remote servers
if ('true' == Configure::read('MISP.sync')) {
// find the uuid
$this->__deleteAttributeFromServers($uuid);
}
$this->__deleteAttributeFromServers($uuid);
// We have just deleted the attribute, let's also check if there are any shadow attributes that were attached to it and delete them
$this->loadModel('ShadowAttribute');

View File

@ -117,7 +117,7 @@ class EventsController extends AppController {
break;
case 'org' :
if ($v == "") continue 2;
if (Configure::read('MISP.showorg') == 'false') continue 2;
if (!Configure::read('MISP.showorg')) continue 2;
// if the first character is '!', search for NOT LIKE the rest of the string (excluding the '!' itself of course)
$pieces = explode('|', $v);
$test = array();
@ -229,7 +229,7 @@ class EventsController extends AppController {
$this->set('events', $this->paginate());
}
if (!$this->Event->User->getPGP($this->Auth->user('id')) && Configure::read('GnuPG.onlyencrypted') == 'true') {
if (!$this->Event->User->getPGP($this->Auth->user('id')) && Configure::read('GnuPG.onlyencrypted')) {
$this->Session->setFlash(__('No GPG key set in your profile. To receive emails, submit your public key in your profile.'));
}
$this->set('eventDescriptions', $this->Event->fieldDescriptions);
@ -306,7 +306,7 @@ class EventsController extends AppController {
'group' => 'orgc'
));
$rules = array('published', 'tag', 'date', 'eventinfo', 'threatlevel', 'distribution', 'analysis');
if (Configure::read('MISP.showorg') != 'false') {
if (Configure::read('MISP.showorg')){
$orgs = array();
foreach ($events as $e) {
$orgs[] = $e['Event']['orgc'];
@ -1148,11 +1148,10 @@ class EventsController extends AppController {
throw new NotFoundException(__('Invalid event'));
}
if ('true' == Configure::read('MISP.sync')) {
// find the uuid
$result = $this->Event->findById($id);
$uuid = $result['Event']['uuid'];
}
// find the uuid
$result = $this->Event->findById($id);
$uuid = $result['Event']['uuid'];
if (!$this->_isSiteAdmin()) {
$this->Event->read();
if ($this->Event->data['Event']['orgc'] != $this->_checkOrg()) {

View File

@ -26,10 +26,6 @@ class ServersController extends AppController {
public function beforeFilter() {
parent::beforeFilter();
// Disable this feature if the sync configuration option is not active
if ('true' != Configure::read('MISP.sync'))
throw new ConfigureException("The sync feature is not active in the configuration.");
// permit reuse of CSRF tokens on some pages.
switch ($this->request->params['action']) {
case 'push':
@ -286,4 +282,105 @@ class ServersController extends AppController {
$s['Server']['cert_file'] = $s['Server']['id'] . '.' . $ext;
if ($result) $this->Server->save($s);
}
public function serverSettings($tab=false) {
if (!$this->_isSiteAdmin()) throw new MethodNotAllowedException();
if ($this->request->is('Get')) {
$tabs = array(
'MISP' => array('count' => 0, 'errors' => 0, 'severity' => 5),
'GnuPG' => array('count' => 0, 'errors' => 0, 'severity' => 5),
'Security' => array('count' => 0, 'errors' => 0, 'severity' => 5),
'misc' => array('count' => 0, 'errors' => 0, 'severity' => 5)
);
$results = $this->Server->serverSettingsRead();
$issues = array(
'errors' => array(
0 => array(
'value' => 0,
'description' => 'MISP will not operate correctly or will be unsecure until these issues are resolved.'
),
1 => array(
'value' => 0,
'description' => 'Some of the features of MISP cannot be utilised until these issues are resolved.'
),
2 => array(
'value' => 0,
'description' => 'There are some optional tweaks that could be done to improve the looks of your MISP instance.'
),
),
'deprecated' => array(),
'overallHealth' => 3,
);
foreach ($results as $k => $result) {
if ($result['level'] == 3) $issues['deprecated']++;
$tabs[$result['tab']]['count']++;
if (isset($result['error']) && $result['level'] < 3) {
$issues['errors'][$result['level']]['value']++;
if ($result['level'] < $issues['overallHealth']) $issues['overallHealth'] = $result['level'];
$tabs[$result['tab']]['errors']++;
if ($result['level'] < $tabs[$result['tab']]['severity']) $tabs[$result['tab']]['severity'] = $result['level'];
}
if ($result['tab'] != $tab) unset($results[$k]);
}
$this->set('tab', $tab);
$this->set('tabs', $tabs);
$this->set('issues', $issues);
$this->set('finalSettings', $results);
$priorities = array(0 => 'Critical', 1 => 'Recommended', 2 => 'Optional', 3 => 'Deprecated');
$priorityErrorColours = array(0 => 'red', 1 => 'yellow', 2 => 'green');
$this->set('priorities', $priorities);
$this->set('priorityErrorColours', $priorityErrorColours);
}
}
public function serverSettingsEdit($setting, $id, $forceSave = false) {
if (!$this->_isSiteAdmin()) throw new MethodNotAllowedException();
if (!isset($setting) || !isset($id)) throw new MethodNotAllowedException();
$this->set('id', $id);
$relevantSettings = (array_intersect_key(Configure::read(), $this->Server->serverSettings));
$found = null;
foreach ($this->Server->serverSettings as $k => $s) {
if (isset($s['branch'])) {
foreach ($s as $ek => $es) {
if ($ek != 'branch') {
if ($setting == $k . '.' . $ek) {
$found = $es;
continue 2;
}
}
}
} else {
if ($setting == $k) {
$found = $s;
continue;
}
}
}
if ($this->request->is('get')) {
if ($found != null) {
$found['value'] = Configure::read($setting);
$found['setting'] = $setting;
}
$this->set('setting', $found);
$this->render('ajax/server_settings_edit');
}
if ($this->request->is('post')) {
if ($found['test'] == 'testBool') {
$this->request->data['Server']['value'] = ($this->request->data['Server']['value'] ? true : false);
}
if ($found['test'] == 'testForNumeric' || $found['test'] == 'testDebug') {
$this->request->data['Server']['value'] = intval($this->request->data['Server']['value']);
}
$testResult = $this->Server->{$found['test']}($this->request->data['Server']['value']);
if (!$forceSave && $testResult !== true) {
if ($testResult === false) $errorMessage = $found['errorMessage'];
else $errorMessage = $testResult;
return new CakeResponse(array('body'=> json_encode(array('saved' => false, 'errors' => $errorMessage)),'status'=>200));
} else {
$this->Server->serverSettingsSaveValue($setting, $this->request->data['Server']['value']);
$this->autoRender = false;
return new CakeResponse(array('body'=> json_encode(array('saved' => true, 'success' => 'Field updated.')),'status'=>200));
}
}
}
}

View File

@ -1317,11 +1317,13 @@ class Attribute extends AppModel {
$this->validator()->remove('value', 'unique');
// get all attributes..
$attributes = $this->find('all', array('recursive' => -1));
$attributes = $this->find('all', array('recursive' => -1, 'fields' => array('id')));
// for all attributes..
$result = array();
$i = 0;
foreach ($attributes as $attribute) {
foreach ($attributes as $a) {
$attribute = $this->find('first', array('recursive' => -1, 'conditions' => array('id' => $a['Attribute']['id'])));
$this->set($attribute);
if ($this->validates()) {
// validates

View File

@ -525,38 +525,6 @@ class Event extends AppModel {
return 'Success';
}
/**
* Call the TAXII client
*
* @param int $id Event id
* @param array $server associative array with server data
* @return mixed boolean or HTTP status
*/
public function taxii_publish($id, $server, $client_path){
$this->contain(array('Attribute' => array('category', 'type', 'value1', 'value2', 'to_ids', 'uuid', 'timestamp', 'distribution')));
$fieldList = array(
'threat_level_id', 'org', 'date', 'info', 'published', 'uuid', 'analysis',
'orgc', 'timestamp', 'distribution'
);
$data = $this->read($fieldList, $id);
$data['api_key'] = $server['Server']['authkey'];
$data['server_url'] = $server['Server']['url'].'/events';
$data = json_encode($data);
ob_start();
passthru(Configure::read('MISP.taxii_client_path'). " -t string -th ".
$server['Server']['url']." -d '".$data."'");
/**
* Response sample:
* '{"in_response_to": "44492", "status_detail": "Total Time: 0.0200021266937", "extended_headers": {},
* "message": "Event saved.", "message_type": "Status_Message", "message_id": "79739", "status_type":
* "SUCCESS"}'
*/
return json_decode(ob_get_clean());
}
/**
* Uploads the event and the associated Attributes to another Server
* TODO move this to a component
@ -568,9 +536,6 @@ class Event extends AppModel {
return 403; //"Event is private and non exportable";
}
if('true' == Configure::read('MISP.taxii_sync')){
return $this->taxii_publish($event['Event']['id'], $server, Configure::read('MISP.taxii_client_path'));
}
$url = $server['Server']['url'];
$authkey = $server['Server']['authkey'];
if (null == $HttpSocket) {
@ -1103,7 +1068,7 @@ class Event extends AppModel {
$body .= 'URL : ' . Configure::read('MISP.baseurl') . '/events/view/' . $event['Event']['id'] . "\n";
$body .= 'Event ID : ' . $event['Event']['id'] . "\n";
$body .= 'Date : ' . $event['Event']['date'] . "\n";
if ('true' == Configure::read('MISP.showorg')) {
if (Configure::read('MISP.showorg')) {
$body .= 'Reported by : ' . $event['Event']['org'] . "\n";
}
$body .= 'Distribution: ' . $this->distributionLevels[$event['Event']['distribution']] . "\n";
@ -1184,7 +1149,7 @@ class Event extends AppModel {
} else {
$conditions = array('User.autoalert' => 1, 'User.gpgkey =' => "");
}
if ('false' == Configure::read('GnuPG.onlyencrypted')) {
if (!Configure::read('GnuPG.onlyencrypted')) {
$alertUsers = $this->User->find('all', array(
'conditions' => $conditions,
'recursive' => 0,
@ -1304,7 +1269,7 @@ class Event extends AppModel {
$body .= 'URL : ' . Configure::read('MISP.baseurl') . '/events/view/' . $event['Event']['id'] . "\n";
$body .= 'Event : ' . $event['Event']['id'] . "\n";
$body .= 'Date : ' . $event['Event']['date'] . "\n";
if ('true' == Configure::read('MISP.showorg')) {
if (Configure::read('MISP.showorg')) {
$body .= 'Reported by : ' . $event['Event']['org'] . "\n";
}
$body .= 'Risk : ' . $event['ThreatLevel']['name'] . "\n";
@ -1613,7 +1578,7 @@ class Event extends AppModel {
$this->save($event, array('fieldList' => $fieldList));
}
$uploaded = false;
if ('true' == Configure::read('MISP.sync') && $event['Event']['distribution'] > 1) {
if ($event['Event']['distribution'] > 1) {
$uploaded = $this->uploadEventToServersRouter($id, $passAlong);
} else {
return true;

View File

@ -103,6 +103,294 @@ class Server extends AppModel {
),
),
);
public $serverSettings = array(
'MISP' => array(
'branch' => 1,
'baseurl' => array(
'level' => 0,
'description' => 'The base url of the application (such as https://www.mymispinstance.com)',
'value' => '',
'errorMessage' => 'The currenty set baseurl does not match the URL through which you have accessed the page. Disregard this if you are accessing the page via an alternate URL (for example via IP address).',
'test' => 'testBaseURL',
'type' => 'string',
),
'name' => array(
'level' => 2,
'description' => 'The name of the application (MISP)',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'version' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'header' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'footerpart1' => array(
'level' => 2,
'description' => 'Footer text prepending the version number.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'footerpart2' => array(
'level' => 2,
'description' => 'Footer text following the version number.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'footer' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'footerversion' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'footer_logo' => array(
'level' => 2 ,
'description' => 'If set, this setting allows you to display a logo on the right side of the footer.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'org' => array(
'level' => 1,
'description' => 'The organisation tag of the hosting organisation. This is used in the e-mail subjects.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'logo' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'showorg' => array(
'level' => 0,
'description' => 'Setting this setting to \'false\' will hide all organisation names / logos.',
'value' => '',
'errorMessage' => '',
'test' => 'testBool',
'type' => 'boolean',
),
'sync' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'taxii_sync' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'taxii_client_path' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'background_jobs' => array(
'level' => 1,
'description' => 'Enables the use of MISP\'s background processing.',
'value' => '',
'errorMessage' => '',
'test' => 'testBool',
'type' => 'boolean',
),
'cached_attachments' => array(
'level' => 1,
'description' => 'Allow the XML caches to include the encoded attachments.',
'value' => '',
'errorMessage' => '',
'test' => 'testBool',
'type' => 'boolean',
),
'email' => array(
'level' => 0,
'description' => 'The e-mail address that MISP should use for all notifications',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'contact' => array(
'level' => 1,
'description' => 'The e-mail address that MISP should include as a contact address for the instance\'s support team.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'dns' => array(
'level' => 3,
'description' => 'This setting is deprecated and can be safely removed.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'cveurl' => array(
'level' => 1,
'description' => 'Turn Vulnerability type attributes into links linking to the provided CVE lookup',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'disablerestalert' => array(
'level' => 1,
'description' => 'This setting controls whether notification e-mails will be sent when an event is created via the REST interface. It might be a good idea to disable this setting when first setting up a link to another instance to avoid spamming your users during the initial pull.',
'value' => '',
'errorMessage' => '',
'test' => 'testBool',
'type' => 'boolean',
),
'default_event_distribution' => array(
'level' => 0,
'description' => 'The default distribution setting for events (0-3).',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'numeric',
),
'default_attribute_distribution' => array(
'level' => 0,
'description' => 'The default distribution setting for attributes, set it to \'event\' if you would like the attributes to default to the event distribution level. (0-3 or "event")',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'tagging' => array(
'level' => 1,
'description' => 'Enable the tagging feature of MISP. This is highly recommended.',
'value' => '',
'errorMessage' => '',
'test' => 'testBool',
'type' => 'boolean',
),
'full_tags_on_event_index' => array(
'level' => 2,
'description' =>'Show the full tag names on the event index.',
'value' => '',
'errorMessage' => '',
'test' => 'testBool',
'type' => 'boolean',
),
),
'GnuPG' => array(
'branch' => 1,
'onlyencrypted' => array(
'level' => 0,
'description' => 'Allow unencrypted e-mails to be sent to users that don\'t have a PGP key.',
'value' => '',
'errorMessage' => '',
'test' => 'testBool',
'type' => 'boolean',
),
'email' => array(
'level' => 0,
'description' => 'The e-mail address that the instance\'s PGP key is tied to.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'password' => array(
'level' => 1,
'description' => 'The password (if it is set) of the PGP key of the instance.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
'homedir' => array(
'level' => 0,
'description' => 'The location of the GPG homedir.',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
),
),
'Security' => array(
'branch' => 1,
'salt' => array(
'level' => 0,
'description' => 'The salt used for the hashed passwords. You cannot reset this from the GUI, only manually from the settings.php file. Keep in mind, this will invalidate all passwords in the database.',
'value' => '',
'errorMessage' => '',
'test' => 'testSalt',
'type' => 'string',
'editable' => false,
),
),
'SecureAuth' => array(
'branch' => 1,
'amount' => array(
'level' => 0,
'description' => 'The number of tries a user can try to login and fail before the bruteforce protection kicks in.',
'value' => '',
'errorMessage' => '',
'test' => 'testForNumeric',
'type' => 'string',
),
'expire' => array(
'level' => 0,
'description' => 'The duration (in seconds) of how long the user will be locked out when the allowed number of login attempts are exhausted.',
'value' => '',
'errorMessage' => '',
'test' => 'testForNumeric',
'type' => 'string',
),
),
'debug' => array(
'level' => 0,
'description' => 'The debug level of the instance, always use 0 for production instances.',
'value' => '',
'errorMessage' => '',
'test' => 'testDebug',
'type' => 'numeric',
),
);
public function isOwnedByOrg($serverid, $org) {
return $this->field('id', array('id' => $serverid, 'org' => $org)) === $serverid;
@ -512,4 +800,98 @@ class Server extends AppModel {
}
}
}
public function serverSettingsRead($unsorted = false) {
$serverSettings = $this->serverSettings;
$results = array();
$currentSettings = Configure::read();
$finalSettingsUnsorted = array();
foreach ($serverSettings as $branchKey => &$branchValue) {
if (isset($branchValue['branch'])) {
foreach ($branchValue as $leafKey => &$leafValue) {
$setting = null;
if (isset($currentSettings[$branchKey][$leafKey])) $setting = $currentSettings[$branchKey][$leafKey];
$leafValue = $this->__evaluateLeaf($leafValue, $leafKey, $setting);
if ($leafKey != 'branch') {
if (strpos($branchKey, 'Secur') === 0) $leafValue['tab'] = 'Security';
else $leafValue['tab'] = $branchKey;
$finalSettingsUnsorted[$branchKey . '.' . $leafKey] = $leafValue;
}
}
} else {
$setting = null;
if (isset($currentSettings[$branchKey])) $setting = $currentSettings[$branchKey];
$branchValue = $this->__evaluateLeaf($branchValue, $branchKey, $setting);
$branchValue['tab'] = 'misc';
$finalSettingsUnsorted[$branchKey] = $branchValue;
}
}
if ($unsorted) return $finalSettingsUnsorted;
$finalSettings = array();
for ($i = 0; $i < 4; $i++) {
foreach ($finalSettingsUnsorted as $k => $s) {
$s['setting'] = $k;
if ($s['level'] == $i) $finalSettings[] = $s;
}
}
return $finalSettings;
}
private function __evaluateLeaf($leafValue, $leafKey, $setting) {
if (isset($setting)) {
$result = $this->{$leafValue['test']}($setting);
if ($result !== true) {
$leafValue['error'] = 1;
if ($result !== false) $leafValue['errorMessage'] = $result;
}
if ($setting !== '') $leafValue['value'] = $setting;
} else {
if ($leafKey != 'branch') {
$leafValue['error'] = 1;
$leafValue['errorMessage'] = 'Value not set.';
}
}
return $leafValue;
}
public function testForNumeric($value) {
if (!is_numeric($value)) return false;
return true;
}
public function testForEmpty($value) {
if ($value === '') return 'Value not set.';
return true;
}
public function testDebug($value) {
if ($this->testForEmpty($value) !== true) return $this->testForEmpty($value);
if ($this->testForNumeric($value) !== true) return 'This setting has to be a number between 0 and 2, with 0 disabling debug mode.';
if ($value === 0) return true;
return 'This setting has to be set to 0 on production systems. Ignore this warning if this is not the case.';
}
public function testBaseURL($value) {
if ($this->testForEmpty($value) !== true) return $this->testForEmpty($value);
$protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'HTTPS' : 'HTTP';
if ($value != strtolower($protocol) . '://' . $_SERVER[$protocol . '_HOST']) return false;
return true;
}
public function testBool($value) {
if ($this->testForEmpty($value) !== true) return $this->testForEmpty($value);
if ($value !== true && $value !== false) return 'Value is not a boolean, make sure that you convert \'true\' to true for example.';
return true;
}
public function testSalt($value) {
if ($this->testForEmpty($value) !== true) return $this->testForEmpty($value);
if (strlen($value) != 32) return 'The salt has to be a 32 byte long string.';
if ($value == "Rooraenietu8Eeyo<Qu2eeNfterd-dd+") return 'This is the default salt shipped with the application and is therefore unsecure.';
return true;
}
public function serverSettingsSaveValue($setting, $value) {
Configure::write($setting, $value);
Configure::dump('settings.php', 'default', array('MISP', 'GnuPG', 'SecureAuth', 'Security', 'debug'));
}
}

View File

@ -14,21 +14,19 @@
echo $this->Form->input('type', array(
'empty' => '(first choose category)'
));
if ('true' == Configure::read('MISP.sync')) {
$initialDistribution = 3;
if (Configure::read('MISP.default_attribute_distribution') != null) {
if (Configure::read('MISP.default_attribute_distribution') === 'event') {
$initialDistribution = $currentDist;
} else {
$initialDistribution = Configure::read('MISP.default_attribute_distribution');
}
$initialDistribution = 3;
if (Configure::read('MISP.default_attribute_distribution') != null) {
if (Configure::read('MISP.default_attribute_distribution') === 'event') {
$initialDistribution = $currentDist;
} else {
$initialDistribution = Configure::read('MISP.default_attribute_distribution');
}
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => $initialDistribution,
));
}
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => $initialDistribution,
));
echo $this->Form->input('value', array(
'type' => 'textarea',
'error' => array('escape' => false),

View File

@ -8,7 +8,6 @@
?>
<div class="input clear"></div>
<?php
if ('true' == Configure::read('MISP.sync')) {
$initialDistribution = 3;
if (Configure::read('MISP.default_attribute_distribution') != null) {
if (Configure::read('MISP.default_attribute_distribution') === 'event') {
@ -30,7 +29,6 @@
'class' => 'input-xxlarge'
));
//'before' => $this->Html->div('forminfo', isset($attrDescriptions['distribution']['formdesc']) ? $attrDescriptions['distribution']['formdesc'] : $attrDescriptions['distribution']['desc']),));
}
?>
<div class="input clear"></div>
<div class="input">

View File

@ -9,14 +9,12 @@
<?php
echo $this->Form->hidden('event_id', array('value' => $id));
echo $this->Form->input('attribute_ids', array('style' => 'display:none;', 'label' => false));
if ('true' == Configure::read('MISP.sync')) {
$distributionLevels[] = 'Do not alter current settings';
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => 4,
));
}
$distributionLevels[] = 'Do not alter current settings';
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => 4,
));
echo $this->Form->input('to_ids', array(
'options' => array('No', 'Yes', 'Do not alter current settings'),
'data-content' => isset($attrDescriptions['signature']['formdesc']) ? $attrDescriptions['signature']['formdesc'] : $attrDescriptions['signature']['desc'],

View File

@ -10,12 +10,10 @@
echo $this->Form->input('type', array(
'empty' => '(first choose category)'
));
if ('true' == Configure::read('MISP.sync')) {
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
));
}
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
));
echo $this->Form->input('value', array(
'type' => 'textarea',
'error' => array('escape' => false),

View File

@ -29,7 +29,7 @@ if ($isSearch == 1) {
<table class="table table-striped table-hover table-condensed">
<tr>
<th><?php echo $this->Paginator->sort('event_id');?></th>
<?php if ('true' == Configure::read('MISP.showorg') || $isAdmin): ?>
<?php if (Configure::read('MISP.showorg') || $isAdmin): ?>
<th><?php echo $this->Paginator->sort('orgc', 'Org');?></th>
<?php endif; ?>
<th><?php echo $this->Paginator->sort('category');?></th>
@ -70,7 +70,7 @@ foreach ($attributes as $attribute):
<a href="/events/view/<?php echo $attribute['Event']['id'];?>" <?php echo $style;?>><?php echo $attribute['Event']['id'];?></a>
</div>
</td>
<?php if ('true' == Configure::read('MISP.showorg') || $isAdmin): ?>
<?php if (Configure::read('MISP.showorg') || $isAdmin): ?>
<td class="short" onclick="document.location.href ='/events/view/<?php echo $attribute['Event']['id'];?>'">
<?php
$imgRelativePath = 'orgs' . DS . h($attribute['Event']['orgc']) . '.png';

View File

@ -8,7 +8,7 @@
echo $this->Form->input('keyword2', array('type' => 'textarea', 'label' => 'Being attributes of the following event IDs', 'div' => 'clear', 'class' => 'input-xxlarge'));
?>
<?php
if ('true' == Configure::read('MISP.showorg') || $isAdmin)
if (Configure::read('MISP.showorg') || $isAdmin)
echo $this->Form->input('org', array(
'type' => 'textarea',
'label' => 'From the following organisation(s)',

View File

@ -16,21 +16,21 @@
echo $this->Form->input('type', array(
'empty' => '(first choose category)'
));
if ('true' == Configure::read('MISP.sync')) {
$initialDistribution = 3;
if (Configure::read('MISP.default_attribute_distribution') != null) {
if (Configure::read('MISP.default_attribute_distribution') === 'event') {
$initialDistribution = $event['Event']['distribution'];
} else {
$initialDistribution = Configure::read('MISP.default_attribute_distribution');
}
$initialDistribution = 3;
if (Configure::read('MISP.default_attribute_distribution') != null) {
if (Configure::read('MISP.default_attribute_distribution') === 'event') {
$initialDistribution = $event['Event']['distribution'];
} else {
$initialDistribution = Configure::read('MISP.default_attribute_distribution');
}
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => $initialDistribution,
));
}
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => $initialDistribution,
));
echo $this->Form->input('value', array(
'type' => 'textarea',
'error' => array('escape' => false),

View File

@ -12,12 +12,15 @@
<?php } ?>
</div>
<div class = "footerText footerCenterText">
<span> <?php if (isset($me)) echo Configure::read('MISP.footerversion'); else echo Configure::read('MISP.footer')?></span>
<?php
$footerText = Configure::read('MISP.footerpart1') . ' ' . Configure::read('MISP.footerpart2');
if (isset($me['id'])) $footerText = Configure::read('MISP.footerpart1') . ' version ' . $mispVersion . ' ' . Configure::read('MISP.footerpart2');
?>
<span> <?php echo $footerText; ?> </span>
</div>
<div class="pull-right" style="position:relative;">
<div class="pull-right" style="position:relative;padding-top:9px;z-index:2;">
<?php if (Configure::read('MISP.footer_logo')): ?>
<span class = "footerText footerRightText">Powered by: </span>
<img src="/img/<?php echo Configure::read('MISP.footer_logo')?>.png" style="height:40px;">
<img src="/img/<?php echo Configure::read('MISP.footer_logo');?>.png" style="height:24px;" />
<?php endif;?>
</div>
</div>

View File

@ -82,7 +82,7 @@
</ul>
</li>
<?php if (('true' == Configure::read('MISP.sync')) && ($isAclSync || $isAdmin)): ?>
<?php if ($isAclSync || $isAdmin): ?>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
Sync Actions

View File

@ -0,0 +1,30 @@
<table class="table table-hover table-condensed">
<tr>
<th>Test</th>
<th>Value</th>
<th>Description</th>
</tr>
<?php
$health = array(0 => 'Critical, your MISP instance requires immediate attention.', 1 => 'Issues found, it is recommended that you resolve them.', 2 => 'Good, but there are some optional settings that are incorrect / not set.', 3 => 'In perfect health.');
$colour = '';
if ($issues['overallHealth'] < 3) $colour = 'background-color:' . $priorityErrorColours[$issues['overallHealth']] . ';';
if ($issues['overallHealth'] == 0 || $issues['overallHealth'] == 2) $colour .= 'color:white;';
?>
<tr>
<td style="<?php echo $colour;?>">Overall health</td>
<td style="<?php echo $colour;?>"><?php echo h($health[$issues['overallHealth']]);?></td>
<td style="<?php echo $colour;?>">The overall health of your instance depends on the most severe unresolved issues.</td>
</tr>
<?php
foreach ($issues['errors'] as $k => $v):
$colour = '';
if ($k < 3 && $v['value'] > 0) $colour = 'background-color:' . $priorityErrorColours[$k] . ';';
if ($k == 0 || $k == 2) $colour .= 'color:white;';
?>
<tr>
<td style="<?php echo $colour; ?>"><?php echo h($priorities[$k]) . ' settings incorrectly or not set';?></td>
<td style="<?php echo $colour; ?>"><?php echo h($v['value']);?></td>
<td style="<?php echo $colour; ?>"><?php echo h($v['description']);?></td>
</tr>
<?php endforeach; ?>
</table>

View File

@ -0,0 +1,35 @@
<table class="table table-hover table-condensed">
<tr>
<th>Priority</th>
<th>Setting</th>
<th>Value</th>
<th>Description</th>
<th>Error Message</th>
<th>Actions</th>
</tr>
<?php
foreach ($finalSettings as $k => $setting):
$bgColour = '';
if (isset($setting['error']) && $setting['level'] < 3) {
$bgColour = 'background-color:' . $priorityErrorColours[$setting['level']] . ';';
if ($setting['level'] == 0 || $setting['level'] == 2) $bgColour .= 'color:white;';
}
if ($setting['level'] == 3) $bgColour = 'background-color:gray;color:white;';
if ($setting['test'] == 'testBool') $setting['value'] = ($setting['value'] === true ? 'true' : 'false');
?>
<tr>
<td class="short" style="<?php echo $bgColour; ?>"><?php echo h($priorities[$setting['level']]);?></td>
<td class="short" style="<?php echo $bgColour; ?>"><?php echo h($setting['setting']);?></td>
<?php if (isset($setting['editable']) && !$setting['editable']): ?>
<td id="setting_<?php echo $k; ?>_passive" class="short inline-field-solid" style="<?php echo $bgColour; ?>width:300px;"><?php echo h($setting['value']);?></td>
<?php else: ?>
<td id="setting_<?php echo $k; ?>_solid" class="short inline-field-solid" onClick="serverSettingsActivateField('<?php echo $setting['setting'];?>', '<?php echo $k;?>')" style="<?php echo $bgColour; ?>width:300px;"><?php echo h($setting['value']);?></td>
<td id="setting_<?php echo $k; ?>_placeholder" class="short hidden inline-field-placeholder" style="<?php echo $bgColour; ?>width:300px;"></td>
<?php endif; ?>
<td style="<?php echo $bgColour; ?>"><?php echo h($setting['description']);?></td>
<td class="short" style="<?php echo $bgColour; ?>"><?php if (isset($setting['error']) && $setting['level'] != 3) echo h($setting['errorMessage']); ?></td>
<td class="short" style="<?php echo $bgColour; ?>"></td>
</tr>
<?php
endforeach; ?>
</table>

View File

@ -0,0 +1,26 @@
<div class="tabMenuFixedContainer">
<span class="tabMenuFixed tabMenuFixedLeft tabMenuSides">
<a href = "/servers/serverSettings/" id="create-button" title="Modify filters" class="discrete">Overview</a>
</span>
<?php
$i = 0;
foreach ($tabs as $k => $tab):
$extra = '';
if ($i == (count($tabs) -1)) $extra = "tabMenuFixedRight";
$label = ucfirst($k) . ' settings';
$severity = '';
if ($tab['severity'] == 0) $severity = 'style="color:red;"';
?>
<span class="tabMenuFixed tabMenuFixedLeft <?php echo h($extra); ?> tabMenuSides">
<a href = "/servers/serverSettings/<?php echo h($k); ?>" id="create-button" title="Modify filters" class="discrete">
<?php
echo h($label);
if ($tab['errors'] > 0) echo '<span ' . $severity . '> (' . $tab['errors'] . ')</span>';
?>
</a>
</span>
<?php
$i++;
endforeach;
?>
</div>

View File

@ -11,13 +11,11 @@
if (Configure::read('MISP.default_event_distribution') != null) {
$initialDistribution = Configure::read('MISP.default_event_distribution');
}
if ('true' == Configure::read('MISP.sync')) {
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => $initialDistribution,
));
}
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => $initialDistribution,
));
echo $this->Form->input('threat_level_id', array(
'div' => 'input clear'
));

View File

@ -12,12 +12,10 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
'type' => 'text',
'class' => 'datepicker'
));
if ('true' == Configure::read('MISP.sync')) {
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
));
}
echo $this->Form->input('threat_level_id', array(
'div' => 'input clear'
));

View File

@ -44,7 +44,7 @@
<?php echo $this->Paginator->sort('published');?>
</th>
<?php
if ('true' == Configure::read('MISP.showorg') || $isAdmin): ?>
if (Configure::read('MISP.showorg') || $isAdmin): ?>
<th class="filter"><?php echo $this->Paginator->sort('org'); ?></th>
<?php
endif;
@ -68,11 +68,9 @@
<?php echo $this->Paginator->sort('analysis');?>
</th>
<th class="filter"><?php echo $this->Paginator->sort('info');?></th>
<?php if ('true' == Configure::read('MISP.sync')): ?>
<th title="<?php echo $eventDescriptions['distribution']['desc'];?>">
<?php echo $this->Paginator->sort('distribution');?>
</th>
<?php endif; ?>
<th class="actions">Actions</th>
</tr>
@ -90,7 +88,7 @@
<?php
}?>&nbsp;
</td>
<?php if ('true' == Configure::read('MISP.showorg') || $isAdmin): ?>
<?php if (Configure::read('MISP.showorg') || $isAdmin): ?>
<td class="short" onclick="document.location.href ='/events/view/<?php echo $event['Event']['id'];?>'">
<?php
$imgRelativePath = 'orgs' . DS . h($event['Event']['orgc']) . '.png';
@ -148,11 +146,9 @@
<td onclick="location.href ='/events/view/<?php echo $event['Event']['id'];?>'">
<?php echo nl2br(h($event['Event']['info'])); ?>&nbsp;
</td>
<?php if ('true' == Configure::read('MISP.sync')): ?>
<td class="short <?php if ($event['Event']['distribution'] == 0) echo 'privateRedText';?>" onclick="location.href ='/events/view/<?php echo $event['Event']['id'];?>'" title = "<?php echo $event['Event']['distribution'] != 3 ? $distributionLevels[$event['Event']['distribution']] : 'All';?>">
<?php echo $shortDist[$event['Event']['distribution']]; ?>
</td>
<?php endif; ?>
<td class="short action-links">
<?php
if (0 == $event['Event']['published'] && ($isSiteAdmin || ($isAclPublish && $event['Event']['org'] == $me['org'])))

View File

@ -7,7 +7,7 @@ foreach ($events as $key => &$event) {
// cleanup the array from things we do not want to expose
unset($events[$key]['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($events[$key]['org']);
unset($events[$key]['orgc']);
unset($events[$key]['from']);

View File

@ -10,7 +10,7 @@ foreach ($results as $result) {
//
unset($result['Event']['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isSiteAdmin) {
if (!Configure::read('MISP.showorg') && !$isSiteAdmin) {
unset($result['Event']['org']);
unset($result['Event']['orgc']);
unset($result['Event']['from']);
@ -30,7 +30,7 @@ foreach ($results as $result) {
if (isset($result['Event']['RelatedEvent'])) {
foreach ($result['Event']['RelatedEvent'] as $key => $value) {
unset($result['Event']['RelatedEvent'][$key]['user_id']);
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($result['Event']['RelatedEvent'][$key]['org']);
unset($result['Event']['RelatedEvent'][$key]['orgc']);
}

View File

@ -6,7 +6,7 @@ unset($event['ShadowAttribute']);
unset($event['Event']['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($event['Event']['org']);
unset($event['Event']['orgc']);
unset($event['Event']['from']);
@ -21,7 +21,7 @@ foreach ($event['Event']['Attribute'] as $key => $value) {
if (isset($event['Event']['RelatedEvent'])) {
foreach ($event['Event']['RelatedEvent'] as $key => $value) {
unset($event['Event']['RelatedEvent'][$key]['user_id']);
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($event['Event']['RelatedEvent'][$key]['org']);
unset($event['Event']['RelatedEvent'][$key]['orgc']);
}

View File

@ -32,11 +32,9 @@
<th class="filter">
<?php echo $this->Paginator->sort('info');?>
</th>
<?php if ('true' == Configure::read('MISP.sync')): ?>
<th title="<?php echo $eventDescriptions['distribution']['desc'];?>">
<?php echo $this->Paginator->sort('distribution');?>
</th>
<?php endif; ?>
</tr>
<?php foreach ($events as $event):?>
<tr <?php if($event['Event']['distribution'] == 0) echo 'class = "privateRed"'?>>
@ -80,11 +78,9 @@
<td onclick="location.href ='/events/view/<?php echo $event['Event']['id'];?>'">
<?php echo nl2br(h($event['Event']['info'])); ?>&nbsp;
</td>
<?php if ('true' == Configure::read('MISP.sync')): ?>
<td class="short <?php if ($event['Event']['distribution'] == 0) echo 'privateRedText';?>" onclick="location.href ='/events/view/<?php echo $event['Event']['id'];?>'">
<?php echo $event['Event']['distribution'] != 3 ? $distributionLevels[$event['Event']['distribution']] : 'All';?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</table>

View File

@ -10,7 +10,7 @@ foreach ($results as $result) {
//
unset($result['Event']['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isSiteAdmin) {
if (!Configure::read('MISP.showorg') && !$isSiteAdmin) {
unset($result['Event']['org']);
unset($result['Event']['orgc']);
unset($result['Event']['from']);
@ -30,7 +30,7 @@ foreach ($results as $result) {
if (isset($result['Event']['RelatedEvent'])) {
foreach ($result['Event']['RelatedEvent'] as $key => $value) {
unset($result['Event']['RelatedEvent'][$key]['user_id']);
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($result['Event']['RelatedEvent'][$key]['org']);
unset($result['Event']['RelatedEvent'][$key]['orgc']);
}

View File

@ -7,7 +7,7 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
?>
<div class="events view">
<?php
if ('true' == Configure::read('MISP.showorg') || $isAdmin) {
if (Configure::read('MISP.showorg') || $isAdmin) {
echo $this->element('img', array('id' => $event['Event']['orgc']));
$left = true;
}
@ -28,7 +28,7 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
<?php echo h($event['Event']['uuid']); ?>
&nbsp;
</dd>
<?php if ('true' == Configure::read('MISP.showorg') || $isAdmin): ?>
<?php if (Configure::read('MISP.showorg') || $isAdmin): ?>
<dt>Org</dt>
<dd>
<?php echo h($event['Event']['orgc']); ?>
@ -46,7 +46,7 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
<dd>
<?php
foreach($logEntries as $k => $entry) {
if ('true' == Configure::read('MISP.showorg') || $isAdmin) {
if (Configure::read('MISP.showorg') || $isAdmin) {
?>
<a href="/logs/event_index/<?php echo $event['Event']['id'] . '/' . h($entry['Log']['org']);?>" style="margin-right:2px;text-decoration: none;">
<?php

View File

@ -12,7 +12,7 @@ foreach ($results as $result) {
//
unset($result['Event']['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isSiteAdmin) {
if (!Configure::read('MISP.showorg') && !$isSiteAdmin) {
unset($result['Event']['org']);
unset($result['Event']['orgc']);
unset($result['Event']['from']);
@ -37,7 +37,7 @@ foreach ($results as $result) {
unset($result['Event']['RelatedEvent'][$key]['Event']);
$result['Event']['RelatedEvent'][$key]['Event'][0] = $temp;
unset($result['Event']['RelatedEvent'][$key]['Event'][0]['user_id']);
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($result['Event']['RelatedEvent'][$key]['Event'][0]['org']);
unset($result['Event']['RelatedEvent'][$key]['Event'][0]['orgc']);
}

View File

@ -12,15 +12,8 @@ foreach ($event['Event']['Attribute'] as $key => $value) {
unset($event['Event']['Attribute'][$key]['category_order']);
}
// hide the private fields is we are not in sync mode
if ('true' != Configure::read('MISP.sync')) {
unset($event['Event']['private']);
foreach ($event['Event']['Attribute'] as $key => $value) {
unset($event['Event']['Attribute'][$key]['private']);
}
}
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($event['Event']['org']);
}

View File

@ -10,7 +10,7 @@ foreach ($events as $key => $event) {
// cleanup the array from things we do not want to expose
unset($events[$key]['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($events[$key]['org']);
unset($events[$key]['orgc']);
unset($events[$key]['from']);

View File

@ -10,7 +10,7 @@ foreach ($results as $result) {
//
unset($result['Event']['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isSiteAdmin) {
if (!Configure::read('MISP.showorg') && !$isSiteAdmin) {
unset($result['Event']['org']);
unset($result['Event']['orgc']);
unset($result['Event']['from']);
@ -30,7 +30,7 @@ foreach ($results as $result) {
if (isset($result['Event']['RelatedEvent'])) {
foreach ($result['Event']['RelatedEvent'] as $key => $value) {
unset($result['Event']['RelatedEvent'][$key]['user_id']);
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($result['Event']['RelatedEvent'][$key]['org']);
unset($result['Event']['RelatedEvent'][$key]['orgc']);
}

View File

@ -18,7 +18,7 @@ if (isset($relatedEvents)) {
//
unset($event['Event']['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($event['Event']['org']);
unset($event['Event']['orgc']);
unset($event['Event']['from']);
@ -33,7 +33,7 @@ foreach ($event['Event']['Attribute'] as $key => $value) {
if (isset($event['Event']['RelatedEvent'])) {
foreach ($event['Event']['RelatedEvent'] as $key => $value) {
unset($event['Event']['RelatedEvent'][$key]['user_id']);
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($event['Event']['RelatedEvent'][$key]['org']);
unset($event['Event']['RelatedEvent'][$key]['orgc']);
}

View File

@ -12,7 +12,7 @@ foreach ($results as $result) {
//
unset($result['Event']['user_id']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isSiteAdmin) {
if (!Configure::read('MISP.showorg') && !$isSiteAdmin) {
unset($result['Event']['org']);
unset($result['Event']['orgc']);
unset($result['Event']['from']);
@ -37,7 +37,7 @@ foreach ($results as $result) {
unset($result['Event']['RelatedEvent'][$key]['Event']);
$result['Event']['RelatedEvent'][$key]['Event'][0] = $temp;
unset($result['Event']['RelatedEvent'][$key]['Event'][0]['user_id']);
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($result['Event']['RelatedEvent'][$key]['Event'][0]['org']);
unset($result['Event']['RelatedEvent'][$key]['Event'][0]['orgc']);
}

View File

@ -0,0 +1,32 @@
<?php
echo $this->Form->create('Server', array('class' => 'inline-form inline-field-form', 'url' => '/servers/serverSettingsEdit/' . $setting['setting'], 'id' => 'setting_' . $id . '_form'));
?>
<div class='inline-input inline-input-container'>
<div class="inline-input-accept inline-input-button inline-input-passive"><span class = "icon-ok"></span></div>
<div class="inline-input-decline inline-input-button inline-input-passive"><span class = "icon-remove"></span></div>
<?php
if ($setting['test'] != 'testBool') {
echo $this->Form->input('value', array(
'type' => 'text',
'label' => false,
'value' => $setting['value'],
'error' => array('escape' => false),
'class' => 'inline-input',
'id' => 'setting_' . $id . '_field',
'div' => false
));
} else {
echo $this->Form->input('value', array(
'label' => false,
'options' => array(false => 'false', true => 'true'),
'value' => $setting['value'],
'class' => 'inline-input',
'id' => 'setting_' . $id . '_field',
'div' => false
));
}
?>
</div>
<?php
echo $this->Form->end();
?>

View File

@ -0,0 +1,14 @@
<div class="server index">
<h2>Server settings</h2>
<?php
echo $this->element('healthElements/tabs');
if (in_array($tab, array('MISP', 'Security', 'GnuPG', 'misc'))) {
echo $this->element('healthElements/settings_tab');
} else {
echo $this->element('healthElements/overview');
}
?>
</div>
<?php
echo $this->element('side_menu', array('menuList' => 'sync', 'menuItem' => 'index'));
?>

View File

@ -16,7 +16,7 @@ foreach ($proposal as &$temp) {
unset($temp['ShadowAttribute']['value1']);
unset($temp['ShadowAttribute']['value2']);
// hide the org field is we are not in showorg mode
if ('true' != Configure::read('MISP.showorg') && !$isAdmin) {
if (!Configure::read('MISP.showorg') && !$isAdmin) {
unset($temp['ShadowAttribute']['org']);
unset($temp['ShadowAttribute']['event_org']);
}

View File

@ -1282,6 +1282,12 @@ a.proposal_link_red:hover {
display:none;
}
a.discrete {
color:black;
text-decoration:none;
font-weight:normal;
}
@-webkit-keyframes rotation {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(359deg);}

View File

@ -219,22 +219,25 @@ function autoresize(textarea) {
// submit the form - this can be triggered by unfocusing the activated form field or by submitting the form (hitting enter)
// after the form is submitted, intercept the response and act on it
function submitForm(type, id, field, event) {
function submitForm(type, id, field, context) {
var object_type = 'attributes';
if (type == 'ShadowAttribute') object_type = 'shadow_attributes';
var action = "editField";
var name = '#' + type + '_' + id + '_' + field;
if (type == 'ShadowAttribute') {
object_type = 'shadow_attributes';
}
$.ajax({
data: $(name + '_field').closest("form").serialize(),
cache: false,
success:function (data, textStatus) {
handleAjaxEditResponse(data, name, type, id, field, event);
handleAjaxEditResponse(data, name, type, id, field, context);
},
error:function() {
showMessage('fail', 'Request failed for an unknown reason.');
updateIndex(event, 'event');
updateIndex(context, 'event');
},
type:"post",
url:"/" + object_type + "/editField/" + id
url:"/" + object_type + "/" + action + "/" + id
});
$(name + '_field').unbind("keyup");
$(name + '_form').unbind("focusout");
@ -1176,3 +1179,80 @@ function expandPagination(bottom, right) {
$("#" + prefix + "page" + i).show();
}
}
function serverSettingsActivateField(setting, id) {
resetForms();
$('.inline-field-placeholder').hide();
var fieldName = "#setting_" + id;
$.ajax({
beforeSend: function (XMLHttpRequest) {
$(".loading").show();
},
dataType:"html",
cache: false,
success:function (data, textStatus) {
$(".loading").hide();
$(fieldName + "_placeholder").html(data);
$(fieldName + "_solid").hide();
$(fieldName + "_placeholder").show();
serverSettingsPostActivationScripts(fieldName, setting, id);
},
url:"/servers/serverSettingsEdit/" + setting + "/" + id,
});
}
function serverSettingsPostActivationScripts(name, setting, id) {
$(name + '_field').focus();
inputFieldButtonActive(name + '_field');
$(name + '_form').submit(function(e){
e.preventDefault();
serverSettingSubmitForm(name, setting, id);
return false;
});
$(name + '_form').bind("focusout", function() {
inputFieldButtonPassive(name + '_field');
});
$(name + '_form').bind("focusin", function(){
inputFieldButtonActive(name + '_field');
});
$(name + '_form').bind("keydown", function(e) {
if (e.ctrlKey && (e.keyCode == 13 || e.keyCode == 10)) {
serverSettingSubmitForm(name, setting, id);
}
});
$(name + '_field').closest('.inline-input-container').children('.inline-input-accept').bind('click', function() {
serverSettingSubmitForm(name, setting, id);
});
$(name + '_field').closest('.inline-input-container').children('.inline-input-decline').bind('click', function() {
resetForms();
$('.inline-field-placeholder').hide();
});
$(name + '_solid').hide();
}
function serverSettingSubmitForm(name, setting, id) {
var name = '#setting_' + id;
var formData = $(name + '_field').closest("form").serialize();
$.ajax({
data: formData,
cache: false,
success:function (data, textStatus) {
window.location.reload();
},
error:function() {
showMessage('fail', 'Request failed for an unknown reason.');
resetForms();
$('.inline-field-placeholder').hide();
},
type:"post",
url:"/servers/serverSettingsEdit/" + setting + "/" + id + "/" + 1
});
$(name + '_field').unbind("keyup");
$(name + '_form').unbind("focusout");
return false;
};