mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 18:05:20 +00:00
Merged 3.6-6.4
This commit is contained in:
parent
947b1a8cc6
commit
bc70f81972
@ -340,7 +340,7 @@ class AgentsController {
|
||||
? packagesDate.items[0].scan_time
|
||||
: 'Unknown',
|
||||
processesDate:
|
||||
processesDate && processesDate.items && processesDate.items.length
|
||||
processesDate && processesDate.items && processesDate.items.length
|
||||
? processesDate.items[0].scan_time
|
||||
: 'Unknown'
|
||||
};
|
||||
|
@ -9,12 +9,12 @@
|
||||
*
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
import './management'
|
||||
import './configuration'
|
||||
import './new-configuration'
|
||||
import './status'
|
||||
import './logs'
|
||||
import './groups'
|
||||
import './rules'
|
||||
import './decoders'
|
||||
import './monitoring'
|
||||
import './management';
|
||||
import './configuration';
|
||||
import './new-configuration';
|
||||
import './status';
|
||||
import './logs';
|
||||
import './groups';
|
||||
import './rules';
|
||||
import './decoders';
|
||||
import './monitoring';
|
||||
|
@ -10,157 +10,179 @@
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
import { uiModules } from 'ui/modules';
|
||||
import angular from 'angular';
|
||||
import js2xmlparser from 'js2xmlparser';
|
||||
import angular from 'angular';
|
||||
import js2xmlparser from 'js2xmlparser';
|
||||
import XMLBeautifier from '../../utils/xml-beautifier';
|
||||
import beautifier from '../../utils/json-beautifier';
|
||||
import beautifier from '../../utils/json-beautifier';
|
||||
|
||||
const app = uiModules.get('app/wazuh', []);
|
||||
|
||||
class NewConfigurationController {
|
||||
constructor($scope, errorHandler, apiReq) {
|
||||
this.$scope = $scope;
|
||||
this.errorHandler = errorHandler;
|
||||
this.apiReq = apiReq;
|
||||
this.$scope.load = true;
|
||||
this.$scope.isArray = Array.isArray;
|
||||
this.configRaw = {};
|
||||
constructor($scope, errorHandler, apiReq) {
|
||||
this.$scope = $scope;
|
||||
this.errorHandler = errorHandler;
|
||||
this.apiReq = apiReq;
|
||||
this.$scope.load = true;
|
||||
this.$scope.isArray = Array.isArray;
|
||||
this.configRaw = {};
|
||||
|
||||
this.$scope.configurationTab = '';
|
||||
this.$scope.configurationSubTab = '';
|
||||
this.$scope.configurationSection = '';
|
||||
this.$scope.configurationTab = '';
|
||||
this.$scope.configurationSubTab = '';
|
||||
this.$scope.configurationSection = '';
|
||||
|
||||
this.$scope.getXML = name => this.getXML(name);
|
||||
this.$scope.getJSON = name => this.getJSON(name);
|
||||
this.$scope.switchConfigurationTab = configurationTab => this.switchConfigurationTab(configurationTab);
|
||||
this.$scope.switchConfigurationSubTab = configurationSubTab => this.switchConfigurationSubTab(configurationSubTab);
|
||||
this.$scope.switchConfigurationSection = configurationSection => this.switchConfigurationSection(configurationSection);
|
||||
}
|
||||
this.$scope.getXML = name => this.getXML(name);
|
||||
this.$scope.getJSON = name => this.getJSON(name);
|
||||
this.$scope.switchConfigurationTab = configurationTab =>
|
||||
this.switchConfigurationTab(configurationTab);
|
||||
this.$scope.switchConfigurationSubTab = configurationSubTab =>
|
||||
this.switchConfigurationSubTab(configurationSubTab);
|
||||
this.$scope.switchConfigurationSection = configurationSection =>
|
||||
this.switchConfigurationSection(configurationSection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
$onInit() {
|
||||
this.load();
|
||||
}
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
$onInit() {
|
||||
this.load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Switchs between configuration tabs
|
||||
* @param {*} configurationTab
|
||||
*/
|
||||
switchConfigurationTab(configurationTab) {
|
||||
this.$scope.XMLContent = false;
|
||||
this.$scope.JSONContent = false;
|
||||
this.$scope.configurationSubTab = false;
|
||||
this.$scope.configurationSection = false;
|
||||
this.$scope.configurationTab = configurationTab;
|
||||
if(!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
/**
|
||||
* Switchs between configuration tabs
|
||||
* @param {*} configurationTab
|
||||
*/
|
||||
switchConfigurationTab(configurationTab) {
|
||||
this.$scope.XMLContent = false;
|
||||
this.$scope.JSONContent = false;
|
||||
this.$scope.configurationSubTab = false;
|
||||
this.$scope.configurationSection = false;
|
||||
this.$scope.configurationTab = configurationTab;
|
||||
if (!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Switchs between configuration sub-tabs
|
||||
* @param {*} configurationSubTab
|
||||
*/
|
||||
switchConfigurationSubTab(configurationSubTab) {
|
||||
this.$scope.XMLContent = false;
|
||||
this.$scope.JSONContent = false;
|
||||
this.$scope.configurationSection = false;
|
||||
this.$scope.configurationSubTab = configurationSubTab;
|
||||
if(!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
/**
|
||||
* Switchs between configuration sub-tabs
|
||||
* @param {*} configurationSubTab
|
||||
*/
|
||||
switchConfigurationSubTab(configurationSubTab) {
|
||||
this.$scope.XMLContent = false;
|
||||
this.$scope.JSONContent = false;
|
||||
this.$scope.configurationSection = false;
|
||||
this.$scope.configurationSubTab = configurationSubTab;
|
||||
if (!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Switchs between configuration sections
|
||||
* @param {*} configurationSection
|
||||
*/
|
||||
switchConfigurationSection(configurationSection) {
|
||||
this.$scope.XMLContent = false;
|
||||
this.$scope.JSONContent = false;
|
||||
this.$scope.configurationSection = configurationSection;
|
||||
if(!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
/**
|
||||
* Switchs between configuration sections
|
||||
* @param {*} configurationSection
|
||||
*/
|
||||
switchConfigurationSection(configurationSection) {
|
||||
this.$scope.XMLContent = false;
|
||||
this.$scope.JSONContent = false;
|
||||
this.$scope.configurationSection = configurationSection;
|
||||
if (!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns XML raw content for specific configuration
|
||||
* @param {string} name Name of the configuration section
|
||||
*/
|
||||
getXML(name) {
|
||||
this.$scope.JSONContent = false;
|
||||
if(this.$scope.XMLContent){
|
||||
this.$scope.XMLContent = false;
|
||||
/**
|
||||
* Assigns XML raw content for specific configuration
|
||||
* @param {string} name Name of the configuration section
|
||||
*/
|
||||
getXML(name) {
|
||||
this.$scope.JSONContent = false;
|
||||
if (this.$scope.XMLContent) {
|
||||
this.$scope.XMLContent = false;
|
||||
} else {
|
||||
try {
|
||||
if (name) {
|
||||
this.$scope.XMLContent = XMLBeautifier(
|
||||
js2xmlparser.parse(name, this.configRaw[name])
|
||||
);
|
||||
} else {
|
||||
try {
|
||||
if (name) {
|
||||
this.$scope.XMLContent = XMLBeautifier(js2xmlparser.parse(name, this.configRaw[name]));
|
||||
}
|
||||
else {
|
||||
this.$scope.XMLContent = XMLBeautifier(js2xmlparser.parse('configuration', this.configRaw));
|
||||
}
|
||||
} catch (error) { this.$scope.XMLContent = false; }
|
||||
this.$scope.XMLContent = XMLBeautifier(
|
||||
js2xmlparser.parse('configuration', this.configRaw)
|
||||
);
|
||||
}
|
||||
if(!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns JSON raw content for specific configuration
|
||||
* @param {string} name Name of the configuration section
|
||||
*/
|
||||
getJSON(name) {
|
||||
} catch (error) {
|
||||
this.$scope.XMLContent = false;
|
||||
if(this.$scope.JSONContent){
|
||||
this.$scope.JSONContent = false;
|
||||
} else {
|
||||
try {
|
||||
if (name) {
|
||||
this.$scope.JSONContent = beautifier.prettyPrint(this.configRaw[name]);
|
||||
}
|
||||
else {
|
||||
this.$scope.JSONContent = beautifier.prettyPrint(this.configRaw);
|
||||
}
|
||||
} catch (error) { this.$scope.JSONContent = false; }
|
||||
}
|
||||
if(!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
}
|
||||
if (!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetchs required data
|
||||
*/
|
||||
async load() {
|
||||
try{
|
||||
const data = await this.apiReq.request('GET', '/manager/configuration', {});
|
||||
Object.assign(this.configRaw, angular.copy(data.data.data))
|
||||
this.$scope.managerConfiguration = data.data.data;
|
||||
/**
|
||||
* Assigns JSON raw content for specific configuration
|
||||
* @param {string} name Name of the configuration section
|
||||
*/
|
||||
getJSON(name) {
|
||||
this.$scope.XMLContent = false;
|
||||
if (this.$scope.JSONContent) {
|
||||
this.$scope.JSONContent = false;
|
||||
} else {
|
||||
try {
|
||||
if (name) {
|
||||
this.$scope.JSONContent = beautifier.prettyPrint(
|
||||
this.configRaw[name]
|
||||
);
|
||||
} else {
|
||||
this.$scope.JSONContent = beautifier.prettyPrint(this.configRaw);
|
||||
}
|
||||
} catch (error) {
|
||||
this.$scope.JSONContent = false;
|
||||
}
|
||||
}
|
||||
if (!this.$scope.$$phase) this.$scope.$digest();
|
||||
}
|
||||
|
||||
if(this.$scope.managerConfiguration && this.$scope.managerConfiguration['active-response']){
|
||||
/**
|
||||
* Fetchs required data
|
||||
*/
|
||||
async load() {
|
||||
try {
|
||||
const data = await this.apiReq.request(
|
||||
'GET',
|
||||
'/manager/configuration',
|
||||
{}
|
||||
);
|
||||
Object.assign(this.configRaw, angular.copy(data.data.data));
|
||||
this.$scope.managerConfiguration = data.data.data;
|
||||
|
||||
for(const ar of this.$scope.managerConfiguration['active-response']) {
|
||||
const rulesArray = ar.rules_id ?
|
||||
ar.rules_id.split(',') :
|
||||
[];
|
||||
if(ar.rules_id && rulesArray.length > 1){
|
||||
const tmp = [];
|
||||
if (
|
||||
this.$scope.managerConfiguration &&
|
||||
this.$scope.managerConfiguration['active-response']
|
||||
) {
|
||||
for (const ar of this.$scope.managerConfiguration['active-response']) {
|
||||
const rulesArray = ar.rules_id ? ar.rules_id.split(',') : [];
|
||||
if (ar.rules_id && rulesArray.length > 1) {
|
||||
const tmp = [];
|
||||
|
||||
for(const id of rulesArray){
|
||||
const rule = await this.apiReq.request('GET',`/rules/${id}`,{});
|
||||
tmp.push(rule.data.data.items[0]);
|
||||
}
|
||||
|
||||
ar.rules = tmp;
|
||||
} else if(ar.rules_id){
|
||||
const rule = await this.apiReq.request('GET',`/rules/${ar.rules_id}`,{});
|
||||
ar.rule = rule.data.data.items[0];
|
||||
}
|
||||
}
|
||||
for (const id of rulesArray) {
|
||||
const rule = await this.apiReq.request('GET', `/rules/${id}`, {});
|
||||
tmp.push(rule.data.data.items[0]);
|
||||
}
|
||||
|
||||
this.$scope.load = false;
|
||||
if(!this.$scope.$$phase) this.$scope.$digest();
|
||||
return;
|
||||
} catch (error) {
|
||||
this.errorHandler.handle(error,'Manager');
|
||||
ar.rules = tmp;
|
||||
} else if (ar.rules_id) {
|
||||
const rule = await this.apiReq.request(
|
||||
'GET',
|
||||
`/rules/${ar.rules_id}`,
|
||||
{}
|
||||
);
|
||||
ar.rule = rule.data.data.items[0];
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.$scope.load = false;
|
||||
if (!this.$scope.$$phase) this.$scope.$digest();
|
||||
return;
|
||||
} catch (error) {
|
||||
this.errorHandler.handle(error, 'Manager');
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
app.controller('managementNewConfigurationController', NewConfigurationController);
|
||||
app.controller(
|
||||
'managementNewConfigurationController',
|
||||
NewConfigurationController
|
||||
);
|
||||
|
@ -16,7 +16,7 @@ import { TabNames } from '../../utils/tab-names';
|
||||
import { TabDescription } from '../../../server/reporting/tab-description';
|
||||
|
||||
import {
|
||||
metricsGeneral,
|
||||
metricsGeneral,
|
||||
metricsAudit,
|
||||
metricsVulnerability,
|
||||
metricsScap,
|
||||
|
@ -10,18 +10,18 @@
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
|
||||
import template from './wz-config-item.html';
|
||||
import template from './wz-config-item.html';
|
||||
import { uiModules } from 'ui/modules';
|
||||
|
||||
const app = uiModules.get('app/wazuh', []);
|
||||
|
||||
app.directive('wzConfigItem', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
label: '@label',
|
||||
value: '@value'
|
||||
},
|
||||
template: template
|
||||
}
|
||||
app.directive('wzConfigItem', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
label: '@label',
|
||||
value: '@value'
|
||||
},
|
||||
template: template
|
||||
};
|
||||
});
|
||||
|
@ -10,15 +10,15 @@
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
|
||||
import template from './wz-no-config.html';
|
||||
import template from './wz-no-config.html';
|
||||
import { uiModules } from 'ui/modules';
|
||||
|
||||
const app = uiModules.get('app/wazuh', []);
|
||||
|
||||
app.directive('wzNoConfig', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {},
|
||||
template: template
|
||||
}
|
||||
app.directive('wzNoConfig', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {},
|
||||
template: template
|
||||
};
|
||||
});
|
||||
|
@ -79,7 +79,7 @@ const metricsAws = {
|
||||
};
|
||||
|
||||
export default {
|
||||
metricsGeneral,
|
||||
metricsGeneral,
|
||||
metricsAudit,
|
||||
metricsVulnerability,
|
||||
metricsScap,
|
||||
|
@ -37,24 +37,23 @@ export const TabNames = {
|
||||
groups: 'Groups',
|
||||
monitoring: 'Monitoring',
|
||||
reporting: 'Reporting',
|
||||
"new-configuration": "New configuration (Beta)",
|
||||
"registration-service": "Registration service",
|
||||
"cluster": "Cluster",
|
||||
"wazuh-modules": "Wazuh modules",
|
||||
"commands-active-response": "Commands & Active response",
|
||||
"integrations": "Integrations",
|
||||
"database-output": "Database output",
|
||||
"alerts": "Alerts",
|
||||
"global-configuration": "Global configuration",
|
||||
"integrity-monitoring": "Integrity monitoring",
|
||||
"policy-monitoring": "Policy monitoring",
|
||||
"log-collection": "Log collection",
|
||||
"agentless": "Agentless",
|
||||
"inventory": "Inventory",
|
||||
"osquery": "Osquery",
|
||||
"open-scap": "OpenSCAP",
|
||||
"cis-cat": "CIS-CAT",
|
||||
"vulnerabilities": "Vulnerabilities",
|
||||
"amazon-s3": "Amazon S3"
|
||||
'new-configuration': 'New configuration (Beta)',
|
||||
'registration-service': 'Registration service',
|
||||
cluster: 'Cluster',
|
||||
'wazuh-modules': 'Wazuh modules',
|
||||
'commands-active-response': 'Commands & Active response',
|
||||
integrations: 'Integrations',
|
||||
'database-output': 'Database output',
|
||||
alerts: 'Alerts',
|
||||
'global-configuration': 'Global configuration',
|
||||
'integrity-monitoring': 'Integrity monitoring',
|
||||
'policy-monitoring': 'Policy monitoring',
|
||||
'log-collection': 'Log collection',
|
||||
agentless: 'Agentless',
|
||||
inventory: 'Inventory',
|
||||
osquery: 'Osquery',
|
||||
'open-scap': 'OpenSCAP',
|
||||
'cis-cat': 'CIS-CAT',
|
||||
vulnerabilities: 'Vulnerabilities',
|
||||
'amazon-s3': 'Amazon S3'
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user