From dd42b1cbd67c6d076110929edeb2c6fbf005a29e Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Wed, 21 Dec 2022 16:50:52 -0300 Subject: [PATCH 1/2] [Backport 7.10.2] Fixed the manager option in the agent deployment section (#5025) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed the manager option in the agent deployment section (#4981) * add manager option * add changelog * add changelog * fix test * fix typo * add getCookies and getHttp (test) * Fixed unit tests * fix comment Co-authored-by: Álex Co-authored-by: Maximiliano Ibarra (cherry picked from commit 65e156b9113a83bf523c5d985daadf97dce2a862) * Update CHANGELOG.md --- CHANGELOG.md | 1 + .../components/register-agent-service.test.ts | 262 ++++++++++-------- .../components/register-agent-service.ts | 121 +++++--- .../agent/components/register-agent.js | 3 +- .../steps/server-address.test.tsx | 42 ++- 5 files changed, 274 insertions(+), 155 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 832c0b5b6a..ae546dc365 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,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) [#5010](https://github.com/wazuh/wazuh-kibana-app/pull/5010) - 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 manager option in the agent deployment section [#4981](https://github.com/wazuh/wazuh-kibana-app/pull/4981) - Fixed commands in the deploy new agent section(most of the commands are missing '-1') [#4962](https://github.com/wazuh/wazuh-kibana-app/pull/4962) - Fixed Inventory checks table filters by stats [#4999](https://github.com/wazuh/wazuh-kibana-app/pull/4999) - Fixed vulnerabilities default last scan date formatter [#4975](https://github.com/wazuh/wazuh-kibana-app/pull/4975) diff --git a/public/controllers/agent/components/register-agent-service.test.ts b/public/controllers/agent/components/register-agent-service.test.ts index 44eb49b776..e61c0bc57a 100644 --- a/public/controllers/agent/components/register-agent-service.test.ts +++ b/public/controllers/agent/components/register-agent-service.test.ts @@ -3,12 +3,21 @@ import { WzRequest } from '../../../react-services/wz-request'; import { ServerAddressOptions } from '../register-agent/steps'; jest.mock('../../../react-services', () => ({ - ...jest.requireActual('../../../react-services') as object, + ...(jest.requireActual('../../../react-services') as object), WzRequest: () => ({ apiReq: jest.fn(), }), })); +const mockedResponseClusterStatus = { + data: { + data: { + enabled: 'yes', + running: 'yes', + }, + error: 0, + }, +}; describe('Register agent service', () => { beforeEach(() => jest.clearAllMocks()); @@ -41,9 +50,15 @@ describe('Register agent service', () => { }, }, }; - WzRequest.apiReq = jest.fn().mockResolvedValueOnce(mockedResponse); + + WzRequest.apiReq = jest + .fn() + .mockResolvedValueOnce(mockedResponseClusterStatus) + .mockResolvedValueOnce(mockedResponse); const nodeName = 'example-node'; - const res = await RegisterAgentService.getRemoteConfiguration('example-node'); + const res = await RegisterAgentService.getRemoteConfiguration( + 'example-node', + ); expect(res.name).toBe(nodeName); expect(res.haveSecureConnection).toBe(true); }); @@ -69,130 +84,149 @@ describe('Register agent service', () => { }, }, }; - WzRequest.apiReq = jest.fn().mockResolvedValueOnce(mockedResponse); + WzRequest.apiReq = jest + .fn() + .mockResolvedValueOnce(mockedResponseClusterStatus) + .mockResolvedValueOnce(mockedResponse); const nodeName = 'example-node'; - const res = await RegisterAgentService.getRemoteConfiguration('example-node'); + const res = await RegisterAgentService.getRemoteConfiguration( + 'example-node', + ); expect(res.name).toBe(nodeName); expect(res.haveSecureConnection).toBe(false); }); it('should return protocols UDP when is the only connection protocol available', async () => { - const remoteWithSecureAndNoSecure = [ - { - connection: 'syslog', - ipv6: 'no', - protocol: ['UDP'], - port: '514', - 'allowed-ips': ['0.0.0.0/0'], - }, - { - connection: 'secure', - ipv6: 'no', - protocol: ['UDP'], - port: '1514', - queue_size: '131072', - }, - ]; - const mockedResponse = { + const remoteWithSecureAndNoSecure = [ + { + connection: 'syslog', + ipv6: 'no', + protocol: ['UDP'], + port: '514', + 'allowed-ips': ['0.0.0.0/0'], + }, + { + connection: 'secure', + ipv6: 'no', + protocol: ['UDP'], + port: '1514', + queue_size: '131072', + }, + ]; + const mockedResponse = { + data: { data: { - data: { - affected_items: [ - { - remote: remoteWithSecureAndNoSecure, - }, - ], - }, + affected_items: [ + { + remote: remoteWithSecureAndNoSecure, + }, + ], }, - }; - WzRequest.apiReq = jest.fn().mockResolvedValueOnce(mockedResponse); - const nodeName = 'example-node'; - const res = await RegisterAgentService.getRemoteConfiguration('example-node'); - expect(res.name).toBe(nodeName); - expect(res.isUdp).toEqual(true); - }); + }, + }; + WzRequest.apiReq = jest + .fn() + .mockResolvedValueOnce(mockedResponseClusterStatus) + .mockResolvedValueOnce(mockedResponse); + const nodeName = 'example-node'; + const res = await RegisterAgentService.getRemoteConfiguration( + 'example-node', + ); + expect(res.name).toBe(nodeName); + expect(res.isUdp).toEqual(true); + }); - it('should return protocols TCP when is the only connection protocol available', async () => { - const remoteWithSecureAndNoSecure = [ - { - connection: 'syslog', - ipv6: 'no', - protocol: ['TCP'], - port: '514', - 'allowed-ips': ['0.0.0.0/0'], - }, - { - connection: 'secure', - ipv6: 'no', - protocol: ['TCP'], - port: '1514', - queue_size: '131072', - }, - ]; - const mockedResponse = { + it('should return protocols TCP when is the only connection protocol available', async () => { + const remoteWithSecureAndNoSecure = [ + { + connection: 'syslog', + ipv6: 'no', + protocol: ['TCP'], + port: '514', + 'allowed-ips': ['0.0.0.0/0'], + }, + { + connection: 'secure', + ipv6: 'no', + protocol: ['TCP'], + port: '1514', + queue_size: '131072', + }, + ]; + const mockedResponse = { + data: { data: { - data: { - affected_items: [ - { - remote: remoteWithSecureAndNoSecure, - }, - ], - }, + affected_items: [ + { + remote: remoteWithSecureAndNoSecure, + }, + ], }, - }; - WzRequest.apiReq = jest.fn().mockResolvedValueOnce(mockedResponse); - const nodeName = 'example-node'; - const res = await RegisterAgentService.getRemoteConfiguration('example-node'); - expect(res.name).toBe(nodeName); - expect(res.isUdp).toEqual(false); - }); + }, + }; + WzRequest.apiReq = jest + .fn() + .mockResolvedValueOnce(mockedResponseClusterStatus) + .mockResolvedValueOnce(mockedResponse); + const nodeName = 'example-node'; + const res = await RegisterAgentService.getRemoteConfiguration( + 'example-node', + ); + expect(res.name).toBe(nodeName); + expect(res.isUdp).toEqual(false); + }); - it('should return is not UDP when have UDP and TCP protocols available', async () => { - const remoteWithSecureAndNoSecure = [ - { - connection: 'syslog', - ipv6: 'no', - protocol: ['TCP'], - port: '514', - 'allowed-ips': ['0.0.0.0/0'], - }, - { - connection: 'secure', - ipv6: 'no', - protocol: ['UDP'], - port: '1514', - queue_size: '131072', - }, - ]; - const mockedResponse = { + it('should return is not UDP when have UDP and TCP protocols available', async () => { + const remoteWithSecureAndNoSecure = [ + { + connection: 'syslog', + ipv6: 'no', + protocol: ['TCP'], + port: '514', + 'allowed-ips': ['0.0.0.0/0'], + }, + { + connection: 'secure', + ipv6: 'no', + protocol: ['UDP'], + port: '1514', + queue_size: '131072', + }, + ]; + const mockedResponse = { + data: { data: { - data: { - affected_items: [ - { - remote: remoteWithSecureAndNoSecure, - }, - ], - }, + affected_items: [ + { + remote: remoteWithSecureAndNoSecure, + }, + ], }, - }; - WzRequest.apiReq = jest.fn().mockResolvedValueOnce(mockedResponse); - const nodeName = 'example-node'; - const res = await RegisterAgentService.getRemoteConfiguration('example-node'); - expect(res.name).toBe(nodeName); - expect(res.isUdp).toEqual(false); - }); + }, + }; + WzRequest.apiReq = jest + .fn() + .mockResolvedValueOnce(mockedResponseClusterStatus) + .mockResolvedValueOnce(mockedResponse); + const nodeName = 'example-node'; + const res = await RegisterAgentService.getRemoteConfiguration( + 'example-node', + ); + expect(res.name).toBe(nodeName); + expect(res.isUdp).toEqual(false); + }); }); describe('getConnectionConfig', () => { - beforeAll(() => { jest.clearAllMocks(); - }) + }); it('should return IS NOT UDP when the server address is typed manually (custom)', async () => { const nodeSelected: ServerAddressOptions = { label: 'node-selected', value: 'node-selected', - nodetype: 'master' + nodetype: 'master', }; const remoteWithSecureAndNoSecure = [ @@ -223,17 +257,20 @@ describe('Register agent service', () => { }, }; WzRequest.apiReq = jest.fn().mockResolvedValueOnce(mockedResponse); - - const config = await RegisterAgentService.getConnectionConfig(nodeSelected, 'default-dns-address'); + + const config = await RegisterAgentService.getConnectionConfig( + nodeSelected, + 'default-dns-address', + ); expect(config.udpProtocol).toEqual(false); expect(config.serverAddress).toBe('default-dns-address'); - }) + }); it('should return IS NOT UDP when the server address is received like default server address dns (custom)', async () => { const nodeSelected: ServerAddressOptions = { label: 'node-selected', value: 'node-selected', - nodetype: 'master' + nodetype: 'master', }; const remoteWithSecureAndNoSecure = [ @@ -264,9 +301,12 @@ describe('Register agent service', () => { }, }; WzRequest.apiReq = jest.fn().mockResolvedValueOnce(mockedResponse); - - const config = await RegisterAgentService.getConnectionConfig(nodeSelected, 'custom-server-address'); + + const config = await RegisterAgentService.getConnectionConfig( + nodeSelected, + 'custom-server-address', + ); expect(config.udpProtocol).toEqual(false); - }) - }) + }); + }); }); diff --git a/public/controllers/agent/components/register-agent-service.ts b/public/controllers/agent/components/register-agent-service.ts index b24cd67057..bc9029f8ba 100644 --- a/public/controllers/agent/components/register-agent-service.ts +++ b/public/controllers/agent/components/register-agent-service.ts @@ -17,22 +17,47 @@ type RemoteConfig = { haveSecureConnection: boolean | null; }; +/** + * Get the cluster status + */ +export const clusterStatusResponse = async (): Promise => { + const clusterStatus = await WzRequest.apiReq('GET', '/cluster/status', {}); + if ( + clusterStatus.data.data.enabled === 'yes' && + clusterStatus.data.data.running === 'yes' + ) { + // Cluster mode + return true; + } else { + // Manager mode + return false; + } +}; + /** * Get the remote configuration from api */ -async function getRemoteConfiguration( - nodeName: string, -): Promise{ +async function getRemoteConfiguration(nodeName: string): Promise { let config: RemoteConfig = { name: nodeName, isUdp: null, haveSecureConnection: null, }; - const result = await WzRequest.apiReq( - 'GET', - `/cluster/${nodeName}/configuration/request/remote`, - {}, - ); + const clusterStatus = await clusterStatusResponse(); + let result; + if (clusterStatus) { + result = await WzRequest.apiReq( + 'GET', + `/cluster/${nodeName}/configuration/request/remote`, + {}, + ); + } else { + result = await WzRequest.apiReq( + 'GET', + '/manager/configuration/request/remote', + {}, + ); + } const items = ((result.data || {}).data || {}).affected_items || []; const remote = items[0]?.remote; if (remote) { @@ -56,11 +81,11 @@ async function getRemoteConfiguration( getRemoteProtocol(protocolsAvailable) === 'UDP' ? true : false; } return config; -}; +} /** * Get the remote protocol available from list of protocols - * @param protocols + * @param protocols */ function getRemoteProtocol(protocols: Protocol[]) { if (protocols.length === 1) { @@ -68,15 +93,17 @@ function getRemoteProtocol(protocols: Protocol[]) { } else { return !protocols.includes('TCP') ? 'UDP' : 'TCP'; } -}; - +} /** * Get the remote configuration from nodes registered in the cluster and decide the protocol to setting up in deploy agent param - * @param nodeSelected - * @param defaultServerAddress + * @param nodeSelected + * @param defaultServerAddress */ -async function getConnectionConfig(nodeSelected: ServerAddressOptions, defaultServerAddress?: string) { +async function getConnectionConfig( + nodeSelected: ServerAddressOptions, + defaultServerAddress?: string, +) { const nodeName = nodeSelected?.label; const nodeIp = nodeSelected?.value; if(!defaultServerAddress){ @@ -86,8 +113,12 @@ async function getConnectionConfig(nodeSelected: ServerAddressOptions, defaultSe }else{ return { serverAddress: nodeName, udpProtocol: false, connectionSecure: true }; } - }else{ - return { serverAddress: defaultServerAddress, udpProtocol: false, connectionSecure: true }; + } else { + return { + serverAddress: defaultServerAddress, + udpProtocol: false, + connectionSecure: true, + }; } } @@ -95,15 +126,15 @@ type NodeItem = { name: string; ip: string; type: string; -} +}; type NodeResponse = { data: { data: { affected_items: NodeItem[]; - } - } -} + }; + }; +}; /** * Get the list of the cluster nodes and parse it into a list of options @@ -112,11 +143,25 @@ export const getNodeIPs = async (): Promise => { return await WzRequest.apiReq('GET', '/cluster/nodes', {}); }; +/** + * Get the list of the manager and parse it into a list of options + */ +export const getManagerNode = async (): Promise => { + const managerNode = await WzRequest.apiReq('GET', '/manager/api/config', {}); + return managerNode?.data?.data?.affected_items?.map(item => ({ + label: item.node_name, + value: item.node_api_config.host, + nodetype: 'master', + })) || []; +}; + /** * Parse the nodes list from the API response to a format that can be used by the EuiComboBox * @param nodes */ -export const parseNodesInOptions = (nodes: NodeResponse): ServerAddressOptions[] => { +export const parseNodesInOptions = ( + nodes: NodeResponse, +): ServerAddressOptions[] => { return nodes.data.data.affected_items.map((item: NodeItem) => ({ label: item.name, value: item.ip, @@ -127,22 +172,30 @@ export const parseNodesInOptions = (nodes: NodeResponse): ServerAddressOptions[] /** * Get the list of the cluster nodes from API and parse it into a list of options */ -export const fetchClusterNodesOptions = async (): Promise => { - const nodes = await getNodeIPs(); - return parseNodesInOptions(nodes); -} +export const fetchClusterNodesOptions = async (): Promise< + ServerAddressOptions[] +> => { + const clusterStatus = await clusterStatusResponse(); + if (clusterStatus) { + // Cluster mode + // Get the cluster nodes + const nodes = await getNodeIPs(); + return parseNodesInOptions(nodes); + } else { + // Manager mode + // Get the manager node + return await getManagerNode(); + } +}; /** * Get the master node data from the list of cluster nodes * @param nodeIps */ -export const getMasterNode = (nodeIps: ServerAddressOptions[]): ServerAddressOptions[] => { - return nodeIps.filter((nodeIp) => nodeIp.nodetype === 'master'); +export const getMasterNode = ( + nodeIps: ServerAddressOptions[], +): ServerAddressOptions[] => { + return nodeIps.filter(nodeIp => nodeIp.nodetype === 'master'); }; - - -export { - getConnectionConfig, - getRemoteConfiguration, -} \ No newline at end of file +export { getConnectionConfig, getRemoteConfiguration }; diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index 9e2332ae3f..ee4cbafba8 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -872,7 +872,6 @@ export const RegisterAgent = withErrorBoundary(

); const missingOSSelection = this.checkMissingOSSelection(); - const agentName = ( ); } - }, + } ); diff --git a/public/controllers/agent/register-agent/steps/server-address.test.tsx b/public/controllers/agent/register-agent/steps/server-address.test.tsx index 86dd698c7f..ce3e8c513e 100644 --- a/public/controllers/agent/register-agent/steps/server-address.test.tsx +++ b/public/controllers/agent/register-agent/steps/server-address.test.tsx @@ -5,6 +5,31 @@ import { act } from 'react-dom/test-utils'; import ServerAddress from './server-address'; import * as registerAgentsUtils from '../../components/register-agent-service'; +jest.mock('../../../../kibana-services', () => ({ + ...(jest.requireActual('../../../../kibana-services') as object), + getHttp: jest.fn().mockReturnValue({ + basePath: { + get: () => { + return 'http://localhost:5601'; + }, + prepend: url => { + return `http://localhost:5601${url}`; + }, + }, + }), + getCookies: jest.fn().mockReturnValue({ + set: (name, value, options) => { + return true; + }, + get: () => { + return '{}'; + }, + remove: () => { + return; + }, + }), +})); + const mockedNodesIps = [ { name: 'master-node', @@ -84,7 +109,7 @@ describe('Server Address Combobox', () => { await promiseFetchOptions; expect(onChangeMocked).toBeCalledTimes(1); expect(onChangeMocked).toBeCalledWith([ - { label: 'default-dns', value: 'default-dns', nodetype: 'custom' } + { label: 'default-dns', value: 'default-dns', nodetype: 'custom' }, ]); expect(getByText('default-dns')).toBeInTheDocument(); expect(getByRole('textbox')).toHaveAttribute('disabled'); @@ -116,12 +141,11 @@ describe('Server Address Combobox', () => { await findByText(`${mockedNodesIps[1].name}:${mockedNodesIps[1].ip}`); await findByText(`${mockedNodesIps[2].name}:${mockedNodesIps[2].ip}`); }); - }); it('should allow only single selection', async () => { const onChangeMocked = jest.fn(); - const { getByRole, getByText,findByText } = render( + const { getByRole, getByText, findByText } = render( { fireEvent.keyDown(serverAddresInput, { key: 'Enter', code: 'Enter' }); fireEvent.change(serverAddresInput, { target: { value: 'last-typed' } }); fireEvent.keyDown(serverAddresInput, { key: 'Enter', code: 'Enter' }); - expect(onChangeMocked).toHaveBeenLastCalledWith([{ label: 'last-typed', value: 'last-typed', nodetype: 'custom' }]); + expect(onChangeMocked).toHaveBeenLastCalledWith([ + { label: 'last-typed', value: 'last-typed', nodetype: 'custom' }, + ]); expect(getByText('last-typed')).toBeInTheDocument(); }); }); @@ -173,7 +199,9 @@ describe('Server Address Combobox', () => { }); fireEvent.keyDown(getByRole('textbox'), { key: 'Enter', code: 'Enter' }); expect(onChangeMocked).toBeCalledTimes(2); - expect(onChangeMocked).toHaveBeenNthCalledWith(2,[{ label: 'custom-ip-dns', value: 'custom-ip-dns', nodetype: 'custom' }]); + expect(onChangeMocked).toHaveBeenNthCalledWith(2, [ + { label: 'custom-ip-dns', value: 'custom-ip-dns', nodetype: 'custom' }, + ]); }); }); @@ -187,9 +215,7 @@ describe('Server Address Combobox', () => { }); mockedNodesIps.forEach(nodeItem => { - expect( - getByText(`${nodeItem.name}:${nodeItem.ip}`), - ).toBeInTheDocument(); + expect(getByText(`${nodeItem.name}:${nodeItem.ip}`)).toBeInTheDocument(); }); }); }); From 549edd0e1cc989c8f97056aff2185a9485108658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chantal=20Bel=C3=A9n=20kelm?= <99441266+chantal-kelm@users.noreply.github.com> Date: Thu, 22 Dec 2022 10:06:44 -0300 Subject: [PATCH 2/2] Fix deploy new agent section (#4933) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * accordion and alpine os * changes * changes * changes * changes * alpine versions commands * commands for alpine and architecture macos * message install and start alpine * CHANGELOG * command debian * command raspbian * Added link for additional steps to alpine os and changelog * clear code * clean code * fixed windows command * deploy new agent section: command fixed for solaris * Fix the agent installation command for macOS (#4968) * Fixed the agent installation command for macOS * CHANGELOG * Update CHANGELOG.md * Fix agent deployment instructions for HP-UX and Solaris (#4943) * removing auto-deploy variables in hp and solaris * hide wazuh server address sections, assign group and assign name to agent when os is hp or solaris * update hp command * removing auto-deploy variables in alpine * move message additional installation steps * links and messages os * changelog * red hat, centos and windows commands fixed * Deploy new agent section: change the commands for all os * Deploy new agent section: change commands for all os * clean code * update commands * Deploy new agents: Update commands * Deploy new agents: Update commands * comand windows * oracleLinux command * warningcOMAND Co-authored-by: Álex --- CHANGELOG.md | 5 + .../agent/components/register-agent.js | 1658 +++++++++-------- .../agent/components/wz-accordion.tsx | 59 + .../controllers/agent/wazuh-config/index.ts | 164 +- public/styles/component.scss | 112 +- 5 files changed, 1108 insertions(+), 890 deletions(-) create mode 100644 public/controllers/agent/components/wz-accordion.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index ae546dc365..8854ac38fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ 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) +- Deploy new agent section: Added link for additional steps to alpine os. [#4933](https://github.com/wazuh/wazuh-kibana-app/pull/4933) - Added file saving conditions in File Editor [#4970](https://github.com/wazuh/wazuh-kibana-app/pull/4970) - Added character validation to avoid invalid agent names in the section 'Deploy new agent'. [#5021](https://github.com/wazuh/wazuh-kibana-app/pull/5021) @@ -50,6 +52,9 @@ All notable changes to the Wazuh app project will be documented in this file. - 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 manager option in the agent deployment section [#4981](https://github.com/wazuh/wazuh-kibana-app/pull/4981) - Fixed commands in the deploy new agent section(most of the commands are missing '-1') [#4962](https://github.com/wazuh/wazuh-kibana-app/pull/4962) +- Fixed agent installation command for macOS in the deploy new agent section. [#4968](https://github.com/wazuh/wazuh-kibana-app/pull/4968) +- Deploy new agent section: 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) +- Fixed agent deployment instructions for HP-UX and Solaris. [#4943](https://github.com/wazuh/wazuh-kibana-app/pull/4943) - Fixed Inventory checks table filters by stats [#4999](https://github.com/wazuh/wazuh-kibana-app/pull/4999) - Fixed vulnerabilities default last scan date formatter [#4975](https://github.com/wazuh/wazuh-kibana-app/pull/4975) diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index ee4cbafba8..1004a47aee 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 { @@ -36,7 +36,7 @@ import { EuiLink, EuiFormRow, EuiFormControlLayout, - EuiForm + EuiForm, } from '@elastic/eui'; import { WzRequest } from '../../../react-services/wz-request'; import { withErrorBoundary } from '../../../components/common/hocs'; @@ -61,7 +61,7 @@ import { versionButtonsRedHat, versionButtonsCentos, architectureButtonsMacos, - osButtons, + osPrincipalButtons, versionButtonsDebian, versionButtonsUbuntu, versionButtonsWindows, @@ -70,12 +70,14 @@ import { versionButtonsSolaris, versionButtonsAix, versionButtonsHPUX, + versionButtonAlpine, } from '../wazuh-config'; import ServerAddress from '../register-agent/steps/server-address'; import { getConnectionConfig, fetchClusterNodesOptions, } from './register-agent-service'; +import { PrincipalButtonGroup } from './wz-accordion'; export const RegisterAgent = withErrorBoundary( class RegisterAgent extends Component { @@ -84,6 +86,13 @@ export const RegisterAgent = withErrorBoundary( this.wazuhConfig = new WazuhConfig(); this.configuration = this.wazuhConfig.getConfig(); this.addToVersion = '-1'; + this.wazuhRpmVariable = '/wazuh-agent.rpm'; + this.wazuhDebVariable = '/wazuh-agent.deb'; + this.wazuhMsiVariable = '/wazuh-agent.msi'; + this.wazuhPkgVariable = '/wazuh-agent.pkg'; + this.wazuhP5pVariable = '/wazuh-agent.p5p'; + this.wazuhTarVariable = '/wazuh-agent.tar'; + this.state = { status: 'incomplete', selectedOS: '', @@ -105,6 +114,7 @@ export const RegisterAgent = withErrorBoundary( showPassword: false, showProtocol: true, connectionSecure: true, + isAccordionOpen: false, }; this.restartAgentCommand = { rpm: this.systemSelector(), @@ -112,8 +122,8 @@ export const RegisterAgent = withErrorBoundary( deb: this.systemSelector(), ubu: this.systemSelector(), oraclelinux: this.systemSelector(), - macos: 'sudo /Library/Ossec/bin/wazuh-control start', - win: 'NET START WazuhSvc', + macos: this.systemSelectorWazuhControlMacos(), + win: this.systemSelectorNet(), }; } @@ -236,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'; @@ -257,22 +266,15 @@ export const RegisterAgent = withErrorBoundary( systemSelectorNet() { if ( this.state.selectedVersion === 'windowsxp' || - this.state.selectedVersion === 'windows8' + this.state.selectedVersion === 'windowsserver2008' || + this.state.selectedVersion === 'windows7' ) { - return 'update-rc.d wazuh-agent defaults && service wazuh-agent start'; + return 'NET START WazuhSvc'; } } 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' - ) { + if (this.state.selectedVersion == 'sierra') { return '/Library/Ossec/bin/wazuh-control start'; } } @@ -282,9 +284,14 @@ 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 === '3.12.12' ) { return '/var/ossec/bin/wazuh-control start'; + } else { + this.state.selectedVersion === '11.31'; + } + { + return '/sbin/init.d/wazuh-agent start'; } } @@ -299,14 +306,20 @@ export const RegisterAgent = withErrorBoundary( setAgentName(event) { const validation = /^[a-z0-9-_.]+$/i; this.setState({ agentName: event.target.value }); - if (validation.test(event.target.value) || event.target.value.length <= 0) { + if ( + validation.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(validation, '')).join(''); - badCharacters = badCharacters.split('').map(char => - char.replace(/\s/, 'whitespace')); + let badCharacters = event.target.value + .split('') + .map(char => char.replace(validation, '')) + .join(''); + badCharacters = badCharacters + .split('') + .map(char => char.replace(/\s/, 'whitespace')); const characters = [...new Set(badCharacters)]; this.setState({ badCharacters: characters }); this.setState({ agentNameError: true }); @@ -371,7 +384,7 @@ export const RegisterAgent = withErrorBoundary( } if (this.state.udpProtocol) { - deployment += `WAZUH_PROTOCOL='UDP' `; + deployment += "WAZUH_PROTOCOL='UDP' "; } if (this.state.selectedGroup.length) { @@ -390,6 +403,14 @@ export const RegisterAgent = withErrorBoundary( 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 { @@ -399,301 +420,301 @@ 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`; + return `https://packages.wazuh.com/4.x/yum5/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm${this.wazuhRpmVariable}`; case 'redhat5-x86_64': - return `https://packages.wazuh.com/4.x/yum5/x86_64/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum5/x86_64/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.x86_64.rpm${this.wazuhRpmVariable}`; case 'redhat6-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'redhat6-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'redhat6-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'redhat6-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case 'redhat7-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'redhat7-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'redhat7-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'redhat7-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case 'redhat7-powerpc': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm${this.wazuhRpmVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; } } 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"`; + return 'https://packages.wazuh.com/key/cicd%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/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; + return 'https://packages.wazuh.com/key/cicd%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/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; + return 'https://packages.wazuh.com/key/cicd%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/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; + return 'https://packages.wazuh.com/key/cicd%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/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; + return 'https://packages.wazuh.com/key/cicd%40wazuh.com-633d7457.rsa.pub && echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"'; default: - return `https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && \echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"`; + return 'https://packages.wazuh.com/key/cicd%40wazuh.com-633d7457.rsa.pub && echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"'; } } 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}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'oraclelinux5-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'oraclelinux5-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'oraclelinux5-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case 'oraclelinux5-powerpc': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm${this.wazuhRpmVariable}`; case 'oraclelinux6-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'oraclelinux6-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'oraclelinux6-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'oraclelinux6-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; } } 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}${this.addToVersion}.el5.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm${this.wazuhRpmVariable}`; case 'centos5-x86_64': - return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.x86_64.rpm${this.wazuhRpmVariable}`; case 'centos6-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'centos6-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'centos6-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'centos6-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case 'centos7-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'centos7-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'centos7-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'centos7-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case 'centos7-powerpc': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm${this.wazuhRpmVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; } } 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}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'suse11-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'suse12-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'suse12-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'suse12-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'suse12-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case 'suse12-powerpc': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm${this.wazuhRpmVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; } } 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}${this.addToVersion}.el5.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm${this.wazuhRpmVariable}`; case '22-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case '22-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case '22-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case '22-powerpc': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm${this.wazuhRpmVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; } } 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`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'amazonlinux1-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'amazonlinux1-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'amazonlinux1-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case 'amazonlinux1-powerpc': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2-powerpc': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.ppc64le.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2022-i386': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2022-aarch64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aarch64.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2022-x86_64': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'amazonlinux2022-armhf': - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; } } resolveDEBPackage() { switch (`${this.state.selectedArchitecture}`) { case 'i386': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_i386.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_i386.deb${this.wazuhDebVariable}`; case 'aarch64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_arm64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_arm64.deb${this.wazuhDebVariable}`; case 'armhf': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_armhf.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_armhf.deb${this.wazuhDebVariable}`; case 'x86_64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb${this.wazuhDebVariable}`; case 'powerpc': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}.ppc64el.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_ppc64el.deb${this.wazuhDebVariable}`; default: - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb${this.wazuhDebVariable}`; } } 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`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_i386.deb${this.wazuhDebVariable}`; case 'busterorgreater-aarch64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_arm64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_arm64.deb${this.wazuhDebVariable}`; case 'busterorgreater-armhf': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_armhf.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_armhf.deb${this.wazuhDebVariable}`; case 'busterorgreater-x86_64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb${this.wazuhDebVariable}`; case 'busterorgreater-powerpc': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}.ppc64el.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}_ppc64el.deb${this.wazuhDebVariable}`; default: - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb${this.wazuhDebVariable}`; } } 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`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_i386.deb${this.wazuhDebVariable}`; case 'ubuntu14-aarch64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_arm64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_arm64.deb${this.wazuhDebVariable}`; case 'ubuntu14-armhf': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_armhf.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_armhf.deb${this.wazuhDebVariable}`; case 'ubuntu14-x86_64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb${this.wazuhDebVariable}`; case 'ubuntu15-i386': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_i386.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_i386.deb${this.wazuhDebVariable}`; case 'ubuntu15-aarch64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_arm64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_arm64.deb${this.wazuhDebVariable}`; case 'ubuntu15-armhf': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_armhf.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_armhf.deb${this.wazuhDebVariable}`; case 'ubuntu15-x86_64': - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb${this.wazuhDebVariable}`; default: - return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb`; + return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_amd64.deb${this.wazuhDebVariable}`; } } 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}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; case 'leap15-ARM64': - return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm`; + return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.armv7hl.rpm${this.wazuhRpmVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; } } 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`; + return `https://packages.wazuh.com/4.x/solaris/i386/10/wazuh-agent_v${this.state.wazuhVersion}-sol10-i386.pkg${this.wazuhPkgVariable}`; case 'solaris10-sparc': - return `https://packages.wazuh.com/4.x/solaris/sparc/10/wazuh-agent-${this.state.wazuhVersion}-sol10-sparc.pkg`; + return `https://packages.wazuh.com/4.x/solaris/sparc/10/wazuh-agent_v${this.state.wazuhVersion}-sol10-sparc.pkg${this.wazuhPkgVariable}`; case 'solaris11-i386': - return `https://packages.wazuh.com/4.x/solaris/i386/11/wazuh-agent-${this.state.wazuhVersion}-sol11-i386.p5p`; + return `https://packages.wazuh.com/4.x/solaris/i386/11/wazuh-agent_v${this.state.wazuhVersion}-sol11-i386.p5p${this.wazuhP5pVariable}`; 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_v${this.state.wazuhVersion}-sol11-sparc.p5p${this.wazuhP5pVariable}`; default: - 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_v${this.state.wazuhVersion}-sol11-sparc.p5p${this.wazuhP5pVariable}`; } } 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}${this.addToVersion}.aix.ppc.rpm`; + return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aix.ppc.rpm${this.wazuhRpmVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aix.ppc.rpm`; + return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.aix.ppc.rpm${this.wazuhRpmVariable}`; } } 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}${this.addToVersion}-hpux-11v3-ia64.tar`; + return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}-hpux-11v3-ia64.tar${this.wazuhTarVariable}`; default: - return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}-hpux-11v3-ia64.tar`; + return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}-hpux-11v3-ia64.tar${this.wazuhTarVariable}`; } } @@ -728,7 +749,7 @@ export const RegisterAgent = withErrorBoundary( case 'alpine': return this.resolveAlpinePackage(); default: - return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; + return `https://packages.wazuh.com/4.x/yum/x86_64/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm${this.wazuhRpmVariable}`; } } @@ -842,6 +863,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 []; } @@ -854,6 +882,7 @@ export const RegisterAgent = withErrorBoundary( return 'bash'; } } + render() { const appVersionMajorDotMinor = this.state.wazuhVersion .split('.') @@ -863,30 +892,34 @@ export const RegisterAgent = withErrorBoundary( 'user-manual/agents/agent-connection.html', appVersionMajorDotMinor, ); - const textAndLinkToCheckConnectionDocumentation = ( -

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

+ + const urlWazuhAgentEnrollment = webDocumentationLink( + 'user-manual/agent-enrollment/index.html', + appVersionMajorDotMinor, ); + + const urlWindowsPackage = `https://packages.wazuh.com/4.x/windows/wazuh-agent-${this.state.wazuhVersion}-1.msi`; + const missingOSSelection = this.checkMissingOSSelection(); const agentName = ( ` "${char}"`)} - ${this.state.badCharacters.length <= 1 ? ('is') : ('are')} - not valid. Allowed characters are A-Z, a-z, ".", "-", "_"`]}> + ${this.state.badCharacters.length <= 1 ? 'is' : 'are'} + not valid. Allowed characters are A-Z, a-z, ".", "-", "_"`, + ]} + > this.setAgentName(event)} /> + onChange={event => this.setAgentName(event)} + /> - +
); const groupInput = ( <> @@ -930,37 +963,56 @@ 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/cicd@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 - }.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' - }`, + debText: `curl -so wazuh-agent.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i .${ + this.wazuhDebVariable + }`, + ubuText: `curl -so wazuh-agent.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i .${ + this.wazuhDebVariable + }`, + macosText: `curl -so wazuh-agent.pkg https://packages.wazuh.com/4.x/macos/wazuh-agent-${ + this.state.wazuhVersion + }-1.pkg${ + this.wazuhPkgVariable + } && sudo launchctl setenv ${this.optionalDeploymentVariables()}${this.agentNameVariable()}&& sudo installer -pkg .${ + this.wazuhPkgVariable + } -target /`, + 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${ + this.wazuhMsiVariable + } -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' + ? 'wazuh-agent.p5p' + : 'wazuh-agent.pkg' + } ${this.optionalPackages()}${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`, + 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()}`, 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.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i .${ + this.wazuhDebVariable + }`, }; const field = `${this.state.selectedOS}Text`; @@ -968,10 +1020,44 @@ 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 textAndLinkToCheckConnectionDocumentation = ( +

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

+ ); + const messageExtraSteps = ( +

+ After installing the agent, you need to enroll it in the Wazuh server. + Check the Wazuh agent enrollment{' '} + + Wazuh agent enrollment{' '} + + section to learn more. +

+ ); + const warningCommand = ( + <> +

+ 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' && ( <> -
    +
    • You will need administrator privileges to perform this @@ -1016,10 +1102,17 @@ export const RegisterAgent = withErrorBoundary( ) : 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. -

      + {this.state.agentName.length > 0 ? ( +

      + You can use this command to install and enroll the Wazuh + agent. +

      + ) : ( +

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

      + )} {windowsAdvice} + {this.state.selectedVersion === 'windowsxp' && ( + <> + + + + )} + {this.state.selectedVersion === 'windowsserver2008' && ( + <> + + + + )}
      {this.state.wazuhPassword && !this.state.showPassword @@ -1043,6 +1156,118 @@ export const RegisterAgent = withErrorBoundary( )}
      + {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 == '3.12.12' ? ( + + 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.needsPassword && ( {windowsAdvice} + {this.state.selectedVersion === 'windowsxp' && ( + <> + + + + )} + {this.state.selectedVersion === 'windowsserver2008' && ( + <> + + + + )}
      {this.state.wazuhPassword && !this.state.showPassword @@ -1123,6 +1368,26 @@ export const RegisterAgent = withErrorBoundary( /> {windowsAdvice} + {this.state.selectedVersion === 'windowsxp' && ( + <> + + + + )} + {this.state.selectedVersion === 'windowsserver2008' && ( + <> + + + + )}
      {this.state.wazuhPassword && !this.state.showPassword @@ -1176,6 +1441,9 @@ export const RegisterAgent = withErrorBoundary(
      {textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''} ), @@ -1206,6 +1474,9 @@ export const RegisterAgent = withErrorBoundary(
      {textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''} ), @@ -1236,6 +1507,9 @@ export const RegisterAgent = withErrorBoundary( {textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''} ), @@ -1266,6 +1540,9 @@ export const RegisterAgent = withErrorBoundary( {textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''} ), @@ -1296,6 +1573,9 @@ export const RegisterAgent = withErrorBoundary( {textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''} ), @@ -1315,117 +1595,6 @@ export const RegisterAgent = withErrorBoundary( ); }; - 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 - - . - - } - > - ) : ( - '' - )} - - ); - }; - const selectedVersionMac = (legend, options, idSelected, onChange) => { return ( this.selectOS(os), + children: ( + 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: 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: 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: 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: 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: 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: 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: 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: 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), + ), + }, + ] : []), ...(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), + ), + }, + ] : []), ...(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 == '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 == 'windows8' + 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' || - 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 == '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), + ), + }, + ] + : []), + ...(!( + this.state.selectedOS == 'hp' || + this.state.selectedOS == 'sol' || + this.state.selectedOS == 'alpine' + ) + ? [ + { + title: 'Wazuh server address', + children: ( + + + + ), + }, + ] : []), - { - title: 'Wazuh server address', - children: ( - - - - ), - }, ...(!(!this.state.needsPassword || this.state.hidePasswordInput) ? [ - { - title: 'Wazuh password', - children: {passwordInput}, - }, - ] + { + title: 'Wazuh password', + children: {passwordInput}, + }, + ] + : []), + ...(!( + this.state.selectedOS == 'hp' || + this.state.selectedOS == 'sol' || + 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', children: this.state.gotErrorRegistrationServiceInfo ? ( @@ -1934,7 +2071,7 @@ export const RegisterAgent = withErrorBoundary( ) : this.state.agentNameError ? ( ) : missingOSSelection.length ? ( @@ -1948,41 +2085,45 @@ export const RegisterAgent = withErrorBoundary( ), }, ...(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 == '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 ? ( - - ) : 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' && - 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 +

      +
      + )} +
      +
      +
      +
      + ), + }, + ] : []), ]; @@ -2127,5 +2269,5 @@ export const RegisterAgent = withErrorBoundary( ); } - } + }, ); diff --git a/public/controllers/agent/components/wz-accordion.tsx b/public/controllers/agent/components/wz-accordion.tsx new file mode 100644 index 0000000000..eafaf073cd --- /dev/null +++ b/public/controllers/agent/components/wz-accordion.tsx @@ -0,0 +1,59 @@ +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)} + className={'action-btn-td'} + > + + + {children} + + + ); +}; diff --git a/public/controllers/agent/wazuh-config/index.ts b/public/controllers/agent/wazuh-config/index.ts index 964c60c004..24e6cbe5ac 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,15 @@ const architectureButtonsSolaris = [ { id: 'sparc', label: 'SPARC', - } + }, ]; const architectureButtonsMacos = [ { - id: 'intel', - label: 'Intel' + id: 'intel/applesilicon', + label: 'Intel/Apple Silicon', }, - { - id: 'applesilicon', - label: 'Apple Silicon' - } -] +]; const architectureButtonsOpenSuse = [ { @@ -89,21 +84,21 @@ const architectureButtonsOpenSuse = [ { id: 'ARM64', label: 'ARM64', - } + }, ]; const architectureButtonsAix = [ { id: 'powerpc', label: 'PowerPC', - } + }, ]; const architectureButtonsHpUx = [ { id: 'itanium2', label: 'Itanium2', - } + }, ]; const versionButtonAmazonLinux = [ @@ -118,8 +113,8 @@ const versionButtonAmazonLinux = [ { id: 'amazonlinux2022', label: 'Amazon Linux 2022', - } -] + }, +]; const versionButtonsRedHat = [ { @@ -167,15 +162,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 = [ { @@ -184,12 +179,8 @@ const versionButtonsUbuntu = [ }, { id: 'ubuntu15', - label: 'Ubuntu 15', + label: 'Ubuntu 15 or higher', }, - { - id: 'ubuntu16', - label: 'Ubuntu 16 or higher', - } ]; const versionButtonsWindows = [ @@ -198,9 +189,13 @@ const versionButtonsWindows = [ label: 'Windows XP', }, { - id: 'windows8', - label: 'Windows 8 or higher', - } + id: 'windowsserver2008', + label: 'Windows Server 2008', + }, + { + id: 'windows7', + label: 'Windows 7 or higher', + }, ]; const versionButtonsSuse = [ @@ -211,36 +206,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 +220,7 @@ const versionButtonsOpenSuse = [ { id: 'leap15', label: 'OpenSuse Leap 15 or higher', - } + }, ]; const versionButtonsSolaris = [ @@ -259,21 +231,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 = [ @@ -283,22 +255,29 @@ const versionButtonsOracleLinux = [ }, { id: 'oraclelinux6', - label: 'Oracle Linux 6 or later', - } + label: 'Oracle Linux 6 or higher', + }, ]; const versionButtonsRaspbian = [ { id: 'busterorgreater', label: 'Raspbian Buster or greater', - } + }, +]; + +const versionButtonAlpine = [ + { + id: '3.12.12', + label: '3.12.12 or higher', + }, ]; /** * 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 +287,9 @@ const orderOSAlphabetically = (a, b) => { return 1; } return 0; -} +}; -const osButtons = [ +const osPrincipalButtons = [ { id: 'rpm', label: 'Red Hat Enterprise Linux', @@ -319,10 +298,6 @@ const osButtons = [ id: 'cent', label: 'CentOS', }, - { - id: 'deb', - label: 'Debian', - }, { id: 'ubu', label: 'Ubuntu', @@ -335,6 +310,13 @@ const osButtons = [ id: 'macos', label: 'macOS', }, +]; + +const osButtons = [ + { + id: 'deb', + label: 'Debian', + }, { id: 'open', label: 'OpenSuse', @@ -347,30 +329,62 @@ 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, + versionButtonAlpine, + architectureButtonsMacos, + osButtons, + osPrincipalButtons, + versionButtonsDebian, + versionButtonsUbuntu, + versionButtonAmazonLinux, + versionButtonsWindows, + versionButtonsMacOS, + versionButtonsOpenSuse, + versionButtonsSolaris, + versionButtonsAix, + versionButtonsHPUX, + architectureButtonsi386, + architectureButtonsSolaris, + architectureButtonsAix, + architectureButtonsHpUx, + architectureButtonsOpenSuse, +}; 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; }