From 1f0e8d3170f64cbb864f35d46798a9430e25404a Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Tue, 29 Nov 2022 10:44:48 -0300 Subject: [PATCH 01/12] accordion and alpine os --- .../agent/components/register-agent.js | 1528 +++++++++++------ .../agent/components/wz-accordion.tsx | 56 + .../controllers/agent/wazuh-config/index.ts | 140 +- 3 files changed, 1139 insertions(+), 585 deletions(-) create mode 100644 public/controllers/agent/components/wz-accordion.tsx diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index 1cbc327079..c0864c53d4 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -9,7 +9,7 @@ * * Find more information about this on the LICENSE file. */ -import React, { Component, Fragment } from 'react'; +import React, { Component, Fragment, useState } from 'react'; import { version } from '../../../../package.json'; import { WazuhConfig } from '../../../react-services/wazuh-config'; import { @@ -33,7 +33,8 @@ import { EuiProgress, EuiIcon, EuiSwitch, - EuiLink + EuiLink, + EuiAccordion, } from '@elastic/eui'; import { WzRequest } from '../../../react-services/wz-request'; import { withErrorBoundary } from '../../../components/common/hocs'; @@ -41,12 +42,42 @@ 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 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, + osPrincipalButtons, + versionButtonsDebian, + versionButtonsUbuntu, + versionButtonsWindows, + versionButtonsMacOS, + versionButtonsOpenSuse, + versionButtonsSolaris, + versionButtonsAix, + versionButtonsHPUX, +} from '../wazuh-config'; +import ServerAddress from '../register-agent/steps/server-address'; +import { + getConnectionConfig, + fetchClusterNodesOptions, +} from './register-agent-service'; +import { WzAccordion, PrincipalButtonGroup } from './wz-accordion'; export const RegisterAgent = withErrorBoundary( - class RegisterAgent extends Component { constructor(props) { super(props); @@ -70,7 +101,8 @@ export const RegisterAgent = withErrorBoundary( udpProtocol: false, showPassword: false, showProtocol: true, - connectionSecure: true + connectionSecure: true, + isAccordionOpen: false, }; this.restartAgentCommand = { rpm: this.systemSelector(), @@ -79,7 +111,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', }; } @@ -93,7 +125,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; } @@ -151,19 +186,29 @@ export const RegisterAgent = withErrorBoundary( } } + // componentDidUpdate() { + // if (this.state.selectedOS == 'macos') { + // this.setVersion('sierra'); + // } + // } + 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 }); @@ -172,6 +217,14 @@ export const RegisterAgent = withErrorBoundary( } selectOS(os) { + if (os == 'macos') { + this.setState({ + selectedOS: os, + selectedVersion: 'sierra', + selectedArchitecture: '', + selectedSYS: '', + }); + } this.setState({ selectedOS: os, selectedVersion: '', @@ -181,28 +234,61 @@ 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') { + 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'; } } @@ -257,16 +343,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}' `; } @@ -281,7 +371,7 @@ export const RegisterAgent = withErrorBoundary( if (this.state.selectedGroup.length) { deployment += `WAZUH_AGENT_GROUP='${this.state.selectedGroup - .map((item) => item.label) + .map(item => item.label) .join(',')}' `; } @@ -295,7 +385,7 @@ export const RegisterAgent = withErrorBoundary( agentNameVariable() { let agentName = `WAZUH_AGENT_NAME='${this.state.agentName}' `; - if(this.state.selectedArchitecture && this.state.agentName !== '') { + if (this.state.selectedArchitecture && this.state.agentName !== '') { return agentName; } else { return ''; @@ -303,7 +393,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': @@ -332,7 +424,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': @@ -357,7 +451,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': @@ -386,7 +482,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': @@ -407,7 +505,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': @@ -424,7 +524,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': @@ -476,7 +578,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': @@ -493,7 +597,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': @@ -524,18 +630,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': @@ -543,14 +653,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: @@ -559,7 +671,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: @@ -722,64 +836,69 @@ export const RegisterAgent = withErrorBoundary( return 'bash'; } } + 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)} /> ); @@ -789,181 +908,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)} + /> + )} + +
    + )}
    ); @@ -975,14 +1148,16 @@ export const RegisterAgent = withErrorBoundary( -
    +
    {this.systemSelector()} - {(copy) => ( -
    -

    Copy command

    + {copy => ( +
    +

    + Copy command +

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

    Copy command

    + {copy => ( +
    +

    + Copy command +

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

    Copy command

    + {copy => ( +
    +

    + Copy command +

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

    Copy command

    + {copy => ( +
    +

    + Copy command +

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

    Copy command

    + {copy => ( +
    +

    + Copy command +

    )} @@ -1110,80 +1293,158 @@ export const RegisterAgent = withErrorBoundary( const buttonGroup = (legend, options, idSelected, onChange) => { return ( - ) - } + className={'osButtonsStyle'} + /> + ); + }; - 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 ( - ) - } + className={'osButtonsStyleMac'} + /> + ); + }; - 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, @@ -1200,352 +1461,579 @@ 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)) + 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' ? [ - { - 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 +

    )} @@ -1553,14 +2041,14 @@ export const RegisterAgent = withErrorBoundary( ), - }, - ] + }, + ] : []), ]; return (
    - + @@ -1574,18 +2062,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 @@ -1596,7 +2084,7 @@ export const RegisterAgent = withErrorBoundary( {this.state.loading && ( <> - + @@ -1614,5 +2102,5 @@ export const RegisterAgent = withErrorBoundary(
    ); } - } -); \ No newline at end of file + }, +); diff --git a/public/controllers/agent/components/wz-accordion.tsx b/public/controllers/agent/components/wz-accordion.tsx new file mode 100644 index 0000000000..fbe80402dc --- /dev/null +++ b/public/controllers/agent/components/wz-accordion.tsx @@ -0,0 +1,56 @@ +import React, { useState } from 'react'; +import { + EuiPanel, + EuiSpacer, + EuiAccordion, + EuiButtonGroup, + htmlIdGenerator, +} from '@elastic/eui'; +import { osButtons } from '../wazuh-config'; + +export const PrincipalButtonGroup = ({ + legend, + options, + idSelected, + onChange, +}) => { + return ( + <> + + + + + + + ); +}; + +export const WzAccordion = ({ children }) => { + const [isAccordionOpen, setIsAccordionOpen] = useState(false); + const rightArrowAccordionId = htmlIdGenerator('wz-accordion')(); + return ( + setIsAccordionOpen(isOpen)} + > + + {children} + + ); +}; diff --git a/public/controllers/agent/wazuh-config/index.ts b/public/controllers/agent/wazuh-config/index.ts index 964c60c004..c6ff4843e5 100644 --- a/public/controllers/agent/wazuh-config/index.ts +++ b/public/controllers/agent/wazuh-config/index.ts @@ -40,12 +40,11 @@ const architectureButtonsWithPPC64LE = [ }, ]; - const architectureButtonsi386 = [ { id: 'i386', label: 'i386', - } + }, ]; const architecturei386Andx86_64 = [ @@ -67,19 +66,19 @@ const architectureButtonsSolaris = [ { id: 'sparc', label: 'SPARC', - } + }, ]; const architectureButtonsMacos = [ { id: 'intel', - label: 'Intel' + label: 'Intel', }, { id: 'applesilicon', - label: 'Apple Silicon' - } -] + label: 'Apple Silicon', + }, +]; const architectureButtonsOpenSuse = [ { @@ -89,21 +88,21 @@ const architectureButtonsOpenSuse = [ { id: 'ARM64', label: 'ARM64', - } + }, ]; const architectureButtonsAix = [ { id: 'powerpc', label: 'PowerPC', - } + }, ]; const architectureButtonsHpUx = [ { id: 'itanium2', label: 'Itanium2', - } + }, ]; const versionButtonAmazonLinux = [ @@ -118,8 +117,8 @@ const versionButtonAmazonLinux = [ { id: 'amazonlinux2022', label: 'Amazon Linux 2022', - } -] + }, +]; const versionButtonsRedHat = [ { @@ -167,15 +166,15 @@ const versionButtonsDebian = [ { id: 'debian10', label: 'Debian 10 or higher', - } + }, ]; const versionButtonFedora = [ { id: '22', - label: 'Fedora 22 or later' - } -] + label: 'Fedora 22 or higher', + }, +]; const versionButtonsUbuntu = [ { @@ -189,7 +188,7 @@ const versionButtonsUbuntu = [ { id: 'ubuntu16', label: 'Ubuntu 16 or higher', - } + }, ]; const versionButtonsWindows = [ @@ -200,7 +199,7 @@ const versionButtonsWindows = [ { id: 'windows8', label: 'Windows 8 or higher', - } + }, ]; const versionButtonsSuse = [ @@ -211,36 +210,13 @@ const versionButtonsSuse = [ { id: 'suse12', label: 'SUSE 12', - } + }, ]; const versionButtonsMacOS = [ { id: 'sierra', - label: 'macOS Sierra', - }, - { - id: 'highSierra', - label: 'macOS High Sierra', - }, - { - id: 'mojave', - label: 'macOS Mojave', - }, - { - id: 'catalina', - label: 'macOS Catalina', - }, - { - id: 'bigSur', - label: 'macOS Big Sur', - }, - { - id: 'monterrey', - label: 'macOS Monterrey', - }, - { id: 'ventura', - label: 'macOS Ventura', + label: 'macOS Sierra or higher', }, ]; @@ -248,7 +224,7 @@ const versionButtonsOpenSuse = [ { id: 'leap15', label: 'OpenSuse Leap 15 or higher', - } + }, ]; const versionButtonsSolaris = [ @@ -259,21 +235,21 @@ const versionButtonsSolaris = [ { id: 'solaris11', label: 'Solaris 11', - } + }, ]; const versionButtonsAix = [ { id: '6.1 TL9', label: 'AIX 6.1 TL9 or higher', - } + }, ]; const versionButtonsHPUX = [ { id: '11.31', label: 'HP-UX 11.31 or higher', - } + }, ]; const versionButtonsOracleLinux = [ @@ -284,21 +260,21 @@ const versionButtonsOracleLinux = [ { id: 'oraclelinux6', label: 'Oracle Linux 6 or later', - } + }, ]; const versionButtonsRaspbian = [ { id: 'busterorgreater', label: 'Raspbian Buster or greater', - } + }, ]; /** * Order the OS Buttons Alphabetically by label - * @param a - * @param b - * @returns + * @param a + * @param b + * @returns */ const orderOSAlphabetically = (a, b) => { if (a.label.toUpperCase() < b.label.toUpperCase()) { @@ -308,9 +284,9 @@ const orderOSAlphabetically = (a, b) => { return 1; } return 0; -} +}; -const osButtons = [ +const osPrincipalButtons = [ { id: 'rpm', label: 'Red Hat Enterprise Linux', @@ -319,10 +295,6 @@ const osButtons = [ id: 'cent', label: 'CentOS', }, - { - id: 'deb', - label: 'Debian', - }, { id: 'ubu', label: 'Ubuntu', @@ -335,6 +307,13 @@ const osButtons = [ id: 'macos', label: 'macOS', }, +]; + +const osButtons = [ + { + id: 'deb', + label: 'Debian', + }, { id: 'open', label: 'OpenSuse', @@ -347,30 +326,61 @@ const osButtons = [ id: 'aix', label: 'AIX', }, - { + { id: 'hp', label: 'HP-UX', }, - { + { id: 'amazonlinux', label: 'Amazon Linux', }, - { + { id: 'fedora', label: 'Fedora', }, - { + { id: 'oraclelinux', label: 'Oracle Linux', }, - { + { id: 'suse', label: 'SUSE', }, - { + { id: 'raspbian', label: 'Raspbian OS', }, + { + id: 'alpine', + label: 'Alpine', + }, ].sort(orderOSAlphabetically); -export { architectureButtons, architecturei386Andx86_64, versionButtonsRaspbian, versionButtonsSuse, architectureButtonsWithPPC64LE, versionButtonsOracleLinux, versionButtonFedora, versionButtonsRedHat, versionButtonsCentos, architectureButtonsMacos, osButtons, versionButtonsDebian, versionButtonsUbuntu, versionButtonAmazonLinux, versionButtonsWindows, versionButtonsMacOS, versionButtonsOpenSuse, versionButtonsSolaris, versionButtonsAix, versionButtonsHPUX, architectureButtonsi386, architectureButtonsSolaris, architectureButtonsAix, architectureButtonsHpUx, architectureButtonsOpenSuse }; +export { + architectureButtons, + architecturei386Andx86_64, + versionButtonsRaspbian, + versionButtonsSuse, + architectureButtonsWithPPC64LE, + versionButtonsOracleLinux, + versionButtonFedora, + versionButtonsRedHat, + versionButtonsCentos, + architectureButtonsMacos, + osButtons, + osPrincipalButtons, + versionButtonsDebian, + versionButtonsUbuntu, + versionButtonAmazonLinux, + versionButtonsWindows, + versionButtonsMacOS, + versionButtonsOpenSuse, + versionButtonsSolaris, + versionButtonsAix, + versionButtonsHPUX, + architectureButtonsi386, + architectureButtonsSolaris, + architectureButtonsAix, + architectureButtonsHpUx, + architectureButtonsOpenSuse, +}; From 6bcc784ce432364c1fe95911797b9d8185adc170 Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Tue, 29 Nov 2022 11:26:51 -0300 Subject: [PATCH 02/12] changes --- .../agent/components/register-agent.js | 32 ++++++++++--------- .../agent/components/wz-accordion.tsx | 1 + .../controllers/agent/wazuh-config/index.ts | 6 +--- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index c0864c53d4..e0120bffd5 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -34,7 +34,6 @@ import { EuiIcon, EuiSwitch, EuiLink, - EuiAccordion, } from '@elastic/eui'; import { WzRequest } from '../../../react-services/wz-request'; import { withErrorBoundary } from '../../../components/common/hocs'; @@ -59,7 +58,6 @@ import { versionButtonsRedHat, versionButtonsCentos, architectureButtonsMacos, - osButtons, osPrincipalButtons, versionButtonsDebian, versionButtonsUbuntu, @@ -75,7 +73,7 @@ import { getConnectionConfig, fetchClusterNodesOptions, } from './register-agent-service'; -import { WzAccordion, PrincipalButtonGroup } from './wz-accordion'; +import { PrincipalButtonGroup } from './wz-accordion'; export const RegisterAgent = withErrorBoundary( class RegisterAgent extends Component { @@ -248,7 +246,6 @@ export const RegisterAgent = withErrorBoundary( 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'; @@ -616,14 +613,6 @@ export const RegisterAgent = withErrorBoundary( return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_armhf.deb`; case 'ubuntu15-x86_64': return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_amd64.deb`; - case 'ubuntu16-i386': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_i386.deb`; - case 'ubuntu16-aarch64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_arm64.deb`; - case 'ubuntu16-armhf': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_armhf.deb`; - case 'ubuntu16-x86_64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_amd64.deb`; default: return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_amd64.deb`; } @@ -1744,6 +1733,21 @@ export const RegisterAgent = withErrorBoundary( }, ] : []), + ...(this.state.selectedOS == 'alpine' + ? [ + { + title: 'Choose the version', + children: + this.state.selectedVersion == '11.31' && + buttonGroup( + 'Choose the version', + versionButtonsHPUX, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] + : []), ...(this.state.selectedVersion == 'centos5' || this.state.selectedVersion == 'redhat5' || this.state.selectedVersion == 'oraclelinux5' || @@ -1781,8 +1785,7 @@ export const RegisterAgent = withErrorBoundary( this.state.selectedVersion == 'debian7' || this.state.selectedVersion == 'debian8' || this.state.selectedVersion == 'ubuntu14' || - this.state.selectedVersion == 'ubuntu15' || - this.state.selectedVersion == 'ubuntu16' + this.state.selectedVersion == 'ubuntu15' ? [ { title: 'Choose the architecture', @@ -1970,7 +1973,6 @@ export const RegisterAgent = withErrorBoundary( this.state.selectedVersion == 'busterorgreater' || this.state.selectedVersion == 'busterorgreater' || this.state.selectedVersion === 'ubuntu15' || - this.state.selectedVersion === 'ubuntu16' || this.state.selectedVersion === 'leap15' ? tabSystemD : this.state.selectedVersion == 'windowsxp' || diff --git a/public/controllers/agent/components/wz-accordion.tsx b/public/controllers/agent/components/wz-accordion.tsx index fbe80402dc..d675f500e1 100644 --- a/public/controllers/agent/components/wz-accordion.tsx +++ b/public/controllers/agent/components/wz-accordion.tsx @@ -48,6 +48,7 @@ export const WzAccordion = ({ children }) => { arrowDisplay='right' buttonContent={isAccordionOpen ? 'Show less' : 'Show more'} onToggle={(isOpen: boolean) => setIsAccordionOpen(isOpen)} + className={'action-btn-td'} > {children} diff --git a/public/controllers/agent/wazuh-config/index.ts b/public/controllers/agent/wazuh-config/index.ts index c6ff4843e5..2e9234bb4c 100644 --- a/public/controllers/agent/wazuh-config/index.ts +++ b/public/controllers/agent/wazuh-config/index.ts @@ -183,11 +183,7 @@ const versionButtonsUbuntu = [ }, { id: 'ubuntu15', - label: 'Ubuntu 15', - }, - { - id: 'ubuntu16', - label: 'Ubuntu 16 or higher', + label: 'Ubuntu 15 or higher', }, ]; From 117ebb284e97964a56ca849a92b1fa9182b6ec41 Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Tue, 29 Nov 2022 13:59:14 -0300 Subject: [PATCH 03/12] changes --- .../agent/components/register-agent.js | 80 ++++++++++++++----- .../controllers/agent/wazuh-config/index.ts | 14 +++- 2 files changed, 71 insertions(+), 23 deletions(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index e0120bffd5..faf81c74dd 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -67,6 +67,7 @@ import { versionButtonsSolaris, versionButtonsAix, versionButtonsHPUX, + versionButtonAlpine, } from '../wazuh-config'; import ServerAddress from '../register-agent/steps/server-address'; import { @@ -266,6 +267,7 @@ export const RegisterAgent = withErrorBoundary( systemSelectorNet() { if ( this.state.selectedVersion === 'windowsxp' || + this.state.selectedVersion === 'windowsserver2008' || this.state.selectedVersion === 'windows8' ) { return 'update-rc.d wazuh-agent defaults && service wazuh-agent start'; @@ -835,6 +837,21 @@ export const RegisterAgent = withErrorBoundary( 'user-manual/agents/agent-connection.html', appVersionMajorDotMinor, ); + const urlWindowsPackage = `https://packages.wazuh.com/4.x/windows/wazuh-agent-${this.state.wazuhVersion}-1.msi`; + + // 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()}`; + + // `https://packages.wazuh.com/${this.state.wazuhVersion}/windows/wazuh-agent-${this.state.wazuhVersion}-1.msi` + + // # Provide MSI package URL and request the user to download the package and run the following command: + // msiexec.exe /i wazuh-agent.msi /q WAZUH_MANAGER='172.31.76.147' WAZUH_REGISTRATION_SERVER='172.31.76.147' + const textAndLinkToCheckConnectionDocumentation = (

    To verify the connection with the Wazuh server, please follow this{' '} @@ -914,13 +931,19 @@ export const RegisterAgent = withErrorBoundary( }-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()}`, + winText: + this.state.selectedVersion == 'windowsxp' || + this.state.selectedVersion == 'windowsserver2008' + ? `msiexec.exe /i wazuh-agent-${ + this.state.wazuhVersion + }-1.msi /q ${this.optionalDeploymentVariables()}` + : `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' @@ -945,6 +968,12 @@ export const RegisterAgent = withErrorBoundary( 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 warningCommand = ( +

    + Download from this link + the package to use with the command. +

    + ); const windowsAdvice = this.state.selectedOS === 'win' && ( <> @@ -1004,6 +1033,17 @@ export const RegisterAgent = withErrorBoundary( /> {windowsAdvice} + {this.state.selectedVersion == 'windowsxp' || + this.state.selectedVersion == 'windowsserver2008' ? ( + + ) : ( + '' + )} +
    {this.state.wazuhPassword && !this.state.showPassword @@ -1613,20 +1653,12 @@ export const RegisterAgent = withErrorBoundary( ? [ { 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), - ), + children: buttonGroup( + 'Choose the version', + versionButtonsWindows, + this.state.selectedVersion, + version => this.setVersion(version), + ), }, ] : []), @@ -1819,6 +1851,7 @@ export const RegisterAgent = withErrorBoundary( ] : []), ...(this.state.selectedVersion == 'windowsxp' || + this.state.selectedVersion == 'windowsserver2008' || this.state.selectedVersion == 'windows8' ? [ { @@ -1943,7 +1976,8 @@ export const RegisterAgent = withErrorBoundary( this.state.selectedOS == 'open' || this.state.selectedOS == 'sol' || this.state.selectedOS == 'aix' || - this.state.selectedOS == 'hp' + this.state.selectedOS == 'hp' || + this.state.selectedOS == 'alpine' ? [ { title: 'Start the agent', @@ -1976,6 +2010,7 @@ export const RegisterAgent = withErrorBoundary( this.state.selectedVersion === 'leap15' ? tabSystemD : this.state.selectedVersion == 'windowsxp' || + this.state.selectedVersion == 'windowsserver2008' || this.state.selectedVersion == 'windows8' ? tabNet : this.state.selectedVersion == 'sierra' || @@ -2017,6 +2052,7 @@ export const RegisterAgent = withErrorBoundary( this.state.selectedOS !== 'oraclelinux' && this.state.selectedOS !== 'suse' && this.state.selectedOS !== 'raspbian' && + this.state.selectedOS !== 'alpine' && restartAgentCommand ? [ { diff --git a/public/controllers/agent/wazuh-config/index.ts b/public/controllers/agent/wazuh-config/index.ts index 2e9234bb4c..7cde5f0b2d 100644 --- a/public/controllers/agent/wazuh-config/index.ts +++ b/public/controllers/agent/wazuh-config/index.ts @@ -192,6 +192,10 @@ const versionButtonsWindows = [ id: 'windowsxp', label: 'Windows XP', }, + { + id: 'windowsserver2008', + label: 'Windows Server 2008', + }, { id: 'windows8', label: 'Windows 8 or higher', @@ -255,7 +259,7 @@ const versionButtonsOracleLinux = [ }, { id: 'oraclelinux6', - label: 'Oracle Linux 6 or later', + label: 'Oracle Linux 6 or higher', }, ]; @@ -266,6 +270,13 @@ const versionButtonsRaspbian = [ }, ]; +const versionButtonAlpine = [ + { + id: '3.12.12', + label: '3.12.12 or higher', + }, +]; + /** * Order the OS Buttons Alphabetically by label * @param a @@ -362,6 +373,7 @@ export { versionButtonFedora, versionButtonsRedHat, versionButtonsCentos, + versionButtonAlpine, architectureButtonsMacos, osButtons, osPrincipalButtons, From d1fade8a08c4c4d0d5093d1384588b4f55fdef1a Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Tue, 29 Nov 2022 14:04:21 -0300 Subject: [PATCH 04/12] changes --- public/controllers/agent/components/register-agent.js | 6 +++--- public/controllers/agent/wazuh-config/index.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index faf81c74dd..e23b1630c7 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -268,7 +268,7 @@ export const RegisterAgent = withErrorBoundary( if ( this.state.selectedVersion === 'windowsxp' || this.state.selectedVersion === 'windowsserver2008' || - this.state.selectedVersion === 'windows8' + this.state.selectedVersion === 'windows7' ) { return 'update-rc.d wazuh-agent defaults && service wazuh-agent start'; } @@ -1852,7 +1852,7 @@ export const RegisterAgent = withErrorBoundary( : []), ...(this.state.selectedVersion == 'windowsxp' || this.state.selectedVersion == 'windowsserver2008' || - this.state.selectedVersion == 'windows8' + this.state.selectedVersion == 'windows7' ? [ { title: 'Choose the architecture', @@ -2011,7 +2011,7 @@ export const RegisterAgent = withErrorBoundary( ? tabSystemD : this.state.selectedVersion == 'windowsxp' || this.state.selectedVersion == 'windowsserver2008' || - this.state.selectedVersion == 'windows8' + this.state.selectedVersion == 'windows7' ? tabNet : this.state.selectedVersion == 'sierra' || this.state.selectedVersion == 'highSierra' || diff --git a/public/controllers/agent/wazuh-config/index.ts b/public/controllers/agent/wazuh-config/index.ts index 7cde5f0b2d..9dad7565ac 100644 --- a/public/controllers/agent/wazuh-config/index.ts +++ b/public/controllers/agent/wazuh-config/index.ts @@ -197,8 +197,8 @@ const versionButtonsWindows = [ label: 'Windows Server 2008', }, { - id: 'windows8', - label: 'Windows 8 or higher', + id: 'windows7', + label: 'Windows 7 or higher', }, ]; From 63e8a3ca4428ecc93c1136d640fd45681765824a Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Tue, 29 Nov 2022 15:09:28 -0300 Subject: [PATCH 05/12] changes --- .../agent/components/register-agent.js | 67 +++++++++++-------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index e23b1630c7..6b846d763f 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -185,12 +185,6 @@ export const RegisterAgent = withErrorBoundary( } } - // componentDidUpdate() { - // if (this.state.selectedOS == 'macos') { - // this.setVersion('sierra'); - // } - // } - getEnrollDNSConfig = () => { let serverAddress = this.configuration['enrollment.dns'] || ''; this.setState({ defaultServerAddress: serverAddress }); @@ -422,6 +416,25 @@ export const RegisterAgent = withErrorBoundary( } } + resolveAlpinePackage() { + switch ( + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + ) { + case 'alpine-i386': + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.i386.rpm`; + case 'alpine-aarch64': + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.aarch64.rpm`; + case 'alpine-x86_64': + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.x86_64.rpm`; + case 'alpine-armhf': + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.armv7hl.rpm`; + case 'alpine-powerpc': + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}.ppc64le.rpm`; + default: + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.x86_64.rpm`; + } + } + resolveORACLELINUXPackage() { switch ( `${this.state.selectedVersion}-${this.state.selectedArchitecture}` @@ -700,6 +713,8 @@ export const RegisterAgent = withErrorBoundary( return this.resolveSUSEPackage(); case 'raspbian': return this.resolveRASPBIANPackage(); + case 'alpine': + return this.resolveAlpinePackage(); default: return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}-1.x86_64.rpm`; } @@ -839,19 +854,6 @@ export const RegisterAgent = withErrorBoundary( ); const urlWindowsPackage = `https://packages.wazuh.com/4.x/windows/wazuh-agent-${this.state.wazuhVersion}-1.msi`; - // 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()}`; - - // `https://packages.wazuh.com/${this.state.wazuhVersion}/windows/wazuh-agent-${this.state.wazuhVersion}-1.msi` - - // # Provide MSI package URL and request the user to download the package and run the following command: - // msiexec.exe /i wazuh-agent.msi /q WAZUH_MANAGER='172.31.76.147' WAZUH_REGISTRATION_SERVER='172.31.76.147' - const textAndLinkToCheckConnectionDocumentation = (

    To verify the connection with the Wazuh server, please follow this{' '} @@ -1769,14 +1771,12 @@ export const RegisterAgent = withErrorBoundary( ? [ { title: 'Choose the version', - children: - this.state.selectedVersion == '11.31' && - buttonGroup( - 'Choose the version', - versionButtonsHPUX, - this.state.selectedVersion, - version => this.setVersion(version), - ), + children: buttonGroup( + 'Choose the version', + versionButtonAlpine, + this.state.selectedVersion, + version => this.setVersion(version), + ), }, ] : []), @@ -1809,6 +1809,19 @@ export const RegisterAgent = withErrorBoundary( }, ] : []), + ...(this.state.selectedVersion == '3.12.12' + ? [ + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsWithPPC64LE, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] + : []), ...(this.state.selectedVersion == 'centos6' || this.state.selectedVersion == 'oraclelinux6' || this.state.selectedVersion == 'amazonlinux1' || From 281f56377fff1211ba0b514d6457e5d9fc028c65 Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Tue, 29 Nov 2022 15:27:12 -0300 Subject: [PATCH 06/12] alpine versions commands --- public/controllers/agent/components/register-agent.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index 6b846d763f..fb95c51627 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -420,15 +420,15 @@ export const RegisterAgent = withErrorBoundary( switch ( `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { - case 'alpine-i386': + case '3.12.12-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.i386.rpm`; - case 'alpine-aarch64': + case '3.12.12-aarch64': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.aarch64.rpm`; - case 'alpine-x86_64': + case '3.12.12-x86_64': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.x86_64.rpm`; - case 'alpine-armhf': + case '3.12.12-armhf': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.armv7hl.rpm`; - case 'alpine-powerpc': + case '3.12.12-powerpc': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}.ppc64le.rpm`; default: return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.x86_64.rpm`; From c5a8643463632b25cf1139a7d1d47bcdc639b60e Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Tue, 29 Nov 2022 17:38:15 -0300 Subject: [PATCH 07/12] commands for alpine and architecture macos --- .../agent/components/register-agent.js | 25 ++++++++++++++++++- .../agent/components/wz-accordion.tsx | 6 +++-- .../controllers/agent/wazuh-config/index.ts | 8 ++---- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index fb95c51627..71ff3a0ac7 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -421,7 +421,7 @@ export const RegisterAgent = withErrorBoundary( `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case '3.12.12-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.i386.rpm`; + return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/trash/alpine/v3.12/main"`; case '3.12.12-aarch64': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.aarch64.rpm`; case '3.12.12-x86_64': @@ -830,6 +830,13 @@ export const RegisterAgent = withErrorBoundary( ? ['OS architecture'] : []), ]; + case 'alpine': + return [ + ...(!this.state.selectedVersion ? ['OS version'] : []), + ...(this.state.selectedVersion && !this.state.selectedArchitecture + ? ['OS architecture'] + : []), + ]; default: return []; } @@ -913,8 +920,24 @@ export const RegisterAgent = withErrorBoundary( const codeBlock = { zIndex: '100', }; + const customTexts = { rpmText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, + alpineText: `wget -O /etc/apk/keys/alpine-devel@wazuh.com-633d7457.rsa.pub ${this.optionalPackages()} >> /etc/apk/repositories && \ +apk update && \ +apk add wazuh-agent`, + + // wget -O /etc/apk/keys/alpine-devel@wazuh.com-633d7457.rsa.pub https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \ + // echo "https://packages.wazuh.com/trash/alpine/v3.12/main" >> /etc/apk/repositories && \ + // apk update && \ + // apk add wazuh-agent + + // armando comando + + // wget -O /etc/apk/keys/alpine-devel@wazuh.com-633d7457.rsa.pub ${this.optionalPackages()} >> /etc/apk/repositories && \ + // apk update && \ + // apk add wazuh-agent + centText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, debText: `curl -so wazuh-agent-${ this.state.wazuhVersion diff --git a/public/controllers/agent/components/wz-accordion.tsx b/public/controllers/agent/components/wz-accordion.tsx index d675f500e1..eafaf073cd 100644 --- a/public/controllers/agent/components/wz-accordion.tsx +++ b/public/controllers/agent/components/wz-accordion.tsx @@ -45,13 +45,15 @@ export const WzAccordion = ({ children }) => { return ( setIsAccordionOpen(isOpen)} className={'action-btn-td'} > - {children} + + {children} + ); }; diff --git a/public/controllers/agent/wazuh-config/index.ts b/public/controllers/agent/wazuh-config/index.ts index 9dad7565ac..24e6cbe5ac 100644 --- a/public/controllers/agent/wazuh-config/index.ts +++ b/public/controllers/agent/wazuh-config/index.ts @@ -71,12 +71,8 @@ const architectureButtonsSolaris = [ const architectureButtonsMacos = [ { - id: 'intel', - label: 'Intel', - }, - { - id: 'applesilicon', - label: 'Apple Silicon', + id: 'intel/applesilicon', + label: 'Intel/Apple Silicon', }, ]; From 2d754efa3b07cdea6d33dfd8c84e5ead676b1e5e Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Wed, 30 Nov 2022 10:25:57 -0300 Subject: [PATCH 08/12] message install and start alpine --- .../agent/components/register-agent.js | 45 +++---- public/styles/component.scss | 112 +++++++++--------- 2 files changed, 71 insertions(+), 86 deletions(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index 71ff3a0ac7..86ad74ddcf 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -210,14 +210,6 @@ export const RegisterAgent = withErrorBoundary( } selectOS(os) { - if (os == 'macos') { - this.setState({ - selectedOS: os, - selectedVersion: 'sierra', - selectedArchitecture: '', - selectedSYS: '', - }); - } this.setState({ selectedOS: os, selectedVersion: '', @@ -279,7 +271,8 @@ export const RegisterAgent = withErrorBoundary( this.state.selectedVersion === 'solaris10' || this.state.selectedVersion === 'solaris11' || this.state.selectedVersion === '6.1 TL9' || - this.state.selectedVersion === '11.31' + this.state.selectedVersion === '11.31' || + this.state.selectedVersion === '3.12.12' ) { return '/var/ossec/bin/wazuh-control start'; } @@ -310,6 +303,7 @@ export const RegisterAgent = withErrorBoundary( } setVersion(selectedVersion) { + console.log(selectedVersion, 'sel'); this.setState({ selectedVersion, selectedArchitecture: '' }); } @@ -421,17 +415,17 @@ export const RegisterAgent = withErrorBoundary( `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case '3.12.12-i386': - return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/trash/alpine/v3.12/main"`; + return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; case '3.12.12-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.aarch64.rpm`; + return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; case '3.12.12-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.x86_64.rpm`; + return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; case '3.12.12-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.armv7hl.rpm`; + return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; case '3.12.12-powerpc': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}.ppc64le.rpm`; + return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; default: - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.x86_64.rpm`; + return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; } } @@ -927,17 +921,6 @@ export const RegisterAgent = withErrorBoundary( apk update && \ apk add wazuh-agent`, - // wget -O /etc/apk/keys/alpine-devel@wazuh.com-633d7457.rsa.pub https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \ - // echo "https://packages.wazuh.com/trash/alpine/v3.12/main" >> /etc/apk/repositories && \ - // apk update && \ - // apk add wazuh-agent - - // armando comando - - // wget -O /etc/apk/keys/alpine-devel@wazuh.com-633d7457.rsa.pub ${this.optionalPackages()} >> /etc/apk/repositories && \ - // apk update && \ - // apk add wazuh-agent - centText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, debText: `curl -so wazuh-agent-${ this.state.wazuhVersion @@ -995,8 +978,11 @@ apk add wazuh-agent`, 'If the installer finds another Wazuh agent in the system, it will upgrade it preserving the configuration.'; const warningCommand = (

    - Download from this link - the package to use with the command. + Please + download + the package from our repository and copy it to the Windows system + where you are going to install it. Then run the following command to + perform the installation:

    ); const windowsAdvice = this.state.selectedOS === 'win' && ( @@ -2060,7 +2046,8 @@ apk add wazuh-agent`, : this.state.selectedVersion == 'solaris10' || this.state.selectedVersion == 'solaris11' || this.state.selectedVersion == '6.1 TL9' || - this.state.selectedVersion == '11.31' + this.state.selectedVersion == '11.31' || + this.state.selectedVersion == '3.12.12' ? tabWazuhControl : tabSysV } diff --git a/public/styles/component.scss b/public/styles/component.scss index a44e860759..7fa8976546 100644 --- a/public/styles/component.scss +++ b/public/styles/component.scss @@ -16,124 +16,122 @@ /* Custom nav bar styles */ -.wz-nav-bar .md-nav-bar{ - height: auto !important; +.wz-nav-bar .md-nav-bar { + height: auto !important; } .wz-nav-item button, .wz-no-padding { - padding: 0 5px!important; + padding: 0 5px !important; } .wz-nav-item button.md-primary { - color: rgb(0, 121, 165) !important; - background: #f5fafb !important; - border-bottom: 2px solid #006BB4; + color: rgb(0, 121, 165) !important; + background: #f5fafb !important; + border-bottom: 2px solid #006bb4; } .wz-nav-item button.md-unselected { - color: rgba(0, 0, 0, 0.87) !important; + color: rgba(0, 0, 0, 0.87) !important; } .wz-nav-bar md-nav-ink-bar { - color: rgb(0, 121, 165) !important; - background: rgb(0, 121, 165) !important; + color: rgb(0, 121, 165) !important; + background: rgb(0, 121, 165) !important; } .wz-nav-bar md-nav-ink-bar._md-left, .wz-nav-bar md-nav-ink-bar._md-right { - transition: none !important; + transition: none !important; } /* Custom tooltip styles */ .wz-tooltip { - background-color: rgba(0,0,0,0.87) !important; - color: #FFF !important; + background-color: rgba(0, 0, 0, 0.87) !important; + color: #fff !important; } /* Custom switch styles */ .wz-switch { - margin: 0 !important; + margin: 0 !important; } /* Custom chips styles */ .wz-chips .md-chips { - box-shadow: none !important; - padding-bottom: 0; + box-shadow: none !important; + padding-bottom: 0; } .wz-chip { - font-size: 12px; - color: white; - background-color: #006BB4; - height: 26px !important; - line-height: 26px !important; - margin: 0 8px 0 0 !important; + font-size: 12px; + color: white; + background-color: #006bb4; + height: 26px !important; + line-height: 26px !important; + margin: 0 8px 0 0 !important; } - .sca-chart-widget { - margin: 0 auto; - //width:350px; - margin-top:50px; - background-color: #222D3A; - border-radius: 5px; - box-shadow: 0px 0px 1px 0px #06060d; - + margin: 0 auto; + //width:350px; + margin-top: 50px; + background-color: #222d3a; + border-radius: 5px; + box-shadow: 0px 0px 1px 0px #06060d; } -.sca-chart-header{ - background-color: #29384D; - height:40px; - color:#929DAF; - text-align: center; - line-height: 40px; - border-top-left-radius: 7px; - border-top-right-radius: 7px; - font-weight: 400; - font-size: 1.5em; - text-shadow: 1px 1px #06060d; +.sca-chart-header { + background-color: #29384d; + height: 40px; + color: #929daf; + text-align: center; + line-height: 40px; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + font-weight: 400; + font-size: 1.5em; + text-shadow: 1px 1px #06060d; } -.sca-chart{ - padding:12px; +.sca-chart { + padding: 12px; } .sca-chart-shadow { - -webkit-filter: drop-shadow( 0px 3px 3px rgba(0,0,0,.5) ); - filter: drop-shadow( 0px 3px 3px rgba(0,0,0,.5) ); + -webkit-filter: drop-shadow(0px 3px 3px rgba(0, 0, 0, 0.5)); + filter: drop-shadow(0px 3px 3px rgba(0, 0, 0, 0.5)); } kbn-dis doc-table .kbnDocViewer__warning { - display: none; + display: none; } /* Custom Breadcrumb styles*/ .header__breadcrumbsWithExtensionContainer .euiHeaderBreadcrumbs { - flex-grow: 1; - margin-right: 12px; + flex-grow: 1; + margin-right: 12px; } .header__breadcrumbsWithExtensionContainer .header__breadcrumbsAppendExtension { - flex-grow: 0; + flex-grow: 0; } .osButtonsStyle { - display: grid; - grid-template-columns: repeat(5, 1fr); - grid-gap: 10px; + display: grid; + grid-template-columns: repeat(5, 1fr); + grid-gap: 10px; } .osButtonsStyleMac { - display: grid; - grid-template-columns: repeat(3, 1fr); - grid-gap: 10px; + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-gap: 10px; } .message { - margin-top: 10px; - display: flex; - flex-direction: row; + margin-top: 10px; + display: flex; + flex-direction: row; } From 021980a486c3f539fa97d5c544b09aec074dee40 Mon Sep 17 00:00:00 2001 From: "chantal.kelm" Date: Wed, 30 Nov 2022 10:44:54 -0300 Subject: [PATCH 09/12] CHANGELOG --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19e1f51f48..8222bc89d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Added powerPC architecture in redhat7, in the section 'Deploy new agent'. [4833](https://github.com/wazuh/wazuh-kibana-app/pull/4833) - Added a centralized service to handle the requests [#4831](https://github.com/wazuh/wazuh-kibana-app/pull/4831) - Added data-test-subj create policy [#4873](https://github.com/wazuh/wazuh-kibana-app/pull/4873) +- Added extra steps message and new command for windows xp and windows server 2008, added alpine agent with all its steps. [#4933](https://github.com/wazuh/wazuh-kibana-app/pull/4933) ### Changed @@ -44,6 +45,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Fixed pagination to SCA table [#4653](https://github.com/wazuh/wazuh-kibana-app/issues/4653) - 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 the way macos versions and architectures were displayed, fixed the way agents were displayed, fixed the way ubuntu versions were displayed. [#4933](https://github.com/wazuh/wazuh-kibana-app/pull/4933) ## Wazuh v4.3.10 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4311 @@ -67,7 +69,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Fixed -- Wazuh.yml review: fixed link to web documentation, improved in-file documentation and fixed some grammatical errors. [#4378](https://github.com/wazuh/wazuh-kibana-app/pull/4378) [#4399](https://github.com/wazuh/wazuh-kibana-app/pull/4399) +- Wazuh.yml review: fixed link to web documentation, improved in-file documentation and fixed some grammatical errors. [#4378](https://github.com/wazuh/wazuh-kibana-app/pull/4378) [#4399](https://github.com/wazuh/wazuh-kibana-app/pull/4399) - Fixed an error during the generation of a group's report, if the request to the Wazuh API fails [#4350](https://github.com/wazuh/wazuh-kibana-app/pull/4350) - Fixed a problem with the group's report, when the group has no agents [#4350](https://github.com/wazuh/wazuh-kibana-app/pull/4350) - Fixed path in logo customization section [#4352](https://github.com/wazuh/wazuh-kibana-app/pull/4352) From ecda6673892a9790bac1c73c70bc2a84ca3cd5f9 Mon Sep 17 00:00:00 2001 From: Nicolas Guevara Date: Wed, 30 Nov 2022 13:50:02 -0300 Subject: [PATCH 10/12] Add validation to the agent name --- .../agent/components/register-agent.js | 1006 +++++++++-------- 1 file changed, 508 insertions(+), 498 deletions(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index 86ad74ddcf..caee81948d 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -34,6 +34,9 @@ import { EuiIcon, EuiSwitch, EuiLink, + EuiFormRow, + EuiFormControlLayout, + EuiForm } from '@elastic/eui'; import { WzRequest } from '../../../react-services/wz-request'; import { withErrorBoundary } from '../../../components/common/hocs'; @@ -93,6 +96,7 @@ export const RegisterAgent = withErrorBoundary( wazuhVersion: '', serverAddress: '', agentName: '', + agentNameError: false, wazuhPassword: '', groups: [], selectedGroup: [], @@ -288,10 +292,11 @@ export const RegisterAgent = withErrorBoundary( setAgentName(event) { this.setState({ agentName: event.target.value }); - } - - setAgentName(event) { - this.setState({ agentName: event.target.value }); + if (/^[a-z0-9-_.]+$/i.test(event.target.value) || event.target.value.length <= 0) { + this.setState({ agentNameError: false }); + } else { + this.setState({ agentNameError: true }); + } } setGroupName(selectedGroup) { @@ -381,7 +386,7 @@ export const RegisterAgent = withErrorBoundary( resolveRPMPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -412,7 +417,7 @@ export const RegisterAgent = withErrorBoundary( resolveAlpinePackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case '3.12.12-i386': return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; @@ -431,7 +436,7 @@ export const RegisterAgent = withErrorBoundary( resolveORACLELINUXPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -458,7 +463,7 @@ export const RegisterAgent = withErrorBoundary( resolveCENTPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -489,7 +494,7 @@ export const RegisterAgent = withErrorBoundary( resolveSUSEPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'suse11-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}.i386.rpm`; @@ -512,7 +517,7 @@ export const RegisterAgent = withErrorBoundary( resolveFEDORAPachage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -531,7 +536,7 @@ export const RegisterAgent = withErrorBoundary( resolveAMAZONLPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'amazonlinux1-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}.i386.rpm`; @@ -585,7 +590,7 @@ export const RegisterAgent = withErrorBoundary( resolveRASPBIANPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -604,7 +609,7 @@ export const RegisterAgent = withErrorBoundary( resolveUBUNTUPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -629,7 +634,7 @@ export const RegisterAgent = withErrorBoundary( resolveOPENSUSEPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -642,7 +647,7 @@ export const RegisterAgent = withErrorBoundary( resolveSOLARISPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -659,7 +664,7 @@ export const RegisterAgent = withErrorBoundary( resolveAIXPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -670,7 +675,7 @@ export const RegisterAgent = withErrorBoundary( resolveHPPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${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`; @@ -864,13 +869,20 @@ export const RegisterAgent = withErrorBoundary(

    ); const missingOSSelection = this.checkMissingOSSelection(); - const agentName = ( - this.setAgentName(event)} - /> + + + this.setAgentName(event)} /> + + + + ); const groupInput = ( <> @@ -922,53 +934,39 @@ apk update && \ apk add wazuh-agent`, 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 /`, + 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: this.state.selectedVersion == 'windowsxp' || - this.state.selectedVersion == 'windowsserver2008' - ? `msiexec.exe /i wazuh-agent-${ - this.state.wazuhVersion - }-1.msi /q ${this.optionalDeploymentVariables()}` - : `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()}`, + this.state.selectedVersion == 'windowsserver2008' + ? `msiexec.exe /i wazuh-agent-${this.state.wazuhVersion + }-1.msi /q ${this.optionalDeploymentVariables()}` + : `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`; @@ -1045,7 +1043,7 @@ apk add wazuh-agent`, {windowsAdvice} {this.state.selectedVersion == 'windowsxp' || - this.state.selectedVersion == 'windowsserver2008' ? ( + this.state.selectedVersion == 'windowsserver2008' ? ( {this.state.selectedVersion == 'solaris10' || - this.state.selectedVersion == 'solaris11' ? ( + this.state.selectedVersion == 'solaris11' ? ( this.setVersion(version), - ) - : buttonGroup( - 'Choose the version', - versionButtonsRedHat, - this.state.selectedVersion, - version => this.setVersion(version), - ), - }, - ] + ? 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' || + { + 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), - ), - }, - ] + ? 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' || + { + 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), - ), - }, - ] + ? 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: buttonGroup( - 'Choose the version', - versionButtonsWindows, - this.state.selectedVersion, - version => this.setVersion(version), - ), - }, - ] + { + title: 'Choose the version', + children: 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' || + { + 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), - ), - }, - ] + ? 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.selectedOS == 'alpine' ? [ - { - title: 'Choose the version', - children: buttonGroup( - 'Choose the version', - versionButtonAlpine, - this.state.selectedVersion, - version => this.setVersion(version), - ), - }, - ] + { + title: 'Choose the version', + children: buttonGroup( + 'Choose the version', + versionButtonAlpine, + 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 == '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 == '3.12.12' ? [ - { - 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 == '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 == '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' ? [ - { - 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 == '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 == 'windowsserver2008' || - this.state.selectedVersion == 'windows7' + this.state.selectedVersion == 'windowsserver2008' || + this.state.selectedVersion == 'windows7' ? [ - { - 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' ? [ - { - 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 == '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', @@ -1954,11 +1952,11 @@ apk add wazuh-agent`, }, ...(!(!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', @@ -1974,6 +1972,12 @@ apk add wazuh-agent`, title: 'Install and enroll the agent', children: this.state.gotErrorRegistrationServiceInfo ? ( calloutErrorRegistrationServiceInfo + ) : this.state.agentNameError ? ( + ) : missingOSSelection.length ? ( - ) : ( - + ) : missingOSSelection.length ? ( + + ) : ( + - ), - }, - ] + ? tabWazuhControlMacos + : this.state.selectedVersion == 'solaris10' || + this.state.selectedVersion == 'solaris11' || + this.state.selectedVersion == '6.1 TL9' || + this.state.selectedVersion == '11.31' || + this.state.selectedVersion == '3.12.12' + ? tabWazuhControl + : tabSysV + } + selectedTab={this.selectedSYS} + onTabClick={onTabClick} + /> + ), + }, + ] : []), ...(!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' && - this.state.selectedOS !== 'alpine' && - 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' && + this.state.selectedOS !== 'alpine' && + restartAgentCommand ? [ - { - title: 'Start the agent', - children: this.state.gotErrorRegistrationServiceInfo ? ( - calloutErrorRegistrationServiceInfo - ) : ( - - -
    - - {restartAgentCommand} - - - {copy => ( -
    -

    - Copy command -

    -
    - )} -
    -
    -
    -
    - ), - }, - ] + { + title: 'Start the agent', + children: this.state.gotErrorRegistrationServiceInfo ? ( + calloutErrorRegistrationServiceInfo + ) : ( + + +
    + + {restartAgentCommand} + + + {copy => ( +
    +

    + Copy command +

    +
    + )} +
    +
    +
    +
    + ), + }, + ] : []), ]; From 2b7ecabe725f3cad6191720c2e2885f79c5fca0e Mon Sep 17 00:00:00 2001 From: Nicolas Guevara Date: Thu, 1 Dec 2022 12:04:01 -0300 Subject: [PATCH 11/12] Add invalid characters to message --- .../controllers/agent/components/register-agent.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index caee81948d..a35095001b 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -97,6 +97,7 @@ export const RegisterAgent = withErrorBoundary( serverAddress: '', agentName: '', agentNameError: false, + badCharacters: [], wazuhPassword: '', groups: [], selectedGroup: [], @@ -294,8 +295,16 @@ export const RegisterAgent = withErrorBoundary( this.setState({ agentName: event.target.value }); if (/^[a-z0-9-_.]+$/i.test(event.target.value) || event.target.value.length <= 0) { this.setState({ agentNameError: false }); + this.setState({ badCharacters: [] }); } else { + let badCharacters = event.target.value.split('').map(char => + char.replace(/^[a-z0-9-_.]+$/i, '')).join(''); + badCharacters = badCharacters.split('').map(char => + char.replace(/\s/, 'whitespace')); + const characters = [...new Set(badCharacters)]; + this.setState({ badCharacters: characters }); this.setState({ agentNameError: true }); + } } @@ -873,7 +882,10 @@ export const RegisterAgent = withErrorBoundary( + error={[`The character${this.state.badCharacters.length <= 1 ? ('') : ('s')} + ${this.state.badCharacters.map(char => ` "${char}"`)} + ${this.state.badCharacters.length <= 1 ? ('is') : ('are')} + not valid. Valid characters are A-Z, a-z, ".", "-", "_"`]}> Date: Thu, 1 Dec 2022 12:05:41 -0300 Subject: [PATCH 12/12] Fix typo --- public/controllers/agent/components/register-agent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index a35095001b..c34f844e3f 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -885,7 +885,7 @@ export const RegisterAgent = withErrorBoundary( error={[`The character${this.state.badCharacters.length <= 1 ? ('') : ('s')} ${this.state.badCharacters.map(char => ` "${char}"`)} ${this.state.badCharacters.length <= 1 ? ('is') : ('are')} - not valid. Valid characters are A-Z, a-z, ".", "-", "_"`]}> + not valid. Allowed characters are A-Z, a-z, ".", "-", "_"`]}>