From b178358f2a59ba4e9ff014bb7a84cc0c65d02d93 Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 10 Sep 2014 11:48:48 +0200 Subject: [PATCH] Default config.php added --- .gitignore | 1 + app/Config/bootstrap.default.php | 3 +- app/Config/config.default.php | 41 +++++++++++++++++++ app/Controller/ShadowAttributesController.php | 2 +- app/Lib/Export/NidsExport.php | 2 +- app/Model/Event.php | 6 +-- app/Model/Server.php | 41 +++++++++++++++++-- app/View/Layouts/default.ctp | 2 +- 8 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 app/Config/config.default.php diff --git a/.gitignore b/.gitignore index 255232f83..2d1ef6de9 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ /app/Config/bootstrap.php /app/Config/database.php /app/Config/core.php +/app/Config/config.php /cakephp /app/webroot/gpg.asc /app/tmp/logs diff --git a/app/Config/bootstrap.default.php b/app/Config/bootstrap.default.php index dda88ab2d..cf2267a1e 100755 --- a/app/Config/bootstrap.default.php +++ b/app/Config/bootstrap.default.php @@ -84,7 +84,8 @@ */ Cache::config('default', array('engine' => 'File')); -Configure::write('MISP.baseurl', 'http://localhost:8888'); + + if (!Configure::read('MISP.baseurl')) { if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { Configure::write('MISP.baseurl', sprintf('https://%s:%d', $_SERVER['SERVER_ADDR'], $_SERVER['SERVER_PORT'])); diff --git a/app/Config/config.default.php b/app/Config/config.default.php new file mode 100644 index 000000000..60d10c69a --- /dev/null +++ b/app/Config/config.default.php @@ -0,0 +1,41 @@ + 0, + 'Security' => + array ( + 'level' => 'medium', + 'salt' => 'Rooraenietu8Eeyo '', + ), + 'MISP' => + array ( + 'baseurl' => '', + 'footerpart1' => 'Powered by MISP', + 'footerpart2' => '© Belgian Defense CERT & NCIRC', + 'org' => 'ORGNAME', + 'showorg' => true, + 'background_jobs' => true, + 'cached_attachments' => false, + 'email' => 'email@address.com', + 'contact' => 'email@address.com', + 'cveurl' => 'http://web.nvd.nist.gov/view/vuln/detail?vulnId=', + 'disablerestalert' => false, + 'default_event_distribution' => '0', + 'default_attribute_distribution' => 'event', + 'tagging' => true, + 'full_tags_on_event_index' => true, + 'footer_logo' => '', + ), + 'GnuPG' => + array ( + 'onlyencrypted' => false, + 'email' => '', + 'homedir' => '', + 'password' => '', + ), + 'SecureAuth' => + array ( + 'amount' => 5, + 'expire' => 300, + ), +); diff --git a/app/Controller/ShadowAttributesController.php b/app/Controller/ShadowAttributesController.php index 2ea4483cf..51769f3ab 100644 --- a/app/Controller/ShadowAttributesController.php +++ b/app/Controller/ShadowAttributesController.php @@ -751,7 +751,7 @@ class ShadowAttributesController extends AppController { // prepare the email $this->Email->from = Configure::read('MISP.email'); $this->Email->to = $reporter['User']['email']; - $this->Email->subject = "[" . Configure::read('MISP.org') . " " . Configure::read('MISP.name') . "] Proposal to event #" . $id; + $this->Email->subject = "[" . Configure::read('MISP.org') . " MISP] Proposal to event #" . $id; $this->Email->template = 'body'; $this->Email->sendAs = 'text'; // both text or html $this->set('body', $bodyEncSig); diff --git a/app/Lib/Export/NidsExport.php b/app/Lib/Export/NidsExport.php index c74fe2a39..5dabde4ad 100644 --- a/app/Lib/Export/NidsExport.php +++ b/app/Lib/Export/NidsExport.php @@ -53,7 +53,7 @@ class NidsExport { }*/ # proto src_ip src_port direction dst_ip dst_port msg rule_content tag sid rev - $ruleFormatMsg = 'msg: "' . Configure::read('MISP.name') . ' e' . $item['Event']['id'] . ' %s"'; + $ruleFormatMsg = 'msg: "MISP e' . $item['Event']['id'] . ' %s"'; $ruleFormatReference = 'reference:url,' . Configure::read('MISP.baseurl') . '/events/view/' . $item['Event']['id']; $ruleFormat = '%salert %s %s %s %s %s %s (' . $ruleFormatMsg . '; %s %s classtype:' . $this->classtype . '; sid:%d; rev:%d; priority:' . $item['Event']['threat_level_id'] . '; ' . $ruleFormatReference . ';) '; diff --git a/app/Model/Event.php b/app/Model/Event.php index 1d6bc6e48..e2065309f 100755 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -1160,7 +1160,7 @@ class Event extends AppModel { $Email = new CakeEmail(); $Email->from(Configure::read('MISP.email')); $Email->to($user['User']['email']); - $Email->subject("[" . Configure::read('MISP.org') . " " . Configure::read('MISP.name') . "] Event " . $id . " - " . $subject . $event['ThreatLevel']['name'] . " - TLP Amber"); + $Email->subject("[" . Configure::read('MISP.org') . " MISP] Event " . $id . " - " . $subject . $event['ThreatLevel']['name'] . " - TLP Amber"); $Email->emailFormat('text'); // both text or html // send it $Email->send($bodySigned); @@ -1192,7 +1192,7 @@ class Event extends AppModel { $Email = new CakeEmail(); $Email->from(Configure::read('MISP.email')); $Email->to($user['User']['email']); - $Email->subject("[" . Configure::read('MISP.org') . " " . Configure::read('MISP.name') . "] Event " . $id . " - " . $subject . " - " . $event['ThreatLevel']['name'] . " - TLP Amber"); + $Email->subject("[" . Configure::read('MISP.org') . " MISP] Event " . $id . " - " . $subject . " - " . $event['ThreatLevel']['name'] . " - TLP Amber"); $Email->emailFormat('text'); // both text or html // import the key of the user into the keyring // this is not really necessary, but it enables us to find @@ -1338,7 +1338,7 @@ class Event extends AppModel { $Email->from(Configure::read('MISP.email')); $Email->replyTo($user['User']['email']); $Email->to($reporter['User']['email']); - $Email->subject("[" . Configure::read('MISP.org') . " " . Configure::read('MISP.name') . "] Need info about event " . $id . " - TLP Amber"); + $Email->subject("[" . Configure::read('MISP.org') . " MISP] Need info about event " . $id . " - TLP Amber"); //$this->Email->delivery = 'debug'; // do not really send out mails, only display it on the screen $Email->emailFormat('text'); // both text or html diff --git a/app/Model/Server.php b/app/Model/Server.php index be328a834..2123ff798 100755 --- a/app/Model/Server.php +++ b/app/Model/Server.php @@ -109,15 +109,15 @@ class Server extends AppModel { 'branch' => 1, 'baseurl' => array( 'level' => 0, - 'description' => 'The base url of the application (such as https://www.mymispinstance.com)', + 'description' => 'The base url of the application (in the format https://www.mymispinstance.com). Several features depend on this setting being correctly set to function.', '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)', + 'level' => 3, + 'description' => 'This setting is deprecated and can be safely removed.', 'value' => '', 'errorMessage' => '', 'test' => 'testForEmpty', @@ -317,6 +317,38 @@ class Server extends AppModel { 'test' => 'testBool', 'type' => 'boolean', ), + 'welcome_text_top' => array( + 'level' => 2, + 'description' => 'Used on the login page, before the MISP logo', + 'value' => '', + 'errorMessage' => '', + 'test' => '', + 'type' => '', + ), + 'welcome_text_bottom' => array( + 'level' => 2, + 'description' => 'Used on the login page, after the MISP logo', + 'value' => '', + 'errorMessage' => '', + 'test' => '', + 'type' => '', + ), + 'welcome_logo' => array( + 'level' => 2, + 'description' => 'Used on the login page, to the left of the MISP logo, place a .png file in app/webroot/img with the name specified here.', + 'value' => '', + 'errorMessage' => '', + 'test' => '', + 'type' => '', + ), + 'welcome_logo2' => array( + 'level' => 2, + 'description' => 'Used on the login page, to the right of the MISP logo, place a .png file in app/webroot/img with the name specified here.', + 'value' => '', + 'errorMessage' => '', + 'test' => '', + 'type' => '', + ), ), 'GnuPG' => array( 'branch' => 1, @@ -812,6 +844,7 @@ class Server extends AppModel { foreach ($serverSettings as $branchKey => &$branchValue) { if (isset($branchValue['branch'])) { foreach ($branchValue as $leafKey => &$leafValue) { + if ($leafValue['level'] == 3 && !(isset($currentSettings[$branchKey][$leafKey]))) continue; $setting = null; if (isset($currentSettings[$branchKey][$leafKey])) $setting = $currentSettings[$branchKey][$leafKey]; $leafValue = $this->__evaluateLeaf($leafValue, $leafKey, $setting); @@ -895,6 +928,6 @@ class Server extends AppModel { public function serverSettingsSaveValue($setting, $value) { Configure::write($setting, $value); - Configure::dump('settings.php', 'default', array('MISP', 'GnuPG', 'SecureAuth', 'Security', 'debug')); + Configure::dump('config.php', 'default', array('MISP', 'GnuPG', 'SecureAuth', 'Security', 'debug')); } } diff --git a/app/View/Layouts/default.ctp b/app/View/Layouts/default.ctp index 04192c10a..a2da00bf9 100755 --- a/app/View/Layouts/default.ctp +++ b/app/View/Layouts/default.ctp @@ -4,7 +4,7 @@ Html->charset(); ?> - <?php echo $title_for_layout, ' - ', Configure::read('MISP.name')?> + <?php echo $title_for_layout, ' - MISP'; ?> Html->meta('icon');