diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f6c1bfeb0..e8f7299b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Added the option to sort by the agents count in the group table. [#4323](https://github.com/wazuh/wazuh-kibana-app/pull/4323) - Added agent synchronization status in the agent module. [#3874](https://github.com/wazuh/wazuh-kibana-app/pull/3874) +- The input name was added and when the user adds a value the variable WAZUH_AGENT_NAME with its value appears in the installation command. [#4739](https://github.com/wazuh/wazuh-kibana-app/pull/4739) - Redesign the SCA table from agent's dashboard [#4512](https://github.com/wazuh/wazuh-kibana-app/pull/4512) - Enhanced the plugin setting description displayed in the UI and the configuration file. [#4501](https://github.com/wazuh/wazuh-kibana-app/pull/4501) - Added validation to the plugin settings in the form of `Settings/Configuration` and the endpoint to update the plugin configuration [#4501](https://github.com/wazuh/wazuh-kibana-app/pull/4503) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index 44baf810f7..70aef6defe 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -60,6 +60,7 @@ export const RegisterAgent = withErrorBoundary( version: '', wazuhVersion: '', serverAddress: '', + agentName: '', wazuhPassword: '', groups: [], selectedGroup: [], @@ -188,25 +189,25 @@ export const RegisterAgent = withErrorBoundary( 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') + 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') + 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') { - return ('/Library/Ossec/bin/wazuh-control start') + 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') + return ('/var/ossec/bin/wazuh-control start'); } } @@ -218,6 +219,10 @@ export const RegisterAgent = withErrorBoundary( this.setState({ serverAddress: event.target.value }); } + setAgentName(event) { + this.setState({ agentName: event.target.value }); + } + setGroupName(selectedGroup) { this.setState({ selectedGroup }); } @@ -260,9 +265,7 @@ export const RegisterAgent = withErrorBoundary( } optionalDeploymentVariables() { - let deployment = `WAZUH_MANAGER='${this.state.serverAddress}' `; - const protocol = false - + let deployment = `WAZUH_MANAGER='${this.state.serverAddress}' `; if (this.state.selectedOS == 'win') { deployment += `WAZUH_REGISTRATION_SERVER='${this.state.serverAddress}' `; } @@ -289,6 +292,16 @@ export const RegisterAgent = withErrorBoundary( return deployment; } + agentNameVariable() { + let agentName = `WAZUH_AGENT_NAME='${this.state.agentName}' `; + + if(this.state.selectedArchitecture && this.state.agentName !== '') { + return agentName; + } else { + return ''; + } + } + resolveRPMPackage() { switch (`${this.state.selectedVersion}-${this.state.selectedArchitecture}`) { case 'redhat5-i386': @@ -716,35 +729,45 @@ export const RegisterAgent = withErrorBoundary( ); + const agentName = ( + this.setAgentName(event)} + /> + ); const groupInput = ( <> {!this.state.groups.length && ( <> - - )} - -

Select one or more existing groups

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

Select one or more existing groups

+ { + this.setGroupName(group); + }} + isDisabled={!this.state.groups.length} + isClearable={true} + data-test-subj="demoComboBox" + /> +
+ ) const passwordInput = ( {groupInput}, + title: 'Assign a name and a group to the agent', + children: {agentName}{groupInput}{agentGroup}, }, { title: 'Install and enroll the agent', @@ -1468,4 +1491,4 @@ export const RegisterAgent = withErrorBoundary( ); } } -); +); \ No newline at end of file