mirror of https://github.com/MISP/MISP
parent
4f234d1d46
commit
f5488e653f
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
class DbCorrelationSchema extends CakeSchema {
|
||||
|
||||
public $name = 'DbCorrelation';
|
||||
|
||||
public function before($event = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function after($event = array()) {
|
||||
}
|
||||
|
||||
public $correlations = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
||||
'1_event_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'1_attribute_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'1_private' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
||||
'event_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'attribute_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'org' => array('type' => 'string', 'null' => false, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'private' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'cluster' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'date' => array('type' => 'date', 'null' => false, 'default' => NULL),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
class DbWhitelistSchema extends CakeSchema {
|
||||
|
||||
public $name = 'DbWhitelist';
|
||||
|
||||
public function before($event = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function after($event = array()) {
|
||||
}
|
||||
|
||||
public $whitelists = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
||||
'name' => array('type' => 'text', 'null' => false, 'default' => NULL, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
}
|
|
@ -20,14 +20,15 @@ class AppSchema extends CakeSchema {
|
|||
public $attributes = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
||||
'event_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'type' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
||||
'category' => array('type' => 'string', 'null' => false, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'type' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
||||
'value1' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'value2' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'to_ids' => array('type' => 'boolean', 'null' => false, 'default' => '1'),
|
||||
'uuid' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'revision' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 10),
|
||||
'private' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'value2' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'cluster' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'event_id' => array('column' => 'event_id', 'unique' => 0), 'uuid' => array('column' => 'uuid', 'unique' => 0)),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
|
@ -38,16 +39,33 @@ class AppSchema extends CakeSchema {
|
|||
'indexes' => array(),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
public $correlations = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
||||
'1_event_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'1_attribute_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'1_private' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
||||
'event_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'attribute_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'),
|
||||
'org' => array('type' => 'string', 'null' => false, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'private' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'cluster' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'uuid' => array('column' => 'uuid', 'unique' => 0), 'info' => array('column' => 'info', 'unique' => 0)),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
public $events = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
||||
'org' => array('type' => 'string', 'null' => false, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'date' => array('type' => 'date', 'null' => false, 'default' => NULL),
|
||||
//'risk' ENUM
|
||||
'info' => array('type' => 'text', 'null' => false, 'default' => NULL, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
||||
'user_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
|
||||
'alerted' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
||||
'uuid' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'private' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'published' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
||||
'uuid' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'revision' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'private' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'cluster' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'attribute_count' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 11),
|
||||
//'alerted' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'uuid' => array('column' => 'uuid', 'unique' => 0), 'info' => array('column' => 'info', 'unique' => 0)),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
|
@ -56,9 +74,12 @@ class AppSchema extends CakeSchema {
|
|||
'url' => array('type' => 'string', 'null' => false, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'authkey' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 40, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'org' => array('type' => 'string', 'null' => false, 'default' => NULL, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'organization' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 10, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
||||
'push' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'pull' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
|
||||
'lastfetchedid' => array('type' => 'integer', 'null' => false, 'default' => NULL),
|
||||
//'lastfetchedid' => array('type' => 'integer', 'null' => false, 'default' => NULL),
|
||||
'lastpulledid' => array('type' => 'integer', 'null' => false, 'default' => NULL),
|
||||
'lastpushedid' => array('type' => 'integer', 'null' => false, 'default' => NULL),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
|
@ -78,4 +99,10 @@ class AppSchema extends CakeSchema {
|
|||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'username' => array('column' => 'password', 'unique' => 0)),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
public $whitelists = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
||||
'name' => array('type' => 'text', 'null' => false, 'default' => NULL, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
||||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
||||
);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,12 @@ cd ${PRJCT}
|
|||
./Console/cake acl create aco root controllers
|
||||
./Console/cake AclExtras.AclExtras aco_sync
|
||||
|
||||
# create Correlation table
|
||||
./Console/cake schema create DbCorrelation
|
||||
|
||||
# create Whitelist table
|
||||
./Console/cake schema create DbWhitelist
|
||||
|
||||
# update Schema, add Users.group_id
|
||||
./Console/cake schema update -s 0.2.2.1
|
||||
|
||||
|
|
Loading…
Reference in New Issue