From fd8560d3db42bbe0c2ffce9238495d0cf7fa6036 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Tue, 23 May 2023 12:56:18 +0200 Subject: [PATCH] Change macOS register agent installation script (#5481) * Change set environment variables for macOS * Add changelog (cherry picked from commit 3200cc9e50d78bc934786edf02625f3ee2a2cdd0) --- CHANGELOG.md | 2 +- .../agent/components/register-agent.js | 1074 ++++++++--------- 2 files changed, 531 insertions(+), 545 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f8eaac4ea..c6edee0174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Fixed -- Fixed command to starting the macOS agent on the agent wizard [#5466](https://github.com/wazuh/wazuh-kibana-app/pull/5466) +- Fixed command to starting the macOS agent on the agent wizard [#5466](https://github.com/wazuh/wazuh-kibana-app/pull/5466) [#5481](https://github.com/wazuh/wazuh-kibana-app/pull/5481) ## Wazuh v4.4.2 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 01 diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index c33d478048..f4671aa1e0 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -402,24 +402,11 @@ export const RegisterAgent = withErrorBoundary( .join(',')}' `; } - // macos doesnt need = param - if (this.state.selectedOS === 'macos') { - return deployment.replace(/=/g, ' '); - } - return deployment; } agentNameVariable() { let agentName = `WAZUH_AGENT_NAME='${this.state.agentName}' `; - if ( - this.state.selectedOS === 'macos' && - this.state.selectedArchitecture && - this.state.agentName !== '' - ) { - return agentName.replace(/=/g, ' '); - } - if (this.state.selectedArchitecture && this.state.agentName !== '') { return agentName; } else { @@ -429,7 +416,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}${this.addToVersion}.el5.i386.rpm`; @@ -460,7 +447,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"'; @@ -481,7 +468,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/yum5/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm`; @@ -502,7 +489,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/yum5/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm`; @@ -533,7 +520,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/yum5/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm`; @@ -556,7 +543,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/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; @@ -575,7 +562,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}${this.addToVersion}.i386.rpm`; @@ -625,7 +612,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}${this.addToVersion}_i386.deb`; @@ -644,7 +631,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}${this.addToVersion}_i386.deb`; @@ -669,7 +656,7 @@ export const RegisterAgent = withErrorBoundary( resolveOPENSUSEPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'leap15-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; @@ -688,7 +675,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_v${this.state.wazuhVersion}-sol10-i386.pkg`; @@ -705,7 +692,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/aix/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aix.ppc.rpm`; @@ -716,7 +703,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/hp-ux/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}-hpux-11v3-ia64.tar`; @@ -915,9 +902,8 @@ export const RegisterAgent = withErrorBoundary( error={[ this.state.badCharacters.length < 1 ? 'The minimum length is 2 characters.' - : `The character${ - this.state.badCharacters.length <= 1 ? '' : 's' - } + : `The character${this.state.badCharacters.length <= 1 ? '' : 's' + } ${this.state.badCharacters.map(char => ` "${char}"`)} ${this.state.badCharacters.length <= 1 ? 'is' : 'are'} not valid. Allowed characters are A-Z, a-z, ".", "-", "_"`, @@ -975,6 +961,12 @@ export const RegisterAgent = withErrorBoundary( zIndex: '100', }; + // Select macOS installation script based on architecture + const macOSInstallationOptions = (this.optionalDeploymentVariables() + this.agentNameVariable()).replaceAll('\' ', '\'\\n'); + const macOSInstallationSetEnvVariablesScript = macOSInstallationOptions ? `echo -e "${macOSInstallationOptions}" > /tmp/wazuh_envs && ` : ``; + const macOSInstallationScript = `curl -so wazuh-agent.pkg https://packages.wazuh.com/4.x/macos/wazuh-agent-${this.state.wazuhVersion + }-1.pkg && ${macOSInstallationSetEnvVariablesScript}sudo installer -pkg ./wazuh-agent.pkg -target /`; + 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 && \ @@ -983,28 +975,22 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`, centText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, debText: `curl -so wazuh-agent.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent.deb`, ubuText: `curl -so wazuh-agent.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent.deb`, - macosText: `curl -so wazuh-agent.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.pkg -target /`, + macosText: macOSInstallationScript, winText: this.state.selectedVersion == 'windowsxp' || - this.state.selectedVersion == 'windowsserver2008' - ? `msiexec.exe /i wazuh-agent-${ - this.state.wazuhVersion - }-1.msi /q ${this.optionalDeploymentVariables()}${this.agentNameVariable()}` - : `Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-${ - this.state.wazuhVersion - }-1.msi -OutFile \${env:tmp}\\wazuh-agent.msi; msiexec.exe /i \${env:tmp}\\wazuh-agent.msi /q ${this.optionalDeploymentVariables()}${this.agentNameVariable()}`, + this.state.selectedVersion == 'windowsserver2008' + ? `msiexec.exe /i wazuh-agent-${this.state.wazuhVersion + }-1.msi /q ${this.optionalDeploymentVariables()}${this.agentNameVariable()}` + : `Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-${this.state.wazuhVersion + }-1.msi -OutFile \${env:tmp}\\wazuh-agent.msi; msiexec.exe /i \${env:tmp}\\wazuh-agent.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.state.selectedVersion == 'solaris11' + solText: `sudo curl -so ${this.state.selectedVersion == 'solaris11' ? 'wazuh-agent.p5p' : 'wazuh-agent.pkg' - } ${this.optionalPackages()} && ${ - this.state.selectedVersion == 'solaris11' + } ${this.optionalPackages()} && ${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 wazuh-agent.tar ${this.optionalPackages()} && sudo groupadd wazuh && sudo useradd -G wazuh wazuh && sudo tar -xvf wazuh-agent.tar`, amazonlinuxText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, @@ -1139,20 +1125,20 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`, {windowsAdvice} {['windowsxp', 'windowsserver2008'].includes( this.state.selectedVersion) && ( - <> - - - - )} + <> + + + + )}
{this.state.wazuhPassword && - !this.state.showPassword && - !['sol', 'hp', 'alpine'].includes(this.state.selectedOS) + !this.state.showPassword && + !['sol', 'hp', 'alpine'].includes(this.state.selectedOS) ? this.obfuscatePassword(text) : text} @@ -1167,7 +1153,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
{this.state.selectedVersion == 'solaris10' || - this.state.selectedVersion == 'solaris11' ? ( + this.state.selectedVersion == 'solaris11' ? ( <> { - this.setState({ - serverAddress: nodeSelected, - udpProtocol: this.state.haveUdpProtocol, - connectionSecure: this.state.haveConnectionSecure - }); + this.setState({ + serverAddress: nodeSelected, + udpProtocol: this.state.haveUdpProtocol, + connectionSecure: this.state.haveConnectionSecure + }); }; const steps = [ @@ -1556,433 +1542,433 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`, }, ...(this.state.selectedOS == 'rpm' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'oraclelinux' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'raspbian' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'amazonlinux' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'cent' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'fedora' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'deb' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'ubu' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'win' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'macos' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'suse' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'open' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'sol' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'aix' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'hp' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + this.setVersion(version)} + /> + ), + }, + ] : []), ...(this.state.selectedOS == 'alpine' ? [ - { - title: 'Choose the version', - children: ( - this.setVersion(version)} - /> - ), - }, - ] + { + title: 'Choose the version', + children: ( + 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: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + this.setArchitecture(architecture) + } + /> + ), + }, + ] : []), ...(this.state.selectedVersion == 'leap15' ? [ - { - title: 'Choose the architecture', - children: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + this.setArchitecture(architecture) + } + /> + ), + }, + ] : []), ...(this.state.selectedVersion == '3.12.12' ? [ - { - title: 'Choose the architecture', - children: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + 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 == 'amazonlinux2' || - 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 == 'amazonlinux2' || + this.state.selectedVersion == 'debian7' || + this.state.selectedVersion == 'debian8' || + this.state.selectedVersion == 'ubuntu14' || + this.state.selectedVersion == 'ubuntu15' ? [ - { - title: 'Choose the architecture', - children: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + this.setArchitecture(architecture) + } + /> + ), + }, + ] : []), ...(this.state.selectedVersion == 'centos7' || - this.state.selectedVersion == 'redhat7' || - this.state.selectedVersion == 'suse12' || - this.state.selectedVersion == '22' || - this.state.selectedVersion == 'debian9' || - this.state.selectedVersion == 'busterorgreater' + this.state.selectedVersion == 'redhat7' || + this.state.selectedVersion == 'suse12' || + this.state.selectedVersion == '22' || + this.state.selectedVersion == 'debian9' || + this.state.selectedVersion == 'busterorgreater' ? [ - { - title: 'Choose the architecture', - children: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + 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: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + this.setArchitecture(architecture) + } + /> + ), + }, + ] : []), ...(this.state.selectedVersion == 'sierra' ? [ - { - title: 'Choose the architecture', - children: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + this.setArchitecture(architecture) + } + /> + ), + }, + ] : []), ...(this.state.selectedVersion == 'solaris10' || - this.state.selectedVersion == 'solaris11' + this.state.selectedVersion == 'solaris11' ? [ - { - title: 'Choose the architecture', - children: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + this.setArchitecture(architecture) + } + /> + ), + }, + ] : []), ...(this.state.selectedVersion == '6.1 TL9' ? [ - { - title: 'Choose the architecture', - children: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + this.setArchitecture(architecture) + } + /> + ), + }, + ] : []), ...(this.state.selectedVersion == '11.31' ? [ - { - title: 'Choose the architecture', - children: ( - - this.setArchitecture(architecture) - } - /> - ), - }, - ] + { + title: 'Choose the architecture', + children: ( + + this.setArchitecture(architecture) + } + /> + ), + }, + ] : []), ...(!( this.state.selectedOS == 'hp' || @@ -1990,18 +1976,18 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`, this.state.selectedOS == 'alpine' ) ? [ - { - title: 'Wazuh server address', - children: ( - - - - ), - }, - ] + { + title: 'Wazuh server address', + children: ( + + + + ), + }, + ] : []), ...(!( !this.state.needsPassword || @@ -2011,11 +1997,11 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`, ) ) ? [ - { - title: 'Wazuh password', - children: {passwordInput}, - }, - ] + { + title: 'Wazuh password', + children: {passwordInput}, + }, + ] : []), ...(!( this.state.selectedOS == 'hp' || @@ -2023,17 +2009,17 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`, this.state.selectedOS == 'alpine' ) ? [ - { - title: 'Assign a name and a group to the agent', - children: ( - - {agentName} - {groupInput} - {agentGroup} - - ), - }, - ] + { + title: 'Assign a name and a group to the agent', + children: ( + + {agentName} + {groupInput} + {agentGroup} + + ), + }, + ] : []), { title: 'Install and enroll the agent', @@ -2057,46 +2043,46 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`, ), }, ...(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 == 'alpine' || - this.state.selectedOS == '' + 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 == 'alpine' || + this.state.selectedOS == '' ? [ - { - title: 'Start the agent', - children: this.state.gotErrorRegistrationServiceInfo ? ( - calloutErrorRegistrationServiceInfo - ) : this.state.agentNameError && - !['hp', 'sol', 'alpine'].includes(this.state.selectedOS) ? ( - - ) : missingOSSelection.length ? ( - - ) : ( - + ) : missingOSSelection.length ? ( + + ) : ( + - ), - }, - ] + ? tabWazuhControlMacos + : this.state.selectedVersion == 'solaris10' || + this.state.selectedVersion == 'solaris11' || + this.state.selectedVersion == '6.1 TL9' || + this.state.selectedVersion == '3.12.12' + ? tabWazuhControl + : this.state.selectedVersion == '11.31' + ? tabInitD + : 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 +

+
+ )} +
+
+
+
+ ), + }, + ] : []), ];