diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e3c9f88d..2eca4fa69a 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 macos apple install command [#5466](https://github.com/wazuh/wazuh-kibana-app/pull/5466) +- Fixed macos apple install command [#5466](https://github.com/wazuh/wazuh-kibana-app/pull/5466) [#5481](https://github.com/wazuh/wazuh-kibana-app/pull/5481) ## Wazuh v4.4.2 - OpenSearch Dashboards 2.6.0 - Revision 01 diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index cc674f9e70..7f79b4b964 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -403,23 +403,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 { @@ -975,6 +963,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,9 +977,7 @@ 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' @@ -1539,7 +1531,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`, serverAddress: nodeSelected, udpProtocol: this.state.haveUdpProtocol, connectionSecure: this.state.haveConnectionSecure - }); + }); }; const steps = [