Skip to content

Commit

Permalink
[Redesign add page] Agent register wizard handle properly special cha…
Browse files Browse the repository at this point in the history
…racters in password (#5738)

* parent component

* Added a title to the container and updated filenames

* Update register-agent.scss

* [Redesign add agent] Register agent reuse common/form component (Settings > Configuration) (#5446)

* Add useForm hook types

* Add custom field use in useForm hook

* Add some code redeability fixes

* Refactored useForm types and unit tests

* Move types to types file

* Remove react use inside hook test file

* Fix review requested changes

* [Redesign add agent] Add register agent command generator (#5469)

* Create reusable card for operating systems (#5462)

* Add useForm hook types

* Add custom field use in useForm hook

* Add some code redeability fixes

* Refactored useForm types and unit tests

* Move types to types file

* reuse of common form on the card

* Card with logic

* CheckboxGroup component logic update

* CheckboxGroup component logic update

* Adding card icons

* update checkbox logic, styles, and card styles

* clean code

* clean code

* gitignore Mac files

* updating checkbox logic, styles, and card styles

* Update os-card.scss

* macos card update

* undoing merging as it was causing checkboxes not to work

* test

* file ds_store

* file ds_store

* file ds_store

* remove files DS_store

* remove files DS_store

---------

Co-authored-by: Maximiliano Ibarra <[email protected]>
Co-authored-by: Maximiliano Ibarra <[email protected]>

* 5518 inputs logic server address name password and group (#5554)

* Add useForm hook types

* Add custom field use in useForm hook

* Add some code redeability fixes

* Refactored useForm types and unit tests

* Move types to types file

* reuse of common form on the card

* Card with logic

* CheckboxGroup component logic update

* CheckboxGroup component logic update

* Adding card icons

* update checkbox logic, styles, and card styles

* clean code

* clean code

* gitignore Mac files

* updating checkbox logic, styles, and card styles

* step component

* Passing interfaces to a separate file, updating styles, and component logic

* Update interfaces and clean up code

* update of folder structure and step logic

* tcp, udp, protocols, password, groups, logics

* input logic server address name password groups and styles

* group input logic

* oscards input logic

* oscards input logic

* styles

* regex

* styles and settings

* styles

* various adjustments

* cleaning up code and changing some styles

* cleaning up code

* cleaning code

* update password

* gitignore

* gitignore

* correcting validation text in input agent name

* correcting validation text in input agent name

* corrección de validación de input de nombre del agente

* cleaning code

* cleaning code

* regex that differentiates between FQDN and IP

* Use of PLUGIN_VERSION_SHORT

* Use of PLUGIN_VERSION_SHORT

* link

* Revert "Merge branch '4205-redesign-add-agent-page' into 5518-inputs-logic-server-address-name-password-and-group"

This reverts commit a4c6fb5, reversing
changes made to 5a0d2cb.

* link and revert

* characteres valid

* correction of styles when bringing changes from parent branch

* change tooltip to popover

* moving validations to a separate file with their tests

* corrections and cleaning of comments

* camel case

* change in function

* type

* remove type

* fullWidth

* type

* change

* conditional

* change label a to Euilink

* change label a to Euilink

* conditional

* delete usePrevious

* delete usePrevious

* deleted files ds store

* test correction and placeholder

* show architecture instead of id

* removing console css warnings

* fixed regex fqdn

* fixed regex fqdn

* data

* changelog

* changelog

---------

Co-authored-by: Maximiliano Ibarra <[email protected]>
Co-authored-by: Maximiliano Ibarra <[email protected]>

* [Redesign add agent] Integration commands generator with UI (#5593)

* Add useForm hook types

* Add custom field use in useForm hook

* Add some code redeability fixes

* Refactored useForm types and unit tests

* Move types to types file

* reuse of common form on the card

* Card with logic

* CheckboxGroup component logic update

* CheckboxGroup component logic update

* Adding card icons

* update checkbox logic, styles, and card styles

* clean code

* clean code

* gitignore Mac files

* updating checkbox logic, styles, and card styles

* step component

* Passing interfaces to a separate file, updating styles, and component logic

* Update interfaces and clean up code

* update of folder structure and step logic

* tcp, udp, protocols, password, groups, logics

* input logic server address name password groups and styles

* group input logic

* oscards input logic

* oscards input logic

* styles

* regex

* styles and settings

* styles

* various adjustments

* cleaning up code and changing some styles

* cleaning up code

* cleaning code

* update password

* gitignore

* gitignore

* correcting validation text in input agent name

* correcting validation text in input agent name

* corrección de validación de input de nombre del agente

* cleaning code

* cleaning code

* regex that differentiates between FQDN and IP

* Use of PLUGIN_VERSION_SHORT

* Use of PLUGIN_VERSION_SHORT

* link

* Revert "Merge branch '4205-redesign-add-agent-page' into 5518-inputs-logic-server-address-name-password-and-group"

This reverts commit a4c6fb5, reversing
changes made to 5a0d2cb.

* link and revert

* characteres valid

* correction of styles when bringing changes from parent branch

* change tooltip to popover

* moving validations to a separate file with their tests

* corrections and cleaning of comments

* camel case

* change in function

* type

* remove type

* fullWidth

* type

* change

* conditional

* change label a to Euilink

* change label a to Euilink

* conditional

* delete usePrevious

* delete usePrevious

* deleted files ds store

* test correction and placeholder

* show architecture instead of id

* Add register agent form values parser

* Remove extension on operating system type

* Add command sections with form values

* Create new components for steps inputs

* Fix some types

* Renamed some options

* Move commands config inside core folder

* Fix server address error message display

* Create methods to get form steps status

* Allow select more than group

* Hide agent group param when is empty

* Fix steps form statuses

* Remove break lines in commands

* Add white space in error messages

* Fix steps form status

* Added new command component white custom copy and language

* Fixed step form status

---------

Co-authored-by: chantal.kelm <[email protected]>
Co-authored-by: Chantal Belén kelm <[email protected]>

* [Redesign add agent] Dark mode (#5620)

* remove custom color styles to make the elastic dark mode work by default on the agent registration page

* add development for images to have dark mode in the section deploy a new agent

* changelog about dark mode

* Cleaning console.log from assets file

* Adding suggested style modifications in the agent registration section

* add a style hint so that text cannot be selected on cards

* add suggested changes to the styles in the register an agent section

* correction added to the word wizard

* added coding enhancements in the agent registration section

* adding an enhancement to eliminate the console error

* adding an enhancement to eliminate the console error

* [Redesign add agent] Add and validate register agent commands (#5622)

* Add show/hide password in command component

* Add protocol and password types

* Add more step status methods

* Add os commands service

* Resolve strings replacements in command component

* Change macos packages name by arch

* Add \n to the macos params

* Fixed parsed macos params inside echo

* Add -e in mac os install command

* Remove sudo from macos install command with echo

* Add sudo to linux before optional params

* Fix PR review comments

* Fixed imports in tests

* Fix components unit tests

* Fix unit test checkbox group component

* Fix os card unit test with mock uiSettings

* modify the fqdn regex because it interferes with an ipv4 instance

* [Redesign add page] Add form status callout message (#5634)

* Add form status manager and unit tests

* Add empty and invalid fields messages

* Hide commands code block when exists warning messages

* Fix fields names in warning messages

* Updated CHANGELOG

* Step 2: the design triggers warnings (#5649)

* changing design to remove console warnings

* update changelog

* Changes in the display of pop-up windows in the agents log section

* semicolon is added

* update changelog

* update changelog

* Merge 4.5.1 into 4.6.0 (#5671)

* Change windows agent service name (#5538)

* Change windows agent service name to Wazuh

Change windows agent service name to Wazuh

* Add CHANGELOG

* Remove agent name in agent info ribbon (#5497)

* remove: agent name in agent info ribbon

* changelog: add pull request entry

---------

Co-authored-by: Álex Ruiz <[email protected]>

* Fix IPV6 visualizations (#5471)

* add ipv6 service

* add test for service

* Fix issue in agents-table

* fix issue in agents-info

* fix groups agents issue

* Fix width in groups agents

* use mapResponseItem

* Add copy button to groups

* Add copy button to info

* fix for node list

* Optimize code

* Fix styles

* Edit changelog

* Edit changelog

* Add imposter changes to test ipv6

* Replace onMouseDown with onClick

* Move copy buttons to the left

* fix: removed compressipv6 property of TableWzAPI

* feat: add tableLayout property to some tables and remove IPv6 address compression

add tableLayout=auto property to some tables:
- Agents/{agent_id}/Inventory data
- Management/Cluster/Nodes
- Agents
- Management/Configuration/Client
- Management/Global configuration/Remote
remove IPv6 address compression

* remove: remove unused service to IPv6 compression

* revert: revert changes in TableWzAPI component

* add: add mocked responses to some syscollector endpoints

* remove: unwanted table columns properties

* changelog: add pull request entry

* Fix imposter

---------

Co-authored-by: Antonio David Gutiérrez <[email protected]>
Co-authored-by: Álex Ruiz <[email protected]>
Co-authored-by: yenienserrano <[email protected]>
Co-authored-by: Antonio <[email protected]>

* Bump v4.4.4-2.6.0-rc2

* Add Apple Silicon architecture to the register Agent wizard (#5478)

* Add Apple Silicon architecture

* Add changelog

* Change macOS environment variables

* Revert "Change macOS environment variables"

This reverts commit 108e866.

* Change macOS architecture ids

* Add missing supported versions to the Docker environments (#5584)

feat(environments): add latest versions to Docker environments

- Add Kibana versions: 7.17.7, 7.17.8, 7.17.9 and 7.17.10
- Add OpenSearch: 2.6.0
- Add OpenSearch Dashboards: 2.6.0
- Add Wazuh 4.4.1, 4.4.2, 4.4.3 and 4.4.4

* Bump 4.5.1

* Change the method to make the redirect (#5539)

* Change the metod to make the redirect

* Remove unused code

* Add changelog

---------

Co-authored-by: Álex Ruiz <[email protected]>

* Fix agents active coverage stat as NaN (#5490)

* fix: agents active coverate stat as NaN

Ensure the values used to calculate have the expected types and
the total count is greater than 0.

* remove: unused openRegistrationDocs method

* changelog: add entry

* fix: check if agents active coverage is a NaN

* changelog: fix entry

---------

Co-authored-by: Álex Ruiz <[email protected]>

* [Backport 4.5.1] Update test snapshots for 4.5 (#5607)

* Update test snapshots for 4.5 (#5601)

* Add missing supported versions to the Docker environments (#5584)

feat(environments): add latest versions to Docker environments

- Add Kibana versions: 7.17.7, 7.17.8, 7.17.9 and 7.17.10
- Add OpenSearch: 2.6.0
- Add OpenSearch Dashboards: 2.6.0
- Add Wazuh 4.4.1, 4.4.2, 4.4.3 and 4.4.4

* Update test snapshost

* Update API data to 4.5

* Update branch patterns for GH Actions

---------

Co-authored-by: Antonio <[email protected]>
(cherry picked from commit 1ae5f19)

* Fix API reference links in endpoints.json

* Add kbn-dev 7.17.11 (#5628)

* Merge 4.5.0 into 4.5.1 (#5670)

* Update test snapshots for 4.5 (#5601)

* Add missing supported versions to the Docker environments (#5584)

feat(environments): add latest versions to Docker environments

- Add Kibana versions: 7.17.7, 7.17.8, 7.17.9 and 7.17.10
- Add OpenSearch: 2.6.0
- Add OpenSearch Dashboards: 2.6.0
- Add Wazuh 4.4.1, 4.4.2, 4.4.3 and 4.4.4

* Update test snapshost

* Update API data to 4.5

* Update branch patterns for GH Actions

---------

Co-authored-by: Antonio <[email protected]>

* Fix API reference links in endpoints.json

* Merge 4.4 into 4.5.0 (#5669)

Merge v4.4.5-2.6.0 into 4.4 (#5665)

* Bump Wazuh and platform versions for v4.4.5 (#5639)

* Update changelog

* Update opensearch_dashboards.json

* Update package.json

* Update readme

* Update tag script

* Change tag.py version value

* Empty tag suffix

* Prepare tag.py for v4.4.5-rc1 (#5645)

Add -rc1 tag suffix

* Fix incompatible version of triple-beam subdependency (#5652)

fix: add yarn.lock file and set version of triple-beam in yarn.lock

* Update unit-test.yml (#5655)

* Add support for Wazuh 4.4.5-rc2 (#5659)

* Update revision of v4.4.5 in the Changelog

* Bump v4.4.5-2.6.0-rc2

---------

Co-authored-by: Nicolas Agustin Guevara Pihen <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Co-authored-by: Álex Ruiz <[email protected]>
Co-authored-by: Antonio <[email protected]>

---------

Co-authored-by: Álex Ruiz <[email protected]>
Co-authored-by: Antonio <[email protected]>
Co-authored-by: Nicolas Agustin Guevara Pihen <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>

---------

Co-authored-by: Julio César Biset <[email protected]>
Co-authored-by: Antonio <[email protected]>
Co-authored-by: Álex Ruiz <[email protected]>
Co-authored-by: Nicolas Agustin Guevara Pihen <[email protected]>
Co-authored-by: Antonio David Gutiérrez <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>

* Remove unused embedded jquery-ui (#5592)

* fix: remove unused embedded jquery-ui dependency

* changelog: add pull request entry

---------

Co-authored-by: Federico Rodriguez <[email protected]>

* Fixes redirection problem to inventory data, stats and configuration in an agent (#5685)

Fix redirect to inventory data, stats and configuration

* Fix conflicts in branch synchronization (#5708)

* fix: fix conflicts

* changelog: remove entry

* Fix 4.6.0 changelog merge errors (#5692)

* Update changelog

* Update CHANGELOG.md

* Merge 4.5.2 into 4.6.0 (#5721)

* Add method to scape special chars in wazuh password

* Upgrade environments to 4.6 and 4.7 (#5741)

* Add wzd-dev.dockerfile

* Update osd dev.sh

* Applied special chars scape un command password

* Redesign deploy new agent page (#5457)

* parent component

* Added a title to the container and updated filenames

* Update register-agent.scss

* [Redesign add agent] Register agent reuse common/form component (Settings > Configuration) (#5446)

* Add useForm hook types

* Add custom field use in useForm hook

* Add some code redeability fixes

* Refactored useForm types and unit tests

* Move types to types file

* Remove react use inside hook test file

* Fix review requested changes

* [Redesign add agent] Add register agent command generator (#5469)

* Create reusable card for operating systems (#5462)

* Add useForm hook types

* Add custom field use in useForm hook

* Add some code redeability fixes

* Refactored useForm types and unit tests

* Move types to types file

* reuse of common form on the card

* Card with logic

* CheckboxGroup component logic update

* CheckboxGroup component logic update

* Adding card icons

* update checkbox logic, styles, and card styles

* clean code

* clean code

* gitignore Mac files

* updating checkbox logic, styles, and card styles

* Update os-card.scss

* macos card update

* undoing merging as it was causing checkboxes not to work

* test

* file ds_store

* file ds_store

* file ds_store

* remove files DS_store

* remove files DS_store

---------

Co-authored-by: Maximiliano Ibarra <[email protected]>
Co-authored-by: Maximiliano Ibarra <[email protected]>

* 5518 inputs logic server address name password and group (#5554)

* Add useForm hook types

* Add custom field use in useForm hook

* Add some code redeability fixes

* Refactored useForm types and unit tests

* Move types to types file

* reuse of common form on the card

* Card with logic

* CheckboxGroup component logic update

* CheckboxGroup component logic update

* Adding card icons

* update checkbox logic, styles, and card styles

* clean code

* clean code

* gitignore Mac files

* updating checkbox logic, styles, and card styles

* step component

* Passing interfaces to a separate file, updating styles, and component logic

* Update interfaces and clean up code

* update of folder structure and step logic

* tcp, udp, protocols, password, groups, logics

* input logic server address name password groups and styles

* group input logic

* oscards input logic

* oscards input logic

* styles

* regex

* styles and settings

* styles

* various adjustments

* cleaning up code and changing some styles

* cleaning up code

* cleaning code

* update password

* gitignore

* gitignore

* correcting validation text in input agent name

* correcting validation text in input agent name

* corrección de validación de input de nombre del agente

* cleaning code

* cleaning code

* regex that differentiates between FQDN and IP

* Use of PLUGIN_VERSION_SHORT

* Use of PLUGIN_VERSION_SHORT

* link

* Revert "Merge branch '4205-redesign-add-agent-page' into 5518-inputs-logic-server-address-name-password-and-group"

This reverts commit a4c6fb5, reversing
changes made to 5a0d2cb.

* link and revert

* characteres valid

* correction of styles when bringing changes from parent branch

* change tooltip to popover

* moving validations to a separate file with their tests

* corrections and cleaning of comments

* camel case

* change in function

* type

* remove type

* fullWidth

* type

* change

* conditional

* change label a to Euilink

* change label a to Euilink

* conditional

* delete usePrevious

* delete usePrevious

* deleted files ds store

* test correction and placeholder

* show architecture instead of id

* removing console css warnings

* fixed regex fqdn

* fixed regex fqdn

* data

* changelog

* changelog

---------

Co-authored-by: Maximiliano Ibarra <[email protected]>
Co-authored-by: Maximiliano Ibarra <[email protected]>

* [Redesign add agent] Integration commands generator with UI (#5593)

* Add useForm hook types

* Add custom field use in useForm hook

* Add some code redeability fixes

* Refactored useForm types and unit tests

* Move types to types file

* reuse of common form on the card

* Card with logic

* CheckboxGroup component logic update

* CheckboxGroup component logic update

* Adding card icons

* update checkbox logic, styles, and card styles

* clean code

* clean code

* gitignore Mac files

* updating checkbox logic, styles, and card styles

* step component

* Passing interfaces to a separate file, updating styles, and component logic

* Update interfaces and clean up code

* update of folder structure and step logic

* tcp, udp, protocols, password, groups, logics

* input logic server address name password groups and styles

* group input logic

* oscards input logic

* oscards input logic

* styles

* regex

* styles and settings

* styles

* various adjustments

* cleaning up code and changing some styles

* cleaning up code

* cleaning code

* update password

* gitignore

* gitignore

* correcting validation text in input agent name

* correcting validation text in input agent name

* corrección de validación de input de nombre del agente

* cleaning code

* cleaning code

* regex that differentiates between FQDN and IP

* Use of PLUGIN_VERSION_SHORT

* Use of PLUGIN_VERSION_SHORT

* link

* Revert "Merge branch '4205-redesign-add-agent-page' into 5518-inputs-logic-server-address-name-password-and-group"

This reverts commit a4c6fb5, reversing
changes made to 5a0d2cb.

* link and revert

* characteres valid

* correction of styles when bringing changes from parent branch

* change tooltip to popover

* moving validations to a separate file with their tests

* corrections and cleaning of comments

* camel case

* change in function

* type

* remove type

* fullWidth

* type

* change

* conditional

* change label a to Euilink

* change label a to Euilink

* conditional

* delete usePrevious

* delete usePrevious

* deleted files ds store

* test correction and placeholder

* show architecture instead of id

* Add register agent form values parser

* Remove extension on operating system type

* Add command sections with form values

* Create new components for steps inputs

* Fix some types

* Renamed some options

* Move commands config inside core folder

* Fix server address error message display

* Create methods to get form steps status

* Allow select more than group

* Hide agent group param when is empty

* Fix steps form statuses

* Remove break lines in commands

* Add white space in error messages

* Fix steps form status

* Added new command component white custom copy and language

* Fixed step form status

---------

Co-authored-by: chantal.kelm <[email protected]>
Co-authored-by: Chantal Belén kelm <[email protected]>

* [Redesign add agent] Dark mode (#5620)

* remove custom color styles to make the elastic dark mode work by default on the agent registration page

* add development for images to have dark mode in the section deploy a new agent

* changelog about dark mode

* Cleaning console.log from assets file

* Adding suggested style modifications in the agent registration section

* add a style hint so that text cannot be selected on cards

* add suggested changes to the styles in the register an agent section

* correction added to the word wizard

* added coding enhancements in the agent registration section

* adding an enhancement to eliminate the console error

* adding an enhancement to eliminate the console error

* [Redesign add agent] Add and validate register agent commands (#5622)

* Add show/hide password in command component

* Add protocol and password types

* Add more step status methods

* Add os commands service

* Resolve strings replacements in command component

* Change macos packages name by arch

* Add \n to the macos params

* Fixed parsed macos params inside echo

* Add -e in mac os install command

* Remove sudo from macos install command with echo

* Add sudo to linux before optional params

* Fix PR review comments

* Fixed imports in tests

* Fix components unit tests

* Fix unit test checkbox group component

* Fix os card unit test with mock uiSettings

* modify the fqdn regex because it interferes with an ipv4 instance

* [Redesign add page] Add form status callout message (#5634)

* Add form status manager and unit tests

* Add empty and invalid fields messages

* Hide commands code block when exists warning messages

* Fix fields names in warning messages

* Updated CHANGELOG

* Step 2: the design triggers warnings (#5649)

* changing design to remove console warnings

* update changelog

* Changes in the display of pop-up windows in the agents log section

* semicolon is added

* update changelog

* update changelog

* Add requested fixs on texts

* Add new rpm and deb install commands

* modify fqdn regex

* Fix server address validation unit test

* Add type in command output types

---------

Co-authored-by: Maximiliano Ibarra <[email protected]>
Co-authored-by: Maximiliano Ibarra <[email protected]>

* Add password scaped singlequote

* Add new wazuh password service for scape special characters with unit tests

* Add new unit test case

* Fix service and added unit tests

* Comment logs in service unit test

* Update CHANGELOG

* Change regex to scape special characters

* Fix unit tests

* Fix osdfucate password with toggle

* Change scape and osdfucate password depending on os selected

* Add osdfucate and scape password for windows

* Add windows scape password unit tests

* Remove $ in wazuh password command param

* Fix overlay height to fix horizontal scroll

* Change macos scape characters method and unit tests

* Change macos scape method

* Fix mac os scape service unit test

---------

Co-authored-by: chantal.kelm <[email protected]>
Co-authored-by: Chantal Belén kelm <[email protected]>
Co-authored-by: Ian Yenien Serrano <[email protected]>
Co-authored-by: Julio César Biset <[email protected]>
Co-authored-by: Antonio <[email protected]>
Co-authored-by: Álex Ruiz <[email protected]>
Co-authored-by: Nicolas Agustin Guevara Pihen <[email protected]>
Co-authored-by: Antonio David Gutiérrez <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
  • Loading branch information
10 people authored Aug 9, 2023
1 parent 5b26e93 commit 8c846ac
Show file tree
Hide file tree
Showing 15 changed files with 289 additions and 53 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to the Wazuh app project will be documented in this file.

- Support for Wazuh 4.7.0
- Added `status detail` column in the agents table. [#5680](https://github.com/wazuh/wazuh-kibana-app/pull/5680)
- Added agent register wizard handle properly special characters in password [5738](https://github.com/wazuh/wazuh-kibana-app/pull/5738)

### Changed

Expand Down
24 changes: 24 additions & 0 deletions docker/images/wzd-dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Usage: docker build --build-arg NODE_VERSION=16.20.0 --build-arg WAZUH_DASHBOARD_VERSION=4.6.0 -t quay.io/wazuh/osd-dev:4.6.0 -f wzd-dev.Dockerfile .

ARG NODE_VERSION
FROM node:${NODE_VERSION} AS base
ARG WAZUH_DASHBOARD_VERSION
USER node
RUN git clone --depth 1 --branch ${WAZUH_DASHBOARD_VERSION} https://github.com/wazuh/wazuh-dashboard.git /home/node/kbn
RUN chown node.node /home/node/kbn

WORKDIR /home/node/kbn
RUN yarn osd bootstrap --production


WORKDIR /home/node/kbn/plugins
RUN git clone --depth 1 --branch ${WAZUH_DASHBOARD_VERSION} https://github.com/wazuh/wazuh-security-dashboards-plugin.git
WORKDIR /home/node/kbn/plugins/wazuh-security-dashboards-plugin
RUN yarn install

RUN mkdir -p /home/node/kbn/data/wazuh/config

FROM node:${NODE_VERSION}
USER node
COPY --chown=node:node --from=base /home/node/kbn /home/node/kbn
WORKDIR /home/node/kbn
13 changes: 12 additions & 1 deletion docker/osd-dev/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ os_versions=(
'2.4.0'
'2.4.1'
'2.6.0'
'2.8.0'
'2.9.0'
)

osd_versions=(
Expand All @@ -20,6 +22,8 @@ osd_versions=(
'2.4.0'
'2.4.1'
'2.6.0'
'4.6.0'
'4.7.0'
)

usage() {
Expand Down Expand Up @@ -71,9 +75,16 @@ export OSD_VERSION=$2
export OSD_PORT=${PORT:-5601}
export IMPOSTER_PORT=8081
export SRC=$3
export OSD_MAJOR=$(echo $OSD_VERSION | cut -d. -f1).x
export OSD_MAJOR_NUMBER=$(echo $OSD_VERSION | cut -d. -f1)
export COMPOSE_PROJECT_NAME=os-dev-${OSD_VERSION//./}

if [[ "$OSD_MAJOR_NUMBER" -ge 2 ]];
then
export OSD_MAJOR="2.x"
else
export OSD_MAJOR="1.x"
fi

profile="standard"
export WAZUH_DASHBOARD_CONF=./config/${OSD_MAJOR}/osd/opensearch_dashboards.yml
export SEC_CONFIG_FILE=./config/${OSD_MAJOR}/os/config.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
position: absolute;
top: 0;
width: 100%;
height: 100%;
height: 90%;
display: flex;
flex-direction: column;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@elastic/eui';
import React, { Fragment, useEffect, useState } from 'react';
import { tOperatingSystem } from '../../core/config/os-commands-definitions';
import { osdfucatePasswordInCommand } from '../../services/wazuh-password-service';

interface ICommandSectionProps {
commandText: string;
Expand All @@ -20,13 +21,6 @@ interface ICommandSectionProps {

export default function CommandOutput(props: ICommandSectionProps) {
const { commandText, showCommand, onCopy, os, password } = props;
const getHighlightCodeLanguage = (os: 'WINDOWS' | string) => {
if (os.toLowerCase() === 'windows') {
return 'powershell';
} else {
return 'bash';
}
};
const [havePassword, setHavePassword] = useState(false);
const [showPassword, setShowPassword] = useState(false);

Expand All @@ -45,27 +39,23 @@ export default function CommandOutput(props: ICommandSectionProps) {
setHavePassword(false);
setCommandToShow(commandText);
}
}, [password, commandText, showPassword])

}, [password, commandText, showPassword]);

const osdfucatePassword = (password: string) => {
if(!password) return;
if(!commandText) return;
if (!password) return;
if (!commandText) return;

if(showPassword){
if (showPassword) {
setCommandToShow(commandText);
}else{
// search password in commandText and replace with * for every character
const findPassword = commandText.search(password);
if (findPassword > -1) {
let command = commandText;
setCommandToShow(command.replace(/WAZUH_REGISTRATION_PASSWORD='([^']+)'/,`WAZUH_REGISTRATION_PASSWORD='${'*'.repeat(password.length)}'`));
}
} else {
setCommandToShow(osdfucatePasswordInCommand(password, commandText, os));
}
}

};
const onChangeShowPassword = (event: EuiSwitchEvent) => {
setShowPassword(event.target.checked);
}
};

return (
<Fragment>
Expand All @@ -76,7 +66,7 @@ export default function CommandOutput(props: ICommandSectionProps) {
style={{
zIndex: '100',
}}
language={getHighlightCodeLanguage(os || '')}
language='tsx'
>
{showCommand ? commandToShow : ''}
</EuiCodeBlock>
Expand All @@ -96,7 +86,13 @@ export default function CommandOutput(props: ICommandSectionProps) {
)}
</div>
<EuiSpacer size='s' />
{showCommand && havePassword ? <EuiSwitch checked={showPassword} label='Show password' onChange={onChangeShowPassword}/> : null}
{showCommand && havePassword ? (
<EuiSwitch
checked={showPassword}
label='Show password'
onChange={onChangeShowPassword}
/>
) : null}
</EuiText>
</Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import {
validateServerAddress,
validateAgentName,
} from '../../utils/validations';
import { getPasswordWithScapedSpecialCharacters } from '../../services/wazuh-password-service';


interface IRegisterAgentProps {
getWazuhVersion: () => Promise<string>;
Expand Down Expand Up @@ -127,6 +129,7 @@ export const RegisterAgent = withReduxProvider(
configuration['enrollment.password'] ||
authInfo['authd.pass'] ||
'';
//wazuhPassword = getPasswordWithScapedSpecialCharacters(wazuhPassword);
}
const groups = await getGroups();
setNeedsPassword(needsPassword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const Steps = ({
) {
selectOS(registerAgentFormValues.operatingSystem as tOperatingSystem);
}
setOptionalParams({ ...registerAgentFormValues.optionalParams });
setOptionalParams({ ...registerAgentFormValues.optionalParams }, registerAgentFormValues.operatingSystem as tOperatingSystem);
setInstallCommandWasCopied(false);
setStartCommandWasCopied(false);
}, [registerAgentFormValues]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getMacosStartCommand,
getWindowsInstallCommand,
getWindowsStartCommand } from '../../services/register-agent-os-commands-services';
import { scapeSpecialCharsForLinux, scapeSpecialCharsForMacOS, scapeSpecialCharsForWindows } from '../../services/wazuh-password-service';
import { IOSDefinition, tOptionalParams } from '../register-commands/types';

// Defined OS combinations
Expand Down Expand Up @@ -149,21 +150,21 @@ export const osCommandsDefinitions = [
export const optionalParamsDefinitions: tOptionalParams<tOptionalParameters> = {
serverAddress: {
property: 'WAZUH_MANAGER',
getParamCommand: props => {
getParamCommand: (props,selectedOS) => {
const { property, value } = props;
return value !== '' ? `${property}='${value}'` : '';
},
},
agentName: {
property: 'WAZUH_AGENT_NAME',
getParamCommand: props => {
getParamCommand: (props,selectedOS) => {
const { property, value } = props;
return value !== '' ? `${property}='${value}'` : '';
},
},
agentGroups: {
property: 'WAZUH_AGENT_GROUP',
getParamCommand: props => {
getParamCommand: (props,selectedOS) => {
const { property, value } = props;
let parsedValue = value;
if (Array.isArray(value)) {
Expand All @@ -174,16 +175,34 @@ export const optionalParamsDefinitions: tOptionalParams<tOptionalParameters> = {
},
protocol: {
property: 'WAZUH_PROTOCOL',
getParamCommand: props => {
getParamCommand: (props,selectedOS) => {
const { property, value } = props;
return value !== '' ? `${property}='${value}'` : '';
},
},
wazuhPassword: {
property: 'WAZUH_REGISTRATION_PASSWORD',
getParamCommand: props => {
getParamCommand: (props,selectedOS) => {
const { property, value } = props;
return value !== '' ? `${property}='${value}'` : '';
if(!value){
return '';
}
if(selectedOS){
let osName = selectedOS.name.toLocaleLowerCase();
switch(osName){
case "linux":
return `${property}=$'${scapeSpecialCharsForLinux(value)}'`;
case "macos":
return `${property}='${scapeSpecialCharsForMacOS(value)}'`;
case "windows":
return `${property}='${scapeSpecialCharsForWindows(value)}'`;
default:
return `${property}=$'${value}'`;
}

}

return value !== '' ? `${property}=$'${value}'` : '';
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export class CommandGenerator<OS extends IOperationSystem, Params extends string
* @param props - The optional parameters to select
* @returns The selected optional parameters
*/
addOptionalParams(props: IOptionalParameters<Params>): void {
addOptionalParams(props: IOptionalParameters<Params>, selectedOS?: OS): void {
// Get all the optional parameters based on the given parameters
this.optionals = this.optionalsManager.getAllOptionalParams(props);
this.optionals = this.optionalsManager.getAllOptionalParams(props, selectedOS);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { tOperatingSystem } from '../../config/os-commands-definitions';
import { NoOptionalParamFoundException } from '../exceptions';
import { IOptionalParamInput, IOptionalParameters, IOptionalParametersManager, tOptionalParams } from '../types';
import { IOperationSystem, IOptionalParamInput, IOptionalParameters, IOptionalParametersManager, tOptionalParams } from '../types';

export class OptionalParametersManager<Params extends string> implements IOptionalParametersManager<Params> {
constructor(private optionalParamsConfig: tOptionalParams<Params>) {}
Expand All @@ -10,7 +11,7 @@ export class OptionalParametersManager<Params extends string> implements IOption
* @returns The command string for the given optional parameter.
* @throws NoOptionalParamFoundException if the given optional parameter name is not found in the configuration.
*/
getOptionalParam(props: IOptionalParamInput<Params>) {
getOptionalParam(props: IOptionalParamInput<Params>, selectedOS?: IOperationSystem) {
const { value, name } = props;
if (!this.optionalParamsConfig[name]) {
throw new NoOptionalParamFoundException(name);
Expand All @@ -19,7 +20,8 @@ export class OptionalParametersManager<Params extends string> implements IOption
value,
property: this.optionalParamsConfig[name].property,
name
});
},
selectedOS);
}

/**
Expand All @@ -28,7 +30,7 @@ export class OptionalParametersManager<Params extends string> implements IOption
* @returns An object containing the command strings for all optional parameters with non-empty values.
* @throws NoOptionalParamFoundException if any of the given optional parameter names is not found in the configuration.
*/
getAllOptionalParams(paramsValues: IOptionalParameters<Params>){
getAllOptionalParams(paramsValues: IOptionalParameters<Params>, selectedOS: IOperationSystem){
// get keys for only the optional params with values !== ''
const optionalParams = Object.keys(paramsValues).filter(key => paramsValues[key as keyof typeof paramsValues] !== '') as Array<keyof typeof paramsValues>;
const resolvedOptionalParams: any = {};
Expand All @@ -42,7 +44,7 @@ export class OptionalParametersManager<Params extends string> implements IOption
name: param as Params,
value: paramsValues[param] as string,
property: paramDef.property
}) as string;
}, selectedOS) as string;
}
return resolvedOptionalParams;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/////////////////////////////////////////////////////////
/// Domain

import { tOperatingSystem } from "../../hooks/use-register-agent-commands.test";

/////////////////////////////////////////////////////////
export interface IOperationSystem {
name: string;
Expand Down Expand Up @@ -51,7 +54,7 @@ export type tOptionalParamsCommandProps<T extends string> = IOptionalParamProps
};
export interface IOptionsParamConfig<T extends string> {
property: string;
getParamCommand: (props: tOptionalParamsCommandProps<T>) => string;
getParamCommand: (props: tOptionalParamsCommandProps<T>, selectedOS?: IOperationSystem) => string;
}

export type tOptionalParams<T extends string> = {
Expand All @@ -64,7 +67,7 @@ export interface IOptionalParamInput<T extends string> {
}
export interface IOptionalParametersManager<T extends string> {
getOptionalParam(props: IOptionalParamInput<T>): string;
getAllOptionalParams(paramsValues: IOptionalParameters<T>): object;
getAllOptionalParams(paramsValues: IOptionalParameters<T>, selectedOs?: IOperationSystem): object;
}

///////////////////////////////////////////////////////////////////
Expand All @@ -79,7 +82,7 @@ export interface ICommandGenerator<OS extends IOperationSystem, Params extends s

export interface ICommandGeneratorMethods<T extends string> {
selectOS(params: IOperationSystem): void;
addOptionalParams(props: IOptionalParameters<T>): void;
addOptionalParams(props: IOptionalParameters<T>, osSelected?: IOperationSystem): void;
getInstallCommand(): string;
getStartCommand(): string;
getUrlPackage(): string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface IUseRegisterCommandsProps<OS extends IOperationSystem, Params extends

interface IUseRegisterCommandsOutput<OS extends IOperationSystem, Params extends string> {
selectOS: (params: OS) => void;
setOptionalParams: (params: IOptionalParameters<Params>) => void;
setOptionalParams: (params: IOptionalParameters<Params>, selectedOS?: OS) => void;
installCommand: string;
startCommand: string;
optionalParamsParsed: IOptionalParameters<Params> | {};
Expand Down Expand Up @@ -62,7 +62,7 @@ export function useRegisterAgentCommands<OS extends IOperationSystem, Params ext
}
if (optionalParamsValues) {
commandGenerator.addOptionalParams(
optionalParamsValues as IOptionalParameters<Params>,
optionalParamsValues as IOptionalParameters<Params>, osSelected
);
}
const installCommand = commandGenerator.getInstallCommand();
Expand Down Expand Up @@ -93,8 +93,8 @@ export function useRegisterAgentCommands<OS extends IOperationSystem, Params ext
* @param {IOptionalParameters} params - The optional parameters to be set.
* @returns {void}
*/
const setOptionalParams = (params: IOptionalParameters<Params>): void => {
commandGenerator.addOptionalParams(params);
const setOptionalParams = (params: IOptionalParameters<Params>, selectedOS?: OS): void => {
commandGenerator.addOptionalParams(params,selectedOS);
setOptionalParamsValues(params);
setOptionalParamsParsed(commandGenerator.getOptionalParamsCommands());
};
Expand Down
Loading

0 comments on commit 8c846ac

Please sign in to comment.