From 619a2dc836c5a3ad364956910f0aa966b6d1383a Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Mon, 29 Apr 2024 20:24:22 +0200 Subject: [PATCH 1/4] Remove count label and PCI-DSS-Requirements-over-time redundant visualization --- .../components/visualize/visualizations.js | 9 - .../visualizations/agents/agents-gcp.ts | 206 +++++++++++++++--- .../visualizations/agents/agents-hipaa.ts | 2 +- .../visualizations/overview/overview-gdpr.ts | 2 +- .../visualizations/overview/overview-pci.ts | 137 ++---------- .../visualizations/overview/overview-pm.ts | 2 +- 6 files changed, 193 insertions(+), 165 deletions(-) diff --git a/plugins/main/public/components/visualize/visualizations.js b/plugins/main/public/components/visualize/visualizations.js index 79ff3d7bac..e842add600 100644 --- a/plugins/main/public/components/visualize/visualizations.js +++ b/plugins/main/public/components/visualize/visualizations.js @@ -260,15 +260,6 @@ export const visualizations = { }, ], }, - { - height: 300, - vis: [ - { - title: 'Top requirements over time', - id: 'Wazuh-App-Overview-PCI-DSS-Requirements-over-time', - }, - ], - }, { height: 530, vis: [ diff --git a/plugins/main/server/integration-files/visualizations/agents/agents-gcp.ts b/plugins/main/server/integration-files/visualizations/agents/agents-gcp.ts index 3e72fc5ef4..8ee6ab0b86 100644 --- a/plugins/main/server/integration-files/visualizations/agents/agents-gcp.ts +++ b/plugins/main/server/integration-files/visualizations/agents/agents-gcp.ts @@ -29,7 +29,13 @@ export default [ totalFunc: 'sum', }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '3', enabled: true, @@ -94,9 +100,19 @@ export default [ addLegend: true, legendPosition: 'right', isDonut: true, - labels: { show: false, values: true, last_level: true, truncate: 100 }, + labels: { + show: false, + values: true, + last_level: true, + truncate: 100, + }, dimensions: { - metric: { accessor: 1, format: { id: 'number' }, params: {}, aggType: 'count' }, + metric: { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, buckets: [ { accessor: 0, @@ -115,7 +131,13 @@ export default [ }, }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '2', enabled: true, @@ -160,10 +182,20 @@ export default [ minFontSize: 18, maxFontSize: 72, showLabel: true, - metric: { type: 'vis_dimension', accessor: 1, format: { id: 'string', params: {} } }, + metric: { + type: 'vis_dimension', + accessor: 1, + format: { id: 'string', params: {} }, + }, }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: { customLabel: '' } }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: { customLabel: '' }, + }, { id: '2', enabled: true, @@ -209,9 +241,19 @@ export default [ addLegend: true, legendPosition: 'right', isDonut: true, - labels: { show: false, values: true, last_level: true, truncate: 100 }, + labels: { + show: false, + values: true, + last_level: true, + truncate: 100, + }, dimensions: { - metric: { accessor: 1, format: { id: 'number' }, params: {}, aggType: 'count' }, + metric: { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, buckets: [ { accessor: 0, @@ -230,7 +272,13 @@ export default [ }, }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '2', enabled: true, @@ -275,9 +323,19 @@ export default [ addLegend: true, legendPosition: 'right', isDonut: true, - labels: { show: false, values: true, last_level: true, truncate: 100 }, + labels: { + show: false, + values: true, + last_level: true, + truncate: 100, + }, dimensions: { - metric: { accessor: 1, format: { id: 'number' }, params: {}, aggType: 'count' }, + metric: { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, buckets: [ { accessor: 0, @@ -296,7 +354,13 @@ export default [ }, }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '2', enabled: true, @@ -375,27 +439,50 @@ export default [ }, ], addTooltip: true, - addLegend: true, + addLegend: false, legendPosition: 'right', times: [], addTimeMarker: false, labels: { show: false }, - thresholdLine: { show: false, value: 10, width: 1, style: 'full', color: '#34130C' }, + thresholdLine: { + show: false, + value: 10, + width: 1, + style: 'full', + color: '#34130C', + }, dimensions: { x: { accessor: 0, format: { id: 'terms', - params: { id: 'string', otherBucketLabel: 'Other', missingBucketLabel: 'Missing' }, + params: { + id: 'string', + otherBucketLabel: 'Other', + missingBucketLabel: 'Missing', + }, }, params: {}, aggType: 'terms', }, - y: [{ accessor: 1, format: { id: 'number' }, params: {}, aggType: 'count' }], + y: [ + { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, + ], }, }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '2', enabled: true, @@ -476,11 +563,17 @@ export default [ }, ], addTooltip: true, - addLegend: true, + addLegend: false, legendPosition: 'right', times: [], addTimeMarker: false, - thresholdLine: { show: false, value: 10, width: 1, style: 'full', color: '#34130C' }, + thresholdLine: { + show: false, + value: 10, + width: 1, + style: 'full', + color: '#34130C', + }, labels: {}, dimensions: { x: { @@ -490,15 +583,31 @@ export default [ date: true, interval: 'P1D', format: 'YYYY-MM-DD', - bounds: { min: '2019-09-07T14:30:14.047Z', max: '2019-11-07T14:19:07.505Z' }, + bounds: { + min: '2019-09-07T14:30:14.047Z', + max: '2019-11-07T14:19:07.505Z', + }, }, aggType: 'date_histogram', }, - y: [{ accessor: 1, format: { id: 'number' }, params: {}, aggType: 'count' }], + y: [ + { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, + ], }, }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '2', enabled: true, @@ -557,12 +666,23 @@ export default [ accessor: 0, format: { id: 'terms', - params: { id: 'string', otherBucketLabel: 'Other', missingBucketLabel: 'Missing' }, + params: { + id: 'string', + otherBucketLabel: 'Other', + missingBucketLabel: 'Missing', + }, }, params: {}, aggType: 'terms', }, - y: [{ accessor: 2, format: { id: 'number' }, params: {}, aggType: 'count' }], + y: [ + { + accessor: 2, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, + ], series: [ { accessor: 1, @@ -610,7 +730,13 @@ export default [ ], }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '2', enabled: true, @@ -673,9 +799,19 @@ export default [ addLegend: true, legendPosition: 'right', isDonut: true, - labels: { show: false, values: true, last_level: true, truncate: 100 }, + labels: { + show: false, + values: true, + last_level: true, + truncate: 100, + }, dimensions: { - metric: { accessor: 1, format: { id: 'number' }, params: {}, aggType: 'count' }, + metric: { + accessor: 1, + format: { id: 'number' }, + params: {}, + aggType: 'count', + }, buckets: [ { accessor: 0, @@ -720,7 +856,13 @@ export default [ }, }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '4', enabled: true, @@ -805,7 +947,13 @@ export default [ totalFunc: 'sum', }, aggs: [ - { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} }, + { + id: '1', + enabled: true, + type: 'count', + schema: 'metric', + params: {}, + }, { id: '2', enabled: true, diff --git a/plugins/main/server/integration-files/visualizations/agents/agents-hipaa.ts b/plugins/main/server/integration-files/visualizations/agents/agents-hipaa.ts index 1370e04e1d..52574bd023 100644 --- a/plugins/main/server/integration-files/visualizations/agents/agents-hipaa.ts +++ b/plugins/main/server/integration-files/visualizations/agents/agents-hipaa.ts @@ -334,7 +334,7 @@ export default [ orientation: 'single', minFontSize: 15, maxFontSize: 25, - showLabel: true, + showLabel: false, metric: { type: 'vis_dimension', accessor: 1, diff --git a/plugins/main/server/integration-files/visualizations/overview/overview-gdpr.ts b/plugins/main/server/integration-files/visualizations/overview/overview-gdpr.ts index d1be4a41bb..c50d772410 100644 --- a/plugins/main/server/integration-files/visualizations/overview/overview-gdpr.ts +++ b/plugins/main/server/integration-files/visualizations/overview/overview-gdpr.ts @@ -370,7 +370,7 @@ export default [ }, ], }), - uiStateJSON: '{"vis":{"legendOpen":false}}', + uiStateJSON: '{"vis":{"legendOpen":true}}', description: '', version: 1, kibanaSavedObjectMeta: { diff --git a/plugins/main/server/integration-files/visualizations/overview/overview-pci.ts b/plugins/main/server/integration-files/visualizations/overview/overview-pci.ts index 620d2c81bf..39118f53d9 100644 --- a/plugins/main/server/integration-files/visualizations/overview/overview-pci.ts +++ b/plugins/main/server/integration-files/visualizations/overview/overview-pci.ts @@ -10,126 +10,6 @@ * Find more information about this on the LICENSE file. */ export default [ - { - _id: 'Wazuh-App-Overview-PCI-DSS-Requirements-over-time', - _source: { - title: 'Requirements over time', - visState: JSON.stringify({ - title: 'Alerts by action over time', - type: 'area', - params: { - type: 'area', - grid: { - categoryLines: true, - style: { color: '#eee' }, - valueAxis: 'ValueAxis-1', - }, - categoryAxes: [ - { - id: 'CategoryAxis-1', - type: 'category', - position: 'bottom', - show: true, - style: {}, - scale: { type: 'linear' }, - labels: { show: true, filter: true, truncate: 100 }, - title: {}, - }, - ], - valueAxes: [ - { - id: 'ValueAxis-1', - name: 'LeftAxis-1', - type: 'value', - position: 'left', - show: true, - style: {}, - scale: { type: 'linear', mode: 'normal' }, - labels: { show: true, rotate: 0, filter: false, truncate: 100 }, - title: { text: 'Count' }, - }, - ], - seriesParams: [ - { - show: 'true', - type: 'area', - mode: 'stacked', - data: { label: 'Count', id: '1' }, - drawLinesBetweenPoints: true, - showCircles: true, - interpolate: 'cardinal', - valueAxis: 'ValueAxis-1', - }, - ], - addTooltip: true, - addLegend: true, - legendPosition: 'right', - times: [], - addTimeMarker: false, - }, - aggs: [ - { - id: '1', - enabled: true, - type: 'count', - schema: 'metric', - params: {}, - }, - { - id: '1', - enabled: true, - type: 'count', - schema: 'metric', - params: {}, - }, - { - id: '3', - enabled: true, - type: 'terms', - schema: 'group', - params: { - field: 'rule.pci_dss', - size: '5', - order: 'desc', - orderBy: '1', - otherBucket: false, - otherBucketLabel: 'Other', - missingBucket: false, - missingBucketLabel: 'Missing', - }, - }, - { - id: '2', - enabled: true, - type: 'date_histogram', - schema: 'segment', - params: { - field: 'timestamp', - timeRange: { from: 'now-24h', to: 'now', mode: 'quick' }, - useNormalizedEsInterval: true, - interval: 'auto', - time_zone: 'Europe/Berlin', - drop_partials: false, - customInterval: '2h', - min_doc_count: 1, - extended_bounds: {}, - }, - }, - ], - }), - uiStateJSON: '{}', - description: '', - version: 1, - kibanaSavedObjectMeta: { - searchSourceJSON: JSON.stringify({ - index: 'wazuh-alerts', - filter: [], - query: { language: 'lucene', query: '' }, - }), - }, - }, - _type: 'visualization', - }, { _id: 'Wazuh-App-Overview-PCI-DSS-Requirements-Agents-heatmap', _type: 'visualization', @@ -353,11 +233,20 @@ export default [ }, }, { - id: '4', + id: '3', enabled: true, - type: 'count', - schema: 'radius', - params: {}, + type: 'terms', + schema: 'group', + params: { + field: 'rule.pci_dss', + orderBy: '1', + order: 'desc', + size: 10, + otherBucket: false, + otherBucketLabel: 'Other', + missingBucket: false, + missingBucketLabel: 'Missing', + }, }, { id: '4', diff --git a/plugins/main/server/integration-files/visualizations/overview/overview-pm.ts b/plugins/main/server/integration-files/visualizations/overview/overview-pm.ts index 7dd8920ca3..8df9e529d9 100644 --- a/plugins/main/server/integration-files/visualizations/overview/overview-pm.ts +++ b/plugins/main/server/integration-files/visualizations/overview/overview-pm.ts @@ -128,7 +128,7 @@ export default [ }, ], addTooltip: true, - addLegend: true, + addLegend: false, legendPosition: 'right', times: [], addTimeMarker: false, From 7baafefc9aee9c7ba33cdad13f886fbd8705308c Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Tue, 30 Apr 2024 19:34:47 +0200 Subject: [PATCH 2/4] Add agent.id condition to WzConfigurationSwitch HOC --- .../management/configuration/configuration-switch.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js b/plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js index baed3e74ce..e557b887b2 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js +++ b/plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js @@ -501,7 +501,9 @@ export default compose( ], ]), //TODO: this need cluster:read permission but manager/cluster is managed in WzConfigurationSwitch component withRenderIfOrWrapped( - props => props.agent.status !== API_NAME_AGENT_STATUS.ACTIVE, + props => + props.agent.id !== '000' && + props.agent.status !== API_NAME_AGENT_STATUS.ACTIVE, PromptNoActiveAgentWithoutSelect, ), connect(mapStateToProps, mapDispatchToProps), From 51f4e37b19ad06b6ba27b7312de8dc82776f73c2 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Thu, 2 May 2024 10:44:34 +0200 Subject: [PATCH 3/4] Add changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf9816174c..a95f5a7058 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed - Moved the plugin menu to platform applications into the side menu [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840) [#6226](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6226) [#6244](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6244) [#6176](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6176) [#6423](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6423) [#6510](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6510) [#6591](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6591) -- Changed dashboards. [#6035](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6035) +- Changed dashboards. [#6035](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6035) [#6632](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6632) - Change the display order of tabs in all modules. [#6067](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6067) - Upgraded the `axios` dependency to `1.6.1` [#6114](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6114) - Changed the api configuration title in the Server APIs section. [#6373](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6373) From 5ffd0b816b44b30593a1b227b866c8e94e032a29 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Thu, 2 May 2024 11:55:18 +0200 Subject: [PATCH 4/4] Improved changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a95f5a7058..3d9dfc363e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed - Moved the plugin menu to platform applications into the side menu [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840) [#6226](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6226) [#6244](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6244) [#6176](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6176) [#6423](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6423) [#6510](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6510) [#6591](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6591) -- Changed dashboards. [#6035](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6035) [#6632](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6632) +- Changed dashboards visualizations definitions. [#6035](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6035) [#6632](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6632) - Change the display order of tabs in all modules. [#6067](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6067) - Upgraded the `axios` dependency to `1.6.1` [#6114](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6114) - Changed the api configuration title in the Server APIs section. [#6373](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6373)