diff --git a/CHANGELOG.md b/CHANGELOG.md index ee340a57ba..8802a16346 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ All notable changes to the Wazuh app project will be documented in this file. - 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 file saving conditions in File Editor [#4970](https://github.com/wazuh/wazuh-kibana-app/pull/4970) +- Deploy new agent section: Added link for additional steps to alpine os. [#4933](https://github.com/wazuh/wazuh-kibana-app/pull/4933) - Added character validation to avoid invalid agent names in the section 'Deploy new agent'. [#5021](https://github.com/wazuh/wazuh-kibana-app/pull/5021) ### Changed @@ -49,6 +50,12 @@ 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 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) +- Fixed agent deployment instructions for HP-UX and Solaris. [#4943](https://github.com/wazuh/wazuh-kibana-app/pull/4943) - Fixed a bug that caused the flyouts to close when clicking inside them [#4638](https://github.com/wazuh/wazuh-kibana-app/pull/4638) - Fixed Inventory checks table filters by stats [#4999](https://github.com/wazuh/wazuh-kibana-app/pull/4999) - Fixed agent graph in opensearch dashboard [#4942] (https://github.com/wazuh/wazuh-kibana-app/pull/4942) diff --git a/public/components/agents/sca/inventory.tsx b/public/components/agents/sca/inventory.tsx index 4d8160f245..dacb7b3cce 100644 --- a/public/components/agents/sca/inventory.tsx +++ b/public/components/agents/sca/inventory.tsx @@ -39,7 +39,10 @@ import { UIErrorSeverity, UILogLevel, } from '../../../react-services/error-orchestrator/types'; -import { API_NAME_AGENT_STATUS, UI_LOGGER_LEVELS } from '../../../../common/constants'; +import { + API_NAME_AGENT_STATUS, + UI_LOGGER_LEVELS, +} from '../../../../common/constants'; import { getErrorOrchestrator } from '../../../react-services/common-services'; import { VisualizationBasic } from '../../common/charts/visualizations/basic'; import { AppNavigate } from '../../../react-services/app-navigate'; @@ -129,7 +132,7 @@ export class Inventory extends Component { { field: 'score', name: 'Score', - render: (score) => { + render: score => { return `${score}%`; }, width: '100px', @@ -146,13 +149,19 @@ export class Inventory extends Component { if (match && match[0]) { this.setState({ loading: true }); const id = match[0].split('=')[1]; - const policy = await WzRequest.apiReq('GET', `/sca/${this.props.agent.id}`, { - q: 'policy_id=' + id, - }); - await this.loadScaPolicy(((((policy || {}).data || {}).data || {}).items || [])[0]); + const policy = await WzRequest.apiReq( + 'GET', + `/sca/${this.props.agent.id}`, + { + q: 'policy_id=' + id, + }, + ); + await this.loadScaPolicy( + ((((policy || {}).data || {}).data || {}).items || [])[0], + ); window.location.href = window.location.href.replace( new RegExp('redirectPolicy=' + '[^&]*'), - '' + '', ); this.setState({ loading: false }); } @@ -175,20 +184,31 @@ export class Inventory extends Component { async componentDidUpdate(prevProps, prevState) { if (!_.isEqual(this.props.agent, prevProps.agent)) { - this.setState({ lookingPolicy: false }, async () => await this.initialize()); + this.setState( + { lookingPolicy: false }, + async () => await this.initialize(), + ); } if (!_.isEqual(this.state.filters, prevState.filters)) { this.setState({ itemIdToExpandedRowMap: {}, - pageTableChecks: { pageIndex: 0, pageSize: this.state.pageTableChecks.pageSize }, + pageTableChecks: { + pageIndex: 0, + pageSize: this.state.pageTableChecks.pageSize, + }, }); } const regex = new RegExp('redirectPolicyTable=' + '[^&]*'); const match = window.location.href.match(regex); - if (match && match[0] && !this.state.secondTable && !this.state.secondTableBack) { - this.loadScaPolicy(match[0].split('=')[1], true) - this.setState({secondTableBack: true, checksIsLoading: true}) + if ( + match && + match[0] && + !this.state.secondTable && + !this.state.secondTableBack + ) { + this.loadScaPolicy(match[0].split('=')[1], true); + this.setState({ secondTableBack: true, checksIsLoading: true }); } } @@ -223,10 +243,13 @@ export class Inventory extends Component { } } - handleBack (ev) { - AppNavigate.navigateToModule(ev, 'agents', { tab: 'welcome', agent: this.props.agent.id }); - ev.stopPropagation(); - }; + handleBack(ev) { + AppNavigate.navigateToModule(ev, 'agents', { + tab: 'welcome', + agent: this.props.agent.id, + }); + ev.stopPropagation(); + } async loadScaPolicy(policy, secondTable?) { this._isMount && @@ -234,20 +257,32 @@ export class Inventory extends Component { loadingPolicy: true, itemIdToExpandedRowMap: {}, pageTableChecks: { pageIndex: 0 }, - secondTable: secondTable ? secondTable : false + secondTable: secondTable ? secondTable : false, }); if (policy) { try { - const policyResponse = await WzRequest.apiReq('GET', `/sca/${this.props.agent.id}`, { - params: { - q: 'policy_id=' + policy, + const policyResponse = await WzRequest.apiReq( + 'GET', + `/sca/${this.props.agent.id}`, + { + params: { + q: 'policy_id=' + policy, + }, }, - }); + ); const [policyData] = policyResponse.data.data.affected_items; this._isMount && - this.setState({ lookingPolicy: policyData, loadingPolicy: false, checksIsLoading: false }); + this.setState({ + lookingPolicy: policyData, + loadingPolicy: false, + checksIsLoading: false, + }); } catch (error) { - this.setState({ lookingPolicy: policy, loadingPolicy: false, checksIsLoading: false }); + this.setState({ + lookingPolicy: policy, + loadingPolicy: false, + checksIsLoading: false, + }); const options: UIErrorLog = { context: `${Inventory.name}.loadScaPolicy`, level: UI_LOGGER_LEVELS.ERROR as UILogLevel, @@ -261,11 +296,17 @@ export class Inventory extends Component { getErrorOrchestrator().handleError(options); } } else { - this._isMount && this.setState({ lookingPolicy: policy, loadingPolicy: false, items: [], checksIsLoading: false }); + this._isMount && + this.setState({ + lookingPolicy: policy, + loadingPolicy: false, + items: [], + checksIsLoading: false, + }); } } - toggleDetails = (item) => { + toggleDetails = item => { const itemIdToExpandedRowMap = { ...this.state.itemIdToExpandedRowMap }; if (itemIdToExpandedRowMap[item.id]) { @@ -276,7 +317,7 @@ export class Inventory extends Component { checks += item.condition ? ` (Condition: ${item.condition})` : ''; const complianceText = item.compliance && item.compliance.length - ? item.compliance.map((el) => `${el.key}: ${el.value}`).join('\n') + ? item.compliance.map(el => `${el.key}: ${el.value}`).join('\n') : ''; const listItems = [ { @@ -308,10 +349,12 @@ export class Inventory extends Component { description: , }, ]; - const itemsToShow = listItems.filter((x) => { + const itemsToShow = listItems.filter(x => { return x.description; }); - itemIdToExpandedRowMap[item.id] = ; + itemIdToExpandedRowMap[item.id] = ( + + ); } this.setState({ itemIdToExpandedRowMap }); }; @@ -325,7 +368,11 @@ export class Inventory extends Component { }; buttonStat(text, field, value) { - return ; + return ( + + ); } onChangeTableChecks({ page: { index: pageIndex, size: pageSize } }) { @@ -333,18 +380,22 @@ export class Inventory extends Component { } render() { - const { onClickRow } = this.props + const { onClickRow } = this.props; - const handlePoliciesTableClickRow = async (policy) => { - onClickRow ? onClickRow(policy) : await this.loadScaPolicy(policy.policy_id) - this.setState({ loading: false, redirect: true }) - } + const handlePoliciesTableClickRow = async policy => { + onClickRow + ? onClickRow(policy) + : await this.loadScaPolicy(policy.policy_id); + this.setState({ loading: false, redirect: true }); + }; const buttonPopover = ( this.setState({ showMoreInfo: !this.state.showMoreInfo })} + iconType='iInCircle' + aria-label='Help' + onClick={() => + this.setState({ showMoreInfo: !this.state.showMoreInfo }) + } > ); const { agent } = this.props; @@ -352,20 +403,21 @@ export class Inventory extends Component { return (
- {this.state.loading || this.state.checksIsLoading && ( -
- - -
- )} + {this.state.loading || + (this.state.checksIsLoading && ( +
+ + +
+ ))}
{agent && (agent || {}).status !== API_NAME_AGENT_STATUS.NEVER_CONNECTED && !this.state.policies.length && !this.state.loading && ( - - this.initialize()}> + + this.initialize()}> Refresh @@ -375,11 +427,11 @@ export class Inventory extends Component { (agent || {}).status === API_NAME_AGENT_STATUS.NEVER_CONNECTED && !this.state.loading && ( - this.initialize()}> + this.initialize()}> Refresh @@ -388,7 +440,8 @@ export class Inventory extends Component { (agent || {}).os && !this.state.lookingPolicy && this.state.policies.length > 0 && - !this.state.loading && !this.state.checksIsLoading && ( + !this.state.loading && + !this.state.checksIsLoading && (
{this.state.policies.length && ( @@ -401,11 +454,19 @@ export class Inventory extends Component { style={{ paddingBottom: 0 }} > { }, ]} showLegend - noDataTitle="No results" - noDataMessage="No results were found." + noDataTitle='No results' + noDataMessage='No results were found.' /> - + ))} )} - + @@ -439,36 +500,47 @@ export class Inventory extends Component { {agent && (agent || {}).os && this.state.lookingPolicy && - ((!this.state.loading) || (!this.state.checksIsLoading )) && ( + (!this.state.loading || !this.state.checksIsLoading) && (
- + this.handleBack(ev) : () => this.loadScaPolicy(false)} - iconType="arrowLeft" - aria-label="Back to policies" + onClick={ + this.state.secondTableBack + ? ev => this.handleBack(ev) + : () => this.loadScaPolicy(false) + } + iconType='arrowLeft' + aria-label='Back to policies' {...{ iconSize: 'l' }} /> - +

{this.state.lookingPolicy.name}  - + this.setState({ showMoreInfo: false })} + closePopover={() => + this.setState({ showMoreInfo: false }) + } > - + - Policy description: {this.state.lookingPolicy.description} + Policy description:{' '} + {this.state.lookingPolicy.description}

- Policy checksum: {this.state.lookingPolicy.hash_file} + Policy checksum:{' '} + {this.state.lookingPolicy.hash_file}
@@ -477,24 +549,32 @@ export class Inventory extends Component { - + @@ -502,35 +582,35 @@ export class Inventory extends Component { title={this.buttonStat( this.state.lookingPolicy.invalid, 'status', - 'not applicable' + 'not applicable', )} - description="Not applicable" - titleColor="subdued" - titleSize="m" - textAlign="center" + description='Not applicable' + titleColor='subdued' + titleSize='m' + textAlign='center' /> - + { } Inventory.defaultProps = { - onClickRow: undefined -} + onClickRow: undefined, +}; diff --git a/public/components/agents/vuls/inventory.tsx b/public/components/agents/vuls/inventory.tsx index b94a9368df..c9f796e3aa 100644 --- a/public/components/agents/vuls/inventory.tsx +++ b/public/components/agents/vuls/inventory.tsx @@ -84,9 +84,17 @@ export class Inventory extends Component { customBadges: [], filters: [], stats: [ - { title: 0, description: 'Critical', titleColor: this.titleColors.Critical }, + { + title: 0, + description: 'Critical', + titleColor: this.titleColors.Critical, + }, { title: 0, description: 'High', titleColor: this.titleColors.High }, - { title: 0, description: 'Medium', titleColor: this.titleColors.Medium }, + { + title: 0, + description: 'Medium', + titleColor: this.titleColors.Medium, + }, { title: 0, description: 'Low', titleColor: this.titleColors.Low }, ], severityPieStats: [], @@ -95,12 +103,10 @@ export class Inventory extends Component { last_partial_scan: '', }, }; - this.fetchVisualizationVulnerabilitiesSummaryData = this.fetchVisualizationVulnerabilitiesSummaryData.bind( - this - ); - this.fetchVisualizationVulnerabilitiesSeverityData = this.fetchVisualizationVulnerabilitiesSeverityData.bind( - this - ); + this.fetchVisualizationVulnerabilitiesSummaryData = + this.fetchVisualizationVulnerabilitiesSummaryData.bind(this); + this.fetchVisualizationVulnerabilitiesSeverityData = + this.fetchVisualizationVulnerabilitiesSeverityData.bind(this); this.colorsVisualizationVulnerabilitiesSummaryData = euiPaletteColorBlind(); } @@ -122,7 +128,10 @@ export class Inventory extends Component { color: this.colorsVisualizationVulnerabilitiesSummaryData[index], onClick: () => this.onFiltersChange(this.buildFilterQuery(field, key)), })) - .sort((firstElement, secondElement) => secondElement.value - firstElement.value); + .sort( + (firstElement, secondElement) => + secondElement.value - firstElement.value, + ); } async fetchVisualizationVulnerabilitiesSeverityData() { @@ -134,7 +143,7 @@ export class Inventory extends Component { const vulnerabilityLastScan = await getLastScan(id); const { severity } = await getAggregation(id, FIELD); - const severityStats = SEVERITY_KEYS.map((key) => ({ + const severityStats = SEVERITY_KEYS.map(key => ({ titleColor: this.titleColors[key], description: key, title: severity[key] ? severity[key] : 0, @@ -147,12 +156,13 @@ export class Inventory extends Component { }); return Object.keys(severity).length - ? SEVERITY_KEYS.map((key) => ({ - label: key, - value: severity[key] ? severity[key] : 0, - color: this.titleColors[key], - onClick: () => this.onFiltersChange(this.buildFilterQuery(FIELD, key)), - })) + ? SEVERITY_KEYS.map(key => ({ + label: key, + value: severity[key] ? severity[key] : 0, + color: this.titleColors[key], + onClick: () => + this.onFiltersChange(this.buildFilterQuery(FIELD, key)), + })) : []; } @@ -173,7 +183,7 @@ export class Inventory extends Component { } } - onFiltersChange = (filters) => { + onFiltersChange = filters => { this.setState({ filters }); }; @@ -181,7 +191,11 @@ export class Inventory extends Component { const { filters } = this.state; return (
- +
); } @@ -191,7 +205,7 @@ export class Inventory extends Component { - + @@ -203,14 +217,18 @@ export class Inventory extends Component { return ( + this.onFiltersChange(this.buildFilterQuery('severity', description))} + onClick={() => + this.onFiltersChange( + this.buildFilterQuery('severity', description), + ) + } > {title} @@ -229,7 +247,9 @@ export class Inventory extends Component { return this.loadingInventory(); } const last_full_scan = beautifyDate(vulnerabilityLastScan.last_full_scan); - const last_partial_scan = beautifyDate(vulnerabilityLastScan.last_partial_scan); + const last_partial_scan = beautifyDate( + vulnerabilityLastScan.last_partial_scan, + ); const table = this.renderTable(); return ( @@ -237,42 +257,53 @@ export class Inventory extends Component { - -
+ +
- - + + - - {stats.map((stat) => this.buildTitleFilter(stat))} + + {stats.map(stat => this.buildTitleFilter(stat))} @@ -281,9 +312,14 @@ export class Inventory extends Component { - + `No ${optionRequirement.text} results were found.` } diff --git a/public/components/agents/vuls/inventory/detail.tsx b/public/components/agents/vuls/inventory/detail.tsx index 4002942981..93ae6d5469 100644 --- a/public/components/agents/vuls/inventory/detail.tsx +++ b/public/components/agents/vuls/inventory/detail.tsx @@ -29,7 +29,10 @@ import { import { Discover } from '../../../common/modules/discover'; import { ModulesHelper } from '../../../common/modules/modules-helper'; import { ICustomBadges } from '../../../wz-search-bar/components'; -import { buildPhraseFilter, IIndexPattern } from '../../../../../../../src/plugins/data/common'; +import { + buildPhraseFilter, + IIndexPattern, +} from '../../../../../../../src/plugins/data/common'; import { getIndexPattern } from '../../../overview/mitre/lib'; import moment from 'moment-timezone'; import { AppNavigate } from '../../../../react-services/app-navigate'; @@ -51,22 +54,22 @@ export class Details extends Component { }; userSvg = ( ); @@ -86,7 +89,7 @@ export class Details extends Component { } componentDidMount() { - getIndexPattern().then((idxPtn) => (this.indexPattern = idxPtn)); + getIndexPattern().then(idxPtn => (this.indexPattern = idxPtn)); } details() { @@ -132,40 +135,40 @@ export class Details extends Component { name: 'Last full scan', icon: 'clock', link: false, - transformValue: beautifyDate + transformValue: beautifyDate, }, { field: 'last_partial_scan', name: 'Last partial scan', icon: 'clock', link: false, - transformValue: beautifyDate + transformValue: beautifyDate, }, { field: 'published', name: 'Published', icon: 'clock', link: false, - transformValue: beautifyDate + transformValue: beautifyDate, }, { field: 'updated', name: 'Updated', icon: 'clock', link: false, - transformValue: beautifyDate + transformValue: beautifyDate, }, { field: 'external_references', name: 'References', icon: 'link', link: false, - transformValue: this.renderExternalReferences + transformValue: this.renderExternalReferences, }, ]; } - viewInEvents = (ev) => { + viewInEvents = ev => { const { cve } = this.props.currentItem; if (this.props.view === 'extern') { AppNavigate.navigateToModule(ev, 'overview', { @@ -177,8 +180,12 @@ export class Details extends Component { AppNavigate.navigateToModule( ev, 'overview', - { tab: 'vuls', tabView: 'events', filters: { 'data.vulnerability.cve': cve } }, - () => this.openEventCurrentWindow() + { + tab: 'vuls', + tabView: 'events', + filters: { 'data.vulnerability.cve': cve }, + }, + () => this.openEventCurrentWindow(), ); } }; @@ -190,7 +197,7 @@ export class Details extends Component { ...buildPhraseFilter( { name: 'data.vulnerability.cve', type: 'text' }, cve, - this.indexPattern + this.indexPattern, ), $state: { store: 'appState' }, }, @@ -220,13 +227,16 @@ export class Details extends Component { if (field === 'date' || field === 'mtime') { let value_max = moment(value).add(1, 'day'); newBadge.value = `${field}>${moment(value).format( - 'YYYY-MM-DD' + 'YYYY-MM-DD', )} AND ${field}<${value_max.format('YYYY-MM-DD')}`; } else { - newBadge.value = `${field}=${field === 'size' ? this.props.currentItem[field] : value}`; + newBadge.value = `${field}=${ + field === 'size' ? this.props.currentItem[field] : value + }`; } - !filters.some((item) => item.field === newBadge.field && item.value === newBadge.value) && - onFiltersChange([...filters, newBadge]); + !filters.some( + item => item.field === newBadge.field && item.value === newBadge.value, + ) && onFiltersChange([...filters, newBadge]); this.props.closeFlyout(); } @@ -241,8 +251,13 @@ export class Details extends Component { var link = (item.link && !['events', 'extern'].includes(view)) || false; const agentPlatform = ((this.props.agent || {}).os || {}).platform; - if (!item.onlyLinux || (item.onlyLinux && this.props.agent && agentPlatform !== 'windows')) { - let className = item.checksum ? 'detail-value detail-value-checksum' : 'detail-value'; + if ( + !item.onlyLinux || + (item.onlyLinux && this.props.agent && agentPlatform !== 'windows') + ) { + let className = item.checksum + ? 'detail-value detail-value-checksum' + : 'detail-value'; className += item.field === 'perm' ? ' detail-value-perm' : ''; className += ' wz-width-100'; return ( @@ -264,18 +279,18 @@ export class Details extends Component { {value} {this.state.hoverAddFilter === item.field && ( { this.addFilter(item.field, value); }} - iconType="magnifyWithPlus" - aria-label="Next" - iconSize="s" - className="buttonAddFilter" + iconType='magnifyWithPlus' + aria-label='Next' + iconSize='s' + className='buttonAddFilter' /> )} @@ -285,15 +300,20 @@ export class Details extends Component { description={ {item.icon !== 'users' ? ( - + ) : ( this.userSvg )} - {item.name} + {item.name} } - textAlign="left" - titleSize="xs" + textAlign='left' + titleSize='xs' /> ); @@ -310,41 +330,55 @@ export class Details extends Component { renderExternalReferences(references) { return ( - -

View external references

+ + +

+ View external references{' '} + +

- }> - ({ label: link, href: link, target: '_blank' })) - } + } + > + ({ + label: link, + href: link, + target: '_blank', + }))} />
); } - updateTotalHits = (total) => { + updateTotalHits = total => { this.setState({ totalHits: total }); }; renderDetailsPermissions(value) { - if (((this.props.agent || {}).os || {}).platform === 'windows' && value && value !== '-') { + if ( + ((this.props.agent || {}).os || {}).platform === 'windows' && + value && + value !== '-' + ) { const components = value .split(', ') - .map((userNameAndPermissionsFullString) => { - const [_, username, userPermissionsString] = userNameAndPermissionsFullString.match( - /(\S+) \(allowed\): (\S+)/ - ); + .map(userNameAndPermissionsFullString => { + const [_, username, userPermissionsString] = + userNameAndPermissionsFullString.match(/(\S+) \(allowed\): (\S+)/); const permissions = userPermissionsString.split('|').sort(); return { username, permissions }; }) @@ -364,7 +398,11 @@ export class Details extends Component { content={permissions.join(', ')} title={`${username} permissions`} > - + {username} @@ -373,7 +411,7 @@ export class Details extends Component { return ( `+${count} users`} + labelButtonHideComponents={count => `+${count} users`} buttonProps={{ size: 'xs' }} componentsWidthPercentage={0.85} /> @@ -385,41 +423,42 @@ export class Details extends Component { render() { const { type, implicitFilters, view, currentItem, agent } = this.props; const id = `${currentItem.name}-${currentItem.cve}-${currentItem.architecture}-${currentItem.version}`; - const inspectButtonText = view === 'extern' ? 'Inspect in Dashboard' : 'Inspect in Events'; + const inspectButtonText = + view === 'extern' ? 'Inspect in Dashboard' : 'Inspect in Events'; return ( +

Details

} - paddingSize="none" + paddingSize='none' initialIsOpen={true} > -
{this.getDetails()}
+
{this.getDetails()}
{this.state.totalHits || 0} hits
} buttonContent={ - +

Recent events {view !== 'events' && ( - + this.viewInEvents(ev)} - type="popout" + className='euiButtonIcon euiButtonIcon--primary' + onMouseDown={ev => this.viewInEvents(ev)} + type='popout' aria-label={inspectButtonText} /> @@ -428,10 +467,10 @@ export class Details extends Component {

} - paddingSize="none" + paddingSize='none' initialIsOpen={true} > - + this.updateTotalHits(total)} + updateTotalHits={total => this.updateTotalHits(total)} /> diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index f59ea22697..5a84361094 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -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'; @@ -113,8 +113,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(), }; } @@ -260,7 +260,7 @@ export const RegisterAgent = withErrorBoundary( this.state.selectedVersion === 'windowsxp' || this.state.selectedVersion === 'windows8' ) { - return 'update-rc.d wazuh-agent defaults && service wazuh-agent start'; + return 'NET START WazuhSvc'; } } @@ -283,9 +283,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'; } } @@ -300,14 +305,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 }); @@ -391,6 +402,13 @@ 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 { @@ -400,7 +418,7 @@ export const RegisterAgent = withErrorBoundary( resolveRPMPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'redhat5-i386': return `https://packages.wazuh.com/4.x/yum5/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm`; @@ -431,7 +449,7 @@ export const RegisterAgent = withErrorBoundary( resolveAlpinePackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case '3.12.12-i386': return 'https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub && echo "https://packages.wazuh.com/4.x/alpine/v3.12/main"'; @@ -450,7 +468,7 @@ export const RegisterAgent = withErrorBoundary( resolveORACLELINUXPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'oraclelinux5-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; @@ -477,7 +495,7 @@ export const RegisterAgent = withErrorBoundary( resolveCENTPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'centos5-i386': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm`; @@ -508,7 +526,7 @@ export const RegisterAgent = withErrorBoundary( resolveSUSEPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'suse11-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; @@ -531,7 +549,7 @@ export const RegisterAgent = withErrorBoundary( resolveFEDORAPachage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case '22-i386': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.el5.i386.rpm`; @@ -550,7 +568,7 @@ export const RegisterAgent = withErrorBoundary( resolveAMAZONLPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'amazonlinux1-i386': return `https://packages.wazuh.com/4.x/yum/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.i386.rpm`; @@ -604,7 +622,7 @@ export const RegisterAgent = withErrorBoundary( resolveRASPBIANPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'busterorgreater-i386': return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_i386.deb`; @@ -623,7 +641,7 @@ export const RegisterAgent = withErrorBoundary( resolveUBUNTUPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'ubuntu14-i386': return `https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}${this.addToVersion}_i386.deb`; @@ -648,7 +666,7 @@ export const RegisterAgent = withErrorBoundary( resolveOPENSUSEPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'leap15-x86_64': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}.x86_64.rpm`; @@ -661,24 +679,24 @@ export const RegisterAgent = withErrorBoundary( resolveSOLARISPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case 'solaris10-i386': - return `https://packages.wazuh.com/4.x/solaris/i386/10/wazuh-agent-${this.state.wazuhVersion}-sol10-i386.pkg`; + return `https://packages.wazuh.com/4.x/solaris/i386/10/wazuh-agent_v${this.state.wazuhVersion}-sol10-i386.pkg`; 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`; 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`; 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`; 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`; } } 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`; @@ -689,7 +707,7 @@ export const RegisterAgent = withErrorBoundary( resolveHPPackage() { switch ( - `${this.state.selectedVersion}-${this.state.selectedArchitecture}` + `${this.state.selectedVersion}-${this.state.selectedArchitecture}` ) { case '11.31-itanium2': return `https://packages.wazuh.com/4.x/yum/i386/wazuh-agent-${this.state.wazuhVersion}${this.addToVersion}-hpux-11v3-ia64.tar`; @@ -864,35 +882,35 @@ 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 = ( <> @@ -939,34 +957,47 @@ export const RegisterAgent = withErrorBoundary( const customTexts = { rpmText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, centText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`, - debText: `curl -so wazuh-agent-${this.state.wazuhVersion - }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${this.state.wazuhVersion - }.deb`, - ubuText: `curl -so wazuh-agent-${this.state.wazuhVersion - }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${this.state.wazuhVersion - }.deb`, - macosText: `curl -so wazuh-agent-${this.state.wazuhVersion - }.pkg https://packages.wazuh.com/4.x/macos/wazuh-agent-${this.state.wazuhVersion - }-1.pkg && sudo launchctl setenv ${this.optionalDeploymentVariables()}${this.agentNameVariable()}&& sudo installer -pkg ./wazuh-agent-${this.state.wazuhVersion - }.pkg -target /`, - winText: `Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-${this.state.wazuhVersion - }-1.msi -OutFile \${env:tmp}\\wazuh-agent-${this.state.wazuhVersion - }.msi; msiexec.exe /i \${env:tmp}\\wazuh-agent-${this.state.wazuhVersion - }.msi /q ${this.optionalDeploymentVariables()}${this.agentNameVariable()}`, + debText: `curl -so wazuh-agent-${ + this.state.wazuhVersion + }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${ + this.state.wazuhVersion + }.deb`, + ubuText: `curl -so wazuh-agent-${ + this.state.wazuhVersion + }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${ + this.state.wazuhVersion + }.deb`, + macosText: `curl -so wazuh-agent-${ + this.state.wazuhVersion + }.pkg https://packages.wazuh.com/4.x/macos/wazuh-agent-${ + this.state.wazuhVersion + }-1.pkg && sudo launchctl setenv ${this.optionalDeploymentVariables()}${this.agentNameVariable()}&& sudo installer -pkg ./wazuh-agent-${ + this.state.wazuhVersion + }.pkg -target /`, + winText: `Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-${ + this.state.wazuhVersion + }-1.msi -OutFile \${env:tmp}\\wazuh-agent-${ + this.state.wazuhVersion + }.msi; msiexec.exe /i \${env:tmp}\\wazuh-agent-${ + this.state.wazuhVersion + }.msi /q ${this.optionalDeploymentVariables()}${this.agentNameVariable()}`, openText: `sudo rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()} zypper install -y ${this.optionalPackages()}`, - solText: `sudo curl -so ${this.optionalPackages()} && sudo ${this.agentNameVariable()}&& ${this.state.selectedVersion == 'solaris11' - ? 'pkg install -g wazuh-agent.p5p wazuh-agent' - : 'pkgadd -d wazuh-agent.pkg' - }`, + solText: `sudo curl -so wazuh-agent.p5p ${this.optionalPackages()}/wazuh-agent.p5p ${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 ${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-${ + this.state.wazuhVersion + }.deb ${this.optionalPackages()} && sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}dpkg -i ./wazuh-agent-${ + this.state.wazuhVersion + }.deb`, }; const field = `${this.state.selectedOS}Text`; @@ -974,6 +1005,39 @@ 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' && ( <> @@ -1022,10 +1086,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 @@ -1049,6 +1133,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 && ( {textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''}
), @@ -1212,6 +1411,9 @@ export const RegisterAgent = withErrorBoundary(

{textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''} ), @@ -1242,6 +1444,9 @@ export const RegisterAgent = withErrorBoundary(
{textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''}
), @@ -1272,6 +1477,9 @@ export const RegisterAgent = withErrorBoundary( {textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''} ), @@ -1302,6 +1510,9 @@ export const RegisterAgent = withErrorBoundary( {textAndLinkToCheckConnectionDocumentation} + {this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' + ? messageExtraSteps + : ''} ), @@ -1321,117 +1532,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 ( ); }; @@ -1496,499 +1595,494 @@ export const RegisterAgent = withErrorBoundary( }, ...(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: + this.state.selectedVersion == 'windowsxp' + ? buttonGroupWithMessage( + 'Choose the version', + versionButtonsWindows, + this.state.selectedVersion, + version => this.setVersion(version), + ) + : buttonGroup( + 'Choose the version', + versionButtonsWindows, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'macos' ? [ - { - title: 'Choose the version', - children: selectedVersionMac( - 'Choose the version', - versionButtonsMacOS, - this.state.selectedVersion, - version => this.setVersion(version), - ), - }, - ] + { + title: 'Choose the version', + children: selectedVersionMac( + 'Choose the version', + versionButtonsMacOS, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'suse' ? [ - { - title: 'Choose the version', - children: selectedVersionMac( - 'Choose the version', - versionButtonsSuse, - this.state.selectedVersion, - version => this.setVersion(version), - ), - }, - ] + { + title: 'Choose the version', + children: selectedVersionMac( + 'Choose the version', + versionButtonsSuse, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'open' ? [ - { - title: 'Choose the version', - children: buttonGroup( - 'Choose the version', - versionButtonsOpenSuse, - this.state.selectedVersion, - version => this.setVersion(version), - ), - }, - ] + { + title: 'Choose the version', + children: buttonGroup( + 'Choose the version', + versionButtonsOpenSuse, + this.state.selectedVersion, + version => this.setVersion(version), + ), + }, + ] : []), ...(this.state.selectedOS == 'sol' ? [ - { - title: 'Choose the version', - children: - this.state.selectedVersion == 'solaris10' || - this.state.selectedVersion == 'solaris11' - ? buttonGroupWithMessage( - 'Choose the version', - versionButtonsSolaris, - this.state.selectedVersion, - version => this.setVersion(version), - ) - : buttonGroup( - 'Choose the version', - versionButtonsSolaris, - this.state.selectedVersion, - version => this.setVersion(version), - ), - }, - ] + { + title: 'Choose the version', + children: 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.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 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' + ? [ + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architecturei386Andx86_64, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), ...(this.state.selectedVersion == 'leap15' ? [ - { - title: 'Choose the architecture', - children: buttonGroup( - 'Choose the architecture', - architectureButtonsOpenSuse, - this.state.selectedArchitecture, - architecture => this.setArchitecture(architecture), - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsOpenSuse, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), ...(this.state.selectedVersion == 'centos6' || - this.state.selectedVersion == 'oraclelinux6' || - this.state.selectedVersion == 'amazonlinux1' || - this.state.selectedVersion == 'redhat6' || - this.state.selectedVersion == 'amazonlinux2022' || - this.state.selectedVersion == 'debian7' || - this.state.selectedVersion == 'debian8' || - this.state.selectedVersion == 'ubuntu14' || - this.state.selectedVersion == 'ubuntu15' || - this.state.selectedVersion == 'ubuntu16' + this.state.selectedVersion == 'oraclelinux6' || + this.state.selectedVersion == 'amazonlinux1' || + this.state.selectedVersion == 'redhat6' || + this.state.selectedVersion == 'amazonlinux2022' || + this.state.selectedVersion == 'debian7' || + this.state.selectedVersion == 'debian8' || + this.state.selectedVersion == 'ubuntu14' || + this.state.selectedVersion == 'ubuntu15' || + this.state.selectedVersion == 'ubuntu16' ? [ - { - title: 'Choose the architecture', - children: buttonGroup( - 'Choose the architecture', - architectureButtons, - this.state.selectedArchitecture, - architecture => this.setArchitecture(architecture), - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtons, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), ...(this.state.selectedVersion == 'centos7' || - this.state.selectedVersion == 'redhat7' || - this.state.selectedVersion == 'amazonlinux2' || - this.state.selectedVersion == 'suse12' || - this.state.selectedVersion == '22' || - this.state.selectedVersion == 'debian9' || - this.state.selectedVersion == 'debian10' || - this.state.selectedVersion == 'busterorgreater' + this.state.selectedVersion == '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 == 'windows8' ? [ - { - title: 'Choose the architecture', - children: buttonGroup( - 'Choose the architecture', - architectureButtonsi386, - this.state.selectedArchitecture, - architecture => this.setArchitecture(architecture), - ), - }, - ] + { + title: 'Choose the architecture', + children: buttonGroup( + 'Choose the architecture', + architectureButtonsi386, + this.state.selectedArchitecture, + architecture => this.setArchitecture(architecture), + ), + }, + ] : []), ...(this.state.selectedVersion == 'sierra' || - this.state.selectedVersion == 'highSierra' || - this.state.selectedVersion == 'mojave' || - this.state.selectedVersion == 'catalina' || - this.state.selectedVersion == 'bigSur' || - this.state.selectedVersion == 'monterrey' || - this.state.selectedVersion == 'ventura' + this.state.selectedVersion == 'highSierra' || + this.state.selectedVersion == 'mojave' || + this.state.selectedVersion == 'catalina' || + this.state.selectedVersion == 'bigSur' || + this.state.selectedVersion == 'monterrey' || + this.state.selectedVersion == 'ventura' ? [ - { - 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}, + }, + ] : []), - { - title: 'Assign a name and a group to the agent', - children: ( - - {agentName} - {groupInput} - {agentGroup} - - ), - }, - { - title: 'Install and enroll the agent', - children: this.state.gotErrorRegistrationServiceInfo ? ( - calloutErrorRegistrationServiceInfo - ) : this.state.agentNameError ? ( - - ) : missingOSSelection.length ? ( - - ) : ( -
{guide}
- ), - }, - ...(this.state.selectedOS == 'rpm' || - this.state.selectedOS == 'cent' || - this.state.selectedOS == 'suse' || - this.state.selectedOS == 'fedora' || - this.state.selectedOS == 'oraclelinux' || - this.state.selectedOS == 'amazonlinux' || - this.state.selectedOS == 'deb' || - this.state.selectedOS == 'raspbian' || - this.state.selectedOS == 'ubu' || - this.state.selectedOS == 'win' || - this.state.selectedOS == 'macos' || - this.state.selectedOS == 'open' || + ...(!( + this.state.selectedOS == 'hp' || this.state.selectedOS == 'sol' || - this.state.selectedOS == 'aix' || - this.state.selectedOS == 'hp' + this.state.selectedOS == 'alpine' + ) ? [ - { - title: 'Start the agent', - children: this.state.gotErrorRegistrationServiceInfo ? ( - calloutErrorRegistrationServiceInfo - ) : this.state.agentNameError ? ( - - ) : missingOSSelection.length ? ( - - ) : ( - + {agentName} + {groupInput} + {agentGroup} + + ), + }, + ] + : []), + ...(!( + this.state.selectedOS == 'hp' || + this.state.selectedOS == 'sol' || + this.state.selectedOS == 'alpine' + ) + ? [ + { + title: 'Install and enroll the agent', + children: this.state.gotErrorRegistrationServiceInfo ? ( + calloutErrorRegistrationServiceInfo + ) : missingOSSelection.length ? ( + + ) : ( +
{guide}
+ ), + }, + ] + : [ + { + title: 'Install the agent', + children: this.state.gotErrorRegistrationServiceInfo ? ( + calloutErrorRegistrationServiceInfo + ) : missingOSSelection.length ? ( + + ) : ( +
{guide}
+ ), + }, + ]), + ...(this.state.selectedOS == 'rpm' || + this.state.selectedOS == 'cent' || + this.state.selectedOS == 'suse' || + this.state.selectedOS == 'fedora' || + this.state.selectedOS == 'oraclelinux' || + this.state.selectedOS == 'amazonlinux' || + this.state.selectedOS == 'deb' || + this.state.selectedOS == 'raspbian' || + this.state.selectedOS == 'ubu' || + this.state.selectedOS == 'win' || + this.state.selectedOS == 'macos' || + this.state.selectedOS == 'open' || + this.state.selectedOS == 'sol' || + this.state.selectedOS == 'aix' || + this.state.selectedOS == 'hp' || + this.state.selectedOS == 'alpine' || + this.state.selectedOS == '' + ? [ + { + title: 'Start the agent', + children: this.state.gotErrorRegistrationServiceInfo ? ( + calloutErrorRegistrationServiceInfo + ) : this.state.agentNameError ? ( + + ) : missingOSSelection.length ? ( + + ) : ( + - ), - }, - ] + ? tabWazuhControlMacos + : this.state.selectedVersion == 'solaris10' || + this.state.selectedVersion == 'solaris11' || + this.state.selectedVersion == '6.1 TL9' || + this.state.selectedVersion == '11.31' + ? 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' && + 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 +

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