From 2a1da470dd1967c8a2265b5ff647d03f2d34d8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20D=C3=ADaz?= Date: Mon, 19 Dec 2022 10:11:19 +0100 Subject: [PATCH 1/3] Add osd 2.4 env (#5001) * Add osd-dev version 2.4.0 * Add OSD 2.4.1 env Co-authored-by: Alex Ruiz Becerra --- docker/images/osd-2.4.0-dev.Dockerfile | 21 +++++++++++++++++++++ docker/images/osd-2.4.1-dev.Dockerfile | 22 ++++++++++++++++++++++ docker/osd-dev/README.md | 4 ++++ docker/osd-dev/dev.sh | 2 ++ 4 files changed, 49 insertions(+) create mode 100644 docker/images/osd-2.4.0-dev.Dockerfile create mode 100644 docker/images/osd-2.4.1-dev.Dockerfile diff --git a/docker/images/osd-2.4.0-dev.Dockerfile b/docker/images/osd-2.4.0-dev.Dockerfile new file mode 100644 index 0000000000..f3608c716c --- /dev/null +++ b/docker/images/osd-2.4.0-dev.Dockerfile @@ -0,0 +1,21 @@ +FROM node:14.20.0 AS builder-osd-2.4.0 +USER node +RUN git clone --depth 1 --branch 2.4.0 https://github.com/opensearch-project/OpenSearch-Dashboards.git /home/node/kbn +RUN chown node.node /home/node/kbn + +WORKDIR /home/node/kbn +RUN yarn config set registry http://host.docker.internal:4873 && \ + sed -i 's/https:\/\/registry.yarnpkg.com/http:\/\/host.docker.internal:4873/g' yarn.lock && \ + yarn osd bootstrap --production + +WORKDIR /home/node/kbn/plugins +RUN git clone --depth 1 --branch 2.4.0.0 https://github.com/opensearch-project/security-dashboards-plugin.git +WORKDIR /home/node/kbn/plugins/security-dashboards-plugin +RUN yarn install + +RUN mkdir -p /home/node/kbn/data/wazuh/config + +FROM node:14.20.0 +USER node +COPY --from=builder-osd-2.4.0 /home/node/kbn /home/node/kbn +WORKDIR /home/node/kbn diff --git a/docker/images/osd-2.4.1-dev.Dockerfile b/docker/images/osd-2.4.1-dev.Dockerfile new file mode 100644 index 0000000000..e8c2415ca8 --- /dev/null +++ b/docker/images/osd-2.4.1-dev.Dockerfile @@ -0,0 +1,22 @@ +FROM node:14.20.0 AS builder-osd-2.4.1 +USER node +RUN git clone --depth 1 --branch 2.4.1 https://github.com/opensearch-project/OpenSearch-Dashboards.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 2.4.1.0 https://github.com/opensearch-project/security-dashboards-plugin.git +WORKDIR /home/node/kbn/plugins/security-dashboards-plugin +RUN yarn install + +RUN yarn config set registry http://host.docker.internal:4873 && \ + sed -i 's/https:\/\/registry.yarnpkg.com/http:\/\/host.docker.internal:4873/g' yarn.lock + +RUN mkdir -p /home/node/kbn/data/wazuh/config + +FROM node:14.20.0 +USER node +COPY --from=builder-osd-2.4.1 /home/node/kbn /home/node/kbn +WORKDIR /home/node/kbn diff --git a/docker/osd-dev/README.md b/docker/osd-dev/README.md index 6191cd69d6..b4e0ed94a6 100644 --- a/docker/osd-dev/README.md +++ b/docker/osd-dev/README.md @@ -44,11 +44,15 @@ version. `OpenSearch` supported versions: - 1.2.4 +- 2.3.0 - 2.4.0 +- 2.4.1 `OpenSearch Dashboards` supported versions: - 1.2.0 +- 2.3.0 - 2.4.0 +- 2.4.1 We must use official `Wazuh Indexer` and `Wazuh Dashboard` images for testing! diff --git a/docker/osd-dev/dev.sh b/docker/osd-dev/dev.sh index f72045a964..7d08ae665c 100755 --- a/docker/osd-dev/dev.sh +++ b/docker/osd-dev/dev.sh @@ -7,6 +7,7 @@ os_versions=( '2.2.1' '2.3.0' '2.4.0' + '2.4.1' ) osd_versions=( @@ -16,6 +17,7 @@ osd_versions=( '2.2.1' '2.3.0' '2.4.0' + '2.4.1' ) usage() { From 5d1a0a0074b02c070d509c8bf62efa0b25f7c2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chantal=20Bel=C3=A9n=20kelm?= <99441266+chantal-kelm@users.noreply.github.com> Date: Mon, 19 Dec 2022 09:01:59 -0300 Subject: [PATCH 2/3] [Backport 4.4-2.4-wzd] Fix the agent installation command for macOS (#4982) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ixed the agent installation command for macOS * changelog * Update changelog Co-authored-by: Álex --- CHANGELOG.md | 1 + .../agent/components/register-agent.js | 1534 +++++++++++------ 2 files changed, 1013 insertions(+), 522 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c5449351..1f88f419e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Fixed WAZUH_PROTOCOL param suggestion [#4849](https://github.com/wazuh/wazuh-kibana-app/pull/4849) - Raspbian OS, Ubuntu, Amazon Linux and Amazon Linux 2 commands in the wizard deploy agent now change when a different architecture is selected [#4876](https://github.com/wazuh/wazuh-kibana-app/pull/4876) [#4880](https://github.com/wazuh/wazuh-kibana-app/pull/4880) - Fixed a bug that caused the flyouts to close when clicking inside them [#4638](https://github.com/wazuh/wazuh-kibana-app/pull/4638) +- Fixed agent installation command for macOS in the deploy new agent section. [#4968](https://github.com/wazuh/wazuh-kibana-app/pull/4968) - Fixed vulnerabilities default last scan date formatter [#4975](https://github.com/wazuh/wazuh-kibana-app/pull/4975) ### Removed diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index 75ea299c52..a7934a1881 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -33,7 +33,7 @@ import { EuiProgress, EuiIcon, EuiSwitch, - EuiLink + EuiLink, } from '@elastic/eui'; import { WzRequest } from '../../../react-services/wz-request'; import { withErrorBoundary } from '../../../components/common/hocs'; @@ -41,13 +41,41 @@ 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 { webDocumentationLink } from '../../../../common/services/web_documentation'; -import { architectureButtons, architectureButtonsi386, architecturei386Andx86_64, versionButtonsRaspbian, versionButtonsSuse, versionButtonsOracleLinux, versionButtonFedora, architectureButtonsSolaris, architectureButtonsWithPPC64LE, architectureButtonsOpenSuse, architectureButtonsAix, architectureButtonsHpUx, versionButtonAmazonLinux, versionButtonsRedHat, versionButtonsCentos, architectureButtonsMacos, osButtons, versionButtonsDebian, versionButtonsUbuntu, versionButtonsWindows, versionButtonsMacOS, versionButtonsOpenSuse, versionButtonsSolaris, versionButtonsAix, versionButtonsHPUX } from '../wazuh-config' -import './register-agent.scss' -import ServerAddress from '../register-agent/steps/server-address'; -import { getConnectionConfig, fetchClusterNodesOptions } from './register-agent-service' +import { + architectureButtons, + architectureButtonsi386, + architecturei386Andx86_64, + versionButtonsRaspbian, + versionButtonsSuse, + versionButtonsOracleLinux, + versionButtonFedora, + architectureButtonsSolaris, + architectureButtonsWithPPC64LE, + architectureButtonsOpenSuse, + architectureButtonsAix, + architectureButtonsHpUx, + versionButtonAmazonLinux, + versionButtonsRedHat, + versionButtonsCentos, + architectureButtonsMacos, + osButtons, + versionButtonsDebian, + versionButtonsUbuntu, + versionButtonsWindows, + versionButtonsMacOS, + versionButtonsOpenSuse, + versionButtonsSolaris, + versionButtonsAix, + versionButtonsHPUX, +} from '../wazuh-config'; +import './register-agent.scss'; +import ServerAddress from '../register-agent/steps/server-address'; +import { + getConnectionConfig, + fetchClusterNodesOptions, +} from './register-agent-service'; export const RegisterAgent = withErrorBoundary( - class RegisterAgent extends Component { constructor(props) { super(props); @@ -71,7 +99,7 @@ export const RegisterAgent = withErrorBoundary( udpProtocol: false, showPassword: false, showProtocol: true, - connectionSecure: true + connectionSecure: true, }; this.restartAgentCommand = { rpm: this.systemSelector(), @@ -80,7 +108,7 @@ export const RegisterAgent = withErrorBoundary( ubu: this.systemSelector(), oraclelinux: this.systemSelector(), macos: 'sudo /Library/Ossec/bin/wazuh-control start', - win: 'NET START WazuhSvc' + win: 'NET START WazuhSvc', }; } @@ -94,7 +122,10 @@ export const RegisterAgent = withErrorBoundary( let authInfo = await this.getAuthInfo(); const needsPassword = (authInfo.auth || {}).use_password === 'yes'; if (needsPassword) { - wazuhPassword = this.configuration['enrollment.password'] || authInfo['authd.pass'] || ''; + wazuhPassword = + this.configuration['enrollment.password'] || + authInfo['authd.pass'] || + ''; if (wazuhPassword) { hidePasswordInput = true; } @@ -155,16 +186,20 @@ export const RegisterAgent = withErrorBoundary( getEnrollDNSConfig = () => { let serverAddress = this.configuration['enrollment.dns'] || ''; this.setState({ defaultServerAddress: serverAddress }); - if(serverAddress){ + if (serverAddress) { this.setState({ udpProtocol: true }); - }else{ + } else { this.setState({ udpProtocol: false }); } - } + }; async getAuthInfo() { try { - const result = await WzRequest.apiReq('GET', '/agents/000/config/auth/auth', {}); + const result = await WzRequest.apiReq( + 'GET', + '/agents/000/config/auth/auth', + {}, + ); return (result.data || {}).data || {}; } catch (error) { this.setState({ gotErrorRegistrationServiceInfo: true }); @@ -182,28 +217,69 @@ export const RegisterAgent = withErrorBoundary( } systemSelector() { - if (this.state.selectedVersion === 'redhat7' || this.state.selectedVersion === 'amazonlinux2022' || this.state.selectedVersion === 'centos7' || this.state.selectedVersion === 'suse11' || this.state.selectedVersion === 'suse12' || this.state.selectedVersion === 'oraclelinux5' || this.state.selectedVersion === '22' || this.state.selectedVersion === 'amazonlinux2' || this.state.selectedVersion === 'debian8' || this.state.selectedVersion === 'debian9' || this.state.selectedVersion === 'debian10' || this.state.selectedVersion === 'busterorgreater' || this.state.selectedVersion === 'ubuntu15' || this.state.selectedVersion === 'ubuntu16' || this.state.selectedVersion === 'leap15') { + if ( + this.state.selectedVersion === 'redhat7' || + this.state.selectedVersion === 'amazonlinux2022' || + this.state.selectedVersion === 'centos7' || + this.state.selectedVersion === 'suse11' || + this.state.selectedVersion === 'suse12' || + this.state.selectedVersion === 'oraclelinux5' || + this.state.selectedVersion === '22' || + this.state.selectedVersion === 'amazonlinux2' || + this.state.selectedVersion === 'debian8' || + this.state.selectedVersion === 'debian9' || + this.state.selectedVersion === 'debian10' || + this.state.selectedVersion === 'busterorgreater' || + this.state.selectedVersion === 'ubuntu15' || + this.state.selectedVersion === 'ubuntu16' || + this.state.selectedVersion === 'leap15' + ) { return 'sudo systemctl daemon-reload\nsudo systemctl enable wazuh-agent\nsudo systemctl start wazuh-agent'; - } else if (this.state.selectedVersion === 'redhat5' || this.state.selectedVersion === 'redhat6' || this.state.selectedVersion === 'centos5' || this.state.selectedVersion === 'centos6' || this.state.selectedVersion === 'oraclelinux6' || this.state.selectedVersion === 'amazonlinux1' || this.state.selectedVersion === 'debian7' || this.state.selectedVersion === 'ubuntu14') { - return ('service wazuh-agent start'); + } else if ( + this.state.selectedVersion === 'redhat5' || + this.state.selectedVersion === 'redhat6' || + this.state.selectedVersion === 'centos5' || + this.state.selectedVersion === 'centos6' || + this.state.selectedVersion === 'oraclelinux6' || + this.state.selectedVersion === 'amazonlinux1' || + this.state.selectedVersion === 'debian7' || + this.state.selectedVersion === 'ubuntu14' + ) { + return 'service wazuh-agent start'; } } systemSelectorNet() { - if (this.state.selectedVersion === 'windowsxp' || this.state.selectedVersion === 'windows8') { - return ('update-rc.d wazuh-agent defaults && service wazuh-agent start'); + if ( + this.state.selectedVersion === 'windowsxp' || + this.state.selectedVersion === 'windows8' + ) { + return 'update-rc.d wazuh-agent defaults && service wazuh-agent start'; } } systemSelectorWazuhControlMacos() { - if (this.state.selectedVersion == 'sierra' || this.state.selectedVersion == 'highSierra' || this.state.selectedVersion == 'mojave' || this.state.selectedVersion == 'catalina' || this.state.selectedVersion == 'bigSur' || this.state.selectedVersion == 'monterrey' || this.state.selectedVersion == 'ventura') { - return ('/Library/Ossec/bin/wazuh-control start'); + if ( + this.state.selectedVersion == 'sierra' || + this.state.selectedVersion == 'highSierra' || + this.state.selectedVersion == 'mojave' || + this.state.selectedVersion == 'catalina' || + this.state.selectedVersion == 'bigSur' || + this.state.selectedVersion == 'monterrey' || + this.state.selectedVersion == 'ventura' + ) { + return '/Library/Ossec/bin/wazuh-control start'; } } systemSelectorWazuhControl() { - if (this.state.selectedVersion === 'solaris10' || this.state.selectedVersion === 'solaris11' || this.state.selectedVersion === '6.1 TL9' || this.state.selectedVersion === '11.31') { - return ('/var/ossec/bin/wazuh-control start'); + if ( + this.state.selectedVersion === 'solaris10' || + this.state.selectedVersion === 'solaris11' || + this.state.selectedVersion === '6.1 TL9' || + this.state.selectedVersion === '11.31' + ) { + return '/var/ossec/bin/wazuh-control start'; } } @@ -258,16 +334,20 @@ export const RegisterAgent = withErrorBoundary( async getGroups() { try { const result = await WzRequest.apiReq('GET', '/groups', {}); - return result.data.data.affected_items.map((item) => ({ label: item.name, id: item.name })); + return result.data.data.affected_items.map(item => ({ + label: item.name, + id: item.name, + })); } catch (error) { throw new Error(error); } } optionalDeploymentVariables() { - - let deployment = this.state.serverAddress && `WAZUH_MANAGER='${this.state.serverAddress}' `; - const protocol = false + let deployment = + this.state.serverAddress && + `WAZUH_MANAGER='${this.state.serverAddress}' `; + const protocol = false; if (this.state.selectedOS == 'win') { deployment += `WAZUH_REGISTRATION_SERVER='${this.state.serverAddress}' `; } @@ -277,12 +357,12 @@ export const RegisterAgent = withErrorBoundary( } if (this.state.udpProtocol) { - deployment += `WAZUH_PROTOCOL='UDP' `; + deployment += "WAZUH_PROTOCOL='UDP' "; } if (this.state.selectedGroup.length) { deployment += `WAZUH_AGENT_GROUP='${this.state.selectedGroup - .map((item) => item.label) + .map(item => item.label) .join(',')}' `; } @@ -296,7 +376,14 @@ export const RegisterAgent = withErrorBoundary( agentNameVariable() { let agentName = `WAZUH_AGENT_NAME='${this.state.agentName}' `; - if(this.state.selectedArchitecture && this.state.agentName !== '') { + if ( + this.state.selectedOS === 'macos' && + this.state.selectedArchitecture && + this.state.agentName !== '' + ) { + return agentName.replace(/=/g, ' '); + } + if (this.state.selectedArchitecture && this.state.agentName !== '') { return agentName; } else { return ''; @@ -304,7 +391,9 @@ export const RegisterAgent = withErrorBoundary( } resolveRPMPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'redhat5-i386': return `https://packages.wazuh.com/4.x/yum5/i386/wazuh-agent-${this.state.wazuhVersion}-1.el5.i386.rpm`; case 'redhat5-x86_64': @@ -333,7 +422,9 @@ export const RegisterAgent = withErrorBoundary( } resolveORACLELINUXPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'oraclelinux5-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.i386.rpm`; case 'oraclelinux5-aarch64': @@ -358,7 +449,9 @@ export const RegisterAgent = withErrorBoundary( } resolveCENTPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'centos5-i386': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}.el5.i386.rpm`; case 'centos5-x86_64': @@ -387,7 +480,9 @@ export const RegisterAgent = withErrorBoundary( } resolveSUSEPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'suse11-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}.i386.rpm`; case 'suse11-x86_64': @@ -408,7 +503,9 @@ export const RegisterAgent = withErrorBoundary( } resolveFEDORAPachage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case '22-i386': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}-1.el5.i386.rpm`; case '22-aarch64': @@ -425,7 +522,9 @@ export const RegisterAgent = withErrorBoundary( } resolveAMAZONLPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'amazonlinux1-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}.i386.rpm`; case 'amazonlinux1-aarch64': @@ -477,7 +576,9 @@ export const RegisterAgent = withErrorBoundary( } resolveRASPBIANPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'busterorgreater-i386': return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_i386.deb`; case 'busterorgreater-aarch64': @@ -494,7 +595,9 @@ export const RegisterAgent = withErrorBoundary( } resolveUBUNTUPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'ubuntu14-i386': return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_i386.deb`; case 'ubuntu14-aarch64': @@ -525,18 +628,22 @@ export const RegisterAgent = withErrorBoundary( } resolveOPENSUSEPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'leap15-x86_64': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}.x86_64.rpm`; case 'leap15-ARM64': - return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}.armv7hl.rpm` + return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}.armv7hl.rpm`; default: return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}.x86_64.rpm`; } } - + resolveSOLARISPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case 'solaris10-i386': return `https://packages.wazuh.com/4.x/solaris/i386/10/wazuh-agent-${this.state.wazuhVersion}-sol10-i386.pkg`; case 'solaris10-sparc': @@ -544,14 +651,16 @@ export const RegisterAgent = withErrorBoundary( case 'solaris11-i386': return `https://packages.wazuh.com/4.x/solaris/i386/11/wazuh-agent-${this.state.wazuhVersion}-sol11-i386.p5p`; case 'solaris11-sparc': - return `https://packages.wazuh.com/4.x/solaris/sparc/11/wazuh-agent-${this.state.wazuhVersion}-sol11-sparc.p5p` + return `https://packages.wazuh.com/4.x/solaris/sparc/11/wazuh-agent-${this.state.wazuhVersion}-sol11-sparc.p5p`; default: return `https://packages.wazuh.com/4.x/solaris/sparc/11/wazuh-agent-${this.state.wazuhVersion}-sol11-sparc.p5p`; } } resolveAIXPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case '6.1 TL9-powerpc': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}.aix.ppc.rpm`; default: @@ -560,7 +669,9 @@ export const RegisterAgent = withErrorBoundary( } resolveHPPackage() { - switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { case '11.31-itanium2': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}-hpux-11v3-ia64.tar`; default: @@ -724,63 +835,71 @@ export const RegisterAgent = withErrorBoundary( } } render() { - const appVersionMajorDotMinor = this.state.wazuhVersion.split('.').slice(0, 2).join('.'); - const urlCheckConnectionDocumentation = webDocumentationLink('user-manual/agents/agent-connection.html', appVersionMajorDotMinor); + const appVersionMajorDotMinor = this.state.wazuhVersion + .split('.') + .slice(0, 2) + .join('.'); + const urlCheckConnectionDocumentation = webDocumentationLink( + 'user-manual/agents/agent-connection.html', + appVersionMajorDotMinor, + ); const textAndLinkToCheckConnectionDocumentation = (

To verify the connection with the Wazuh server, please follow this{' '} - + document.

); const missingOSSelection = this.checkMissingOSSelection(); - const agentName = ( this.setAgentName(event)} + onChange={event => this.setAgentName(event)} /> ); const groupInput = ( <> {!this.state.groups.length && ( <> - )} ); - - const agentGroup = ( - -

Select one or more existing groups

- { - this.setGroupName(group); - }} - isDisabled={!this.state.groups.length} - isClearable={true} - data-test-subj="demoComboBox" - /> -
- ) + +

Select one or more existing groups

+ { + this.setGroupName(group); + }} + isDisabled={!this.state.groups.length} + isClearable={true} + data-test-subj='demoComboBox' + /> +
+ ); const passwordInput = ( this.setWazuhPassword(event)} + onChange={event => this.setWazuhPassword(event)} /> ); @@ -790,181 +909,235 @@ export const RegisterAgent = withErrorBoundary( const customTexts = { rpmText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, centText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, - debText: `curl -so wazuh-agent-${this.state.wazuhVersion - }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${this.state.wazuhVersion - }.deb`, - ubuText: `curl -so wazuh-agent-${this.state.wazuhVersion - }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${this.state.wazuhVersion - }.deb`, - macosText: `curl -so wazuh-agent-${this.state.wazuhVersion - }.pkg https://packages.wazuh.com/4.x/macos/wazuh-agent-${this.state.wazuhVersion - }-1.pkg && sudo launchctl setenv ${this.optionalDeploymentVariables()}${this.agentNameVariable()}&& sudo installer -pkg ./wazuh-agent-${this.state.wazuhVersion - }.pkg -target /`, - winText: `Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-${this.state.wazuhVersion - }-1.msi -OutFile \${env:tmp}\\wazuh-agent-${this.state.wazuhVersion}.msi; msiexec.exe /i \${env:tmp}\\wazuh-agent-${this.state.wazuhVersion - }.msi /q ${this.optionalDeploymentVariables()}${this.agentNameVariable()}`, + debText: `curl -so wazuh-agent-${ + this.state.wazuhVersion + }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${ + this.state.wazuhVersion + }.deb`, + ubuText: `curl -so wazuh-agent-${ + this.state.wazuhVersion + }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${ + this.state.wazuhVersion + }.deb`, + macosText: `curl -so wazuh-agent-${ + this.state.wazuhVersion + }.pkg https://packages.wazuh.com/4.x/macos/wazuh-agent-${ + this.state.wazuhVersion + }-1.pkg && sudo launchctl setenv ${this.optionalDeploymentVariables()}${this.agentNameVariable()}&& sudo installer -pkg ./wazuh-agent-${ + this.state.wazuhVersion + }.pkg -target /`, + winText: `Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-${ + this.state.wazuhVersion + }-1.msi -OutFile \${env:tmp}\\wazuh-agent-${ + this.state.wazuhVersion + }.msi; msiexec.exe /i \${env:tmp}\\wazuh-agent-${ + this.state.wazuhVersion + }.msi /q ${this.optionalDeploymentVariables()}${this.agentNameVariable()}`, openText: `sudo rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()} zypper install -y ${this.optionalPackages()}`, - solText: `sudo curl -so ${this.optionalPackages()} && sudo ${this.agentNameVariable()}&& ${this.state.selectedVersion == 'solaris11' ? 'pkg install -g wazuh-agent.p5p wazuh-agent' : 'pkgadd -d wazuh-agent.pkg'}`, + solText: `sudo curl -so ${this.optionalPackages()} && sudo ${this.agentNameVariable()}&& ${ + this.state.selectedVersion == 'solaris11' + ? 'pkg install -g wazuh-agent.p5p wazuh-agent' + : 'pkgadd -d wazuh-agent.pkg' + }`, aixText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}rpm -ivh ${this.optionalPackages()}`, hpText: `cd / && sudo curl -so ${this.optionalPackages()} && sudo ${this.agentNameVariable()}groupadd wazuh && sudo useradd -G wazuh wazuh && sudo tar -xvf wazuh-agent.tar`, amazonlinuxText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, fedoraText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, oraclelinuxText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, suseText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, - raspbianText: `curl -so wazuh-agent-${this.state.wazuhVersion - }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${this.state.wazuhVersion - }.deb`, + raspbianText: `curl -so wazuh-agent-${ + this.state.wazuhVersion + }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${ + this.state.wazuhVersion + }.deb`, }; const field = `${this.state.selectedOS}Text`; const text = customTexts[field]; const language = this.getHighlightCodeLanguage(this.state.selectedOS); - const warningUpgrade = 'If the installer finds another Wazuh agent in the system, it will upgrade it preserving the configuration.' + const warningUpgrade = + 'If the installer finds another Wazuh agent in the system, it will upgrade it preserving the configuration.'; const windowsAdvice = this.state.selectedOS === 'win' && ( <> - -
    -
  • You will need administrator privileges to perform this installation.
  • -
  • PowerShell 3.0 or greater is required.
  • + +
      +
    • + + You will need administrator privileges to perform this + installation. + +
    • +
    • + PowerShell 3.0 or greater is required. +
    -

    Keep in mind you need to run this command in a Windows PowerShell terminal.

    +

    + Keep in mind you need to run this command in a Windows PowerShell + terminal. +

    ); - const restartAgentCommand = this.restartAgentCommand[this.state.selectedOS]; - const onTabClick = (selectedTab) => { + const restartAgentCommand = + this.restartAgentCommand[this.state.selectedOS]; + const onTabClick = selectedTab => { this.selectSYS(selectedTab.id); }; - const calloutErrorRegistrationServiceInfo = this.state.gotErrorRegistrationServiceInfo ? ( + const calloutErrorRegistrationServiceInfo = this.state + .gotErrorRegistrationServiceInfo ? ( ) : null; const guide = (
    - {(this.state.gotErrorRegistrationServiceInfo) ? ( + {this.state.gotErrorRegistrationServiceInfo ? ( - ) : (this.state.connectionSecure === true && this.state.udpProtocol === false) ? ( + ) : this.state.connectionSecure === true && + this.state.udpProtocol === false ? ( -

    - You can use this command to install and enroll the Wazuh agent in one or more hosts. -

    - - - {windowsAdvice} -
    - - {this.state.wazuhPassword && !this.state.showPassword ? this.obfuscatePassword(text) : text} - - - {(copy) => ( -
    -

    Copy command

    -
    - )} -
    -
    - {this.state.needsPassword && ( - this.setShowPassword(active)} +

    + You can use this command to install and enroll the Wazuh agent + in one or more hosts. +

    + - )} - -
    ) : (this.state.connectionSecure === false) ? - ( + + {windowsAdvice} +
    + + {this.state.wazuhPassword && !this.state.showPassword + ? this.obfuscatePassword(text) + : text} + + + {copy => ( +
    +

    + Copy command +

    +
    + )} +
    +
    + {this.state.needsPassword && ( + this.setShowPassword(active)} + /> + )} + + + ) : this.state.connectionSecure === false ? ( -

    - You can use this command to install and enroll the Wazuh agent in one or more hosts. -

    - - - - Warning: there's no secure protocol configured and agents will not be able to communicate with the manager. - - } - iconType="iInCircle" - /> - - {windowsAdvice} -
    - - {this.state.wazuhPassword && !this.state.showPassword ? this.obfuscatePassword(text) : text} - - - {(copy) => ( -
    -

    Copy command

    -
    - )} -
    -
    - {this.state.needsPassword && ( - this.setShowPassword(active)} +

    + You can use this command to install and enroll the Wazuh agent + in one or more hosts. +

    + - )} - -
    ) : ( - -

    - You can use this command to install and enroll the Wazuh agent in one or more hosts. -

    - + + Warning: there's no{' '} + + secure protocol configured + {' '} + and agents will not be able to communicate with the manager. + + } + iconType='iInCircle' + /> + + {windowsAdvice} +
    + + {this.state.wazuhPassword && !this.state.showPassword + ? this.obfuscatePassword(text) + : text} + + + {copy => ( +
    +

    + Copy command +

    +
    + )} +
    +
    + {this.state.needsPassword && ( + this.setShowPassword(active)} /> - - {windowsAdvice} -
    - - {this.state.wazuhPassword && !this.state.showPassword ? this.obfuscatePassword(text) : text} - - - {(copy) => ( -
    -

    Copy command

    -
    - )} -
    -
    - {this.state.needsPassword && ( - this.setShowPassword(active)} - /> - )} - -
    - )} + )} + + + ) : ( + +

    + You can use this command to install and enroll the Wazuh agent + in one or more hosts. +

    + + + {windowsAdvice} +
    + + {this.state.wazuhPassword && !this.state.showPassword + ? this.obfuscatePassword(text) + : text} + + + {copy => ( +
    +

    + Copy command +

    +
    + )} +
    +
    + {this.state.needsPassword && ( + this.setShowPassword(active)} + /> + )} + +
    + )}
    ); @@ -976,14 +1149,16 @@ export const RegisterAgent = withErrorBoundary( -
    +
    {this.systemSelector()} - {(copy) => ( -
    -

    Copy command

    + {copy => ( +
    +

    + Copy command +

    )} @@ -1004,14 +1179,16 @@ export const RegisterAgent = withErrorBoundary( -
    +
    {this.systemSelector()} - {(copy) => ( -
    -

    Copy command

    + {copy => ( +
    +

    + Copy command +

    )} @@ -1032,14 +1209,16 @@ export const RegisterAgent = withErrorBoundary( -
    +
    {this.systemSelectorNet()} - {(copy) => ( -
    -

    Copy command

    + {copy => ( +
    +

    + Copy command +

    )} @@ -1060,14 +1239,16 @@ export const RegisterAgent = withErrorBoundary( -
    +
    {this.systemSelectorWazuhControlMacos()} - {(copy) => ( -
    -

    Copy command

    + {copy => ( +
    +

    + Copy command +

    )} @@ -1088,14 +1269,16 @@ export const RegisterAgent = withErrorBoundary( -
    +
    {this.systemSelectorWazuhControl()} - {(copy) => ( -
    -

    Copy command

    + {copy => ( +
    +

    + Copy command +

    )} @@ -1111,80 +1294,156 @@ export const RegisterAgent = withErrorBoundary( const buttonGroup = (legend, options, idSelected, onChange) => { return ( - ) - } + /> + ); + }; - const buttonGroupWithMessage = (legend, options, idSelected, onChange) => { + const buttonGroupWithMessage = ( + legend, + options, + idSelected, + onChange, + ) => { return ( <> - {this.state.selectedVersion == 'solaris10' || this.state.selectedVersion == 'solaris11' ? - Might require some extra installation steps. - - }> - : this.state.selectedVersion == '6.1 TL9' ? - Might require some extra installation steps. - - }> - : this.state.selectedVersion == '11.31' ? - Might require some extra installation steps. - - }> - : this.state.selectedVersion == 'debian7' || this.state.selectedVersion == 'debian8' || this.state.selectedVersion == 'debian9' || this.state.selectedVersion == 'debian10' ? - Might require some extra installation steps. - - }> - : ''} + {this.state.selectedVersion == 'solaris10' || + this.state.selectedVersion == 'solaris11' ? ( + + Might require some extra installation{' '} + + steps + + . + + } + > + ) : this.state.selectedVersion == '6.1 TL9' ? ( + + Might require some extra installation{' '} + + steps + + . + + } + > + ) : this.state.selectedVersion == '11.31' ? ( + + Might require some extra installation{' '} + + steps + + . + + } + > + ) : this.state.selectedVersion == 'debian7' || + this.state.selectedVersion == 'debian8' || + this.state.selectedVersion == 'debian9' || + this.state.selectedVersion == 'debian10' ? ( + + Might require some extra installation{' '} + + steps + + . + + } + > + ) : ( + '' + )} - ) - } + ); + }; const selectedVersionMac = (legend, options, idSelected, onChange) => { return ( - ) - } + onChange={onChange} + /> + ); + }; - const onChangeServerAddress = async (selectedNodes) => { - if(selectedNodes.length === 0){ + const onChangeServerAddress = async selectedNodes => { + if (selectedNodes.length === 0) { this.setState({ serverAddress: '', udpProtocol: false, - connectionSecure: null - }) - }else{ + connectionSecure: null, + }); + } else { const nodeSelected = selectedNodes[0]; try { const remoteConfig = await getConnectionConfig(nodeSelected); this.setState({ serverAddress: remoteConfig.serverAddress, udpProtocol: remoteConfig.udpProtocol, - connectionSecure: remoteConfig.connectionSecure - }) - }catch(error){ + connectionSecure: remoteConfig.connectionSecure, + }); + } catch (error) { const options = { context: `${RegisterAgent.name}.onChangeServerAddress`, level: UI_LOGGER_LEVELS.ERROR, @@ -1201,352 +1460,583 @@ export const RegisterAgent = withErrorBoundary( this.setState({ serverAddress: nodeSelected.label, udpProtocol: false, - connectionSecure: false - }) + connectionSecure: false, + }); } } - - } - + }; const steps = [ { title: 'Choose the operating system', - children: ( - buttonGroup("Choose the Operating system", osButtons, this.state.selectedOS, (os) => this.selectOS(os)) + children: buttonGroup( + 'Choose the Operating system', + osButtons, + this.state.selectedOS, + os => this.selectOS(os), ), }, ...(this.state.selectedOS == 'rpm' ? [ - { - title: 'Choose the version', - children: ( - this.state.selectedVersion == 'redhat5' || this.state.selectedVersion == 'redhat6' ? buttonGroupWithMessage("Choose the version", versionButtonsRedHat, this.state.selectedVersion, (version) => this.setVersion(version)) : buttonGroup("Choose the version", versionButtonsRedHat, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: + this.state.selectedVersion == 'redhat5' || + this.state.selectedVersion == 'redhat6' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsRedHat, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsRedHat, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'oraclelinux' ? [ - { - title: 'Choose the version', - children: ( - buttonGroup("Choose the version", versionButtonsOracleLinux, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: buttonGroup( + 'Choose the version', + versionButtonsOracleLinux, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'raspbian' ? [ - { - title: 'Choose the version', - children: ( - buttonGroup("Choose the version", versionButtonsRaspbian, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: buttonGroup( + 'Choose the version', + versionButtonsRaspbian, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'amazonlinux' ? [ - { - title: 'Choose the version', - children: ( - buttonGroup("Choose the version", versionButtonAmazonLinux, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: buttonGroup( + 'Choose the version', + versionButtonAmazonLinux, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'cent' ? [ - { - title: 'Choose the version', - children: ( - this.state.selectedVersion == 'centos5' || this.state.selectedVersion == 'centos6' ? buttonGroupWithMessage("Choose the version", versionButtonsCentos, this.state.selectedVersion, (version) => this.setVersion(version)) : buttonGroup("Choose the version", versionButtonsCentos, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: + this.state.selectedVersion == 'centos5' || + this.state.selectedVersion == 'centos6' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsCentos, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsCentos, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'fedora' ? [ - { - title: 'Choose the version', - children: ( - buttonGroup("Choose the version", versionButtonFedora, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: buttonGroup( + 'Choose the version', + versionButtonFedora, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'deb' ? [ - { - title: 'Choose the version', - children: ( - this.state.selectedVersion == 'debian7' || this.state.selectedVersion == 'debian8' || this.state.selectedVersion == 'debian9' || this.state.selectedVersion == 'debian10' ? buttonGroupWithMessage("Choose the version", versionButtonsDebian, this.state.selectedVersion, (version) => this.setVersion(version)) : buttonGroup("Choose the version", versionButtonsDebian, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: + this.state.selectedVersion == 'debian7' || + this.state.selectedVersion == 'debian8' || + this.state.selectedVersion == 'debian9' || + this.state.selectedVersion == 'debian10' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsDebian, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsDebian, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'ubu' ? [ - { - title: 'Choose the version', - children: ( - this.state.selectedVersion == 'ubuntu14' ? buttonGroupWithMessage("Choose the version", versionButtonsUbuntu, this.state.selectedVersion, (version) => this.setVersion(version)) : buttonGroup("Choose the version", versionButtonsUbuntu, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: + this.state.selectedVersion == 'ubuntu14' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsUbuntu, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsUbuntu, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'win' ? [ - { - title: 'Choose the version', - children: ( - this.state.selectedVersion == 'windowsxp' ? buttonGroupWithMessage("Choose the version", versionButtonsWindows, this.state.selectedVersion, (version) => this.setVersion(version)) : buttonGroup("Choose the version", versionButtonsWindows, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: + this.state.selectedVersion == 'windowsxp' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsWindows, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsWindows, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'macos' ? [ - { - title: 'Choose the version', - children: ( - selectedVersionMac("Choose the version", versionButtonsMacOS, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: selectedVersionMac( + 'Choose the version', + versionButtonsMacOS, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'suse' ? [ - { - title: 'Choose the version', - children: ( - selectedVersionMac("Choose the version", versionButtonsSuse, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: selectedVersionMac( + 'Choose the version', + versionButtonsSuse, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'open' ? [ - { - title: 'Choose the version', - children: ( - buttonGroup("Choose the version", versionButtonsOpenSuse, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: buttonGroup( + 'Choose the version', + versionButtonsOpenSuse, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'sol' ? [ - { - title: 'Choose the version', - children: ( - this.state.selectedVersion == 'solaris10' || this.state.selectedVersion == 'solaris11' ? buttonGroupWithMessage("Choose the version", versionButtonsSolaris, this.state.selectedVersion, (version) => this.setVersion(version)) : buttonGroup("Choose the version", versionButtonsSolaris, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: + this.state.selectedVersion == 'solaris10' || + this.state.selectedVersion == 'solaris11' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsSolaris, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsSolaris, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'aix' ? [ - { - title: 'Choose the version', - children: ( - this.state.selectedVersion == '6.1 TL9' ? buttonGroupWithMessage("Choose the version", versionButtonsAix, this.state.selectedVersion, (version) => this.setVersion(version)) : buttonGroup("Choose the version", versionButtonsAix, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: + this.state.selectedVersion == '6.1 TL9' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsAix, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsAix, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'hp' ? [ - { - title: 'Choose the version', - children: ( - this.state.selectedVersion == '11.31' ? buttonGroupWithMessage("Choose the version", versionButtonsHPUX, this.state.selectedVersion, (version) => this.setVersion(version)) : buttonGroup("Choose the version", versionButtonsHPUX, this.state.selectedVersion, (version) => this.setVersion(version)) - ), - }, - ] + { + title: 'Choose the version', + children: + this.state.selectedVersion == '11.31' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsHPUX, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsHPUX, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), - ...(this.state.selectedVersion == 'centos5' || this.state.selectedVersion == 'redhat5' || this.state.selectedVersion == 'oraclelinux5' || this.state.selectedVersion == 'suse11' + ...(this.state.selectedVersion == 'centos5' || + this.state.selectedVersion == 'redhat5' || + this.state.selectedVersion == 'oraclelinux5' || + this.state.selectedVersion == 'suse11' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architecturei386Andx86_64, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architecturei386Andx86_64, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), ...(this.state.selectedVersion == 'leap15' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architectureButtonsOpenSuse, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsOpenSuse, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), - ...(this.state.selectedVersion == 'centos6' || this.state.selectedVersion == 'oraclelinux6' || this.state.selectedVersion == 'amazonlinux1' || this.state.selectedVersion == 'redhat6' || this.state.selectedVersion == 'amazonlinux2022' || this.state.selectedVersion == 'debian7' || this.state.selectedVersion == 'debian8' || this.state.selectedVersion == 'ubuntu14' || this.state.selectedVersion == 'ubuntu15' || this.state.selectedVersion == 'ubuntu16' + ...(this.state.selectedVersion == 'centos6' || + this.state.selectedVersion == 'oraclelinux6' || + this.state.selectedVersion == 'amazonlinux1' || + this.state.selectedVersion == 'redhat6' || + this.state.selectedVersion == 'amazonlinux2022' || + this.state.selectedVersion == 'debian7' || + this.state.selectedVersion == 'debian8' || + this.state.selectedVersion == 'ubuntu14' || + this.state.selectedVersion == 'ubuntu15' || + this.state.selectedVersion == 'ubuntu16' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architectureButtons, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtons, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), - ...(this.state.selectedVersion == 'centos7' || this.state.selectedVersion == 'redhat7' || this.state.selectedVersion == 'amazonlinux2' || this.state.selectedVersion == 'suse12' || this.state.selectedVersion == '22' || this.state.selectedVersion == 'debian9' || this.state.selectedVersion == 'debian10' || this.state.selectedVersion == 'busterorgreater' + ...(this.state.selectedVersion == 'centos7' || + this.state.selectedVersion == 'redhat7' || + this.state.selectedVersion == 'amazonlinux2' || + this.state.selectedVersion == 'suse12' || + this.state.selectedVersion == '22' || + this.state.selectedVersion == 'debian9' || + this.state.selectedVersion == 'debian10' || + this.state.selectedVersion == 'busterorgreater' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architectureButtonsWithPPC64LE, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsWithPPC64LE, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), - ...(this.state.selectedVersion == 'windowsxp' || this.state.selectedVersion == 'windows8' + ...(this.state.selectedVersion == 'windowsxp' || + this.state.selectedVersion == 'windows8' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architectureButtonsi386, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsi386, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), - ...(this.state.selectedVersion == 'sierra' || this.state.selectedVersion == 'highSierra' || this.state.selectedVersion == 'mojave' || this.state.selectedVersion == 'catalina' || this.state.selectedVersion == 'bigSur' || this.state.selectedVersion == 'monterrey' || this.state.selectedVersion == 'ventura' + ...(this.state.selectedVersion == 'sierra' || + this.state.selectedVersion == 'highSierra' || + this.state.selectedVersion == 'mojave' || + this.state.selectedVersion == 'catalina' || + this.state.selectedVersion == 'bigSur' || + this.state.selectedVersion == 'monterrey' || + this.state.selectedVersion == 'ventura' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architectureButtonsMacos, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsMacos, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), - ...(this.state.selectedVersion == 'solaris10' || this.state.selectedVersion == 'solaris11' + ...(this.state.selectedVersion == 'solaris10' || + this.state.selectedVersion == 'solaris11' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architectureButtonsSolaris, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsSolaris, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), ...(this.state.selectedVersion == '6.1 TL9' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architectureButtonsAix, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsAix, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), ...(this.state.selectedVersion == '11.31' ? [ - { - title: 'Choose the architecture', - children: ( - buttonGroup("Choose the architecture", architectureButtonsHpUx, this.state.selectedArchitecture, (architecture) => this.setArchitecture(architecture)) - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsHpUx, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), { title: 'Wazuh server address', - children: - - , + children: ( + + + + ), }, ...(!(!this.state.needsPassword || this.state.hidePasswordInput) ? [ - { - title: 'Wazuh password', - children: {passwordInput}, - }, - ] + { + title: 'Wazuh password', + children: {passwordInput}, + }, + ] : []), { title: 'Assign a name and a group to the agent', - children: {agentName}{groupInput}{agentGroup}, + children: ( + + {agentName} + {groupInput} + {agentGroup} + + ), }, { title: 'Install and enroll the agent', - children: this.state.gotErrorRegistrationServiceInfo ? + children: this.state.gotErrorRegistrationServiceInfo ? ( calloutErrorRegistrationServiceInfo - : missingOSSelection.length ? ( - - ) : ( -
    {guide}
    - ), + ) : missingOSSelection.length ? ( + + ) : ( +
    {guide}
    + ), }, - ...(this.state.selectedOS == 'rpm' || this.state.selectedOS == 'cent' || this.state.selectedOS == 'suse' || this.state.selectedOS == 'fedora' || this.state.selectedOS == 'oraclelinux' || this.state.selectedOS == 'amazonlinux' || this.state.selectedOS == 'deb' || this.state.selectedOS == 'raspbian' || this.state.selectedOS == 'ubu' || this.state.selectedOS == 'win' || this.state.selectedOS == 'macos' || this.state.selectedOS == 'open' || this.state.selectedOS == 'sol' || this.state.selectedOS == 'aix' || this.state.selectedOS == 'hp' + ...(this.state.selectedOS == 'rpm' || + this.state.selectedOS == 'cent' || + this.state.selectedOS == 'suse' || + this.state.selectedOS == 'fedora' || + this.state.selectedOS == 'oraclelinux' || + this.state.selectedOS == 'amazonlinux' || + this.state.selectedOS == 'deb' || + this.state.selectedOS == 'raspbian' || + this.state.selectedOS == 'ubu' || + this.state.selectedOS == 'win' || + this.state.selectedOS == 'macos' || + this.state.selectedOS == 'open' || + this.state.selectedOS == 'sol' || + this.state.selectedOS == 'aix' || + this.state.selectedOS == 'hp' ? [ - { - title: 'Start the agent', - children: this.state.gotErrorRegistrationServiceInfo ? - calloutErrorRegistrationServiceInfo - : missingOSSelection.length ? ( + { + title: 'Start the agent', + children: this.state.gotErrorRegistrationServiceInfo ? ( + calloutErrorRegistrationServiceInfo + ) : missingOSSelection.length ? ( ) : ( ), - }, - ] + }, + ] : []), ...(!missingOSSelection.length && - this.state.selectedOS !== 'rpm' && - this.state.selectedOS !== 'deb' && - this.state.selectedOS !== 'cent' && - this.state.selectedOS !== 'ubu' && - this.state.selectedOS !== 'win' && - this.state.selectedOS !== 'macos' && - this.state.selectedOS !== 'open' && - this.state.selectedOS !== 'sol' && - this.state.selectedOS !== 'aix' && - this.state.selectedOS !== 'hp' && - this.state.selectedOS !== 'amazonlinux' && - this.state.selectedOS !== 'fedora' && - this.state.selectedOS !== 'oraclelinux' && - this.state.selectedOS !== 'suse' && - this.state.selectedOS !== 'raspbian' && - restartAgentCommand + this.state.selectedOS !== 'rpm' && + this.state.selectedOS !== 'deb' && + this.state.selectedOS !== 'cent' && + this.state.selectedOS !== 'ubu' && + this.state.selectedOS !== 'win' && + this.state.selectedOS !== 'macos' && + this.state.selectedOS !== 'open' && + this.state.selectedOS !== 'sol' && + this.state.selectedOS !== 'aix' && + this.state.selectedOS !== 'hp' && + this.state.selectedOS !== 'amazonlinux' && + this.state.selectedOS !== 'fedora' && + this.state.selectedOS !== 'oraclelinux' && + this.state.selectedOS !== 'suse' && + this.state.selectedOS !== 'raspbian' && + restartAgentCommand ? [ - { - title: 'Start the agent', - children: this.state.gotErrorRegistrationServiceInfo ? - calloutErrorRegistrationServiceInfo - : ( - + { + title: 'Start the agent', + children: this.state.gotErrorRegistrationServiceInfo ? ( + calloutErrorRegistrationServiceInfo + ) : ( + -
    +
    {restartAgentCommand} - {(copy) => ( -
    -

    Copy command

    + {copy => ( +
    +

    + Copy command +

    )} @@ -1554,14 +2044,14 @@ export const RegisterAgent = withErrorBoundary( ), - }, - ] + }, + ] : []), ]; return (
    - + @@ -1575,18 +2065,18 @@ export const RegisterAgent = withErrorBoundary( {this.props.hasAgents() && ( this.props.addNewAgent(false)} - iconType="cross" + iconType='cross' > Close )} {!this.props.hasAgents() && ( this.props.reload()} - iconType="refresh" + iconType='refresh' > Refresh @@ -1597,7 +2087,7 @@ export const RegisterAgent = withErrorBoundary( {this.state.loading && ( <> - + @@ -1615,5 +2105,5 @@ export const RegisterAgent = withErrorBoundary(
    ); } - } -); \ No newline at end of file + }, +); From 35cc6c2313232cbd9587a226f9f407b52231d923 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 14:33:19 +0100 Subject: [PATCH 3/3] [Backport 4.4-2.4-wzd] Fixed paste value on server address selected (#5009) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed paste value on server address selected (#4954) * Fixed paste value on server address selected * Updated CHANGELOG Co-authored-by: Álex (cherry picked from commit 3b398cbfb37605a47095da05687aa90e26b4a6a9) Co-authored-by: Maximiliano Ibarra <6089438+Machi3mfl@users.noreply.github.com> --- CHANGELOG.md | 2 +- public/controllers/agent/components/register-agent-service.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f88f419e4..0f8eba3c35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Independently load each dashboard from the `Agents Overview` page [#4363](https://github.com/wazuh/wazuh-kibana-app/pull/4363) - The endpoint `/agents/summary/status` response was adapted. [#3874](https://github.com/wazuh/wazuh-kibana-app/pull/3874) - Updated and added operating systems, versions, architectures commands of Install and enroll the agent and commands of Start the agent in the deploy new agent section [#4458](https://github.com/wazuh/wazuh-kibana-app/pull/4458) -- Added cluster's IP and protocol as suggestions in the agent deployment wizard. [#4776](https://github.com/wazuh/wazuh-kibana-app/pull/4776) +- Added cluster's IP and protocol as suggestions in the agent deployment wizard. [#4776](https://github.com/wazuh/wazuh-kibana-app/pull/4776) [#4954](https://github.com/wazuh/wazuh-kibana-app/pull/4954) - Show OS name and OS version in the agent installation wizard. [#4851](https://github.com/wazuh/wazuh-kibana-app/pull/4851) - Changed the endpoint that updates the plugin configuration to support multiple settings. [#4501](https://github.com/wazuh/wazuh-kibana-app/pull/4501) - The button to export the app logs is now disabled when there are no results, instead of showing an error toast [#4992](https://github.com/wazuh/wazuh-kibana-app/pull/4992) diff --git a/public/controllers/agent/components/register-agent-service.ts b/public/controllers/agent/components/register-agent-service.ts index 246457aee6..b24cd67057 100644 --- a/public/controllers/agent/components/register-agent-service.ts +++ b/public/controllers/agent/components/register-agent-service.ts @@ -78,10 +78,11 @@ function getRemoteProtocol(protocols: Protocol[]) { */ async function getConnectionConfig(nodeSelected: ServerAddressOptions, defaultServerAddress?: string) { const nodeName = nodeSelected?.label; + const nodeIp = nodeSelected?.value; if(!defaultServerAddress){ if(nodeSelected.nodetype !== 'custom'){ const remoteConfig = await getRemoteConfiguration(nodeName); - return { serverAddress: remoteConfig.name, udpProtocol: remoteConfig.isUdp, connectionSecure: remoteConfig.haveSecureConnection }; + return { serverAddress: nodeIp, udpProtocol: remoteConfig.isUdp, connectionSecure: remoteConfig.haveSecureConnection }; }else{ return { serverAddress: nodeName, udpProtocol: false, connectionSecure: true }; }