mirror of https://github.com/MISP/MISP
new: Added User and Organisation addition/change data to the ZMQ feed
parent
bc9aa60577
commit
bce780090f
|
@ -92,6 +92,15 @@ class PubSubTool {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function modified($data, $type) {
|
||||
$settings = $this->__setupPubServer();
|
||||
$redis = new Redis();
|
||||
$redis->connect($settings['redis_host'], $settings['redis_port']);
|
||||
$redis->select($settings['redis_database']);
|
||||
$redis->rPush($settings['redis_namespace'] . ':data:misp_json_' . $type, json_encode($data, JSON_PRETTY_PRINT));
|
||||
return true;
|
||||
}
|
||||
|
||||
public function killService($settings = false) {
|
||||
$redis = new Redis();
|
||||
if ($this->checkIfRunning()) {
|
||||
|
|
|
@ -98,6 +98,15 @@ class Organisation extends AppModel{
|
|||
return true;
|
||||
}
|
||||
|
||||
public function afterSave($created, $options = array()) {
|
||||
if (Configure::read('Plugin.ZeroMQ_enable') && Configure::read('Plugin.ZeroMQ_organisation_notifications_enable')) {
|
||||
App::uses('PubSubTool', 'Tools');
|
||||
$pubSubTool = new PubSubTool();
|
||||
$pubSubTool->modified($this->data, 'organisation');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function captureOrg($org, $user, $force = false) {
|
||||
if (is_array($org)) {
|
||||
if (isset($org['uuid']) && !empty($org['uuid'])) {
|
||||
|
|
|
@ -1150,6 +1150,22 @@ class Server extends AppModel {
|
|||
'test' => 'testBool',
|
||||
'type' => 'boolean'
|
||||
),
|
||||
'ZeroMQ_user_notifications_enable' => array(
|
||||
'level' => 2,
|
||||
'description' => 'Enables or disables the publishing of new/modified users to the ZMQ pubsub feed.',
|
||||
'value' => false,
|
||||
'errorMessage' => '',
|
||||
'test' => 'testBool',
|
||||
'type' => 'boolean'
|
||||
),
|
||||
'ZeroMQ_organisation_notifications_enable' => array(
|
||||
'level' => 2,
|
||||
'description' => 'Enables or disables the publishing of new/modified organisations to the ZMQ pubsub feed.',
|
||||
'value' => false,
|
||||
'errorMessage' => '',
|
||||
'test' => 'testBool',
|
||||
'type' => 'boolean'
|
||||
),
|
||||
'Sightings_enable' => array(
|
||||
'level' => 1,
|
||||
'description' => 'Enables or disables the sighting functionality. When enabled, users can use the UI or the appropriate APIs to submit sightings data about indicators.',
|
||||
|
|
|
@ -256,6 +256,20 @@ class User extends AppModel {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function afterSave($created, $options = array()) {
|
||||
if (Configure::read('Plugin.ZeroMQ_enable') && Configure::read('Plugin.ZeroMQ_user_notifications_enable')) {
|
||||
App::uses('PubSubTool', 'Tools');
|
||||
$pubSubTool = new PubSubTool();
|
||||
$user = $this->data;
|
||||
if (isset($user['User']['password'])) {
|
||||
unset($user['User']['password']);
|
||||
unset($user['User']['confirm_password']);
|
||||
}
|
||||
$pubSubTool->modified($user, 'organisation');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Checks if the GPG key is a valid key, but also import it in the keychain.
|
||||
// TODO: this will NOT fail on keys that can only be used for signing but not encryption!
|
||||
// the method in verifyUsers will fail in that case.
|
||||
|
|
Loading…
Reference in New Issue