diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb12982b32..e477f31c2b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,10 +28,11 @@ All notable changes to the Wazuh app project will be documented in this file.
- Move AngularJS controller and view for manage groups to ReactJS [#6543](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6543)
- Move AngularJS controllers and views of Tools and Dev Tools to ReactJS [#6544](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6544)
- Move the AngularJS controller and template of blank screen to ReactJS component [#6538](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6538)
+- Move AngularJS controller for management to ReactJS component [#6555](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6555)
- Moved the registry data to in-memory cache [#6481](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6481)
- Enhance the validation for `enrollment.dns` on App Settings application [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573)
-- Remove AngularJS controller for manage groups [#6543](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6543)
- Remove some branding references across the application. [#6155](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6155)
+- Move AngularJS controller for the agent view to ReactJS [#6618](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6618)
- Implement new data source feature on MITRE ATT&CK module [#6482](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6482)
### Fixed
@@ -46,19 +47,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Removed API endpoint DELETE /hosts/remove-orphan-entries [#6481](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6481)
- Remove AngularJS component `click-action` [#6613](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6613)
-## Wazuh v4.8.2 - OpenSearch Dashboards 2.10.0 - Revision 00
-
-### Added
-
-- Support for Wazuh 4.8.2
-
-## Wazuh v4.8.1 - OpenSearch Dashboards 2.10.0 - Revision 00
-
-### Added
-
-- Support for Wazuh 4.8.1
-
-## Wazuh v4.8.0 - OpenSearch Dashboards 2.10.0 - Revision 06
+## Wazuh v4.8.0 - OpenSearch Dashboards 2.10.0 - Revision 08
### Added
@@ -66,7 +55,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Added the ability to check if there are available updates from the UI. [#6093](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6093) [#6256](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6256) [#6328](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6328)
- Added remember server address check [#5791](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5791)
- Added the ssl_agent_ca configuration to the SSL Settings form [#6083](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6083)
-- Added global vulnerabilities dashboards [#5896](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5896) [#6179](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6179) [#6173](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6173) [#6147](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6147) [#6231](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6231) [#6246](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6246) [#6321](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6321) [#6338](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6338) [#6356](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6356) [#6396](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6396) [#6399](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6399) [#6405](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6405) [#6410](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6410) [#6424](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6424) [#6422](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6422) [#6429](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6429) [#6448](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6448) [#6488](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6488)
+- Added global vulnerabilities dashboards [#5896](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5896) [#6179](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6179) [#6173](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6173) [#6147](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6147) [#6231](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6231) [#6246](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6246) [#6321](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6321) [#6338](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6338) [#6356](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6356) [#6396](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6396) [#6399](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6399) [#6405](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6405) [#6410](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6410) [#6424](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6424) [#6422](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6422) [#6429](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6429) [#6448](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6448) [#6488](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6488) [#6590](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6590)
- Added an agent selector to the IT Hygiene application [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840)
- Added query results limit when the search exceed 10000 hits [#6106](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6106)
- Added a redirection button to Endpoint Summary from IT Hygiene application [#6176](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6176)
@@ -75,13 +64,14 @@ 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)
+- 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)
- 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)
-- Changed overview home top KPIs. [#6379](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6379) [#6408](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6408)
+- Changed overview home top KPIs. [#6379](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6379) [#6408](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6408) [#6569](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6569)
- Updated the PDF report year number. [#6492](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6492)
+- Changed overview home font size [#6627](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6627)
### Fixed
@@ -104,6 +94,8 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed a error pop-up spawn in MITRE ATT&CK [#6431](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6431)
- Fixed minor style issues [#6484](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6484) [#6489](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6489)
- Fixed "View alerts of this Rule" link [#6553](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6553)
+- Fixed minor color styles [#6587](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6587)
+- Fixed disconnected agent configuration error [#6587](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6617)
### Removed
@@ -114,6 +106,12 @@ All notable changes to the Wazuh app project will be documented in this file.
- Removed compilation date field from the app [#6366](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6366)
- Removed WAZUH_REGISTRATION_SERVER from Windows agent deployment command [#6361](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6361)
+## Wazuh v4.7.4 - OpenSearch Dashboards 2.8.0 - Revision 02
+
+### Added
+
+- Support for Wazuh 4.7.4
+
## Wazuh v4.7.3 - OpenSearch Dashboards 2.8.0 - Revision 02
### Added
diff --git a/docker/osd-dev/config/2.x/osd/wazuh.yml b/docker/osd-dev/config/2.x/osd/wazuh.yml
index 3f3bc90bbb..421c58b1e1 100755
--- a/docker/osd-dev/config/2.x/osd/wazuh.yml
+++ b/docker/osd-dev/config/2.x/osd/wazuh.yml
@@ -17,3 +17,6 @@ hosts:
username: wazuh-wui
password: MyS3cr37P450r.*-
run_as: false
+
+
+wazuh.updates.disabled: true
diff --git a/plugins/main/common/constants.ts b/plugins/main/common/constants.ts
index 0d1def528f..283a5125ac 100644
--- a/plugins/main/common/constants.ts
+++ b/plugins/main/common/constants.ts
@@ -238,7 +238,6 @@ export const DATA_SOURCE_FILTER_CONTROLLED_MALWARE_DETECTION_RULE_GROUP =
export const DATA_SOURCE_FILTER_CONTROLLED_AWS_RULE_GROUP = 'aws-rule-group';
export const DATA_SOURCE_FILTER_CONTROLLED_FIM_RULE_GROUP = 'fim-rule-group';
-
// Wazuh links
export const WAZUH_LINK_GITHUB = 'https://github.com/wazuh';
export const WAZUH_LINK_GOOGLE_GROUPS =
@@ -313,6 +312,15 @@ export const PLUGIN_PLATFORM_REQUEST_HEADERS = {
export const PLUGIN_APP_NAME = 'dashboard';
// UI
+export const UI_COLOR_STATUS = {
+ success: '#007871',
+ danger: '#BD271E',
+ warning: '#FEC514',
+ disabled: '#646A77',
+ info: '#6092C0',
+ default: '#000000',
+} as const;
+
export const API_NAME_AGENT_STATUS = {
ACTIVE: 'active',
DISCONNECTED: 'disconnected',
@@ -321,11 +329,11 @@ export const API_NAME_AGENT_STATUS = {
} as const;
export const UI_COLOR_AGENT_STATUS = {
- [API_NAME_AGENT_STATUS.ACTIVE]: '#007871',
- [API_NAME_AGENT_STATUS.DISCONNECTED]: '#BD271E',
- [API_NAME_AGENT_STATUS.PENDING]: '#FEC514',
- [API_NAME_AGENT_STATUS.NEVER_CONNECTED]: '#646A77',
- default: '#000000',
+ [API_NAME_AGENT_STATUS.ACTIVE]: UI_COLOR_STATUS.success,
+ [API_NAME_AGENT_STATUS.DISCONNECTED]: UI_COLOR_STATUS.danger,
+ [API_NAME_AGENT_STATUS.PENDING]: UI_COLOR_STATUS.warning,
+ [API_NAME_AGENT_STATUS.NEVER_CONNECTED]: UI_COLOR_STATUS.disabled,
+ default: UI_COLOR_STATUS.default,
} as const;
export const UI_LABEL_NAME_AGENT_STATUS = {
diff --git a/plugins/main/opensearch_dashboards.json b/plugins/main/opensearch_dashboards.json
index 7af70c4235..0c8c88c485 100644
--- a/plugins/main/opensearch_dashboards.json
+++ b/plugins/main/opensearch_dashboards.json
@@ -2,7 +2,9 @@
"id": "wazuh",
"version": "4.9.0-00",
"opensearchDashboardsVersion": "opensearchDashboards",
- "configPath": ["wazuh"],
+ "configPath": [
+ "wazuh"
+ ],
"requiredPlugins": [
"navigation",
"data",
@@ -28,4 +30,4 @@
],
"server": true,
"ui": true
-}
+}
\ No newline at end of file
diff --git a/plugins/main/public/app.js b/plugins/main/public/app.js
index 35de083e45..c06cdb7fd4 100644
--- a/plugins/main/public/app.js
+++ b/plugins/main/public/app.js
@@ -101,7 +101,7 @@ app.run(function ($rootElement) {
-
+
`);
// Bind deleteExistentToken on Log out component.
diff --git a/plugins/main/public/components/agents/export-configuration.js b/plugins/main/public/components/agents/export-configuration.js
new file mode 100644
index 0000000000..995a4d23bc
--- /dev/null
+++ b/plugins/main/public/components/agents/export-configuration.js
@@ -0,0 +1,181 @@
+/*
+ * Wazuh app - React component for exporting the configuration of a group.
+ * Copyright (C) 2015-2022 Wazuh, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Find more information about this on the LICENSE file.
+ */
+import React, { Component } from 'react';
+
+import {
+ EuiPopover,
+ EuiButton,
+ EuiCheckboxGroup,
+ EuiSpacer,
+ EuiButtonEmpty,
+} from '@elastic/eui';
+
+import PropTypes from 'prop-types';
+import { UnsupportedComponents } from '../../utils/components-os-support';
+import { WAZUH_AGENTS_OS_TYPE } from '../../../common/constants';
+import { withErrorBoundary } from '../common/hocs';
+
+export const ExportConfiguration = withErrorBoundary(
+ class ExportConfiguration extends Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ buttonDisabled: false,
+ isPopoverOpen: false,
+ };
+
+ const agentOptions = [
+ 'Global configuration',
+ 'Communication',
+ 'Anti-flooding settings',
+ 'Labels',
+ 'Policy monitoring',
+ { name: 'oscap', desc: 'OpenSCAP' },
+ 'CIS-CAT',
+ 'Osquery',
+ 'Inventory data',
+ 'Active response',
+ 'Commands',
+ { name: 'docker', desc: 'Docker listener' },
+ 'Log collection',
+ 'Integrity monitoring',
+ ];
+ const groupOptions = ['Configurations', 'Agents in group'];
+
+ this.options = [];
+ const list = this.props.type === 'agent' ? agentOptions : groupOptions;
+ list.forEach((x, idx) => {
+ if (
+ typeof x === 'string' ||
+ (x.name &&
+ !(
+ UnsupportedComponents[this.props.agentPlatform] ||
+ UnsupportedComponents[WAZUH_AGENTS_OS_TYPE.OTHERS]
+ ).includes(x.name))
+ ) {
+ this.options.push({ id: `${idx}`, label: x.desc || x });
+ }
+ });
+
+ let initialChecks = {};
+ this.options.forEach(x => {
+ initialChecks[x.id] = true;
+ });
+ this.state.checkboxIdToSelectedMap = initialChecks;
+ }
+
+ selectAll(flag) {
+ let newCheckboxIdToSelectedMap = {};
+ for (let i = 0; i < this.options.length; i++) {
+ newCheckboxIdToSelectedMap[`${this.options[i].id}`] = flag;
+ }
+ this.setState({
+ checkboxIdToSelectedMap: newCheckboxIdToSelectedMap,
+ buttonDisabled: !flag,
+ });
+ }
+
+ exportClick() {
+ this.setState({
+ isPopoverOpen: !this.state.isPopoverOpen,
+ });
+ }
+
+ closePopover() {
+ this.setState({
+ isPopoverOpen: false,
+ });
+ }
+
+ onChange = optionId => {
+ const newCheckboxIdToSelectedMap = {
+ ...this.state.checkboxIdToSelectedMap,
+ ...{
+ [optionId]: !this.state.checkboxIdToSelectedMap[optionId],
+ },
+ };
+ let result = false;
+ for (let i = 0; i < this.options.length; i++) {
+ if (newCheckboxIdToSelectedMap[`${this.options[i].id}`] === true) {
+ result = true;
+ }
+ }
+ this.setState({
+ checkboxIdToSelectedMap: newCheckboxIdToSelectedMap,
+ buttonDisabled: !result,
+ });
+ };
+
+ render() {
+ const button = (
+
+ Export PDF
+
+ );
+ return (
+
+
+
+ {this.options.length > 3 && (
+ <>
+ this.selectAll(true)}>
+ Select all
+
+
+ this.selectAll(false)}>
+ Unselect all
+
+ >
+ )}
+
+ {
+ this.closePopover();
+ this.props.exportConfiguration(
+ this.state.checkboxIdToSelectedMap,
+ );
+ }}
+ fill
+ >
+ Generate PDF report
+
+
+ );
+ }
+ },
+);
+
+ExportConfiguration.propTypes = {
+ exportConfiguration: PropTypes.func,
+ type: PropTypes.string,
+ agentPlatform: PropTypes.string,
+};
diff --git a/plugins/main/public/components/common/charts/visualizations/basic.tsx b/plugins/main/public/components/common/charts/visualizations/basic.tsx
index 2e48e5e734..eaca2e6270 100644
--- a/plugins/main/public/components/common/charts/visualizations/basic.tsx
+++ b/plugins/main/public/components/common/charts/visualizations/basic.tsx
@@ -160,7 +160,11 @@ export const VisualizationBasicWidgetSelector = ({
return (
<>
-
+
{title && (
diff --git a/plugins/main/public/components/common/modules/main-agent.tsx b/plugins/main/public/components/common/modules/main-agent.tsx
index 6baa5d2ab9..028d6933d9 100644
--- a/plugins/main/public/components/common/modules/main-agent.tsx
+++ b/plugins/main/public/components/common/modules/main-agent.tsx
@@ -18,6 +18,7 @@ import {
EuiTitle,
EuiButtonEmpty,
} from '@elastic/eui';
+import { euiThemeVars } from '@osd/ui-shared-deps/theme';
import '../../common/modules/module.scss';
import store from '../../../redux/store';
import { FilterHandler } from '../../../utils/filter-handler';
@@ -107,6 +108,7 @@ export class MainModuleAgent extends Component {
{
window.location.href = `#/agents?agent=${this.props.agent.id}`;
this.router.reload();
diff --git a/plugins/main/public/components/common/modules/module.scss b/plugins/main/public/components/common/modules/module.scss
index 5c076faf70..fd906406cd 100644
--- a/plugins/main/public/components/common/modules/module.scss
+++ b/plugins/main/public/components/common/modules/module.scss
@@ -1,130 +1,130 @@
.wz-module {
- display: contents;
+ display: contents;
}
-.wz-module-header-agent, .wz-module-header-nav{
- background:#fafbfd;
+.wz-module-header-agent,
+.wz-module-header-nav {
+ background: #fafbfd;
}
-.wz-module-header-agent{
- height: 50px;
- padding: 16px;
+.wz-module-header-agent {
+ height: 50px;
+ padding: 16px;
}
-.wz-module-header-agent .euiHealth svg{
- width: 16px;
- height: 24px;
+.wz-module-header-agent .euiHealth svg {
+ width: 16px;
+ height: 24px;
}
-.wzApp .euiFlyoutBody .euiFlyoutBody__overflowContent{
- padding:0!important;
+.wzApp .euiFlyoutBody .euiFlyoutBody__overflowContent {
+ padding: 0 !important;
}
.wz-module-header-nav > .euiFlexGroup {
- margin-top: -16px;
+ margin-top: -16px;
}
-.wz-module-header-nav > .euiFlexGroup .euiFlexItem{
- margin-top: 0px;
+.wz-module-header-nav > .euiFlexGroup .euiFlexItem {
+ margin-top: 0px;
}
-.wz-module-header-agent-title{
- margin: 6px 12px!important;
+.wz-module-header-agent-title {
+ margin: 6px 12px !important;
}
-.wz-module-header-agent-title-badge{
- border: 1px solid #d3dae6;
- padding: 0 100px;
- border-radius: 100px;
+.wz-module-header-agent-title-badge {
+ border: 1px solid #d3dae6;
+ padding: 0 100px;
+ border-radius: 100px;
}
-.wz-module-header-agent-title-btn{
- cursor: pointer;
+.wz-module-header-agent-title-btn {
+ cursor: pointer;
}
-.wz-module-header-agent-title-btn > span:hover{
- color: #006BB4;
+.wz-font-weight-normal {
+ font-weight: normal;
}
-
-.wz-module-header-agent h1{
- font-weight: 400;
+.wz-module-header-agent h1 {
+ font-weight: 400;
}
-.wz-module-header-agent h1 b{
- font-weight: 500;
+.wz-module-header-agent h1 b {
+ font-weight: 500;
}
-.wz-module-header-nav .euiTabs{
- padding-top: 6px;
+.wz-module-header-nav .euiTabs {
+ padding-top: 6px;
}
-.wz-module-header-nav .euiTab__content{
- font-size: 16px!important;
- font-weight: 400;
+.wz-module-header-nav .euiTab__content {
+ font-size: 16px !important;
+ font-weight: 400;
}
.wz-module-body {
- padding-top: 105px;
+ padding-top: 105px;
}
-.wz-module.wz-module-welcome{
- .wz-module-body{
- padding-top: 109px !important;
- }
+.wz-module.wz-module-welcome {
+ .wz-module-body {
+ padding-top: 109px !important;
+ }
}
-.wz-module.wz-module-showing-agent .wz-module-body{
- padding-top: 160px !important;
+.wz-module.wz-module-showing-agent .wz-module-body {
+ padding-top: 160px !important;
}
-.flyout-body .globalQueryBar{
- padding: 2px 0px 8px 0px!important;
+.flyout-body .globalQueryBar {
+ padding: 2px 0px 8px 0px !important;
}
-.sidebar-list{
- margin-bottom: 2px;
+.sidebar-list {
+ margin-bottom: 2px;
}
discover-app-w .sidebar-container {
- background-color: transparent!important;
-}
+ background-color: transparent !important;
+}
+
+@media only screen and (max-width: 1360px) {
+ .wz-module.wz-module-welcome .wz-module-body {
+ padding-top: 189px !important;
+ }
+ @media only screen and (max-width: 767px) {
+ .wz-module-header-agent {
+ height: auto;
+ h1 {
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ }
+ }
+ .wz-module-body {
+ margin-top: -160px;
+ }
+
+ .wz-module-header-nav {
+ padding-bottom: 16px;
+ }
+
+ .wz-module-body-agent-info > .euiFlexGroup > .euiFlexItem {
+ max-width: unset !important;
+ }
-@media only screen and (max-width: 1360px){
- .wz-module.wz-module-welcome .wz-module-body{
- padding-top: 189px !important;
+ .wz-module-header-agent-title .euiFlexItem {
+ align-items: flex-start !important;
}
- @media only screen and (max-width: 767px){
- .wz-module-header-agent{
- height: auto;
- h1{
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- }
- .wz-module-body {
- margin-top: -160px;
- }
-
- .wz-module-header-nav {
- padding-bottom: 16px;
- }
-
- .wz-module-body-agent-info > .euiFlexGroup > .euiFlexItem {
- max-width: unset!important;
- }
-
- .wz-module-header-agent-title .euiFlexItem{
- align-items: flex-start!important;
- }
- .wz-agent-empty-item.euiFlexItem{
- margin-top: 0px!important;
- margin-bottom:0px!important;
- }
+ .wz-agent-empty-item.euiFlexItem {
+ margin-top: 0px !important;
+ margin-bottom: 0px !important;
}
+ }
}
.wz-section-sca-euiFlexGroup {
- display: flex;
- justify-content: space-between;
+ display: flex;
+ justify-content: space-between;
}
diff --git a/plugins/main/public/components/common/welcome/agents-welcome.js b/plugins/main/public/components/common/welcome/agents-welcome.js
index cb4b63fb54..43b19f1556 100644
--- a/plugins/main/public/components/common/welcome/agents-welcome.js
+++ b/plugins/main/public/components/common/welcome/agents-welcome.js
@@ -22,7 +22,6 @@ import {
EuiButtonEmpty,
EuiPage,
EuiPopover,
- EuiLoadingChart,
EuiToolTip,
EuiButtonIcon,
EuiPageBody,
@@ -39,20 +38,16 @@ import WzReduxProvider from '../../../redux/wz-redux-provider';
import MenuAgent from './components/menu-agent';
import './welcome.scss';
import { WzDatePicker } from '../../../components/wz-date-picker/wz-date-picker';
-import KibanaVis from '../../../kibana-integrations/kibana-vis';
-import { VisFactoryHandler } from '../../../react-services/vis-factory-handler';
-import { AppState } from '../../../react-services/app-state';
-import { FilterHandler } from '../../../utils/filter-handler';
import { TabVisualizations } from '../../../factories/tab-visualizations';
import {
showExploreAgentModalGlobal,
updateCurrentAgentData,
} from '../../../redux/actions/appStateActions';
import {
- getAngularModule,
getChrome,
getCore,
getDataPlugin,
+ getAngularModule,
} from '../../../kibana-services';
import { hasAgentSupportModule } from '../../../react-services/wz-agents';
import {
@@ -80,6 +75,7 @@ import {
malwareDetection,
} from '../../../utils/applications';
import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public';
+import { EventsCount } from './dashboard/events-count';
const mapStateToProps = state => ({
agent: state.appStateReducers.currentAgentData,
@@ -105,11 +101,11 @@ export const AgentsWelcome = compose(
},
...(agent?.name
? [
- {
- text: `${agent.name}`,
- truncate: true,
- },
- ]
+ {
+ text: `${agent.name}`,
+ truncate: true,
+ },
+ ]
: []),
];
}),
@@ -150,6 +146,9 @@ export const AgentsWelcome = compose(
this.sidebarSizeDefault = 320;
+ const $injector = getAngularModule().$injector;
+ this.location = $injector.get('$location');
+
this.state = {
lastScans: [],
isLoading: true,
@@ -200,8 +199,8 @@ export const AgentsWelcome = compose(
of duplicating it. It was duplicated due to the differences of requirements
in the Explore agent button for the modules and agent welcome
*/
- async removeAgentsFilter() {
- await this.props.setAgent(false);
+ removeAgentsFilter() {
+ this.props.setAgent(false);
const currentAppliedFilters = getDataPlugin().query.filterManager.filters;
const agentFilters = currentAppliedFilters.filter(x => {
return x.meta.key !== 'agent.id';
@@ -226,8 +225,7 @@ export const AgentsWelcome = compose(
tabVisualizations.assign({
welcome: 8,
});
- const filterHandler = new FilterHandler(AppState.getCurrentPattern());
- const $injector = getAngularModule().$injector;
+
this.drawerLokedSubscribtion = getChrome()
.getIsNavDrawerLocked$()
.subscribe(isLocked => {
@@ -235,15 +233,7 @@ export const AgentsWelcome = compose(
this.updateWidth();
});
});
- this.router = $injector.get('$route');
- this.location = $injector.get('$location');
window.addEventListener('resize', this.updateWidth); //eslint-disable-line
- await VisFactoryHandler.buildAgentsVisualizations(
- filterHandler,
- 'welcome',
- null,
- this.props.agent.id,
- );
}
componentDidUpdate(prevProps) {
@@ -268,13 +258,13 @@ export const AgentsWelcome = compose(
)
? JSON.parse(window.localStorage.getItem('wz-menu-agent-apps-pinned'))
: [
- // Default pinned applications
- threatHunting.id,
- fileIntegrityMonitoring.id,
- configurationAssessment.id,
- mitreAttack.id,
- malwareDetection.id,
- ];
+ // Default pinned applications
+ threatHunting.id,
+ fileIntegrityMonitoring.id,
+ configurationAssessment.id,
+ mitreAttack.id,
+ malwareDetection.id,
+ ];
}
// Ensure the pinned applications are supported
@@ -354,7 +344,6 @@ export const AgentsWelcome = compose(
closePopover={() => {
this.setState({ switchModule: false });
}}
- switchTab={module => this.props.switchTab(module)}
>
@@ -366,7 +355,6 @@ export const AgentsWelcome = compose(
}
renderTitle() {
- const notNeedStatus = true;
const thereAreAgentSelected = Boolean(this.props.agent?.id);
// Calculate if the header buttons should display the name or only the icon to be responsive
@@ -411,7 +399,6 @@ export const AgentsWelcome = compose(
closePopover={() => {
this.setState({ switchModule: false });
}}
- switchTab={module => this.props.switchTab(module)}
>
@@ -460,9 +447,7 @@ export const AgentsWelcome = compose(
- this.props.switchTab('syscollector', notNeedStatus)
- }
+ onClick={() => this.props.switchTab('syscollector')}
className='wz-it-hygiene-header-button'
tooltip={
this.state.maxModules === null
@@ -477,7 +462,7 @@ export const AgentsWelcome = compose(
this.props.switchTab('stats', notNeedStatus)}
+ onClick={() => this.props.switchTab('stats')}
className='wz-it-hygiene-header-button'
tooltip={
this.state.maxModules === null
@@ -492,9 +477,7 @@ export const AgentsWelcome = compose(
- this.props.switchTab('configuration', notNeedStatus)
- }
+ onClick={() => this.props.switchTab('configuration')}
className='wz-it-hygiene-header-button'
tooltip={
this.state.maxModules === null
@@ -569,50 +552,13 @@ export const AgentsWelcome = compose(
}
renderEventCountVisualization() {
- return (
-
-
-
-
-
-
- Events count evolution
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
+ return ;
}
renderSCALastScan() {
return (
-
+
);
}
@@ -654,8 +600,8 @@ export const AgentsWelcome = compose(
}}
>
{' '}
- {/* DatePicker */}
- {}} />
+ {/* TODO: Replace with SearchBar and replace implementation to get the time range in AgentView component*/}
+ { }} />
{(this.state.widthWindow < 1150 && (
@@ -688,33 +634,33 @@ export const AgentsWelcome = compose(
)) || (
-
-
-
-
-
- {this.renderMitrePanel()}
-
- {this.renderCompliancePanel()}
-
-
-
-
-
-
-
- {' '}
- {/* Events count evolution */}
- {this.renderEventCountVisualization()}
-
- {this.renderSCALastScan()}
-
-
- )}
+
+
+
+
+
+ {this.renderMitrePanel()}
+
+ {this.renderCompliancePanel()}
+
+
+
+
+
+
+
+ {' '}
+ {/* Events count evolution */}
+ {this.renderEventCountVisualization()}
+
+ {this.renderSCALastScan()}
+
+
+ )}
diff --git a/plugins/main/public/components/common/welcome/dashboard/dashboard_panels.ts b/plugins/main/public/components/common/welcome/dashboard/dashboard_panels.ts
new file mode 100644
index 0000000000..7d250e7d05
--- /dev/null
+++ b/plugins/main/public/components/common/welcome/dashboard/dashboard_panels.ts
@@ -0,0 +1,137 @@
+import { DashboardPanelState } from '../../../../../../../src/plugins/dashboard/public/application';
+import { EmbeddableInput } from '../../../../../../../src/plugins/embeddable/public';
+
+const getVisStateEventsCountEvolution = (indexPatternId: string) => ({
+ id: 'App-Agents-Welcome-Events-Evolution',
+ title: 'Events count evolution',
+ type: 'line',
+ params: {
+ type: 'line',
+ grid: { categoryLines: false },
+ 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: 'line',
+ mode: 'normal',
+ data: { label: 'Count', id: '1' },
+ valueAxis: 'ValueAxis-1',
+ drawLinesBetweenPoints: true,
+ lineWidth: 2,
+ interpolate: 'linear',
+ showCircles: true,
+ },
+ ],
+ addTooltip: true,
+ addLegend: false,
+ legendPosition: 'right',
+ times: [],
+ addTimeMarker: false,
+ labels: {},
+ thresholdLine: {
+ show: false,
+ value: 10,
+ width: 1,
+ style: 'full',
+ color: '#E7664C',
+ },
+ dimensions: {
+ x: null,
+ y: [
+ {
+ accessor: 0,
+ format: { id: 'number' },
+ params: {},
+ label: 'Count',
+ aggType: 'count',
+ },
+ ],
+ },
+ },
+ uiState: {
+ vis: { params: { sort: { columnIndex: 2, direction: 'desc' } } },
+ },
+ data: {
+ searchSource: {
+ query: {
+ language: 'kuery',
+ query: '',
+ },
+ index: indexPatternId,
+ },
+ references: [
+ {
+ name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
+ type: 'index-pattern',
+ id: indexPatternId,
+ },
+ ],
+ aggs: [
+ { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} },
+ {
+ id: '2',
+ enabled: true,
+ type: 'date_histogram',
+ schema: 'segment',
+ params: {
+ field: 'timestamp',
+ useNormalizedEsInterval: true,
+ scaleMetricValues: false,
+ interval: 'auto',
+ drop_partials: false,
+ min_doc_count: 1,
+ extended_bounds: {},
+ },
+ },
+ ],
+ },
+});
+
+export const getDashboardPanels = (
+ indexPatternId: string,
+): {
+ [panelId: string]: DashboardPanelState<
+ EmbeddableInput & { [k: string]: unknown }
+ >;
+} => {
+ return {
+ '1': {
+ gridData: {
+ w: 48,
+ h: 12,
+ x: 0,
+ y: 0,
+ i: '1',
+ },
+ type: 'visualization',
+ explicitInput: {
+ id: '1',
+ savedVis: getVisStateEventsCountEvolution(indexPatternId),
+ },
+ },
+ };
+};
diff --git a/plugins/main/public/components/common/welcome/dashboard/events-count.tsx b/plugins/main/public/components/common/welcome/dashboard/events-count.tsx
new file mode 100644
index 0000000000..e41f399a5f
--- /dev/null
+++ b/plugins/main/public/components/common/welcome/dashboard/events-count.tsx
@@ -0,0 +1,75 @@
+import React from 'react';
+import { AlertsDataSource } from '../../data-source/pattern/alerts/alerts-data-source';
+import { AlertsDataSourceRepository } from '../../data-source/pattern/alerts/alerts-data-source-repository';
+import { getPlugins } from '../../../../kibana-services';
+import { getDashboardPanels } from './dashboard_panels';
+import { ViewMode } from '../../../../../../../src/plugins/embeddable/public';
+import { useDataSource } from '../../data-source/hooks';
+import { PatternDataSource, tParsedIndexPattern } from '../../data-source';
+import {
+ EuiPanel,
+ EuiFlexItem,
+ EuiFlexGroup,
+ EuiSpacer,
+ EuiText,
+} from '@elastic/eui';
+import { useTimeFilter } from '../../hooks';
+import { LoadingSpinner } from '../../loading-spinner/loading-spinner';
+
+const plugins = getPlugins();
+const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer;
+
+export const EventsCount = () => {
+ const {
+ dataSource,
+ fetchFilters,
+ isLoading: isDataSourceLoading,
+ } = useDataSource({
+ DataSource: AlertsDataSource,
+ repository: new AlertsDataSourceRepository(),
+ });
+
+ const { timeFilter } = useTimeFilter();
+
+ return (
+
+
+
+
+
+
+ Events count evolution
+
+
+
+
+
+ {!isDataSourceLoading && dataSource ? (
+
+ ) : (
+
+ )}
+
+
+ );
+};
diff --git a/plugins/main/public/components/common/welcome/overview-welcome.js b/plugins/main/public/components/common/welcome/overview-welcome.js
index 58bac33425..8d9d8be91a 100644
--- a/plugins/main/public/components/common/welcome/overview-welcome.js
+++ b/plugins/main/public/components/common/welcome/overview-welcome.js
@@ -116,11 +116,11 @@ export const OverviewWelcome = compose(
render() {
return (
-
+
{this.props.agentsCountTotal === 0 && this.addAgent()}
-
+
{appCategories.map(({ label, apps }) => (
@@ -136,7 +136,8 @@ export const OverviewWelcome = compose(
{apps.map(app => (
-
{
+ //TODO: Replace when implement React router
+ const $injector = getAngularModule().$injector;
+ const $router = $injector.get('$route');
+ const $commonData = $injector.get('commonData');
+
+ const shareAgent = new ShareAgent();
+
+ //TODO: Replace with useDatasource and useSearchBar when replace WzDatePicker with SearchBar in AgentsWelcome component
+ const savedTimefilter = $commonData.getTimefilter();
+ if (savedTimefilter) {
+ getDataPlugin().query.timefilter.timefilter.setTime(savedTimefilter);
+ $commonData.removeTimefilter();
+ }
+
+ const { agent: agentId } = $router.current.params;
+
+ const [agent, setAgent] = useState();
+ const [isLoadingAgent, setIsLoadingAgent] = useState(true);
+ const [tab, setTab] = useState($commonData.checkTabLocation());
+ const dispatch = useDispatch();
+
+ const getAgent = async () => {
+ try {
+ setIsLoadingAgent(true);
+
+ const id = $commonData.checkLocationAgentId(
+ agentId,
+ shareAgent.getAgent(),
+ );
+
+ if (!id) {
+ return;
+ }
+
+ const { affected_items } = await getAgentsService({
+ agents: [agentId],
+ });
+ if (!affected_items?.length) {
+ throw 'Not found';
+ }
+
+ const agent = affected_items[0];
+ setAgent(agent);
+ dispatch(updateCurrentAgentData(agent));
+ } catch (error) {
+ const options = {
+ context: `AgentView.getAgent`,
+ level: UI_LOGGER_LEVELS.ERROR,
+ severity: UI_ERROR_SEVERITIES.CRITICAL,
+ store: true,
+ error: {
+ error,
+ message: error.message || error,
+ title: `Error getting the agent: ${error.message || error}`,
+ },
+ };
+ getErrorOrchestrator().handleError(options);
+ } finally {
+ setIsLoadingAgent(false);
+ }
+ };
+
+ useEffect(() => {
+ getAgent();
+ }, [tab]);
+
+ const switchTab = (tab: string) => {
+ setTab(tab);
+ getCore().application.navigateToApp(endpointSummary.id, {
+ path: `#/agents?tab=${tab}&agent=${agent?.id}`,
+ });
+ };
+
+ if (isLoadingAgent) {
+ return (
+
+
+
+
+
+ );
+ }
+
+ if (tab === 'welcome') {
+ return ;
+ }
+
+ if (tab === 'syscollector' && agent) {
+ return ;
+ }
+
+ if (tab === 'stats' && agent) {
+ return ;
+ }
+
+ if (tab === 'configuration' && agent) {
+ return ;
+ }
+});
diff --git a/plugins/main/public/components/endpoints-summary/services/get-agents.tsx b/plugins/main/public/components/endpoints-summary/services/get-agents.tsx
index ebe67f445e..5040a34335 100644
--- a/plugins/main/public/components/endpoints-summary/services/get-agents.tsx
+++ b/plugins/main/public/components/endpoints-summary/services/get-agents.tsx
@@ -4,11 +4,13 @@ import { Agent } from '../types';
export const getAgentsService = async ({
filters,
+ agents,
limit,
offset,
pageSize = 1000,
}: {
- filters: any;
+ filters?: any;
+ agents?: string[];
limit?: number;
offset?: number;
pageSize?: number;
@@ -27,7 +29,8 @@ export const getAgentsService = async ({
params: {
limit: queryLimit,
offset: queryOffset,
- q: filters,
+ ...(agents?.length ? { agents_list: agents?.join(',') } : {}),
+ ...(filters ? { q: filters } : {}),
wait_for_complete: true,
},
})) as IApiResponse;
diff --git a/plugins/main/public/components/overview/vulnerabilities/common/components/document-view-table-and-json.tsx b/plugins/main/public/components/overview/vulnerabilities/common/components/document-view-table-and-json.tsx
new file mode 100644
index 0000000000..c82e73eef8
--- /dev/null
+++ b/plugins/main/public/components/overview/vulnerabilities/common/components/document-view-table-and-json.tsx
@@ -0,0 +1,40 @@
+import React from 'react';
+import { EuiFlexItem, EuiCodeBlock, EuiTabbedContent } from '@elastic/eui';
+import { IndexPattern } from '../../../../../../../../src/plugins/data/common';
+import DocViewer from '../../../../common/doc-viewer/doc-viewer';
+import { useDocViewer } from '../../../../common/doc-viewer';
+
+export const DocumentViewTableAndJson = ({ document, indexPattern }) => {
+ const docViewerProps = useDocViewer({
+ doc: document,
+ indexPattern: indexPattern as IndexPattern,
+ });
+
+ return (
+
+ ,
+ },
+ {
+ id: 'json',
+ name: 'JSON',
+ content: (
+
+ {JSON.stringify(document, null, 2)}
+
+ ),
+ },
+ ]}
+ />
+
+ );
+};
diff --git a/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx b/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx
index 6176b52ebe..ae60c2859a 100644
--- a/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx
+++ b/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx
@@ -7,7 +7,6 @@ import {
EuiButtonIcon,
EuiDataGridCellValueElementProps,
EuiFlexGroup,
- EuiFlexItem,
EuiFlyout,
EuiFlyoutBody,
EuiFlyoutHeader,
@@ -46,6 +45,7 @@ import {
} from '../../../../common/data-source';
import { useDataSource } from '../../../../common/data-source/hooks';
import { IndexPattern } from '../../../../../../../../src/plugins/data/public';
+import { DocumentViewTableAndJson } from '../../common/components/document-view-table-and-json';
const InventoryVulsComponent = () => {
const {
@@ -243,9 +243,10 @@ const InventoryVulsComponent = () => {
-
-
-
+
diff --git a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard_panels.ts b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard_panels.ts
index 8ff1084b67..252d60d65a 100644
--- a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard_panels.ts
+++ b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard_panels.ts
@@ -269,11 +269,11 @@ const getVisStateAccumulationMostDetectedVulnerabilities = (
indexPatternId: string,
) => {
return {
- id: 'accumulation_most_vulnerable_vulnerabilities',
- title: 'Accumulation of the most detected vulnerabilities',
- type: 'line',
+ id: 'vulnerabilities_by_year_of_publication',
+ title: 'Vulnerabilities by year of publication',
+ type: 'histogram',
params: {
- type: 'line',
+ type: 'histogram',
grid: {
categoryLines: false,
},
@@ -304,8 +304,9 @@ const getVisStateAccumulationMostDetectedVulnerabilities = (
show: true,
style: {},
scale: {
- type: 'linear',
+ type: 'log',
mode: 'normal',
+ defaultYExtents: true,
},
labels: {
show: true,
@@ -321,16 +322,15 @@ const getVisStateAccumulationMostDetectedVulnerabilities = (
seriesParams: [
{
show: true,
- type: 'line',
- mode: 'normal',
+ type: 'histogram',
+ mode: 'stacked',
data: {
label: 'Count',
id: '1',
},
valueAxis: 'ValueAxis-1',
- drawLinesBetweenPoints: false,
+ drawLinesBetweenPoints: true,
lineWidth: 2,
- interpolate: 'linear',
showCircles: true,
},
],
@@ -339,7 +339,9 @@ const getVisStateAccumulationMostDetectedVulnerabilities = (
legendPosition: 'right',
times: [],
addTimeMarker: false,
- labels: {},
+ labels: {
+ show: false,
+ },
thresholdLine: {
show: false,
value: 10,
@@ -347,7 +349,6 @@ const getVisStateAccumulationMostDetectedVulnerabilities = (
style: 'full',
color: '#E7664C',
},
- radiusRatio: 20,
},
data: {
searchSource: {
@@ -376,49 +377,38 @@ const getVisStateAccumulationMostDetectedVulnerabilities = (
{
id: '2',
enabled: true,
- type: 'count',
- params: {},
- schema: 'radius',
- },
- {
- id: '4',
- enabled: true,
- type: 'terms',
- params: {
- field: 'vulnerability.id',
- orderBy: '1',
- order: 'desc',
- size: 5,
- otherBucket: false,
- otherBucketLabel: 'Others',
- missingBucket: false,
- missingBucketLabel: 'Missing',
- },
- schema: 'group',
- },
- {
- id: '3',
- enabled: true,
type: 'date_histogram',
params: {
field: 'vulnerability.published_at',
- customLabel: 'Published at',
timeRange: {
from: 'now-24h',
to: 'now',
},
useNormalizedOpenSearchInterval: true,
scaleMetricValues: false,
- interval: 'w',
- // eslint-disable-next-line camelcase
+ interval: 'y',
drop_partials: false,
- // eslint-disable-next-line camelcase
min_doc_count: 1,
- // eslint-disable-next-line camelcase
extended_bounds: {},
},
schema: 'segment',
},
+ {
+ id: '3',
+ enabled: true,
+ type: 'terms',
+ params: {
+ field: 'vulnerability.severity',
+ orderBy: '1',
+ order: 'desc',
+ size: 5,
+ otherBucket: false,
+ otherBucketLabel: 'Other',
+ missingBucket: false,
+ missingBucketLabel: 'Missing',
+ },
+ schema: 'group',
+ },
],
},
};
diff --git a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard_panels_kpis.ts b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard_panels_kpis.ts
index 996c2af3e4..45e31b0ffc 100644
--- a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard_panels_kpis.ts
+++ b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard_panels_kpis.ts
@@ -60,7 +60,7 @@ const getVisStateSeverityCritical = (indexPatternId: string) => {
enabled: true,
type: 'count',
params: {
- customLabel: 'Critical',
+ customLabel: 'Severity',
},
schema: 'metric',
},
@@ -75,7 +75,7 @@ const getVisStateSeverityCritical = (indexPatternId: string) => {
query: 'vulnerability.severity:"Critical"',
language: 'kuery',
},
- label: 'Severity',
+ label: 'Critical',
},
],
},
@@ -152,7 +152,7 @@ const getVisStateSeverityHigh = (indexPatternId: string) => {
enabled: true,
type: 'count',
params: {
- customLabel: 'High',
+ customLabel: 'Severity',
},
schema: 'metric',
},
@@ -167,7 +167,7 @@ const getVisStateSeverityHigh = (indexPatternId: string) => {
query: 'vulnerability.severity:"High"',
language: 'kuery',
},
- label: 'Severity',
+ label: 'High',
},
],
},
@@ -237,7 +237,7 @@ const getVisStateSeverityMedium = (indexPatternId: string) => {
enabled: true,
type: 'count',
params: {
- customLabel: 'Medium',
+ customLabel: 'Severity',
},
schema: 'metric',
},
@@ -252,7 +252,7 @@ const getVisStateSeverityMedium = (indexPatternId: string) => {
query: 'vulnerability.severity:"Medium"',
language: 'kuery',
},
- label: 'Severity',
+ label: 'Medium',
},
],
},
@@ -322,7 +322,7 @@ const getVisStateSeverityLow = (indexPatternId: string) => {
enabled: true,
type: 'count',
params: {
- customLabel: 'Low',
+ customLabel: 'Severity',
},
schema: 'metric',
},
@@ -337,7 +337,7 @@ const getVisStateSeverityLow = (indexPatternId: string) => {
query: 'vulnerability.severity:"Low"',
language: 'kuery',
},
- label: 'Severity',
+ label: 'Low',
},
],
},
diff --git a/plugins/main/public/components/settings/api/api-table.js b/plugins/main/public/components/settings/api/api-table.js
index 9bb6252bef..86e14b00b1 100644
--- a/plugins/main/public/components/settings/api/api-table.js
+++ b/plugins/main/public/components/settings/api/api-table.js
@@ -55,6 +55,7 @@ import {
ErrorHandler,
GenericRequest,
} from '../../../react-services';
+import { WazuhConfig } from '../../../react-services/wazuh-config';
export const ApiTable = compose(
withErrorBoundary,
@@ -79,7 +80,7 @@ export const ApiTable = compose(
selectedAPIConnection,
refreshingEntries: false,
availableUpdates: {},
- refreshingAvailableUpdates: true,
+ refreshingAvailableUpdates: false,
};
}
@@ -115,8 +116,11 @@ export const ApiTable = compose(
componentDidMount() {
this.refresh();
-
- this.getApisAvailableUpdates();
+ this.wazuhConfig = new WazuhConfig().getConfig();
+ this.isUpdatesEnabled = !this.wazuhConfig?.['wazuh.updates.disabled'];
+ if (this.isUpdatesEnabled) {
+ this.getApisAvailableUpdates();
+ }
}
copyToClipBoard(msg) {
@@ -464,94 +468,6 @@ export const ApiTable = compose(
}
},
},
- {
- field: 'current_version',
- name: 'Version',
- align: 'left',
- sortable: true,
- },
- {
- field: 'version_status',
- name: 'Updates status',
- sortable: true,
- render: (item, api) => {
- const color = API_UPDATES_STATUS_COLUMN[item]?.color ?? 'subdued';
-
- const content =
- API_UPDATES_STATUS_COLUMN[item]?.text ?? 'Never checked';
-
- if (!this.state.refreshingAvailableUpdates) {
- return (
-
-
-
- {content}
-
-
- {!item ? (
-
-
- Click Check updates button to get information
-
- }
- >
-
-
-
- ) : null}
- {item === 'availableUpdates' ? (
-
- {
- return ;
- }}
- buttonProps={{
- buttonType: 'icon',
- iconType: 'eye',
- }}
- />
-
- ) : null}
- {item === 'error' && api.error?.detail ? (
-
-
- this.copyToClipBoard(api.error.detail)}
- />
-
-
- ) : null}
-
- );
- } else {
- return (
-
-
- Checking
-
- );
- }
- },
- },
{
name: 'Run as',
field: 'allow_run_as',
@@ -618,6 +534,101 @@ export const ApiTable = compose(
},
];
+ // optional column if Check Updates is enabled
+ const currentVersionColumn = {
+ field: 'current_version',
+ name: 'Version',
+ align: 'left',
+ sortable: true,
+ };
+
+ // optional column if Check Updates is enabled
+ const versionStatusColumn = {
+ field: 'version_status',
+ name: 'Updates status',
+ sortable: true,
+ render: (item, api) => {
+ const color = API_UPDATES_STATUS_COLUMN[item]?.color ?? 'subdued';
+
+ const content =
+ API_UPDATES_STATUS_COLUMN[item]?.text ?? 'Never checked';
+
+ if (!this.state.refreshingAvailableUpdates) {
+ return (
+
+
+
+ {content}
+
+
+ {!item ? (
+
+
+ Click Check updates button to get information
+
+ }
+ >
+
+
+
+ ) : null}
+ {item === 'availableUpdates' ? (
+
+ {
+ return ;
+ }}
+ buttonProps={{
+ buttonType: 'icon',
+ iconType: 'eye',
+ }}
+ />
+
+ ) : null}
+ {item === 'error' && api.error?.detail ? (
+
+
+ this.copyToClipBoard(api.error.detail)}
+ />
+
+
+ ) : null}
+
+ );
+ } else {
+ return (
+
+
+ Checking
+
+ );
+ }
+ },
+ };
+ if (this.isUpdatesEnabled) {
+ columns.splice(7, 0, currentVersionColumn, versionStatusColumn);
+ }
+
const search = {
box: {
incremental: this.state.incremental,
@@ -672,33 +683,37 @@ export const ApiTable = compose(
Refresh
-
-
- await this.getApisAvailableUpdates(true, true)
- }
- >
-
- Check updates{' '}
-
+
+
+ await this.getApisAvailableUpdates(true, true)
}
>
-
-
-
-
-
-
-
-
+
+ Check updates{' '}
+
+
+
+
+
+
+
+
+
+ >
+ )}
diff --git a/plugins/main/public/components/wz-updates-notification/index.tsx b/plugins/main/public/components/wz-updates-notification/index.tsx
index fd4abcc29b..859f426f6a 100644
--- a/plugins/main/public/components/wz-updates-notification/index.tsx
+++ b/plugins/main/public/components/wz-updates-notification/index.tsx
@@ -11,11 +11,4 @@
* Find more information about this on the LICENSE file.
*/
-import React from 'react';
-import { getWazuhCheckUpdatesPlugin } from '../../kibana-services';
-
-export const WzUpdatesNotification = () => {
- const { UpdatesNotification } = getWazuhCheckUpdatesPlugin();
-
- return ;
-};
+export { WzUpdatesNotification } from './wz-updates-notification';
diff --git a/plugins/main/public/components/wz-updates-notification/wz-updates-notification.tsx b/plugins/main/public/components/wz-updates-notification/wz-updates-notification.tsx
new file mode 100644
index 0000000000..202ee79e5b
--- /dev/null
+++ b/plugins/main/public/components/wz-updates-notification/wz-updates-notification.tsx
@@ -0,0 +1,34 @@
+/*
+ * Wazuh app - React Component component to display new updates notification.
+ *
+ * Copyright (C) 2015-2023 Wazuh, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Find more information about this on the LICENSE file.
+ */
+
+import React from 'react';
+import { compose } from 'redux';
+import { connect } from 'react-redux';
+import { getWazuhCheckUpdatesPlugin } from '../../kibana-services';
+import { withReduxProvider } from '../common/hocs';
+
+const mapStateToProps = state => {
+ return {
+ appConfig: state?.appConfig,
+ };
+};
+export const WzUpdatesNotification = compose(
+ withReduxProvider,
+ connect(mapStateToProps),
+)(({ appConfig }) => {
+ const isUpdatesEnabled =
+ !appConfig?.isLoading && !appConfig?.data?.['wazuh.updates.disabled'];
+ const { UpdatesNotification } = getWazuhCheckUpdatesPlugin();
+
+ return isUpdatesEnabled ? : <>>;
+});
diff --git a/plugins/main/public/controllers/agent/agents.js b/plugins/main/public/controllers/agent/agents.js
deleted file mode 100644
index db8249dedc..0000000000
--- a/plugins/main/public/controllers/agent/agents.js
+++ /dev/null
@@ -1,784 +0,0 @@
-/*
- * Wazuh app - Agents controller
- * Copyright (C) 2015-2022 Wazuh, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Find more information about this on the LICENSE file.
- */
-import { FilterHandler } from '../../utils/filter-handler';
-import { TabNames } from '../../utils/tab-names';
-import { visualizations } from '../../templates/agents/visualizations';
-
-import { ConfigurationHandler } from '../../utils/config-handler';
-import { AppState } from '../../react-services/app-state';
-import { WazuhConfig } from '../../react-services/wazuh-config';
-import { GenericRequest } from '../../react-services/generic-request';
-import { WzRequest } from '../../react-services/wz-request';
-import {
- getToasts,
- getDataPlugin,
- getWazuhCorePlugin,
-} from '../../kibana-services';
-import { ShareAgent } from '../../factories/share-agent';
-import { TabVisualizations } from '../../factories/tab-visualizations';
-import { formatUIDate } from '../../react-services/time-service';
-import { hasAgentSupportModule } from '../../react-services/wz-agents';
-import { UI_LOGGER_LEVELS } from '../../../common/constants';
-import { UI_ERROR_SEVERITIES } from '../../react-services/error-orchestrator/types';
-import { getErrorOrchestrator } from '../../react-services/common-services';
-import { updateCurrentAgentData } from '../../redux/actions/appStateActions';
-import store from '../../redux/store';
-
-export class AgentsController {
- /**
- * Class constructor
- * @param {Object} $scope
- * @param {Object} $location
- * @param {Object} $rootScope
- * @param {Object} errorHandler
- * @param {Object} commonData
- * @param {Object} reportingService
- * @param {Object} visFactoryService
- * @param {Object} csvReq
- */
- constructor(
- $scope,
- $location,
- $rootScope,
- errorHandler,
- commonData,
- reportingService,
- visFactoryService,
- csvReq,
- ) {
- this.$scope = $scope;
- this.$location = $location;
- this.$rootScope = $rootScope;
- this.errorHandler = errorHandler;
- this.tabVisualizations = new TabVisualizations();
- this.$scope.visualizations = visualizations;
- this.shareAgent = new ShareAgent();
- this.commonData = commonData;
- this.reportingService = reportingService;
- this.visFactoryService = visFactoryService;
- this.csvReq = csvReq;
- this.wazuhConfig = new WazuhConfig();
- this.genericReq = GenericRequest;
-
- // Config on-demand
- this.$scope.isArray = Array.isArray;
- this.configurationHandler = new ConfigurationHandler(errorHandler);
- this.$scope.currentConfig = null;
- this.$scope.configurationTab = '';
- this.$scope.configurationSubTab = '';
- this.$scope.integrations = {};
- this.$scope.selectedItem = 0;
- this.targetLocation = null;
- this.ignoredTabs = ['syscollector', 'welcome', 'configuration', 'stats'];
-
- this.$scope.expandArray = [
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- ];
-
- this.loadWelcomeCardsProps();
- this.$scope.getWelcomeCardsProps = resultState => {
- return { ...this.$scope.welcomeCardsProps, resultState };
- };
- }
-
- /**
- * On controller loads
- */
- async $onInit() {
- const savedTimefilter = this.commonData.getTimefilter();
- if (savedTimefilter) {
- getDataPlugin().query.timefilter.timefilter.setTime(savedTimefilter);
- this.commonData.removeTimefilter();
- }
-
- this.$rootScope.reportStatus = false;
-
- this.$location.search('_a', null);
- this.filterHandler = new FilterHandler(AppState.getCurrentPattern());
- this.visFactoryService.clearAll();
-
- // Getting possible target location
- this.targetLocation = this.shareAgent.getTargetLocation();
-
- if (this.targetLocation && typeof this.targetLocation === 'object') {
- this.$scope.tabView = this.targetLocation.subTab;
- this.$scope.tab = this.targetLocation.tab;
- } else {
- this.$scope.tabView = this.commonData.checkTabViewLocation();
- this.$scope.tab = this.commonData.checkTabLocation();
- }
- this.tabHistory = [];
- if (!this.ignoredTabs.includes(this.$scope.tab))
- this.tabHistory.push(this.$scope.tab);
-
- // Tab names
- this.$scope.tabNames = TabNames;
-
- this.tabVisualizations.assign('agents');
-
- /**
- * This check if given array of items contais a single given item
- * @param {Object} item
- * @param {Array
);
diff --git a/plugins/main/public/controllers/overview/components/stats.js b/plugins/main/public/controllers/overview/components/stats.js
index 6701993a02..e0f08ae4ad 100644
--- a/plugins/main/public/controllers/overview/components/stats.js
+++ b/plugins/main/public/controllers/overview/components/stats.js
@@ -13,12 +13,11 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
- EuiStat,
+ EuiCard,
EuiFlexItem,
EuiFlexGroup,
EuiPage,
EuiToolTip,
- EuiLink,
} from '@elastic/eui';
import { withErrorBoundary } from '../../../components/common/hocs';
import { API_NAME_AGENT_STATUS } from '../../../../common/constants';
@@ -29,13 +28,22 @@ import {
import { getCore } from '../../../kibana-services';
import { endpointSummary } from '../../../utils/applications';
import { LastAlertsStat } from './last-alerts-stat';
-
+import { VisualizationBasic } from '../../../components/common/charts/visualizations/basic';
+import './stats.scss';
export const Stats = withErrorBoundary(
class Stats extends Component {
constructor(props) {
super(props);
- this.state = {};
+ this.state = {
+ agentStatusSummary: {
+ active: '-',
+ disconnected: '-',
+ total: '-',
+ pending: '-',
+ never_connected: '-',
+ },
+ };
this.agentStatus = [
API_NAME_AGENT_STATUS.ACTIVE,
API_NAME_AGENT_STATUS.DISCONNECTED,
@@ -70,39 +78,50 @@ export const Stats = withErrorBoundary(
}
render() {
+ const hasResults = this.agentStatus.some(
+ ({ status }) => this.props[status],
+ );
return (
-
+ <>
-
- {this.agentStatus.map(({ status, label, onClick, color }) => (
-
-
-
- {typeof this.props[status] !== 'undefined'
- ? this.props[status]
- : '-'}
-
-
+
+
+ ({
+ onClick,
+ label,
+ value:
+ typeof this.props[status] !== 'undefined'
+ ? this.props[status]
+ : 0,
+ color,
+ }),
+ )
}
- description={`${label} agents`}
- titleColor={color}
- textAlign='center'
+ noDataTitle='No results'
+ noDataMessage='No results were found.'
/>
-
- ))}
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+ >
);
}
},
diff --git a/plugins/main/public/controllers/overview/components/stats.scss b/plugins/main/public/controllers/overview/components/stats.scss
new file mode 100644
index 0000000000..8e8bfcf937
--- /dev/null
+++ b/plugins/main/public/controllers/overview/components/stats.scss
@@ -0,0 +1,3 @@
+.vulnerabilites-summary-card {
+ padding-top: 2vh;
+}
diff --git a/plugins/main/public/controllers/overview/components/stats.test.tsx b/plugins/main/public/controllers/overview/components/stats.test.tsx
index 4e4a777b63..1b794f8842 100644
--- a/plugins/main/public/controllers/overview/components/stats.test.tsx
+++ b/plugins/main/public/controllers/overview/components/stats.test.tsx
@@ -17,7 +17,14 @@ import { render, act } from '@testing-library/react';
import '@testing-library/jest-dom';
import { Stats } from './stats';
-jest.mock('react-use/lib/useObservable', () => () => {});
+jest.mock(
+ '../../../../../../node_modules/@elastic/eui/lib/services/accessibility/html_id_generator',
+ () => ({
+ htmlIdGenerator: () => () => 'htmlId',
+ }),
+);
+
+jest.mock('react-use/lib/useObservable', () => () => { });
jest.mock('./last-alerts-stat/last-alerts-service', () => ({
getLast24HoursAlerts: jest.fn().mockReturnValue({
count: 100,
@@ -35,12 +42,15 @@ jest.mock('../../../kibana-services', () => ({
navigateToApp: () => 'http://url',
getUrlForApp: () => 'http://url',
},
+ uiSettings: {
+ get: () => true
+ }
}),
}));
jest.mock('../../../react-services/common-services', () => ({
getErrorOrchestrator: () => ({
- handleError: options => {},
+ handleError: options => { },
}),
}));
diff --git a/plugins/main/public/directives/wz-logtest/components/logtest.tsx b/plugins/main/public/directives/wz-logtest/components/logtest.tsx
index eb376f1bbb..f6a5eec19d 100644
--- a/plugins/main/public/directives/wz-logtest/components/logtest.tsx
+++ b/plugins/main/public/directives/wz-logtest/components/logtest.tsx
@@ -16,16 +16,11 @@ import {
EuiCodeBlock,
EuiFlexGroup,
EuiFlexItem,
- EuiFlyout,
- EuiFlyoutBody,
- EuiFlyoutHeader,
- EuiOverlayMask,
EuiPage,
EuiPanel,
EuiSpacer,
EuiTextArea,
EuiTitle,
- EuiOutsideClickDetector,
} from '@elastic/eui';
import { WzRequest } from '../../../react-services';
import {
@@ -45,29 +40,27 @@ import {
} from '../../../react-services/error-orchestrator/types';
import { UI_LOGGER_LEVELS } from '../../../../common/constants';
import { getErrorOrchestrator } from '../../../react-services/common-services';
-import { WzFlyout } from '../../../components/common/flyouts';
import _ from 'lodash';
type LogstestProps = {
- openCloseFlyout: () => {};
- showClose: boolean;
onFlyout: boolean;
- isRuleset: string;
};
export const Logtest = compose(
withErrorBoundary,
withReduxProvider,
- withUserAuthorizationPrompt([{ action: 'logtest:run', resource: `*:*:*` }])
+ withUserAuthorizationPrompt([{ action: 'logtest:run', resource: '*:*:*' }]),
)((props: LogstestProps) => {
const [events, setEvents] = useState([]);
const [testing, setTesting] = useState(false);
const [testResult, setTestResult] = useState('');
const dispatch = useDispatch();
- const sessionToken = useSelector((state) => state.appStateReducers.logtestToken);
+ const sessionToken = useSelector(
+ state => state.appStateReducers.logtestToken,
+ );
- const onChange = (e) => {
- setEvents(e.target.value.split('\n').filter((item) => item));
+ const onChange = e => {
+ setEvents(e.target.value.split('\n').filter(item => item));
};
// Format the result of the Wazuh API response to an output similar one to the `wazuh-logtest` utility
@@ -75,30 +68,39 @@ export const Logtest = compose(
// How to the `wazuh-logtest` utility logs the output:
// https://github.com/wazuh/wazuh/blob/master/framework/scripts/wazuh-logtest.py#L359-L397
-
const logging = [];
-
+
const showFieldInfo = (item, path, label = '') => {
- _.has(item, path) && logging.push(
- `\t${label || path}: '${Array.isArray(_.get(item, path))
- ? JSON.stringify(_.get(item, path))
- : _.get(item, path)}'`
+ _.has(item, path) &&
+ logging.push(
+ `\t${label || path}: '${
+ Array.isArray(_.get(item, path))
+ ? JSON.stringify(_.get(item, path))
+ : _.get(item, path)
+ }'`,
);
};
const showPhaseInfo = (item, showFirst = [], prefix = '') => {
- showFirst && showFirst.forEach(field => {
- showFieldInfo(item, field, prefix+field);
- _.unset(item, field);
- });
- typeof item === 'object' && Object.keys(item).sort().forEach((field) => {
- if(typeof item[field] === 'object' && !Array.isArray(item[field])){
- showPhaseInfo(item[field],[], prefix + field + '.');
- }else{
- showFieldInfo(item, field, prefix+field);
- };
- });
- }
+ showFirst &&
+ showFirst.forEach(field => {
+ showFieldInfo(item, field, prefix + field);
+ _.unset(item, field);
+ });
+ typeof item === 'object' &&
+ Object.keys(item)
+ .sort()
+ .forEach(field => {
+ if (
+ typeof item[field] === 'object' &&
+ !Array.isArray(item[field])
+ ) {
+ showPhaseInfo(item[field], [], prefix + field + '.');
+ } else {
+ showFieldInfo(item, field, prefix + field);
+ }
+ });
+ };
// Output messages
if (messages) {
@@ -110,25 +112,29 @@ export const Logtest = compose(
// Pre-decoding phase
logging.push('**Phase 1: Completed pre-decoding.');
// Check in case rule has no_full_log attribute
- if(result.full_log){
+ if (result.full_log) {
showFieldInfo(result, 'full_log', 'full event');
- };
+ }
- if(result.predecoder){
- showPhaseInfo(result.predecoder, ['timestamp', 'hostname', 'program_name']);
+ if (result.predecoder) {
+ showPhaseInfo(result.predecoder, [
+ 'timestamp',
+ 'hostname',
+ 'program_name',
+ ]);
}
// Decoding phase
logging.push('');
logging.push('**Phase 2: Completed decoding.');
- if(result.decoder && Object.keys(result.decoder).length > 0){
+ if (result.decoder && Object.keys(result.decoder).length > 0) {
showPhaseInfo(result.decoder, ['name', 'parent']);
- if(result.data){
+ if (result.data) {
showPhaseInfo(result.data, []);
- };
- }else{
- logging.push('\tNo decoder matched.')
+ }
+ } else {
+ logging.push('\tNo decoder matched.');
}
// Rule phase
@@ -136,24 +142,34 @@ export const Logtest = compose(
// Rule debugging
// The output has data if the utility is ran in verbose mode: `wazuh-logtest -v`.
// At this moment, the Wazuh API doesn't let run in verbose mode.
- if(result.rules_debug){
+ if (result.rules_debug) {
logging.push('');
logging.push('**Rule debugging:');
- result.rules_debug.forEach(debugMessage => logging.push(`${debugMessage[0] === '*' ? '\t\t' : '\t'}${debugMessage}`));
- };
-
- if(result.rule){
+ result.rules_debug.forEach(debugMessage =>
+ logging.push(
+ `${debugMessage[0] === '*' ? '\t\t' : '\t'}${debugMessage}`,
+ ),
+ );
+ }
+
+ if (result.rule) {
logging.push('');
logging.push('**Phase 3: Completed filtering (rules).');
- showPhaseInfo(result.rule, ['id', 'level', 'description', 'groups', 'firedtimes']);
- };
+ showPhaseInfo(result.rule, [
+ 'id',
+ 'level',
+ 'description',
+ 'groups',
+ 'firedtimes',
+ ]);
+ }
- if(alert){
+ if (alert) {
logging.push('**Alert to be generated.');
- };
+ }
return logging.join('\n');
- };
+ };
const runAllTests = async () => {
setTestResult('');
@@ -172,22 +188,31 @@ export const Logtest = compose(
});
token = response.data.data.token;
- !sessionToken && !gotToken && token && dispatch(updateLogtestToken(token));
+ !sessionToken &&
+ !gotToken &&
+ token &&
+ dispatch(updateLogtestToken(token));
token && (gotToken = true);
responses.push(response);
}
- const testResults = responses.map((response) => {
- return response.data.data.output || ''
- ? formatResult(response.data.data.output, response.data.data.alert, response.data.data.messages)
- : `No result found for: ${response.data.data.output.full_log}`;
- }).join('\n\n');
+ const testResults = responses
+ .map(response => {
+ return response.data.data.output || ''
+ ? formatResult(
+ response.data.data.output,
+ response.data.data.alert,
+ response.data.data.messages,
+ )
+ : `No result found for: ${response.data.data.output.full_log}`;
+ })
+ .join('\n\n');
setTestResult(testResults);
} finally {
setTesting(false);
}
};
- const handleKeyPress = async (event) => {
+ const handleKeyPress = async event => {
if (event.ctrlKey && event.key === 'Enter') {
await runAllTests();
}
@@ -205,7 +230,9 @@ export const Logtest = compose(
severity: UI_ERROR_SEVERITIES.BUSINESS as UIErrorSeverity,
error: {
error: error,
- message: `Error trying to delete logtest token due to: ${error.message || error}`,
+ message: `Error trying to delete logtest token due to: ${
+ error.message || error
+ }`,
title: error.name,
},
};
@@ -217,21 +244,21 @@ export const Logtest = compose(
return (
-
-
+
+
@@ -244,12 +271,12 @@ export const Logtest = compose(
tooltip={{ position: 'top', content: 'Clear current session' }}
fill
isDisabled={sessionToken === '' ? true : false}
- aria-label="Clear current session"
- iconType="broom"
+ aria-label='Clear current session'
+ iconType='broom'
onConfirm={async () => {
deleteToken();
}}
- color="danger"
+ color='danger'
modalTitle={`Do you want to clear current session?`}
modalProps={{
buttonColor: 'danger',
@@ -261,10 +288,10 @@ export const Logtest = compose(
-
+
- DynamicHeight.dynamicHeightStatic('.euiCodeBlock', props.showClose ? 70 : 100);
+ DynamicHeight.dynamicHeightStatic(
+ '.euiCodeBlock',
+ props.onFlyout ? 70 : 100,
+ );
dynamicHeight();
@@ -287,40 +317,33 @@ export const Logtest = compose(
{(!props.onFlyout && (
-
+
-
+
-
+
Ruleset Test
-
+
{buildLogtest()}
)) || (
- props.openCloseFlyout()}>
-
-
- {props.isRuleset.includes('rules') ? Ruleset Test
: Decoders Test
}
-
-
-
-
-
-
-
- {buildLogtest()}
-
-
+ <>
+
+
+
+
+ {buildLogtest()}
+ >
)}
);
diff --git a/plugins/main/public/kibana-integrations/discover/build_services.ts b/plugins/main/public/kibana-integrations/discover/build_services.ts
index 9d7d4dd86b..41a93a99e3 100644
--- a/plugins/main/public/kibana-integrations/discover/build_services.ts
+++ b/plugins/main/public/kibana-integrations/discover/build_services.ts
@@ -40,11 +40,15 @@ import { VisualizationsStart } from 'src/plugins/visualizations/public';
import { SavedObjectOpenSearchDashboardsServices } from 'src/plugins/saved_objects/public';
//import { createSavedSearchesLoader, SavedSearch } from './saved_searches';
-import { getHistory } from './kibana_services';
+import { syncHistoryLocations } from './kibana_services';
import { OpenSearchDashboardsLegacyStart } from '../../../../../src/plugins/opensearch_dashboards_legacy/public';
import { UrlForwardingStart } from '../../../../../src/plugins/url_forwarding/public';
import { NavigationPublicPluginStart } from '../../../../../src/plugins/navigation/public';
-import { getDataPlugin, getNavigationPlugin, getVisualizationsPlugin } from '../../kibana-services';
+import {
+ getDataPlugin,
+ getNavigationPlugin,
+ getVisualizationsPlugin,
+} from '../../kibana-services';
//import { DiscoverStartPlugins, SavedSearch } from '../../../../../src/plugins/discover/public';
export interface DiscoverServices {
@@ -77,9 +81,9 @@ export async function buildServices(
core: CoreStart,
plugins: any, //DiscoverStartPlugins,
context: PluginInitializerContext,
- getEmbeddableInjector: any
+ getEmbeddableInjector: any,
): Promise {
-/* const services: SavedObjectOpenSearchDashboardsServices = {
+ /* const services: SavedObjectOpenSearchDashboardsServices = {
savedObjectsClient: core.savedObjects.client,
indexPatterns: plugins.data.indexPatterns,
search: plugins.data.search,
@@ -99,7 +103,10 @@ export async function buildServices(
getEmbeddableInjector,
/* getSavedSearchById: async (id: string) => savedObjectService.get(id),
getSavedSearchUrlById: async (id: string) => savedObjectService.urlFor(id), */
- history: getHistory,
+ /* Discover currently uses two history instances:
+ one from Opensearch Dashboards Platform and another from history package.
+ getHistory is replaced by the following function that is used each time the Discover application is loaded to synchronise both instances */
+ history: syncHistoryLocations,
indexPatterns: getDataPlugin().indexPatterns,
inspector: plugins.inspector,
metadata: {
diff --git a/plugins/main/public/kibana-integrations/kibana-discover.js b/plugins/main/public/kibana-integrations/kibana-discover.js
index a666e157f6..bba15bf855 100644
--- a/plugins/main/public/kibana-integrations/kibana-discover.js
+++ b/plugins/main/public/kibana-integrations/kibana-discover.js
@@ -201,7 +201,7 @@ function discoverController(
filterManager,
timefilter,
toastNotifications,
- history: getHistory,
+ history: syncHistoryLocations,
uiSettings: config,
visualizations,
} = getServices();
@@ -215,7 +215,7 @@ function discoverController(
: undefined;
};
- const history = getHistory();
+ const history = syncHistoryLocations();
const {
appStateContainer,
diff --git a/plugins/main/public/plugin.ts b/plugins/main/public/plugin.ts
index 5f4f8b1844..f8dee3b0e8 100644
--- a/plugins/main/public/plugin.ts
+++ b/plugins/main/public/plugin.ts
@@ -45,7 +45,6 @@ import {
unregisterInterceptor,
} from './services/request-handler';
import { Applications, Categories } from './utils/applications';
-import { syncHistoryLocations } from './kibana-integrations/discover/kibana_services';
import { euiPaletteColorBlind } from '@elastic/eui';
const innerAngularName = 'app/wazuh';
@@ -170,10 +169,6 @@ export class WazuhPlugin
setScopedHistory(params.history);
// This allows you to add the selectors to the navbar
setHeaderActionMenuMounter(params.setHeaderActionMenu);
- // Discover currently uses two history instances:
- // one from Kibana Platform and another from history package.
- // Below function is used every time Discover app is loaded to synchronize both instances
- syncHistoryLocations();
// Load application bundle
const { renderApp } = await import('./application');
// Get start services as specified in kibana.json
diff --git a/plugins/main/public/services/config-handler.js b/plugins/main/public/services/config-handler.js
index e9547e35fe..e87fde2436 100644
--- a/plugins/main/public/services/config-handler.js
+++ b/plugins/main/public/services/config-handler.js
@@ -24,11 +24,10 @@ export class ConfigHandler {
*/
async saveManagerConfiguration(content) {
try {
- const result = await WzRequest.apiReq(
- 'PUT',
- `/manager/configuration`,
- { content, origin: 'xmleditor' }
- );
+ const result = await WzRequest.apiReq('PUT', `/manager/configuration`, {
+ content,
+ origin: 'xmleditor',
+ });
return result;
} catch (error) {
return Promise.reject(error);
@@ -45,7 +44,7 @@ export class ConfigHandler {
const result = await WzRequest.apiReq(
'PUT',
`/cluster/${node}/configuration`,
- { content, origin: 'xmleditor' }
+ { content, origin: 'xmleditor' },
);
return result;
} catch (error) {
@@ -56,9 +55,7 @@ export class ConfigHandler {
async performClusterRestart() {
try {
await WzRequest.apiReq('PUT', `/cluster/restart`, { delay: 15000 });
- this.$rootScope.$broadcast('removeRestarting', {});
} catch (error) {
- this.$rootScope.$broadcast('removeRestarting', {});
throw new Error('Error restarting cluster');
}
}
@@ -71,7 +68,7 @@ export class ConfigHandler {
const validationError = await WzRequest.apiReq(
'GET',
`/manager/configuration/validation`,
- {}
+ {},
);
const data = ((validationError || {}).data || {}).data || {};
@@ -96,7 +93,7 @@ export class ConfigHandler {
const validationError = await WzRequest.apiReq(
'GET',
`/cluster/configuration/validation`,
- {}
+ {},
);
const data = ((validationError || {}).data || {}).data || {};
@@ -120,7 +117,7 @@ export class ConfigHandler {
const validationError = await WzRequest.apiReq(
'GET',
`/cluster/${node}/configuration/validation`,
- {}
+ {},
);
const data = ((validationError || {}).data || {}).data || {};
@@ -132,7 +129,7 @@ export class ConfigHandler {
const result = await WzRequest.apiReq(
'PUT',
`/cluster/${node}/restart`,
- {}
+ {},
);
return result;
} catch (error) {
diff --git a/plugins/main/public/styles/common.scss b/plugins/main/public/styles/common.scss
index 09810f9e96..bef2dcba4f 100644
--- a/plugins/main/public/styles/common.scss
+++ b/plugins/main/public/styles/common.scss
@@ -252,30 +252,6 @@
top: 210px !important;
}
-.btn-as-i {
- background: none;
- border: 0;
- color: #006bb4;
- padding: 0;
- margin: 0;
- font-size: 20px;
- box-shadow: none !important;
-}
-
-.btn-as-i:hover,
-.btn-as-i:focus {
- background: none !important;
- color: #006bb4 !important;
-}
-
-/* Custom reporting button styles */
-
-.wz-report-button:hover {
- background-color: #006bb4 !important;
- color: #f5f5f5;
- border-radius: 0;
-}
-
.wz-report-refresh-btn {
position: absolute !important;
right: 0px;
@@ -326,23 +302,6 @@ input[type='search'].euiFieldSearch {
border: 1px solid #d9d9d9 !important;
}
-/* Custom input container styles */
-
-.wz-input-container label {
- font-weight: 700 !important;
- color: rgba(0, 0, 0, 0.38) !important;
-}
-
-.wz-input-container label.md-required:after {
- color: #006bb4 !important;
-}
-
-.wz-input-container input,
-.wz-input-container input.md-input-invalid.md-input,
-.wz-input-container input.ng-invalid.ng-touched {
- border-color: rgba(0, 0, 0, 0.12) !important;
-}
-
.wz-autocomplete md-autocomplete-wrap {
box-shadow: none !important;
}
diff --git a/plugins/main/public/styles/component.scss b/plugins/main/public/styles/component.scss
index 7fa8976546..b4d8f3a0ac 100644
--- a/plugins/main/public/styles/component.scss
+++ b/plugins/main/public/styles/component.scss
@@ -20,21 +20,10 @@
height: auto !important;
}
-.wz-nav-item button,
.wz-no-padding {
padding: 0 5px !important;
}
-.wz-nav-item button.md-primary {
- color: rgb(0, 121, 165) !important;
- background: #f5fafb !important;
- border-bottom: 2px solid #006bb4;
-}
-
-.wz-nav-item button.md-unselected {
- color: rgba(0, 0, 0, 0.87) !important;
-}
-
.wz-nav-bar md-nav-ink-bar {
color: rgb(0, 121, 165) !important;
background: rgb(0, 121, 165) !important;
@@ -58,22 +47,6 @@
margin: 0 !important;
}
-/* Custom chips styles */
-
-.wz-chips .md-chips {
- box-shadow: none !important;
- padding-bottom: 0;
-}
-
-.wz-chip {
- font-size: 12px;
- color: white;
- background-color: #006bb4;
- height: 26px !important;
- line-height: 26px !important;
- margin: 0 8px 0 0 !important;
-}
-
.sca-chart-widget {
margin: 0 auto;
//width:350px;
diff --git a/plugins/main/public/styles/layout.scss b/plugins/main/public/styles/layout.scss
index 2bf6fc5318..bcc08f7681 100644
--- a/plugins/main/public/styles/layout.scss
+++ b/plugins/main/public/styles/layout.scss
@@ -294,131 +294,6 @@
display: inline;
}
-md-dialog-actions button {
- color: white !important;
- transition: none !important;
- background-color: rgb(0, 85, 113) !important;
-}
-
-md-backdrop.md-opaque {
- opacity: 1 !important;
- background-color: rgba(255, 255, 255, 0.8);
-}
-
-md-backdrop.md-opaque.ng-leave {
- opacity: 0 !important;
- transition: none !important;
- transform: none !important;
-}
-
-md-dialog.md-transition-in {
- transition: 150ms ease-in !important;
- transform: none !important;
- animation: 350ms cubic-bezier(0.34, 1.61, 0.7, 1);
-}
-
-md-dialog.md-transition-out {
- transition: none !important;
- transform: none !important;
-}
-
-.md-dialog-container {
- //padding-bottom: 10vh;
- z-index: 100 !important;
-}
-
-md-dialog .md-dialog-content {
- padding: 0px !important;
-}
-
-md-dialog {
- animation: 350ms cubic-bezier(0.34, 1.61, 0.7, 1);
- border: 1px solid #d9d9d9;
- border-color: #c4cace;
- border-top-color: #e2e5e7;
- border-bottom-color: #a7b0b6;
- min-width: 400px;
- max-width: 768px;
- padding: 15px;
- box-shadow: 0 40px 64px 0 rgba(59, 79, 93, 0.1),
- 0 24px 32px 0 rgba(59, 79, 93, 0.1), 0 16px 16px 0 rgba(59, 79, 93, 0.1),
- 0 8px 8px 0 rgba(59, 79, 93, 0.1), 0 4px 4px 0 rgba(59, 79, 93, 0.1),
- 0 2px 2px 0 rgba(59, 79, 93, 0.1) !important;
-}
-
-.md-cancel-button {
- background-color: #ffffff !important;
- color: #005571 !important;
-}
-
-.md-title {
- color: #1a1a1a;
- font-size: 24px;
- font-weight: 600;
- line-height: 2.5rem;
-}
-
-md-dialog md-dialog-content .md-dialog-content-body {
- padding-top: 15px;
- margin-bottom: 45px;
-}
-
-md-dialog .md-dialog-content {
- padding: 25px 5px 35px 5px;
- overflow: hidden !important;
- height: auto !important;
-}
-
-md-dialog .md-actions,
-md-dialog md-dialog-actions {
- border: none !important;
-}
-
-md-dialog .md-button.md-primary:not(.md-cancel-button) {
- color: #ffffff;
- background-color: #006bb4 !important;
- border-color: #006bb4 !important;
- border-radius: 4px;
-}
-
-md-dialog .md-button.md-primary:not(.md-cancel-button):hover {
- background-color: #005472 !important;
- border-color: #004c68 !important;
-}
-
-md-dialog.modalTheme {
- animation: none !important;
- transition: none !important;
- transform: none !important;
- bottom: 0;
- right: 0;
- position: fixed;
- width: 350px;
-}
-
-md-dialog.modalTheme .md-button {
- margin-bottom: 0;
-}
-
-.md-dialog-body {
- top: 0 !important;
- width: 100vw !important;
-}
-
-.md-dialog-body {
- top: 0 !important;
- width: 100vw !important;
-}
-
-.md-dialog-body .md-scroll-mask {
- display: none !important;
-}
-
-.md-dialog-body .md-dialog-container {
- height: 0 !important;
- width: 0 !important;
-}
-
.chrHeaderWrapper--navIsLocked ~ .app-wrapper .fullscreen {
width: calc(100vw - 400px) !important;
left: 321px !important;
@@ -440,10 +315,6 @@ md-dialog.modalTheme .md-button {
padding: 5%;
}
-.filter-bar .filter {
- background-color: #0079a5 !important;
-}
-
.columns-bar {
margin-top: -17px;
margin-left: -16px;
@@ -512,7 +383,3 @@ md-dialog.modalTheme .md-button {
font-kerning: normal !important;
padding: 8px !important;
}
-
-.kbnTableCellFilter {
- cursor: pointer;
-}
diff --git a/plugins/main/public/styles/theme/dark/index.dark.scss b/plugins/main/public/styles/theme/dark/index.dark.scss
index 4f037e9dba..0bbe58a1f2 100644
--- a/plugins/main/public/styles/theme/dark/index.dark.scss
+++ b/plugins/main/public/styles/theme/dark/index.dark.scss
@@ -123,21 +123,11 @@ md-content {
color: #fff;
}
-.wz-nav-item button.md-primary {
- color: #0079a5 !important;
- background-color: #232635 !important;
- border-bottom: 2px solid #006bb4;
-}
-
md-nav-bar.md-default-theme .md-nav-bar,
md-nav-bar .md-nav-bar {
border-color: rgb(52, 55, 65);
}
-.wz-nav-item button.md-unselected {
- color: #fff !important;
-}
-
.sidebar-container .index-pattern {
background-color: #1ba9f5 !important;
color: white !important;
@@ -239,10 +229,6 @@ table thead > tr {
border-left: 1px dashed #343741;
}
-md-dialog.md-default-theme.md-content-overflow .md-actions,
-md-dialog.md-content-overflow .md-actions,
-md-dialog.md-default-theme.md-content-overflow md-dialog-actions,
-md-dialog.md-content-overflow md-dialog-actions,
md-divider.md-default-theme,
md-divider {
border-top-color: rgb(52, 55, 65);
diff --git a/plugins/main/public/styles/typography.scss b/plugins/main/public/styles/typography.scss
index 6475feaea7..8534102e97 100644
--- a/plugins/main/public/styles/typography.scss
+++ b/plugins/main/public/styles/typography.scss
@@ -20,13 +20,13 @@ body,
button:not(.fa):not(.fa-times),
textarea,
input,
-select{
+select {
//font-size: 14px;
}
.wz-headline-title:not(.wz-dev-title) {
- padding: 8px!important;
- justify-content: start!important;
+ padding: 8px !important;
+ justify-content: start !important;
font-size: 12px;
}
@@ -39,18 +39,6 @@ select{
color: grey !important;
}
-.color-f9 {
- color: #ff9999;
-}
-
-.wz-color-orange {
- color: #f39c12 !important;
-}
-
-.color-pointer {
- color: #006bb4 !important;
-}
-
.wz-line-height {
line-height: 20px !important;
}
@@ -142,31 +130,6 @@ select{
color: rgb(0, 166, 155);
}
-/* Class for linkable text elements */
-.wz-text-link {
- cursor: pointer !important;
- color: #006bb4 !important;
-
- &:hover {
- text-decoration: underline !important;
- }
-}
-
-.wz-text-link-add {
- cursor: pointer !important;
- color: #006bb4 !important;
-
- &:hover {
- text-decoration: none !important;
- }
-}
-
-.wz-text-active {
- color: rgb(0, 121, 165);
- font-weight: bold;
- text-decoration: underline;
-}
-
/* Special fix for text in navbars */
.md-button {
diff --git a/plugins/main/public/templates/agents/dashboards.html b/plugins/main/public/templates/agents/dashboards.html
index 33fe5c8c5e..93330667b7 100644
--- a/plugins/main/public/templates/agents/dashboards.html
+++ b/plugins/main/public/templates/agents/dashboards.html
@@ -1,138 +1 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{loadingStatus}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{reportStatus}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/plugins/main/public/templates/management/management.html b/plugins/main/public/templates/management/management.html
index 4d69103378..01db1a17d5 100644
--- a/plugins/main/public/templates/management/management.html
+++ b/plugins/main/public/templates/management/management.html
@@ -1,49 +1 @@
-
-
-
-
-
-
-
-
-
-
-
- {{ mctrl.tabNames[mctrl.tab] }}
- / {{ mctrl.currentGroup.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/plugins/main/server/integration-files/visualizations/agents/agents-welcome.ts b/plugins/main/server/integration-files/visualizations/agents/agents-welcome.ts
index 27db0c5f70..20e62748bd 100644
--- a/plugins/main/server/integration-files/visualizations/agents/agents-welcome.ts
+++ b/plugins/main/server/integration-files/visualizations/agents/agents-welcome.ts
@@ -24,7 +24,12 @@ 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,
@@ -57,7 +62,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,
@@ -105,7 +116,12 @@ 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,
@@ -138,7 +154,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,
@@ -186,7 +208,12 @@ 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,
@@ -219,7 +246,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,
@@ -267,7 +300,12 @@ 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,
@@ -300,7 +338,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,
@@ -348,7 +392,12 @@ 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,
@@ -381,7 +430,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,
@@ -429,7 +484,12 @@ 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,
@@ -462,7 +522,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,
@@ -496,106 +562,4 @@ export default [
},
},
},
- {
- _id: 'Wazuh-App-Agents-Welcome-Events-Evolution',
- _type: 'visualization',
- _source: {
- title: 'Events evolution',
- visState: JSON.stringify({
- title: 'event evolution',
- type: 'line',
- params: {
- type: 'line',
- grid: { categoryLines: false },
- 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: 'line',
- mode: 'normal',
- data: { label: 'Count', id: '1' },
- valueAxis: 'ValueAxis-1',
- drawLinesBetweenPoints: true,
- lineWidth: 2,
- interpolate: 'linear',
- showCircles: true,
- },
- ],
- addTooltip: true,
- addLegend: false,
- legendPosition: 'right',
- times: [],
- addTimeMarker: false,
- labels: {},
- thresholdLine: { show: false, value: 10, width: 1, style: 'full', color: '#E7664C' },
- dimensions: {
- x: null,
- y: [
- {
- accessor: 0,
- format: { id: 'number' },
- params: {},
- label: 'Count',
- aggType: 'count',
- },
- ],
- },
- },
- aggs: [
- { id: '1', enabled: true, type: 'count', schema: 'metric', params: {} },
- {
- id: '2',
- enabled: true,
- type: 'date_histogram',
- schema: 'segment',
- params: {
- field: 'timestamp',
- useNormalizedEsInterval: true,
- scaleMetricValues: false,
- interval: 'auto',
- drop_partials: false,
- min_doc_count: 1,
- extended_bounds: {},
- },
- },
- ],
- }),
- uiStateJSON: JSON.stringify({
- vis: { params: { sort: { columnIndex: 2, direction: 'desc' } } },
- }),
- description: '',
- version: 1,
- kibanaSavedObjectMeta: {
- searchSourceJSON: JSON.stringify({
- index: 'wazuh-alerts',
- query: { query: '', language: 'lucene' },
- filter: [],
- }),
- },
- },
- },
];
diff --git a/plugins/main/server/lib/generate-alerts/generate-alerts-script.js b/plugins/main/server/lib/generate-alerts/generate-alerts-script.js
index 9510171002..91b65114cd 100644
--- a/plugins/main/server/lib/generate-alerts/generate-alerts-script.js
+++ b/plugins/main/server/lib/generate-alerts/generate-alerts-script.js
@@ -61,7 +61,7 @@ const ruleDescription = [
'Sample alert 4',
'Sample alert 5',
];
-const ruleMaxLevel = 14;
+const ruleMaxLevel = 15;
/**
* Generate a alert
diff --git a/plugins/wazuh-check-updates/opensearch_dashboards.json b/plugins/wazuh-check-updates/opensearch_dashboards.json
index bf69812edc..2f071b5548 100644
--- a/plugins/wazuh-check-updates/opensearch_dashboards.json
+++ b/plugins/wazuh-check-updates/opensearch_dashboards.json
@@ -13,4 +13,4 @@
"optionalPlugins": [
"securityDashboards"
]
-}
+}
\ No newline at end of file
diff --git a/plugins/wazuh-core/common/constants.ts b/plugins/wazuh-core/common/constants.ts
index 20a981bbeb..59da67e7bd 100644
--- a/plugins/wazuh-core/common/constants.ts
+++ b/plugins/wazuh-core/common/constants.ts
@@ -299,6 +299,15 @@ export const PLUGIN_PLATFORM_REQUEST_HEADERS = {
export const PLUGIN_APP_NAME = 'Dashboard';
// UI
+export const UI_COLOR_STATUS = {
+ success: '#007871',
+ danger: '#BD271E',
+ warning: '#FEC514',
+ disabled: '#646A77',
+ info: '#6092C0',
+ default: '#000000',
+} as const;
+
export const API_NAME_AGENT_STATUS = {
ACTIVE: 'active',
DISCONNECTED: 'disconnected',
@@ -307,11 +316,11 @@ export const API_NAME_AGENT_STATUS = {
} as const;
export const UI_COLOR_AGENT_STATUS = {
- [API_NAME_AGENT_STATUS.ACTIVE]: '#007871',
- [API_NAME_AGENT_STATUS.DISCONNECTED]: '#BD271E',
- [API_NAME_AGENT_STATUS.PENDING]: '#FEC514',
- [API_NAME_AGENT_STATUS.NEVER_CONNECTED]: '#646A77',
- default: '#000000',
+ [API_NAME_AGENT_STATUS.ACTIVE]: UI_COLOR_STATUS.success,
+ [API_NAME_AGENT_STATUS.DISCONNECTED]: UI_COLOR_STATUS.danger,
+ [API_NAME_AGENT_STATUS.PENDING]: UI_COLOR_STATUS.warning,
+ [API_NAME_AGENT_STATUS.NEVER_CONNECTED]: UI_COLOR_STATUS.disabled,
+ default: UI_COLOR_STATUS.default,
} as const;
export const UI_LABEL_NAME_AGENT_STATUS = {
@@ -1703,6 +1712,33 @@ hosts:
},
validate: SettingsValidator.isBoolean,
},
+ 'wazuh.updates.disabled': {
+ title: 'Check updates',
+ description: 'Define if the check updates service is active.',
+ category: SettingCategory.GENERAL,
+ type: EpluginSettingType.switch,
+ defaultValue: false,
+ store: {
+ file: {
+ configurableManaged: false,
+ },
+ },
+ isConfigurableFromSettings: false,
+ options: {
+ switch: {
+ values: {
+ disabled: { label: 'false', value: false },
+ enabled: { label: 'true', value: true },
+ },
+ },
+ },
+ uiFormTransformChangedInputValue: function (
+ value: boolean | string,
+ ): boolean {
+ return Boolean(value);
+ },
+ validate: SettingsValidator.isBoolean,
+ },
pattern: {
title: 'Index pattern',
store: {
diff --git a/plugins/wazuh-core/opensearch_dashboards.json b/plugins/wazuh-core/opensearch_dashboards.json
index 47ff8cfd52..99195c389b 100644
--- a/plugins/wazuh-core/opensearch_dashboards.json
+++ b/plugins/wazuh-core/opensearch_dashboards.json
@@ -11,4 +11,4 @@
"optionalPlugins": [
"securityDashboards"
]
-}
+}
\ No newline at end of file
diff --git a/scripts/vulnerabilities-events-injector/dataInjectScript.py b/scripts/vulnerabilities-events-injector/dataInjectScript.py
index cee658ad92..e9f8edb324 100644
--- a/scripts/vulnerabilities-events-injector/dataInjectScript.py
+++ b/scripts/vulnerabilities-events-injector/dataInjectScript.py
@@ -6,9 +6,9 @@
import warnings
warnings.filterwarnings("ignore")
-def generateRandomDate():
+def generateRandomDate(days_interval=10):
start_date = datetime.now()
- end_date = start_date - timedelta(days=10)
+ end_date = start_date - timedelta(days=days_interval)
random_date = start_date + (end_date - start_date) * random.random()
return(random_date.strftime("%Y-%m-%dT%H:%M:%S.{}Z".format(random.randint(0, 999))))
@@ -115,8 +115,8 @@ def generateRandomVulnerability():
vulnerability['scanner'] = {'vendor':'vendor-{}'.format(random.randint(0, 9))}
vulnerability['score'] = {'base':round(random.uniform(0, 10),1), 'environmental':round(random.uniform(0, 10),1), 'temporal':round(random.uniform(0, 10),1),'version':'{}'.format(round(random.uniform(0, 10),1))}
vulnerability['severity'] = random.choice(['Low','Medium','High','Critical'])
- vulnerability['published_at'] = generateRandomDate()
- vulnerability['detected_at'] = generateRandomDate()
+ vulnerability['published_at'] = generateRandomDate(2000)
+ vulnerability['detected_at'] = generateRandomDate(180)
return(vulnerability)
def generateRandomWazuh():
diff --git a/scripts/wazuh-alerts-generator/lib/index.js b/scripts/wazuh-alerts-generator/lib/index.js
index 9a9a58b819..9c3a92d5d5 100644
--- a/scripts/wazuh-alerts-generator/lib/index.js
+++ b/scripts/wazuh-alerts-generator/lib/index.js
@@ -1,49 +1,56 @@
// General
const {
- IPs,
- Users,
- Ports,
- Paths,
- Win_Hostnames,
- GeoLocation,
- Agents,
- randomElements,
- randomArrayItem,
+ IPs,
+ Users,
+ Ports,
+ Paths,
+ Win_Hostnames,
+ GeoLocation,
+ Agents,
+ randomElements,
+ randomArrayItem,
} = require('./common');
-const { PCI_DSS, GDPR, HIPAA, GPG13, NIST_800_53, tsc } = require('./modules/regulatory-compliance');
+const {
+ PCI_DSS,
+ GDPR,
+ HIPAA,
+ GPG13,
+ NIST_800_53,
+ tsc,
+} = require('./modules/regulatory-compliance');
const Audit = require('./modules/audit');
const Authentication = require('./modules/authentication');
-const AWS = require( './modules/aws');
-const IntegrityMonitoring = require( './modules/integrity-monitoring');
-const CISCAT = require( './modules/ciscat');
-const GCP = require( './modules/gcp');
-const Docker = require( './modules/docker');
-const Mitre = require( './modules/mitre');
-const Osquery = require( './modules/osquery');
-const OpenSCAP = require( './modules/openscap');
-const PolicyMonitoring = require( './modules/policy-monitoring');
-const Virustotal = require( './modules/virustotal');
-const Vulnerability = require( './modules/vulnerabilities');
-const SSH = require( './modules/ssh');
-const Apache = require( './modules/apache');
-const Web = require( './modules/web');
-const GitHub = require( './modules/github');
-const Office = require( './modules/office');
+const AWS = require('./modules/aws');
+const IntegrityMonitoring = require('./modules/integrity-monitoring');
+const CISCAT = require('./modules/ciscat');
+const GCP = require('./modules/gcp');
+const Docker = require('./modules/docker');
+const Mitre = require('./modules/mitre');
+const Osquery = require('./modules/osquery');
+const OpenSCAP = require('./modules/openscap');
+const PolicyMonitoring = require('./modules/policy-monitoring');
+const Virustotal = require('./modules/virustotal');
+const Vulnerability = require('./modules/vulnerabilities');
+const SSH = require('./modules/ssh');
+const Apache = require('./modules/apache');
+const Web = require('./modules/web');
+const GitHub = require('./modules/github');
+const Office = require('./modules/office');
//Alert
const alertIDMax = 6000;
// Rule
const ruleDescription = [
- 'Sample alert 1',
- 'Sample alert 2',
- 'Sample alert 3',
- 'Sample alert 4',
- 'Sample alert 5',
+ 'Sample alert 1',
+ 'Sample alert 2',
+ 'Sample alert 3',
+ 'Sample alert 4',
+ 'Sample alert 5',
];
-const ruleMaxLevel = 14;
+const ruleMaxLevel = 15;
/**
* Generate a alert
@@ -76,900 +83,1069 @@ const ruleMaxLevel = 14;
* @return {any} - Alert generated
*/
function generateAlert(params) {
- let alert = {
- ['@sampledata']: true,
- timestamp: '2020-01-27T11:08:47.777+0000',
- rule: {
- level: 3,
- description: 'Sample alert',
- id: '5502',
- mail: false,
- groups: [],
- },
- agent: {
- id: '000',
- name: 'master',
- },
- manager: {
- name: 'master',
- },
- cluster: {
- name: 'wazuh',
- },
- id: '1580123327.49031',
- predecoder: {},
- decoder: {},
- data: {},
- location: '',
- };
- alert.agent = randomArrayItem(Agents);
- alert.rule.description = randomArrayItem(ruleDescription);
- alert.rule.id = `${randomIntervalInteger(1, alertIDMax)}`;
- alert.rule.level = randomIntervalInteger(1, ruleMaxLevel);
-
- alert.timestamp = randomDate();
-
- if (params.manager) {
- if (params.manager.name) {
- alert.manager.name = params.manager.name;
- }
+ let alert = {
+ ['@sampledata']: true,
+ timestamp: '2020-01-27T11:08:47.777+0000',
+ rule: {
+ level: 3,
+ description: 'Sample alert',
+ id: '5502',
+ mail: false,
+ groups: [],
+ },
+ agent: {
+ id: '000',
+ name: 'master',
+ },
+ manager: {
+ name: 'master',
+ },
+ cluster: {
+ name: 'wazuh',
+ },
+ id: '1580123327.49031',
+ predecoder: {},
+ decoder: {},
+ data: {},
+ location: '',
+ };
+ alert.agent = randomArrayItem(Agents);
+ alert.rule.description = randomArrayItem(ruleDescription);
+ alert.rule.id = `${randomIntervalInteger(1, alertIDMax)}`;
+ alert.rule.level = randomIntervalInteger(1, ruleMaxLevel);
+
+ alert.timestamp = randomDate();
+
+ if (params.manager) {
+ if (params.manager.name) {
+ alert.manager.name = params.manager.name;
}
+ }
- if (params.cluster) {
- if (params.cluster.name) {
- alert.cluster.name = params.cluster.name;
- }
- if (params.cluster.node) {
- alert.cluster.node = params.cluster.node;
- }
+ if (params.cluster) {
+ if (params.cluster.name) {
+ alert.cluster.name = params.cluster.name;
}
-
- if (params.aws) {
- let randomType = randomArrayItem([
- 'guarddutyPortProbe',
- 'apiCall',
- 'networkConnection',
- 'iamPolicyGrantGlobal',
- ]);
-
- const beforeDate = new Date(new Date(alert.timestamp) - 3 * 24 * 60 * 60 * 1000);
- switch (randomType) {
- case 'guarddutyPortProbe': {
- const typeAlert = AWS.guarddutyPortProbe;
-
- alert.data = { ...typeAlert.data };
- alert.data.integration = 'aws';
- alert.data.aws.region = randomArrayItem(AWS.region);
- alert.data.aws.resource.instanceDetails = { ...randomArrayItem(AWS.instanceDetails) };
- alert.data.aws.resource.instanceDetails.iamInstanceProfile.arn = interpolateAlertProps(
- typeAlert.data.aws.resource.instanceDetails.iamInstanceProfile.arn,
- alert
- );
- alert.data.aws.title = interpolateAlertProps(alert.data.aws.title, alert);
- alert.data.aws.accountId = randomArrayItem(AWS.accountId);
- alert.data.aws.service.eventFirstSeen = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
- alert.data.aws.service.eventLastSeen = formatDate(
- new Date(alert.timestamp),
- 'Y-M-DTh:m:s.lZ'
- );
- alert.data.aws.service.action.portProbeAction.portProbeDetails.remoteIpDetails = {
- ...randomArrayItem(AWS.remoteIpDetails),
- };
- alert.data.aws.log_info = {
- s3bucket: randomArrayItem(AWS.buckets),
- log_file: `guardduty/${formatDate(
- new Date(alert.timestamp),
- 'Y/M/D/h'
- )}/firehose_guardduty-1-${formatDate(
- new Date(alert.timestamp),
- 'Y-M-D-h-m-s-l'
- )}b5b9b-ec62-4a07-85d7-b1699b9c031e.zip`,
- };
- alert.data.aws.service.count = `${randomIntervalInteger(400, 4000)}`;
- alert.data.aws.createdAt = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
-
- alert.rule = { ...typeAlert.rule };
- alert.rule.firedtimes = randomIntervalInteger(1, 50);
- alert.rule.description = interpolateAlertProps(typeAlert.rule.description, alert);
-
- alert.decoder = { ...typeAlert.decoder };
- alert.location = typeAlert.location;
- break;
- }
- case 'apiCall': {
- const typeAlert = AWS.apiCall;
-
- alert.data = { ...typeAlert.data };
- alert.data.integration = 'aws';
- alert.data.aws.region = randomArrayItem(AWS.region);
- alert.data.aws.resource.accessKeyDetails.userName = randomArrayItem(Users);
- alert.data.aws.log_info = {
- s3bucket: randomArrayItem(AWS.buckets),
- log_file: `guardduty/${formatDate(
- new Date(alert.timestamp),
- 'Y/M/D/h'
- )}/firehose_guardduty-1-${formatDate(
- new Date(alert.timestamp),
- 'Y-M-D-h-m-s-l'
- )}b5b9b-ec62-4a07-85d7-b1699b9c031e.zip`,
- };
- alert.data.aws.accountId = randomArrayItem(AWS.accountId);
- alert.data.aws.service.action.awsApiCallAction.remoteIpDetails = {
- ...randomArrayItem(AWS.remoteIpDetails),
- };
- alert.data.aws.service.eventFirstSeen = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
- alert.data.aws.service.eventLastSeen = formatDate(
- new Date(alert.timestamp),
- 'Y-M-DTh:m:s.lZ'
- );
- alert.data.aws.createdAt = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
- alert.data.aws.title = interpolateAlertProps(alert.data.aws.title, alert);
- alert.data.aws.description = interpolateAlertProps(alert.data.aws.description, alert);
- const count = `${randomIntervalInteger(400, 4000)}`;
- alert.data.aws.service.additionalInfo.recentApiCalls.count = count;
- alert.data.aws.service.count = count;
-
- alert.rule = { ...typeAlert.rule };
- alert.rule.firedtimes = randomIntervalInteger(1, 50);
- alert.rule.description = interpolateAlertProps(typeAlert.rule.description, alert);
-
- alert.decoder = { ...typeAlert.decoder };
- alert.location = typeAlert.location;
- break;
- }
- case 'networkConnection': {
- const typeAlert = AWS.networkConnection;
-
- alert.data = { ...typeAlert.data };
- alert.data.integration = 'aws';
- alert.data.aws.region = randomArrayItem(AWS.region);
- alert.data.aws.resource.instanceDetails = { ...randomArrayItem(AWS.instanceDetails) };
- alert.data.aws.log_info = {
- s3bucket: randomArrayItem(AWS.buckets),
- log_file: `guardduty/${formatDate(
- new Date(alert.timestamp),
- 'Y/M/D/h'
- )}/firehose_guardduty-1-${formatDate(
- new Date(alert.timestamp),
- 'Y-M-D-h-m-s-l'
- )}b5b9b-ec62-4a07-85d7-b1699b9c031e.zip`,
- };
- alert.data.aws.description = interpolateAlertProps(alert.data.aws.description, alert);
- alert.data.aws.title = interpolateAlertProps(alert.data.aws.title, alert);
- alert.data.aws.accountId = randomArrayItem(AWS.accountId);
- alert.data.aws.createdAt = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
- alert.data.aws.service.action.networkConnectionAction.remoteIpDetails = {
- ...randomArrayItem(AWS.remoteIpDetails),
- };
- alert.data.aws.service.eventFirstSeen = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
- alert.data.aws.service.eventLastSeen = formatDate(
- new Date(alert.timestamp),
- 'Y-M-DTh:m:s.lZ'
- );
- alert.data.aws.service.additionalInfo = {
- localPort: `${randomArrayItem(Ports)}`,
- outBytes: `${randomIntervalInteger(1000, 3000)}`,
- inBytes: `${randomIntervalInteger(1000, 10000)}`,
- unusual: `${randomIntervalInteger(1000, 10000)}`,
- };
- alert.data.aws.service.count = `${randomIntervalInteger(400, 4000)}`;
- alert.data.aws.service.action.networkConnectionAction.localIpDetails.ipAddressV4 =
- alert.data.aws.resource.instanceDetails.networkInterfaces.privateIpAddress;
- alert.data.aws.arn = interpolateAlertProps(typeAlert.data.aws.arn, alert);
- alert.rule = { ...typeAlert.rule };
- alert.rule.firedtimes = randomIntervalInteger(1, 50);
- alert.rule.description = interpolateAlertProps(typeAlert.rule.description, alert);
-
- alert.decoder = { ...typeAlert.decoder };
- alert.location = typeAlert.location;
- break;
- }
- case 'iamPolicyGrantGlobal': {
- const typeAlert = AWS.iamPolicyGrantGlobal;
-
- alert.data = { ...typeAlert.data };
- alert.data.integration = 'aws';
- alert.data.aws.region = randomArrayItem(AWS.region);
- alert.data.aws.summary.Timestamps = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
- alert.data.aws.log_info = {
- s3bucket: randomArrayItem(AWS.buckets),
- log_file: `macie/${formatDate(
- new Date(alert.timestamp),
- 'Y/M/D/h'
- )}/firehose_macie-1-${formatDate(
- new Date(alert.timestamp),
- 'Y-M-D-h-m-s'
- )}-0b1ede94-f399-4e54-8815-1c6587eee3b1//firehose_guardduty-1-${formatDate(
- new Date(alert.timestamp),
- 'Y-M-D-h-m-s-l'
- )}b5b9b-ec62-4a07-85d7-b1699b9c031e.zip`,
- };
- alert.data.aws['created-at'] = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
- alert.data.aws.url = interpolateAlertProps(typeAlert.data.aws.url, alert);
- alert.data.aws['alert-arn'] = interpolateAlertProps(typeAlert.data.aws['alert-arn'], alert);
-
- alert.rule = { ...typeAlert.rule };
- alert.rule.firedtimes = randomIntervalInteger(1, 50);
-
- alert.decoder = { ...typeAlert.decoder };
- alert.location = typeAlert.location;
- break;
- }
- default: {
- }
- }
- alert.input = { type: 'log' };
- alert.GeoLocation = randomArrayItem(GeoLocation);
+ if (params.cluster.node) {
+ alert.cluster.node = params.cluster.node;
}
+ }
+
+ if (params.aws) {
+ let randomType = randomArrayItem([
+ 'guarddutyPortProbe',
+ 'apiCall',
+ 'networkConnection',
+ 'iamPolicyGrantGlobal',
+ ]);
+
+ const beforeDate = new Date(
+ new Date(alert.timestamp) - 3 * 24 * 60 * 60 * 1000,
+ );
+ switch (randomType) {
+ case 'guarddutyPortProbe': {
+ const typeAlert = AWS.guarddutyPortProbe;
- if (params.office) {
- alert.agent = {
- id: '000',
- ip: alert.agent.ip,
- name: alert.agent.name
+ alert.data = { ...typeAlert.data };
+ alert.data.integration = 'aws';
+ alert.data.aws.region = randomArrayItem(AWS.region);
+ alert.data.aws.resource.instanceDetails = {
+ ...randomArrayItem(AWS.instanceDetails),
};
-
- if (params.manager && params.manager.name) {
- alert.agent.name = params.manager.name;
+ alert.data.aws.resource.instanceDetails.iamInstanceProfile.arn =
+ interpolateAlertProps(
+ typeAlert.data.aws.resource.instanceDetails.iamInstanceProfile.arn,
+ alert,
+ );
+ alert.data.aws.title = interpolateAlertProps(
+ alert.data.aws.title,
+ alert,
+ );
+ alert.data.aws.accountId = randomArrayItem(AWS.accountId);
+ alert.data.aws.service.eventFirstSeen = formatDate(
+ beforeDate,
+ 'Y-M-DTh:m:s.lZ',
+ );
+ alert.data.aws.service.eventLastSeen = formatDate(
+ new Date(alert.timestamp),
+ 'Y-M-DTh:m:s.lZ',
+ );
+ alert.data.aws.service.action.portProbeAction.portProbeDetails.remoteIpDetails =
+ {
+ ...randomArrayItem(AWS.remoteIpDetails),
+ };
+ alert.data.aws.log_info = {
+ s3bucket: randomArrayItem(AWS.buckets),
+ log_file: `guardduty/${formatDate(
+ new Date(alert.timestamp),
+ 'Y/M/D/h',
+ )}/firehose_guardduty-1-${formatDate(
+ new Date(alert.timestamp),
+ 'Y-M-D-h-m-s-l',
+ )}b5b9b-ec62-4a07-85d7-b1699b9c031e.zip`,
};
+ alert.data.aws.service.count = `${randomIntervalInteger(400, 4000)}`;
+ alert.data.aws.createdAt = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
- const beforeDate = new Date(new Date(alert.timestamp) - 3 * 24 * 60 * 60 * 1000);
- const IntraID = randomArrayItem(Office.arrayUuidOffice);
- const OrgID = randomArrayItem(Office.arrayUuidOffice);
- const objID = randomArrayItem(Office.arrayUuidOffice);
- const userKey = randomArrayItem(Office.arrayUuidOffice);
- const userID = randomArrayItem(Office.arrayUserId);
- const userType = randomArrayItem([0, 2, 4]);
- const resultStatus = randomArrayItem(['Succeeded', 'PartiallySucceeded', 'Failed']);
- const log = randomArrayItem(Office.arrayLogs);
- const ruleData = Office.officeRules[log.RecordType];
-
- alert.agent.id = '000'
- alert.rule = ruleData.rule;
- alert.decoder = randomArrayItem(Office.arrayDecoderOffice);
- alert.GeoLocation = randomArrayItem(GeoLocation);
- alert.data.integration = 'Office365';
- alert.location = Office.arrayLocationOffice;
- alert.data.office365 = {
- ...log,
- ...ruleData.data.office365,
- Id: IntraID,
- CreationTime: formatDate(beforeDate, 'Y-M-DTh:m:s.lZ'),
- OrganizationId: OrgID,
- UserType: userType,
- UserKey: userKey,
- ResultStatus: resultStatus,
- ObjectId: objID,
- UserId: userID,
- ClientIP: randomArrayItem(Office.arrayIp),
- };
- }
+ alert.rule = { ...typeAlert.rule };
+ alert.rule.firedtimes = randomIntervalInteger(1, 50);
+ alert.rule.description = interpolateAlertProps(
+ typeAlert.rule.description,
+ alert,
+ );
- if (params.gcp) {
- alert.rule = randomArrayItem(GCP.arrayRules);
- alert.data.integration = 'gcp';
- alert.data.gcp = {
- insertId: 'uk1zpe23xcj',
- jsonPayload: {
- authAnswer: GCP.arrayAuthAnswer[Math.floor(GCP.arrayAuthAnswer.length * Math.random())],
- protocol: GCP.arrayProtocol[Math.floor(GCP.arrayProtocol.length * Math.random())],
- queryName: GCP.arrayQueryName[Math.floor(GCP.arrayQueryName.length * Math.random())],
- queryType: GCP.arrayQueryType[Math.floor(GCP.arrayQueryType.length * Math.random())],
- responseCode:
- GCP.arrayResponseCode[Math.floor(GCP.arrayResponseCode.length * Math.random())],
- sourceIP: GCP.arraySourceIP[Math.floor(GCP.arraySourceIP.length * Math.random())],
- vmInstanceId: '4980113928800839680.000000',
- vmInstanceName: '531339229531.instance-1',
- },
- logName: 'projects/wazuh-dev/logs/dns.googleapis.com%2Fdns_queries',
- receiveTimestamp: '2019-11-11T02:42:05.05853152Z',
- resource: {
- labels: {
- location: GCP.arrayLocation[Math.floor(GCP.arrayLocation.length * Math.random())],
- project_id: GCP.arrayProject[Math.floor(GCP.arrayProject.length * Math.random())],
- source_type: GCP.arraySourceType[Math.floor(GCP.arraySourceType.length * Math.random())],
- target_type: 'external',
- },
- type: GCP.arrayType[Math.floor(GCP.arrayType.length * Math.random())],
- },
- severity: GCP.arraySeverity[Math.floor(GCP.arraySeverity.length * Math.random())],
- timestamp: '2019-11-11T02:42:04.34921449Z',
- };
+ alert.decoder = { ...typeAlert.decoder };
+ alert.location = typeAlert.location;
+ break;
+ }
+ case 'apiCall': {
+ const typeAlert = AWS.apiCall;
- alert.GeoLocation = randomArrayItem(GeoLocation);
- }
+ alert.data = { ...typeAlert.data };
+ alert.data.integration = 'aws';
+ alert.data.aws.region = randomArrayItem(AWS.region);
+ alert.data.aws.resource.accessKeyDetails.userName =
+ randomArrayItem(Users);
+ alert.data.aws.log_info = {
+ s3bucket: randomArrayItem(AWS.buckets),
+ log_file: `guardduty/${formatDate(
+ new Date(alert.timestamp),
+ 'Y/M/D/h',
+ )}/firehose_guardduty-1-${formatDate(
+ new Date(alert.timestamp),
+ 'Y-M-D-h-m-s-l',
+ )}b5b9b-ec62-4a07-85d7-b1699b9c031e.zip`,
+ };
+ alert.data.aws.accountId = randomArrayItem(AWS.accountId);
+ alert.data.aws.service.action.awsApiCallAction.remoteIpDetails = {
+ ...randomArrayItem(AWS.remoteIpDetails),
+ };
+ alert.data.aws.service.eventFirstSeen = formatDate(
+ beforeDate,
+ 'Y-M-DTh:m:s.lZ',
+ );
+ alert.data.aws.service.eventLastSeen = formatDate(
+ new Date(alert.timestamp),
+ 'Y-M-DTh:m:s.lZ',
+ );
+ alert.data.aws.createdAt = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
+ alert.data.aws.title = interpolateAlertProps(
+ alert.data.aws.title,
+ alert,
+ );
+ alert.data.aws.description = interpolateAlertProps(
+ alert.data.aws.description,
+ alert,
+ );
+ const count = `${randomIntervalInteger(400, 4000)}`;
+ alert.data.aws.service.additionalInfo.recentApiCalls.count = count;
+ alert.data.aws.service.count = count;
- if (params.audit) {
- let dataAudit = randomArrayItem(Audit.dataAudit);
- alert.data = dataAudit.data;
- alert.data.audit.file
- ? alert.data.audit.file.name === ''
- ? (alert.data.audit.file.name = randomArrayItem(Audit.fileName))
- : null
- : null;
- alert.rule = dataAudit.rule;
- }
+ alert.rule = { ...typeAlert.rule };
+ alert.rule.firedtimes = randomIntervalInteger(1, 50);
+ alert.rule.description = interpolateAlertProps(
+ typeAlert.rule.description,
+ alert,
+ );
- if (params.ciscat) {
- alert.rule.groups.push('ciscat');
- alert.data.cis = {};
-
- alert.data.cis.group = randomArrayItem(CISCAT.group);
- alert.data.cis.fail = randomIntervalInteger(0, 100);
- alert.data.cis.rule_title = randomArrayItem(CISCAT.ruleTitle);
- alert.data.cis.notchecked = randomIntervalInteger(0, 100);
- alert.data.cis.score = randomIntervalInteger(0, 100);
- alert.data.cis.pass = randomIntervalInteger(0, 100);
- alert.data.cis.timestamp = new Date(randomDate());
- alert.data.cis.error = randomIntervalInteger(0, 1);
- alert.data.cis.benchmark = randomArrayItem(CISCAT.benchmark);
- alert.data.cis.unknown = randomIntervalInteger(0, 100);
- alert.data.cis.notchecked = randomIntervalInteger(0, 5);
- alert.data.cis.result = randomArrayItem(CISCAT.result);
- }
+ alert.decoder = { ...typeAlert.decoder };
+ alert.location = typeAlert.location;
+ break;
+ }
+ case 'networkConnection': {
+ const typeAlert = AWS.networkConnection;
- if (params.docker) {
- const dataDocker = randomArrayItem(Docker.dataDocker);
- alert.data = {};
- alert.data = dataDocker.data;
- alert.rule = dataDocker.rule;
- }
+ alert.data = { ...typeAlert.data };
+ alert.data.integration = 'aws';
+ alert.data.aws.region = randomArrayItem(AWS.region);
+ alert.data.aws.resource.instanceDetails = {
+ ...randomArrayItem(AWS.instanceDetails),
+ };
+ alert.data.aws.log_info = {
+ s3bucket: randomArrayItem(AWS.buckets),
+ log_file: `guardduty/${formatDate(
+ new Date(alert.timestamp),
+ 'Y/M/D/h',
+ )}/firehose_guardduty-1-${formatDate(
+ new Date(alert.timestamp),
+ 'Y-M-D-h-m-s-l',
+ )}b5b9b-ec62-4a07-85d7-b1699b9c031e.zip`,
+ };
+ alert.data.aws.description = interpolateAlertProps(
+ alert.data.aws.description,
+ alert,
+ );
+ alert.data.aws.title = interpolateAlertProps(
+ alert.data.aws.title,
+ alert,
+ );
+ alert.data.aws.accountId = randomArrayItem(AWS.accountId);
+ alert.data.aws.createdAt = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
+ alert.data.aws.service.action.networkConnectionAction.remoteIpDetails =
+ {
+ ...randomArrayItem(AWS.remoteIpDetails),
+ };
+ alert.data.aws.service.eventFirstSeen = formatDate(
+ beforeDate,
+ 'Y-M-DTh:m:s.lZ',
+ );
+ alert.data.aws.service.eventLastSeen = formatDate(
+ new Date(alert.timestamp),
+ 'Y-M-DTh:m:s.lZ',
+ );
+ alert.data.aws.service.additionalInfo = {
+ localPort: `${randomArrayItem(Ports)}`,
+ outBytes: `${randomIntervalInteger(1000, 3000)}`,
+ inBytes: `${randomIntervalInteger(1000, 10000)}`,
+ unusual: `${randomIntervalInteger(1000, 10000)}`,
+ };
+ alert.data.aws.service.count = `${randomIntervalInteger(400, 4000)}`;
+ alert.data.aws.service.action.networkConnectionAction.localIpDetails.ipAddressV4 =
+ alert.data.aws.resource.instanceDetails.networkInterfaces.privateIpAddress;
+ alert.data.aws.arn = interpolateAlertProps(
+ typeAlert.data.aws.arn,
+ alert,
+ );
+ alert.rule = { ...typeAlert.rule };
+ alert.rule.firedtimes = randomIntervalInteger(1, 50);
+ alert.rule.description = interpolateAlertProps(
+ typeAlert.rule.description,
+ alert,
+ );
- if (params.mitre) {
- alert.rule = randomArrayItem(Mitre.arrayMitreRules);
- alert.location = randomArrayItem(Mitre.arrayLocation);
- }
+ alert.decoder = { ...typeAlert.decoder };
+ alert.location = typeAlert.location;
+ break;
+ }
+ case 'iamPolicyGrantGlobal': {
+ const typeAlert = AWS.iamPolicyGrantGlobal;
- if (params.openscap) {
- alert.data = {};
- alert.data.oscap = {};
- const typeAlert = { ...randomArrayItem(OpenSCAP.data) };
alert.data = { ...typeAlert.data };
- alert.rule = { ...typeAlert.rule };
- alert.rule.firedtimes = randomIntervalInteger(2, 10);
- alert.input = {
- type: 'log',
+ alert.data.integration = 'aws';
+ alert.data.aws.region = randomArrayItem(AWS.region);
+ alert.data.aws.summary.Timestamps = formatDate(
+ beforeDate,
+ 'Y-M-DTh:m:s.lZ',
+ );
+ alert.data.aws.log_info = {
+ s3bucket: randomArrayItem(AWS.buckets),
+ log_file: `macie/${formatDate(
+ new Date(alert.timestamp),
+ 'Y/M/D/h',
+ )}/firehose_macie-1-${formatDate(
+ new Date(alert.timestamp),
+ 'Y-M-D-h-m-s',
+ )}-0b1ede94-f399-4e54-8815-1c6587eee3b1//firehose_guardduty-1-${formatDate(
+ new Date(alert.timestamp),
+ 'Y-M-D-h-m-s-l',
+ )}b5b9b-ec62-4a07-85d7-b1699b9c031e.zip`,
};
- alert.decoder = { ...OpenSCAP.decoder };
- alert.location = OpenSCAP.location;
- if (typeAlert.full_log) {
- alert.full_log = interpolateAlertProps(typeAlert.full_log, alert);
- }
- }
+ alert.data.aws['created-at'] = formatDate(beforeDate, 'Y-M-DTh:m:s.lZ');
+ alert.data.aws.url = interpolateAlertProps(
+ typeAlert.data.aws.url,
+ alert,
+ );
+ alert.data.aws['alert-arn'] = interpolateAlertProps(
+ typeAlert.data.aws['alert-arn'],
+ alert,
+ );
- if (params.rootcheck) {
- alert.location = PolicyMonitoring.location;
- alert.decoder = { ...PolicyMonitoring.decoder };
- alert.input = {
- type: 'log',
- };
+ alert.rule = { ...typeAlert.rule };
+ alert.rule.firedtimes = randomIntervalInteger(1, 50);
- const alertCategory = randomArrayItem(['Rootkit', 'Trojan']);
-
- switch (alertCategory) {
- case 'Rootkit': {
- const rootkitCategory = randomArrayItem(Object.keys(PolicyMonitoring.rootkits));
- const rootkit = randomArrayItem(PolicyMonitoring.rootkits[rootkitCategory]);
- alert.data = {
- title: interpolateAlertProps(PolicyMonitoring.rootkitsData.data.title, alert, {
- _rootkit_category: rootkitCategory,
- _rootkit_file: rootkit,
- }),
- };
- alert.rule = { ...PolicyMonitoring.rootkitsData.rule };
- alert.rule.firedtimes = randomIntervalInteger(1, 10);
- alert.full_log = alert.data.title;
- break;
- }
- case 'Trojan': {
- const trojan = randomArrayItem(PolicyMonitoring.trojans);
- alert.data = {
- file: trojan.file,
- title: 'Trojaned version of file detected.',
- };
- alert.rule = { ...PolicyMonitoring.trojansData.rule };
- alert.rule.firedtimes = randomIntervalInteger(1, 10);
- alert.full_log = interpolateAlertProps(PolicyMonitoring.trojansData.full_log, alert, {
- _trojan_signature: trojan.signature,
- });
- break;
- }
- default: {
- }
- }
+ alert.decoder = { ...typeAlert.decoder };
+ alert.location = typeAlert.location;
+ break;
+ }
+ default: {
+ }
}
+ alert.input = { type: 'log' };
+ alert.GeoLocation = randomArrayItem(GeoLocation);
+ }
+
+ if (params.office) {
+ alert.agent = {
+ id: '000',
+ ip: alert.agent.ip,
+ name: alert.agent.name,
+ };
- if (params.syscheck) {
- alert.rule.groups.push('syscheck');
- alert.syscheck = {};
- alert.syscheck.event = randomArrayItem(IntegrityMonitoring.events);
- alert.syscheck.path = randomArrayItem(
- alert.agent.name === 'Windows'
- ? IntegrityMonitoring.pathsWindows
- : IntegrityMonitoring.pathsLinux
- );
- alert.syscheck.uname_after = randomArrayItem(Users);
- alert.syscheck.gname_after = 'root';
- alert.syscheck.mtime_after = new Date(randomDate());
- alert.syscheck.size_after = randomIntervalInteger(0, 65);
- alert.syscheck.uid_after = randomArrayItem(IntegrityMonitoring.uid_after);
- alert.syscheck.gid_after = randomArrayItem(IntegrityMonitoring.gid_after);
- alert.syscheck.perm_after = 'rw-r--r--';
- alert.syscheck.inode_after = randomIntervalInteger(0, 100000);
- switch (alert.syscheck.event) {
- case 'added':
- alert.rule = IntegrityMonitoring.regulatory[0];
- break;
- case 'modified':
- alert.rule = IntegrityMonitoring.regulatory[1];
- alert.syscheck.mtime_before = new Date(alert.syscheck.mtime_after.getTime() - 1000 * 60);
- alert.syscheck.inode_before = randomIntervalInteger(0, 100000);
- alert.syscheck.sha1_after = randomElements(40, 'abcdef0123456789');
- alert.syscheck.changed_attributes = [randomArrayItem(IntegrityMonitoring.attributes)];
- alert.syscheck.md5_after = randomElements(32, 'abcdef0123456789');
- alert.syscheck.sha256_after = randomElements(60, 'abcdef0123456789');
- break;
- case 'deleted':
- alert.rule = IntegrityMonitoring.regulatory[2];
- alert.syscheck.tags = [randomArrayItem(IntegrityMonitoring.tags)];
- alert.syscheck.sha1_after = randomElements(40, 'abcdef0123456789');
- alert.syscheck.audit = {
- process: {
- name: randomArrayItem(Paths),
- id: randomIntervalInteger(0, 100000),
- ppid: randomIntervalInteger(0, 100000),
- },
- effective_user: {
- name: randomArrayItem(Users),
- id: randomIntervalInteger(0, 100),
- },
- user: {
- name: randomArrayItem(Users),
- id: randomIntervalInteger(0, 100),
- },
- group: {
- name: randomArrayItem(Users),
- id: randomIntervalInteger(0, 100),
- },
- };
- alert.syscheck.md5_after = randomElements(32, 'abcdef0123456789');
- alert.syscheck.sha256_after = randomElements(60, 'abcdef0123456789');
- break;
- default: {
- }
- }
+ if (params.manager && params.manager.name) {
+ alert.agent.name = params.manager.name;
}
- if (params.virustotal) {
- alert.rule.groups.push('virustotal');
- alert.location = 'virustotal';
- alert.data.virustotal = {};
- alert.data.virustotal.found = randomArrayItem(['0', '1', '1', '1']);
-
- alert.data.virustotal.source = {
- sha1: randomElements(40, 'abcdef0123456789'),
- file: randomArrayItem(Virustotal.sourceFile),
- alert_id: `${randomElements(10, '0123456789')}.${randomElements(7, '0123456789')}`,
- md5: randomElements(32, 'abcdef0123456789'),
- };
+ const beforeDate = new Date(
+ new Date(alert.timestamp) - 3 * 24 * 60 * 60 * 1000,
+ );
+ const IntraID = randomArrayItem(Office.arrayUuidOffice);
+ const OrgID = randomArrayItem(Office.arrayUuidOffice);
+ const objID = randomArrayItem(Office.arrayUuidOffice);
+ const userKey = randomArrayItem(Office.arrayUuidOffice);
+ const userID = randomArrayItem(Office.arrayUserId);
+ const userType = randomArrayItem([0, 2, 4]);
+ const resultStatus = randomArrayItem([
+ 'Succeeded',
+ 'PartiallySucceeded',
+ 'Failed',
+ ]);
+ const log = randomArrayItem(Office.arrayLogs);
+ const ruleData = Office.officeRules[log.RecordType];
+
+ alert.agent.id = '000';
+ alert.rule = ruleData.rule;
+ alert.decoder = randomArrayItem(Office.arrayDecoderOffice);
+ alert.GeoLocation = randomArrayItem(GeoLocation);
+ alert.data.integration = 'Office365';
+ alert.location = Office.arrayLocationOffice;
+ alert.data.office365 = {
+ ...log,
+ ...ruleData.data.office365,
+ Id: IntraID,
+ CreationTime: formatDate(beforeDate, 'Y-M-DTh:m:s.lZ'),
+ OrganizationId: OrgID,
+ UserType: userType,
+ UserKey: userKey,
+ ResultStatus: resultStatus,
+ ObjectId: objID,
+ UserId: userID,
+ ClientIP: randomArrayItem(Office.arrayIp),
+ };
+ }
+
+ if (params.gcp) {
+ alert.rule = randomArrayItem(GCP.arrayRules);
+ alert.data.integration = 'gcp';
+ alert.data.gcp = {
+ insertId: 'uk1zpe23xcj',
+ jsonPayload: {
+ authAnswer:
+ GCP.arrayAuthAnswer[
+ Math.floor(GCP.arrayAuthAnswer.length * Math.random())
+ ],
+ protocol:
+ GCP.arrayProtocol[
+ Math.floor(GCP.arrayProtocol.length * Math.random())
+ ],
+ queryName:
+ GCP.arrayQueryName[
+ Math.floor(GCP.arrayQueryName.length * Math.random())
+ ],
+ queryType:
+ GCP.arrayQueryType[
+ Math.floor(GCP.arrayQueryType.length * Math.random())
+ ],
+ responseCode:
+ GCP.arrayResponseCode[
+ Math.floor(GCP.arrayResponseCode.length * Math.random())
+ ],
+ sourceIP:
+ GCP.arraySourceIP[
+ Math.floor(GCP.arraySourceIP.length * Math.random())
+ ],
+ vmInstanceId: '4980113928800839680.000000',
+ vmInstanceName: '531339229531.instance-1',
+ },
+ logName: 'projects/wazuh-dev/logs/dns.googleapis.com%2Fdns_queries',
+ receiveTimestamp: '2019-11-11T02:42:05.05853152Z',
+ resource: {
+ labels: {
+ location:
+ GCP.arrayLocation[
+ Math.floor(GCP.arrayLocation.length * Math.random())
+ ],
+ project_id:
+ GCP.arrayProject[
+ Math.floor(GCP.arrayProject.length * Math.random())
+ ],
+ source_type:
+ GCP.arraySourceType[
+ Math.floor(GCP.arraySourceType.length * Math.random())
+ ],
+ target_type: 'external',
+ },
+ type: GCP.arrayType[Math.floor(GCP.arrayType.length * Math.random())],
+ },
+ severity:
+ GCP.arraySeverity[Math.floor(GCP.arraySeverity.length * Math.random())],
+ timestamp: '2019-11-11T02:42:04.34921449Z',
+ };
- if (alert.data.virustotal.found === '1') {
- alert.data.virustotal.malicious = randomArrayItem(Virustotal.malicious);
- alert.data.virustotal.positives = `${randomIntervalInteger(0, 65)}`;
- alert.data.virustotal.total =
- alert.data.virustotal.malicious + alert.data.virustotal.positives;
- alert.rule.description = `VirusTotal: Alert - ${alert.data.virustotal.source.file} - ${alert.data.virustotal.positives} engines detected this file`;
- alert.data.virustotal.permalink = randomArrayItem(Virustotal.permalink);
- alert.data.virustotal.scan_date = new Date(Date.parse(alert.timestamp) - 4 * 60000);
- } else {
- alert.data.virustotal.malicious = '0';
- alert.rule.description = 'VirusTotal: Alert - No records in VirusTotal database';
- }
+ alert.GeoLocation = randomArrayItem(GeoLocation);
+ }
+
+ if (params.audit) {
+ let dataAudit = randomArrayItem(Audit.dataAudit);
+ alert.data = dataAudit.data;
+ alert.data.audit.file
+ ? alert.data.audit.file.name === ''
+ ? (alert.data.audit.file.name = randomArrayItem(Audit.fileName))
+ : null
+ : null;
+ alert.rule = dataAudit.rule;
+ }
+
+ if (params.ciscat) {
+ alert.rule.groups.push('ciscat');
+ alert.data.cis = {};
+
+ alert.data.cis.group = randomArrayItem(CISCAT.group);
+ alert.data.cis.fail = randomIntervalInteger(0, 100);
+ alert.data.cis.rule_title = randomArrayItem(CISCAT.ruleTitle);
+ alert.data.cis.notchecked = randomIntervalInteger(0, 100);
+ alert.data.cis.score = randomIntervalInteger(0, 100);
+ alert.data.cis.pass = randomIntervalInteger(0, 100);
+ alert.data.cis.timestamp = new Date(randomDate());
+ alert.data.cis.error = randomIntervalInteger(0, 1);
+ alert.data.cis.benchmark = randomArrayItem(CISCAT.benchmark);
+ alert.data.cis.unknown = randomIntervalInteger(0, 100);
+ alert.data.cis.notchecked = randomIntervalInteger(0, 5);
+ alert.data.cis.result = randomArrayItem(CISCAT.result);
+ }
+
+ if (params.docker) {
+ const dataDocker = randomArrayItem(Docker.dataDocker);
+ alert.data = {};
+ alert.data = dataDocker.data;
+ alert.rule = dataDocker.rule;
+ }
+
+ if (params.mitre) {
+ alert.rule = randomArrayItem(Mitre.arrayMitreRules);
+ alert.location = randomArrayItem(Mitre.arrayLocation);
+ }
+
+ if (params.openscap) {
+ alert.data = {};
+ alert.data.oscap = {};
+ const typeAlert = { ...randomArrayItem(OpenSCAP.data) };
+ alert.data = { ...typeAlert.data };
+ alert.rule = { ...typeAlert.rule };
+ alert.rule.firedtimes = randomIntervalInteger(2, 10);
+ alert.input = {
+ type: 'log',
+ };
+ alert.decoder = { ...OpenSCAP.decoder };
+ alert.location = OpenSCAP.location;
+ if (typeAlert.full_log) {
+ alert.full_log = interpolateAlertProps(typeAlert.full_log, alert);
}
+ }
- if (params.vulnerabilities) {
- const dataVulnerability = randomArrayItem(Vulnerability.data);
- alert.rule = {
- ...dataVulnerability.rule,
- mail: false,
- groups: ['vulnerability-detector'],
- gdpr: ['IV_35.7.d'],
- pci_dss: ['11.2.1', '11.2.3'],
- tsc: ['CC7.1', 'CC7.2'],
+ if (params.rootcheck) {
+ alert.location = PolicyMonitoring.location;
+ alert.decoder = { ...PolicyMonitoring.decoder };
+ alert.input = {
+ type: 'log',
+ };
+
+ const alertCategory = randomArrayItem(['Rootkit', 'Trojan']);
+
+ switch (alertCategory) {
+ case 'Rootkit': {
+ const rootkitCategory = randomArrayItem(
+ Object.keys(PolicyMonitoring.rootkits),
+ );
+ const rootkit = randomArrayItem(
+ PolicyMonitoring.rootkits[rootkitCategory],
+ );
+ alert.data = {
+ title: interpolateAlertProps(
+ PolicyMonitoring.rootkitsData.data.title,
+ alert,
+ {
+ _rootkit_category: rootkitCategory,
+ _rootkit_file: rootkit,
+ },
+ ),
};
- alert.location = 'vulnerability-detector';
- alert.decoder = { name: 'json' };
+ alert.rule = { ...PolicyMonitoring.rootkitsData.rule };
+ alert.rule.firedtimes = randomIntervalInteger(1, 10);
+ alert.full_log = alert.data.title;
+ break;
+ }
+ case 'Trojan': {
+ const trojan = randomArrayItem(PolicyMonitoring.trojans);
alert.data = {
- ...dataVulnerability.data,
+ file: trojan.file,
+ title: 'Trojaned version of file detected.',
};
+ alert.rule = { ...PolicyMonitoring.trojansData.rule };
+ alert.rule.firedtimes = randomIntervalInteger(1, 10);
+ alert.full_log = interpolateAlertProps(
+ PolicyMonitoring.trojansData.full_log,
+ alert,
+ {
+ _trojan_signature: trojan.signature,
+ },
+ );
+ break;
+ }
+ default: {
+ }
}
-
- if (params.osquery) {
- alert.rule.groups.push('osquery');
- alert.data.osquery = {};
- if (randomIntervalInteger(0, 5) === 0) {
- alert.rule.description = 'osquery error message';
- } else {
- let dataOsquery = randomArrayItem(Osquery.dataOsquery);
- alert.data.osquery = dataOsquery.osquery;
- alert.data.osquery.calendarTime = alert.timestamp;
- alert.rule.description = dataOsquery.rule.description;
- randomIntervalInteger(0, 99) === 0 ? (alert.data.osquery.action = 'removed') : null;
- }
+ }
+
+ if (params.syscheck) {
+ alert.rule.groups.push('syscheck');
+ alert.syscheck = {};
+ alert.syscheck.event = randomArrayItem(IntegrityMonitoring.events);
+ alert.syscheck.path = randomArrayItem(
+ alert.agent.name === 'Windows'
+ ? IntegrityMonitoring.pathsWindows
+ : IntegrityMonitoring.pathsLinux,
+ );
+ alert.syscheck.uname_after = randomArrayItem(Users);
+ alert.syscheck.gname_after = 'root';
+ alert.syscheck.mtime_after = new Date(randomDate());
+ alert.syscheck.size_after = randomIntervalInteger(0, 65);
+ alert.syscheck.uid_after = randomArrayItem(IntegrityMonitoring.uid_after);
+ alert.syscheck.gid_after = randomArrayItem(IntegrityMonitoring.gid_after);
+ alert.syscheck.perm_after = 'rw-r--r--';
+ alert.syscheck.inode_after = randomIntervalInteger(0, 100000);
+ switch (alert.syscheck.event) {
+ case 'added':
+ alert.rule = IntegrityMonitoring.regulatory[0];
+ break;
+ case 'modified':
+ alert.rule = IntegrityMonitoring.regulatory[1];
+ alert.syscheck.mtime_before = new Date(
+ alert.syscheck.mtime_after.getTime() - 1000 * 60,
+ );
+ alert.syscheck.inode_before = randomIntervalInteger(0, 100000);
+ alert.syscheck.sha1_after = randomElements(40, 'abcdef0123456789');
+ alert.syscheck.changed_attributes = [
+ randomArrayItem(IntegrityMonitoring.attributes),
+ ];
+ alert.syscheck.md5_after = randomElements(32, 'abcdef0123456789');
+ alert.syscheck.sha256_after = randomElements(60, 'abcdef0123456789');
+ break;
+ case 'deleted':
+ alert.rule = IntegrityMonitoring.regulatory[2];
+ alert.syscheck.tags = [randomArrayItem(IntegrityMonitoring.tags)];
+ alert.syscheck.sha1_after = randomElements(40, 'abcdef0123456789');
+ alert.syscheck.audit = {
+ process: {
+ name: randomArrayItem(Paths),
+ id: randomIntervalInteger(0, 100000),
+ ppid: randomIntervalInteger(0, 100000),
+ },
+ effective_user: {
+ name: randomArrayItem(Users),
+ id: randomIntervalInteger(0, 100),
+ },
+ user: {
+ name: randomArrayItem(Users),
+ id: randomIntervalInteger(0, 100),
+ },
+ group: {
+ name: randomArrayItem(Users),
+ id: randomIntervalInteger(0, 100),
+ },
+ };
+ alert.syscheck.md5_after = randomElements(32, 'abcdef0123456789');
+ alert.syscheck.sha256_after = randomElements(60, 'abcdef0123456789');
+ break;
+ default: {
+ }
}
+ }
+
+ if (params.virustotal) {
+ alert.rule.groups.push('virustotal');
+ alert.location = 'virustotal';
+ alert.data.virustotal = {};
+ alert.data.virustotal.found = randomArrayItem(['0', '1', '1', '1']);
+
+ alert.data.virustotal.source = {
+ sha1: randomElements(40, 'abcdef0123456789'),
+ file: randomArrayItem(Virustotal.sourceFile),
+ alert_id: `${randomElements(10, '0123456789')}.${randomElements(
+ 7,
+ '0123456789',
+ )}`,
+ md5: randomElements(32, 'abcdef0123456789'),
+ };
- // Regulatory compliance
- if (
- params.pci_dss ||
- params.regulatory_compliance ||
- (params.random_probability_regulatory_compliance &&
- randomProbability(params.random_probability_regulatory_compliance))
- ) {
- alert.rule.pci_dss = [randomArrayItem(PCI_DSS)];
- }
- if (
- params.gdpr ||
- params.regulatory_compliance ||
- (params.random_probability_regulatory_compliance &&
- randomProbability(params.random_probability_regulatory_compliance))
- ) {
- alert.rule.gdpr = [randomArrayItem(GDPR)];
- }
- if (
- params.gpg13 ||
- params.regulatory_compliance ||
- (params.random_probability_regulatory_compliance &&
- randomProbability(params.random_probability_regulatory_compliance))
- ) {
- alert.rule.gpg13 = [randomArrayItem(GPG13)];
+ if (alert.data.virustotal.found === '1') {
+ alert.data.virustotal.malicious = randomArrayItem(Virustotal.malicious);
+ alert.data.virustotal.positives = `${randomIntervalInteger(0, 65)}`;
+ alert.data.virustotal.total =
+ alert.data.virustotal.malicious + alert.data.virustotal.positives;
+ alert.rule.description = `VirusTotal: Alert - ${alert.data.virustotal.source.file} - ${alert.data.virustotal.positives} engines detected this file`;
+ alert.data.virustotal.permalink = randomArrayItem(Virustotal.permalink);
+ alert.data.virustotal.scan_date = new Date(
+ Date.parse(alert.timestamp) - 4 * 60000,
+ );
+ } else {
+ alert.data.virustotal.malicious = '0';
+ alert.rule.description =
+ 'VirusTotal: Alert - No records in VirusTotal database';
}
- if (
- params.hipaa ||
- params.regulatory_compliance ||
- (params.random_probability_regulatory_compliance &&
- randomIntervalInteger(params.random_probability_regulatory_compliance))
- ) {
- alert.rule.hipaa = [randomArrayItem(HIPAA)];
- }
- if (
- params.nist_800_83 ||
- params.regulatory_compliance ||
- (params.random_probability_regulatory_compliance &&
- randomIntervalInteger(params.random_probability_regulatory_compliance))
- ) {
- alert.rule.nist_800_53 = [randomArrayItem(NIST_800_53)];
+ }
+
+ if (params.vulnerabilities) {
+ const dataVulnerability = randomArrayItem(Vulnerability.data);
+ alert.rule = {
+ ...dataVulnerability.rule,
+ mail: false,
+ groups: ['vulnerability-detector'],
+ gdpr: ['IV_35.7.d'],
+ pci_dss: ['11.2.1', '11.2.3'],
+ tsc: ['CC7.1', 'CC7.2'],
+ };
+ alert.location = 'vulnerability-detector';
+ alert.decoder = { name: 'json' };
+ alert.data = {
+ ...dataVulnerability.data,
+ };
+ }
+
+ if (params.osquery) {
+ alert.rule.groups.push('osquery');
+ alert.data.osquery = {};
+ if (randomIntervalInteger(0, 5) === 0) {
+ alert.rule.description = 'osquery error message';
+ } else {
+ let dataOsquery = randomArrayItem(Osquery.dataOsquery);
+ alert.data.osquery = dataOsquery.osquery;
+ alert.data.osquery.calendarTime = alert.timestamp;
+ alert.rule.description = dataOsquery.rule.description;
+ randomIntervalInteger(0, 99) === 0
+ ? (alert.data.osquery.action = 'removed')
+ : null;
}
-
- if (params.authentication) {
- alert.data = {
- srcip: randomArrayItem(IPs),
- srcuser: randomArrayItem(Users),
- srcport: randomArrayItem(Ports),
- };
- alert.GeoLocation = randomArrayItem(GeoLocation);
- alert.decoder = {
- name: 'sshd',
- parent: 'sshd',
- };
- alert.input = {
- type: 'log',
- };
- alert.predecoder = {
- program_name: 'sshd',
- timestamp: formatDate(new Date(alert.timestamp), 'N D h:m:s'),
- hostname: alert.manager.name,
+ }
+
+ // Regulatory compliance
+ if (
+ params.pci_dss ||
+ params.regulatory_compliance ||
+ (params.random_probability_regulatory_compliance &&
+ randomProbability(params.random_probability_regulatory_compliance))
+ ) {
+ alert.rule.pci_dss = [randomArrayItem(PCI_DSS)];
+ }
+ if (
+ params.gdpr ||
+ params.regulatory_compliance ||
+ (params.random_probability_regulatory_compliance &&
+ randomProbability(params.random_probability_regulatory_compliance))
+ ) {
+ alert.rule.gdpr = [randomArrayItem(GDPR)];
+ }
+ if (
+ params.gpg13 ||
+ params.regulatory_compliance ||
+ (params.random_probability_regulatory_compliance &&
+ randomProbability(params.random_probability_regulatory_compliance))
+ ) {
+ alert.rule.gpg13 = [randomArrayItem(GPG13)];
+ }
+ if (
+ params.hipaa ||
+ params.regulatory_compliance ||
+ (params.random_probability_regulatory_compliance &&
+ randomIntervalInteger(params.random_probability_regulatory_compliance))
+ ) {
+ alert.rule.hipaa = [randomArrayItem(HIPAA)];
+ }
+ if (
+ params.nist_800_83 ||
+ params.regulatory_compliance ||
+ (params.random_probability_regulatory_compliance &&
+ randomIntervalInteger(params.random_probability_regulatory_compliance))
+ ) {
+ alert.rule.nist_800_53 = [randomArrayItem(NIST_800_53)];
+ }
+
+ if (params.authentication) {
+ alert.data = {
+ srcip: randomArrayItem(IPs),
+ srcuser: randomArrayItem(Users),
+ srcport: randomArrayItem(Ports),
+ };
+ alert.GeoLocation = randomArrayItem(GeoLocation);
+ alert.decoder = {
+ name: 'sshd',
+ parent: 'sshd',
+ };
+ alert.input = {
+ type: 'log',
+ };
+ alert.predecoder = {
+ program_name: 'sshd',
+ timestamp: formatDate(new Date(alert.timestamp), 'N D h:m:s'),
+ hostname: alert.manager.name,
+ };
+ let typeAlert = randomArrayItem([
+ 'invalidLoginPassword',
+ 'invalidLoginUser',
+ 'multipleAuthenticationFailures',
+ 'windowsInvalidLoginPassword',
+ 'userLoginFailed',
+ 'passwordCheckFailed',
+ 'nonExistentUser',
+ 'bruteForceTryingAccessSystem',
+ 'authenticationSuccess',
+ 'maximumAuthenticationAttemptsExceeded',
+ ]);
+
+ switch (typeAlert) {
+ case 'invalidLoginPassword': {
+ alert.location = Authentication.invalidLoginPassword.location;
+ alert.rule = { ...Authentication.invalidLoginPassword.rule };
+ alert.rule.groups = [
+ ...Authentication.invalidLoginPassword.rule.groups,
+ ];
+ alert.full_log = interpolateAlertProps(
+ Authentication.invalidLoginPassword.full_log,
+ alert,
+ );
+ break;
+ }
+ case 'invalidLoginUser': {
+ alert.location = Authentication.invalidLoginUser.location;
+ alert.rule = { ...Authentication.invalidLoginUser.rule };
+ alert.rule.groups = [...Authentication.invalidLoginUser.rule.groups];
+ alert.full_log = interpolateAlertProps(
+ Authentication.invalidLoginUser.full_log,
+ alert,
+ );
+ break;
+ }
+ case 'multipleAuthenticationFailures': {
+ alert.location = Authentication.multipleAuthenticationFailures.location;
+ alert.rule = { ...Authentication.multipleAuthenticationFailures.rule };
+ alert.rule.groups = [
+ ...Authentication.multipleAuthenticationFailures.rule.groups,
+ ];
+ alert.rule.frequency = randomIntervalInteger(5, 50);
+ alert.full_log = interpolateAlertProps(
+ Authentication.multipleAuthenticationFailures.full_log,
+ alert,
+ );
+ break;
+ }
+ case 'windowsInvalidLoginPassword': {
+ alert.location = Authentication.windowsInvalidLoginPassword.location;
+ alert.rule = { ...Authentication.windowsInvalidLoginPassword.rule };
+ alert.rule.groups = [
+ ...Authentication.windowsInvalidLoginPassword.rule.groups,
+ ];
+ alert.rule.frequency = randomIntervalInteger(5, 50);
+ alert.data.win = {
+ ...Authentication.windowsInvalidLoginPassword.data_win,
};
- let typeAlert = randomArrayItem([
- 'invalidLoginPassword',
- 'invalidLoginUser',
- 'multipleAuthenticationFailures',
- 'windowsInvalidLoginPassword',
- 'userLoginFailed',
- 'passwordCheckFailed',
- 'nonExistentUser',
- 'bruteForceTryingAccessSystem',
- 'authenticationSuccess',
- 'maximumAuthenticationAttemptsExceeded',
- ]);
-
- switch (typeAlert) {
- case 'invalidLoginPassword': {
- alert.location = Authentication.invalidLoginPassword.location;
- alert.rule = { ...Authentication.invalidLoginPassword.rule };
- alert.rule.groups = [...Authentication.invalidLoginPassword.rule.groups];
- alert.full_log = interpolateAlertProps(Authentication.invalidLoginPassword.full_log, alert);
- break;
- }
- case 'invalidLoginUser': {
- alert.location = Authentication.invalidLoginUser.location;
- alert.rule = { ...Authentication.invalidLoginUser.rule };
- alert.rule.groups = [...Authentication.invalidLoginUser.rule.groups];
- alert.full_log = interpolateAlertProps(Authentication.invalidLoginUser.full_log, alert);
- break;
- }
- case 'multipleAuthenticationFailures': {
- alert.location = Authentication.multipleAuthenticationFailures.location;
- alert.rule = { ...Authentication.multipleAuthenticationFailures.rule };
- alert.rule.groups = [...Authentication.multipleAuthenticationFailures.rule.groups];
- alert.rule.frequency = randomIntervalInteger(5, 50);
- alert.full_log = interpolateAlertProps(
- Authentication.multipleAuthenticationFailures.full_log,
- alert
- );
- break;
- }
- case 'windowsInvalidLoginPassword': {
- alert.location = Authentication.windowsInvalidLoginPassword.location;
- alert.rule = { ...Authentication.windowsInvalidLoginPassword.rule };
- alert.rule.groups = [...Authentication.windowsInvalidLoginPassword.rule.groups];
- alert.rule.frequency = randomIntervalInteger(5, 50);
- alert.data.win = { ...Authentication.windowsInvalidLoginPassword.data_win };
- alert.data.win.eventdata.ipAddress = randomArrayItem(IPs);
- alert.data.win.eventdata.ipPort = randomArrayItem(Ports);
- alert.data.win.system.computer = randomArrayItem(Win_Hostnames);
- alert.data.win.system.eventID = `${randomIntervalInteger(1, 600)}`;
- alert.data.win.system.eventRecordID = `${randomIntervalInteger(10000, 50000)}`;
- alert.data.win.system.processID = `${randomIntervalInteger(1, 1200)}`;
- alert.data.win.system.systemTime = alert.timestamp;
- alert.data.win.system.processID = `${randomIntervalInteger(1, 1200)}`;
- alert.data.win.system.task = `${randomIntervalInteger(1, 1800)}`;
- alert.data.win.system.threadID = `${randomIntervalInteger(1, 500)}`;
- alert.full_log = interpolateAlertProps(
- Authentication.windowsInvalidLoginPassword.full_log,
- alert
- );
- break;
- }
- case 'userLoginFailed': {
- alert.location = Authentication.userLoginFailed.location;
- alert.rule = { ...Authentication.userLoginFailed.rule };
- alert.rule.groups = [...Authentication.userLoginFailed.rule.groups];
- alert.data = {
- srcip: randomArrayItem(IPs),
- dstuser: randomArrayItem(Users),
- uid: `${randomIntervalInteger(0, 50)}`,
- euid: `${randomIntervalInteger(0, 50)}`,
- tty: 'ssh',
- };
- alert.decoder = { ...Authentication.userLoginFailed.decoder };
- alert.full_log = interpolateAlertProps(Authentication.userLoginFailed.full_log, alert);
- break;
- }
- case 'passwordCheckFailed': {
- alert.location = Authentication.passwordCheckFailed.location;
- alert.rule = { ...Authentication.passwordCheckFailed.rule };
- alert.rule.groups = [...Authentication.passwordCheckFailed.rule.groups];
- alert.data = {
- srcuser: randomArrayItem(Users),
- };
- alert.predecoder.program_name = 'unix_chkpwd';
- alert.decoder = { ...Authentication.passwordCheckFailed.decoder };
- alert.full_log = interpolateAlertProps(Authentication.passwordCheckFailed.full_log, alert);
- break;
- }
- case 'nonExistentUser': {
- alert.location = Authentication.nonExistentUser.location;
- alert.rule = { ...Authentication.nonExistentUser.rule };
- alert.rule.groups = [...Authentication.nonExistentUser.rule.groups];
- alert.full_log = interpolateAlertProps(Authentication.nonExistentUser.full_log, alert);
- break;
- }
- case 'bruteForceTryingAccessSystem': {
- alert.location = Authentication.bruteForceTryingAccessSystem.location;
- alert.rule = { ...Authentication.bruteForceTryingAccessSystem.rule };
- alert.rule.groups = [...Authentication.bruteForceTryingAccessSystem.rule.groups];
- alert.full_log = interpolateAlertProps(
- Authentication.bruteForceTryingAccessSystem.full_log,
- alert
- );
- break;
- }
- case 'reverseLoockupError': {
- alert.location = Authentication.reverseLoockupError.location;
- alert.rule = { ...Authentication.reverseLoockupError.rule };
- alert.rule.groups = [...Authentication.reverseLoockupError.rule.groups];
- alert.data = {
- srcip: randomArrayItem(IPs),
- };
- alert.full_log = interpolateAlertProps(Authentication.reverseLoockupError.full_log, alert);
- }
- case 'insecureConnectionAttempt': {
- alert.location = Authentication.insecureConnectionAttempt.location;
- alert.rule = { ...Authentication.insecureConnectionAttempt.rule };
- alert.rule.groups = [...Authentication.insecureConnectionAttempt.rule.groups];
- alert.data = {
- srcip: randomArrayItem(IPs),
- srcport: randomArrayItem(Ports),
- };
- alert.full_log = interpolateAlertProps(
- Authentication.insecureConnectionAttempt.full_log,
- alert
- );
- }
- case 'authenticationSuccess': {
- alert.location = Authentication.authenticationSuccess.location;
- alert.rule = { ...Authentication.authenticationSuccess.rule };
- alert.rule.groups = [...Authentication.authenticationSuccess.rule.groups];
- alert.data = {
- srcip: randomArrayItem(IPs),
- srcport: randomArrayItem(Ports),
- dstuser: randomArrayItem(Users),
- };
- alert.full_log = interpolateAlertProps(
- Authentication.authenticationSuccess.full_log,
- alert
- );
- }
- case 'maximumAuthenticationAttemptsExceeded': {
- alert.location = Authentication.maximumAuthenticationAttemptsExceeded.location;
- alert.rule = { ...Authentication.maximumAuthenticationAttemptsExceeded.rule };
- alert.rule.groups = [...Authentication.maximumAuthenticationAttemptsExceeded.rule.groups];
- alert.data = {
- srcip: randomArrayItem(IPs),
- srcport: randomArrayItem(Ports),
- dstuser: randomArrayItem(Users),
- };
- alert.full_log = interpolateAlertProps(
- Authentication.maximumAuthenticationAttemptsExceeded.full_log,
- alert
- );
- }
- default: {
- }
- }
- alert.rule.firedtimes = randomIntervalInteger(2, 15);
- alert.rule.tsc = [randomArrayItem(tsc)];
- }
-
- if (params.ssh) {
+ alert.data.win.eventdata.ipAddress = randomArrayItem(IPs);
+ alert.data.win.eventdata.ipPort = randomArrayItem(Ports);
+ alert.data.win.system.computer = randomArrayItem(Win_Hostnames);
+ alert.data.win.system.eventID = `${randomIntervalInteger(1, 600)}`;
+ alert.data.win.system.eventRecordID = `${randomIntervalInteger(
+ 10000,
+ 50000,
+ )}`;
+ alert.data.win.system.processID = `${randomIntervalInteger(1, 1200)}`;
+ alert.data.win.system.systemTime = alert.timestamp;
+ alert.data.win.system.processID = `${randomIntervalInteger(1, 1200)}`;
+ alert.data.win.system.task = `${randomIntervalInteger(1, 1800)}`;
+ alert.data.win.system.threadID = `${randomIntervalInteger(1, 500)}`;
+ alert.full_log = interpolateAlertProps(
+ Authentication.windowsInvalidLoginPassword.full_log,
+ alert,
+ );
+ break;
+ }
+ case 'userLoginFailed': {
+ alert.location = Authentication.userLoginFailed.location;
+ alert.rule = { ...Authentication.userLoginFailed.rule };
+ alert.rule.groups = [...Authentication.userLoginFailed.rule.groups];
alert.data = {
- srcip: randomArrayItem(IPs),
- srcuser: randomArrayItem(Users),
- srcport: randomArrayItem(Ports),
- };
- alert.GeoLocation = randomArrayItem(GeoLocation);
- alert.decoder = {
- name: 'sshd',
- parent: 'sshd',
- };
- alert.input = {
- type: 'log',
+ srcip: randomArrayItem(IPs),
+ dstuser: randomArrayItem(Users),
+ uid: `${randomIntervalInteger(0, 50)}`,
+ euid: `${randomIntervalInteger(0, 50)}`,
+ tty: 'ssh',
};
- alert.predecoder = {
- program_name: 'sshd',
- timestamp: formatDate(new Date(alert.timestamp), 'N D h:m:s'),
- hostname: alert.manager.name,
- };
- const typeAlert = randomArrayItem(SSH.data);
- alert.location = typeAlert.location;
- alert.rule = { ...typeAlert.rule };
- alert.rule.groups = [...typeAlert.rule.groups];
- alert.rule.firedtimes = randomIntervalInteger(1, 15);
- alert.full_log = interpolateAlertProps(typeAlert.full_log, alert);
- }
-
- if (params.windows) {
- alert.rule.groups.push('windows');
- if (params.windows.service_control_manager) {
- alert.predecoder = {
- program_name: 'WinEvtLog',
- timestamp: '2020 Apr 17 05:59:05',
- };
- alert.input = {
- type: 'log',
- };
- alert.data = {
- extra_data: 'Service Control Manager',
- dstuser: 'SYSTEM',
- system_name: randomArrayItem(Win_Hostnames),
- id: '7040',
- type: 'type',
- status: 'INFORMATION',
- };
- alert.rule.description = 'Windows: Service startup type was changed.';
- alert.rule.firedtimes = randomIntervalInteger(1, 20);
- alert.rule.mail = false;
- alert.rule.level = 3;
- alert.rule.groups.push('windows', 'policy_changed');
- alert.rule.pci = ['10.6'];
- alert.rule.hipaa = ['164.312.b'];
- alert.rule.gdpr = ['IV_35.7.d'];
- alert.rule.nist_800_53 = ['AU.6'];
- alert.rule.info = 'This does not appear to be logged on Windows 2000.';
- alert.location = 'WinEvtLog';
- alert.decoder = {
- parent: 'windows',
- name: 'windows',
- };
- alert.full_log = `2020 Apr 17 05:59:05 WinEvtLog: type: INFORMATION(7040): Service Control Manager: SYSTEM: NT AUTHORITY: ${alert.data.system_name}: Background Intelligent Transfer Service auto start demand start BITS `; //TODO: date
- alert.id = 18145;
- alert.fields = {
- timestamp: alert.timestamp,
- };
- }
- }
-
- if (params.apache) {
- const typeAlert = { ...Apache.data[0] }; // there is only one type alert in data array at the moment. Randomize if add more type of alerts to data array
+ alert.decoder = { ...Authentication.userLoginFailed.decoder };
+ alert.full_log = interpolateAlertProps(
+ Authentication.userLoginFailed.full_log,
+ alert,
+ );
+ break;
+ }
+ case 'passwordCheckFailed': {
+ alert.location = Authentication.passwordCheckFailed.location;
+ alert.rule = { ...Authentication.passwordCheckFailed.rule };
+ alert.rule.groups = [...Authentication.passwordCheckFailed.rule.groups];
alert.data = {
- srcip: randomArrayItem(IPs),
- srcport: randomArrayItem(Ports),
- id: `AH${randomIntervalInteger(10000, 99999)}`,
+ srcuser: randomArrayItem(Users),
};
- alert.GeoLocation = { ...randomArrayItem(GeoLocation) };
- alert.rule = { ...typeAlert.rule };
- alert.rule.firedtimes = randomIntervalInteger(2, 10);
- alert.input = { type: 'log' };
- alert.location = Apache.location;
- alert.decoder = { ...Apache.decoder };
-
- alert.full_log = interpolateAlertProps(typeAlert.full_log, alert, {
- _timestamp_apache: formatDate(new Date(alert.timestamp), 'E N D h:m:s.l Y'),
- _pi_id: randomIntervalInteger(10000, 30000),
- });
- }
-
- if (params.web) {
- alert.input = {
- type: 'log',
+ alert.predecoder.program_name = 'unix_chkpwd';
+ alert.decoder = { ...Authentication.passwordCheckFailed.decoder };
+ alert.full_log = interpolateAlertProps(
+ Authentication.passwordCheckFailed.full_log,
+ alert,
+ );
+ break;
+ }
+ case 'nonExistentUser': {
+ alert.location = Authentication.nonExistentUser.location;
+ alert.rule = { ...Authentication.nonExistentUser.rule };
+ alert.rule.groups = [...Authentication.nonExistentUser.rule.groups];
+ alert.full_log = interpolateAlertProps(
+ Authentication.nonExistentUser.full_log,
+ alert,
+ );
+ break;
+ }
+ case 'bruteForceTryingAccessSystem': {
+ alert.location = Authentication.bruteForceTryingAccessSystem.location;
+ alert.rule = { ...Authentication.bruteForceTryingAccessSystem.rule };
+ alert.rule.groups = [
+ ...Authentication.bruteForceTryingAccessSystem.rule.groups,
+ ];
+ alert.full_log = interpolateAlertProps(
+ Authentication.bruteForceTryingAccessSystem.full_log,
+ alert,
+ );
+ break;
+ }
+ case 'reverseLoockupError': {
+ alert.location = Authentication.reverseLoockupError.location;
+ alert.rule = { ...Authentication.reverseLoockupError.rule };
+ alert.rule.groups = [...Authentication.reverseLoockupError.rule.groups];
+ alert.data = {
+ srcip: randomArrayItem(IPs),
};
+ alert.full_log = interpolateAlertProps(
+ Authentication.reverseLoockupError.full_log,
+ alert,
+ );
+ }
+ case 'insecureConnectionAttempt': {
+ alert.location = Authentication.insecureConnectionAttempt.location;
+ alert.rule = { ...Authentication.insecureConnectionAttempt.rule };
+ alert.rule.groups = [
+ ...Authentication.insecureConnectionAttempt.rule.groups,
+ ];
alert.data = {
- protocol: 'GET',
- srcip: randomArrayItem(IPs),
- id: '404',
- url: randomArrayItem(Web.urls),
+ srcip: randomArrayItem(IPs),
+ srcport: randomArrayItem(Ports),
};
- alert.GeoLocation = { ...randomArrayItem(GeoLocation) };
-
- const typeAlert = randomArrayItem(Web.data);
- const userAgent = randomArrayItem(Web.userAgents);
- alert.rule = { ...typeAlert.rule };
- alert.rule.firedtimes = randomIntervalInteger(1, 10);
- alert.decoder = { ...typeAlert.decoder };
- alert.location = typeAlert.location;
- alert.full_log = interpolateAlertProps(typeAlert.full_log, alert, {
- _user_agent: userAgent,
- _date: formatDate(new Date(alert.timestamp), 'D/N/Y:h:m:s +0000'),
- });
- if (typeAlert.previous_output) {
- const previousOutput = [];
- const beforeSeconds = 4;
- for (let i = beforeSeconds; i > 0; i--) {
- const beforeDate = new Date(new Date(alert.timestamp) - (2 + i) * 1000);
- previousOutput.push(
- interpolateAlertProps(typeAlert.full_log, alert, {
- _user_agent: userAgent,
- _date: formatDate(new Date(beforeDate), 'D/N/Y:h:m:s +0000'),
- })
- );
- }
- alert.previous_output = previousOutput.join('\n');
- }
- }
-
- if (params.github) {
- alert.location = GitHub.LOCATION;
- alert.decoder = GitHub.DECODER;
- const alertType = randomArrayItem(GitHub.ALERT_TYPES);
- const actor = randomArrayItem(GitHub.ACTORS);
+ alert.full_log = interpolateAlertProps(
+ Authentication.insecureConnectionAttempt.full_log,
+ alert,
+ );
+ }
+ case 'authenticationSuccess': {
+ alert.location = Authentication.authenticationSuccess.location;
+ alert.rule = { ...Authentication.authenticationSuccess.rule };
+ alert.rule.groups = [
+ ...Authentication.authenticationSuccess.rule.groups,
+ ];
alert.data = {
- github: { ...alertType.data.github }
+ srcip: randomArrayItem(IPs),
+ srcport: randomArrayItem(Ports),
+ dstuser: randomArrayItem(Users),
};
- alert.data.github.org = randomArrayItem(GitHub.ORGANIZATION_NAMES);
- alert.data.github.repo && (alert.data.github.repo = `${alert.data.github.org}/${randomArrayItem(GitHub.REPOSITORY_NAMES)}`);
- alert.data.github.repository && (alert.data.github.repository = `${alert.data.github.org}/${randomArrayItem(GitHub.REPOSITORY_NAMES)}`);
- alert.data.github.actor = actor.name;
- alert.data.github.actor_location && alert.data.github.actor_location.country_code && (alert.data.github.actor_location.country_code = actor.country_code);
- alert.data.github.user && (alert.data.github.user = randomArrayItem(GitHub.USER_NAMES));
- alert.data.github.config && alert.data.github.config.url && (alert.data.github.config.url = randomArrayItem(GitHub.SERVER_ADDRESS_WEBHOOK));
- alert.data.github['@timestamp'] = alert.timestamp;
- alert.data.github.created_at && (alert.data.github.created_at = alert.timestamp);
+ alert.full_log = interpolateAlertProps(
+ Authentication.authenticationSuccess.full_log,
+ alert,
+ );
+ }
+ case 'maximumAuthenticationAttemptsExceeded': {
+ alert.location =
+ Authentication.maximumAuthenticationAttemptsExceeded.location;
alert.rule = {
- ...alertType.rule
+ ...Authentication.maximumAuthenticationAttemptsExceeded.rule,
};
+ alert.rule.groups = [
+ ...Authentication.maximumAuthenticationAttemptsExceeded.rule.groups,
+ ];
+ alert.data = {
+ srcip: randomArrayItem(IPs),
+ srcport: randomArrayItem(Ports),
+ dstuser: randomArrayItem(Users),
+ };
+ alert.full_log = interpolateAlertProps(
+ Authentication.maximumAuthenticationAttemptsExceeded.full_log,
+ alert,
+ );
+ }
+ default: {
+ }
}
+ alert.rule.firedtimes = randomIntervalInteger(2, 15);
+ alert.rule.tsc = [randomArrayItem(tsc)];
+ }
+
+ if (params.ssh) {
+ alert.data = {
+ srcip: randomArrayItem(IPs),
+ srcuser: randomArrayItem(Users),
+ srcport: randomArrayItem(Ports),
+ };
+ alert.GeoLocation = randomArrayItem(GeoLocation);
+ alert.decoder = {
+ name: 'sshd',
+ parent: 'sshd',
+ };
+ alert.input = {
+ type: 'log',
+ };
+ alert.predecoder = {
+ program_name: 'sshd',
+ timestamp: formatDate(new Date(alert.timestamp), 'N D h:m:s'),
+ hostname: alert.manager.name,
+ };
+ const typeAlert = randomArrayItem(SSH.data);
+ alert.location = typeAlert.location;
+ alert.rule = { ...typeAlert.rule };
+ alert.rule.groups = [...typeAlert.rule.groups];
+ alert.rule.firedtimes = randomIntervalInteger(1, 15);
+ alert.full_log = interpolateAlertProps(typeAlert.full_log, alert);
+ }
+
+ if (params.windows) {
+ alert.rule.groups.push('windows');
+ if (params.windows.service_control_manager) {
+ alert.predecoder = {
+ program_name: 'WinEvtLog',
+ timestamp: '2020 Apr 17 05:59:05',
+ };
+ alert.input = {
+ type: 'log',
+ };
+ alert.data = {
+ extra_data: 'Service Control Manager',
+ dstuser: 'SYSTEM',
+ system_name: randomArrayItem(Win_Hostnames),
+ id: '7040',
+ type: 'type',
+ status: 'INFORMATION',
+ };
+ alert.rule.description = 'Windows: Service startup type was changed.';
+ alert.rule.firedtimes = randomIntervalInteger(1, 20);
+ alert.rule.mail = false;
+ alert.rule.level = 3;
+ alert.rule.groups.push('windows', 'policy_changed');
+ alert.rule.pci = ['10.6'];
+ alert.rule.hipaa = ['164.312.b'];
+ alert.rule.gdpr = ['IV_35.7.d'];
+ alert.rule.nist_800_53 = ['AU.6'];
+ alert.rule.info = 'This does not appear to be logged on Windows 2000.';
+ alert.location = 'WinEvtLog';
+ alert.decoder = {
+ parent: 'windows',
+ name: 'windows',
+ };
+ alert.full_log = `2020 Apr 17 05:59:05 WinEvtLog: type: INFORMATION(7040): Service Control Manager: SYSTEM: NT AUTHORITY: ${alert.data.system_name}: Background Intelligent Transfer Service auto start demand start BITS `; //TODO: date
+ alert.id = 18145;
+ alert.fields = {
+ timestamp: alert.timestamp,
+ };
+ }
+ }
+
+ if (params.apache) {
+ const typeAlert = { ...Apache.data[0] }; // there is only one type alert in data array at the moment. Randomize if add more type of alerts to data array
+ alert.data = {
+ srcip: randomArrayItem(IPs),
+ srcport: randomArrayItem(Ports),
+ id: `AH${randomIntervalInteger(10000, 99999)}`,
+ };
+ alert.GeoLocation = { ...randomArrayItem(GeoLocation) };
+ alert.rule = { ...typeAlert.rule };
+ alert.rule.firedtimes = randomIntervalInteger(2, 10);
+ alert.input = { type: 'log' };
+ alert.location = Apache.location;
+ alert.decoder = { ...Apache.decoder };
+
+ alert.full_log = interpolateAlertProps(typeAlert.full_log, alert, {
+ _timestamp_apache: formatDate(
+ new Date(alert.timestamp),
+ 'E N D h:m:s.l Y',
+ ),
+ _pi_id: randomIntervalInteger(10000, 30000),
+ });
+ }
+
+ if (params.web) {
+ alert.input = {
+ type: 'log',
+ };
+ alert.data = {
+ protocol: 'GET',
+ srcip: randomArrayItem(IPs),
+ id: '404',
+ url: randomArrayItem(Web.urls),
+ };
+ alert.GeoLocation = { ...randomArrayItem(GeoLocation) };
+
+ const typeAlert = randomArrayItem(Web.data);
+ const userAgent = randomArrayItem(Web.userAgents);
+ alert.rule = { ...typeAlert.rule };
+ alert.rule.firedtimes = randomIntervalInteger(1, 10);
+ alert.decoder = { ...typeAlert.decoder };
+ alert.location = typeAlert.location;
+ alert.full_log = interpolateAlertProps(typeAlert.full_log, alert, {
+ _user_agent: userAgent,
+ _date: formatDate(new Date(alert.timestamp), 'D/N/Y:h:m:s +0000'),
+ });
+ if (typeAlert.previous_output) {
+ const previousOutput = [];
+ const beforeSeconds = 4;
+ for (let i = beforeSeconds; i > 0; i--) {
+ const beforeDate = new Date(new Date(alert.timestamp) - (2 + i) * 1000);
+ previousOutput.push(
+ interpolateAlertProps(typeAlert.full_log, alert, {
+ _user_agent: userAgent,
+ _date: formatDate(new Date(beforeDate), 'D/N/Y:h:m:s +0000'),
+ }),
+ );
+ }
+ alert.previous_output = previousOutput.join('\n');
+ }
+ }
+
+ if (params.github) {
+ alert.location = GitHub.LOCATION;
+ alert.decoder = GitHub.DECODER;
+ const alertType = randomArrayItem(GitHub.ALERT_TYPES);
+ const actor = randomArrayItem(GitHub.ACTORS);
+ alert.data = {
+ github: { ...alertType.data.github },
+ };
+ alert.data.github.org = randomArrayItem(GitHub.ORGANIZATION_NAMES);
+ alert.data.github.repo &&
+ (alert.data.github.repo = `${alert.data.github.org}/${randomArrayItem(
+ GitHub.REPOSITORY_NAMES,
+ )}`);
+ alert.data.github.repository &&
+ (alert.data.github.repository = `${
+ alert.data.github.org
+ }/${randomArrayItem(GitHub.REPOSITORY_NAMES)}`);
+ alert.data.github.actor = actor.name;
+ alert.data.github.actor_location &&
+ alert.data.github.actor_location.country_code &&
+ (alert.data.github.actor_location.country_code = actor.country_code);
+ alert.data.github.user &&
+ (alert.data.github.user = randomArrayItem(GitHub.USER_NAMES));
+ alert.data.github.config &&
+ alert.data.github.config.url &&
+ (alert.data.github.config.url = randomArrayItem(
+ GitHub.SERVER_ADDRESS_WEBHOOK,
+ ));
+ alert.data.github['@timestamp'] = alert.timestamp;
+ alert.data.github.created_at &&
+ (alert.data.github.created_at = alert.timestamp);
+ alert.rule = {
+ ...alertType.rule,
+ };
+ }
- return alert;
+ return alert;
}
/**
@@ -980,12 +1156,12 @@ function generateAlert(params) {
* @return {*} Array with random values extracted of paramater array passed
*/
function randomUniqueValuesFromArray(array, randomMaxRepetitions = 1, sort) {
- const repetitions = randomIntervalInteger(1, randomMaxRepetitions);
- const set = new Set();
- for (let i = 0; i < repetitions; i++) {
- set.add(array[randomIntervalInteger(0, array.length - 1)]);
- }
- return sort ? Array.from(set).sort(sort) : Array.from(set);
+ const repetitions = randomIntervalInteger(1, randomMaxRepetitions);
+ const set = new Set();
+ for (let i = 0; i < repetitions; i++) {
+ set.add(array[randomIntervalInteger(0, array.length - 1)]);
+ }
+ return sort ? Array.from(set).sort(sort) : Array.from(set);
}
/**
@@ -995,7 +1171,7 @@ function randomUniqueValuesFromArray(array, randomMaxRepetitions = 1, sort) {
* @returns {number} - Randomized number in interval
*/
function randomIntervalInteger(min, max) {
- return Math.floor(Math.random() * (max - (min - 1))) + min;
+ return Math.floor(Math.random() * (max - (min - 1))) + min;
}
/**
@@ -1005,11 +1181,11 @@ function randomIntervalInteger(min, max) {
* @return {*} - Random generated alerts defined with params
*/
function generateAlerts(params, numAlerts = 1) {
- const alerts = [];
- for (let i = 0; i < numAlerts; i++) {
- alerts.push(generateAlert(params));
- }
- return alerts;
+ const alerts = [];
+ for (let i = 0; i < numAlerts; i++) {
+ alerts.push(generateAlert(params));
+ }
+ return alerts;
}
/**
@@ -1017,61 +1193,83 @@ function generateAlerts(params, numAlerts = 1) {
* @returns {date} - Random date in range (7 days ago - now)
*/
function randomDate(inf, sup) {
- const nowTimestamp = Date.now();
- const time = randomIntervalInteger(0, 604800000); // Random 7 days in miliseconds
+ const nowTimestamp = Date.now();
+ const time = randomIntervalInteger(0, 604800000); // Random 7 days in miliseconds
- const unix_timestamp = nowTimestamp - time; // Last 7 days = require( now
+ const unix_timestamp = nowTimestamp - time; // Last 7 days = require( now
- const lastWeek = new Date(unix_timestamp);
- return formatDate(lastWeek, 'Y-M-DTh:m:s.l+0000');
+ const lastWeek = new Date(unix_timestamp);
+ return formatDate(lastWeek, 'Y-M-DTh:m:s.l+0000');
}
-const formatterNumber = (number, zeros = 0) => ('0'.repeat(zeros) + `${number}`).slice(-zeros);
+const formatterNumber = (number, zeros = 0) =>
+ ('0'.repeat(zeros) + `${number}`).slice(-zeros);
const monthNames = {
- long: [
- 'January',
- 'February',
- 'March',
- 'April',
- 'May',
- 'June',
- 'July',
- 'August',
- 'September',
- 'October',
- 'November',
- 'December',
- ],
- short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ long: [
+ 'January',
+ 'February',
+ 'March',
+ 'April',
+ 'May',
+ 'June',
+ 'July',
+ 'August',
+ 'September',
+ 'October',
+ 'November',
+ 'December',
+ ],
+ short: [
+ 'Jan',
+ 'Feb',
+ 'Mar',
+ 'Apr',
+ 'May',
+ 'Jun',
+ 'Jul',
+ 'Aug',
+ 'Sep',
+ 'Oct',
+ 'Nov',
+ 'Dec',
+ ],
};
const dayNames = {
- long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
- short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ long: [
+ 'Sunday',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ ],
+ short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
};
function formatDate(date, format) {
- // It could use "moment" library to format strings too
- const tokens = {
- D: (d) => formatterNumber(d.getDate(), 2), // 01-31
- A: (d) => dayNames.long[d.getDay()], // 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
- E: (d) => dayNames.short[d.getDay()], // 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
- M: (d) => formatterNumber(d.getMonth() + 1, 2), // 01-12
- J: (d) => monthNames.long[d.getMonth()], // 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
- N: (d) => monthNames.short[d.getMonth()], // 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
- Y: (d) => d.getFullYear(), // 2020
- h: (d) => formatterNumber(d.getHours(), 2), // 00-23
- m: (d) => formatterNumber(d.getMinutes(), 2), // 00-59
- s: (d) => formatterNumber(d.getSeconds(), 2), // 00-59
- l: (d) => formatterNumber(d.getMilliseconds(), 3), // 000-999
- };
-
- return format.split('').reduce((accum, token) => {
- if (tokens[token]) {
- return accum + tokens[token](date);
- }
- return accum + token;
- }, '');
+ // It could use "moment" library to format strings too
+ const tokens = {
+ D: d => formatterNumber(d.getDate(), 2), // 01-31
+ A: d => dayNames.long[d.getDay()], // 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
+ E: d => dayNames.short[d.getDay()], // 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
+ M: d => formatterNumber(d.getMonth() + 1, 2), // 01-12
+ J: d => monthNames.long[d.getMonth()], // 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
+ N: d => monthNames.short[d.getMonth()], // 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
+ Y: d => d.getFullYear(), // 2020
+ h: d => formatterNumber(d.getHours(), 2), // 00-23
+ m: d => formatterNumber(d.getMinutes(), 2), // 00-59
+ s: d => formatterNumber(d.getSeconds(), 2), // 00-59
+ l: d => formatterNumber(d.getMilliseconds(), 3), // 000-999
+ };
+
+ return format.split('').reduce((accum, token) => {
+ if (tokens[token]) {
+ return accum + tokens[token](date);
+ }
+ return accum + token;
+ }, '');
}
/**
@@ -1081,17 +1279,19 @@ function formatDate(date, format) {
* @param {*} extra Extra parameters to interpolate what aren't in alert objet. Only admit one level of depth
*/
function interpolateAlertProps(str, alert, extra = {}) {
- const matches = str.match(/{([\w\._]+)}/g);
- return (
- (matches &&
- matches.reduce((accum, cur) => {
- const match = cur.match(/{([\w\._]+)}/);
- const items = match[1].split('.');
- const value = items.reduce((a, c) => (a && a[c]) || extra[c] || undefined, alert) || cur;
- return accum.replace(cur, value);
- }, str)) ||
- str
- );
+ const matches = str.match(/{([\w\._]+)}/g);
+ return (
+ (matches &&
+ matches.reduce((accum, cur) => {
+ const match = cur.match(/{([\w\._]+)}/);
+ const items = match[1].split('.');
+ const value =
+ items.reduce((a, c) => (a && a[c]) || extra[c] || undefined, alert) ||
+ cur;
+ return accum.replace(cur, value);
+ }, str)) ||
+ str
+ );
}
/**
@@ -1100,7 +1300,7 @@ function interpolateAlertProps(str, alert, extra = {}) {
* @param {number[=100]} maximum
*/
function randomProbability(probability, maximum = 100) {
- return randomIntervalInteger(0, maximum) <= probability;
+ return randomIntervalInteger(0, maximum) <= probability;
}
module.exports = { generateAlert, generateAlerts };