Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enrollment agent assistant to fleet management plugin #7289

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
659c0f2
feat: copy the register agent assistant to wazuh-fleet plugin
Desvelao Feb 6, 2025
f258346
feat: add inputs to enrollment agent assistant
Desvelao Feb 11, 2025
c8edfb9
fix: prettier and eslint
Desvelao Feb 11, 2025
bbb9292
fix: eslint
Desvelao Feb 11, 2025
a05efa7
fix: install agent on Windows command
Desvelao Feb 12, 2025
591c975
feat(enrollment): add ability to remember the server address
Desvelao Feb 13, 2025
beb18ff
feat(enrollment): rename Deploy new agent by Enroll new agent
Desvelao Feb 13, 2025
22b8646
remove(enrollment): remove enrollment.password setting by securiy rea…
Desvelao Feb 13, 2025
9bf7d5d
Merge branch 'main' of https://github.com/wazuh/wazuh-kibana-app into…
Desvelao Feb 13, 2025
4d80439
fix(enrollment): windows command to install and enroll the agent
Desvelao Feb 14, 2025
8ace81e
fix: rename register-agent direcotry to enroll-agent
Desvelao Feb 14, 2025
8f692e9
fix(enrollment): rename register to enroll references
Desvelao Feb 14, 2025
fa5023d
fix(enrollment): rename register to enroll references
Desvelao Feb 14, 2025
4d40182
fix(enrollment): background color of copy overlay in dark mode
Desvelao Feb 14, 2025
5c7e396
Merge branch 'enhancement/514-add-enrollment-agent-assistant' of http…
Desvelao Feb 14, 2025
cb4ef30
fix: remove a unused comment and enhance types
Desvelao Feb 17, 2025
58f4549
fix(enrollment): remove unused data from fetching Wazuh server API ve…
Desvelao Feb 17, 2025
d5851d2
fet(enrollment): add test toe nsure the step status
Desvelao Feb 17, 2025
2f252d0
feat(enrollment): replace --register-agent flag to --enroll-agent
Desvelao Feb 17, 2025
141a3e3
Merge branch 'main' into enhancement/514-add-enrollment-agent-assistant
Desvelao Feb 18, 2025
4522188
ci: add wazuh-fleet plugin
Desvelao Feb 18, 2025
283fe60
chore: add entry to changelog
Desvelao Feb 19, 2025
70d457e
Merge branch 'main' of https://github.com/wazuh/wazuh-kibana-app into…
Desvelao Feb 19, 2025
d8436c7
docs: add fleet-management module
Desvelao Feb 19, 2025
240c301
docs(enrollment): add docs related to enrollment agent assistant
Desvelao Feb 19, 2025
5a44932
docs: add fleet management
Desvelao Feb 19, 2025
dedda97
Merge branch 'main' of https://github.com/wazuh/wazuh-kibana-app into…
Desvelao Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ jobs:
path: 'wazuh/plugins/wazuh-core',
container_path: 'wazuh-core',
},
{
name: 'Wazuh Fleet Management',
path: 'wazuh/plugins/wazuh-fleet',
container_path: 'wazuh-fleet',
},
]

steps:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ All notable changes to the Wazuh app project will be documented in this file.
- Added pinned agent data validation when rendering the Inventory data, Stats and Configuration tabs in Agent preview of Endpoints Summary [#6800](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6800)
- Added wz-link component to make redirections [#6848](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6848)
- Added embedded and customized `dom-to-image-more` dependency [#6902](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6902)
- Added `wazuh-fleet` plugin [#7289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7289)
- Added enrollment agent assistant to `wazuh-fleet` plugin [#7289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7289)

### Changed

Expand Down
5 changes: 5 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
- [Installation](ref/getting-started/installation.md)
- [Configuration](ref/configuration.md)
- [Modules](ref/modules/README.md)
- [Fleet management](ref/modules/fleet-management/description.md)
- [Description](ref/modules/fleet-management/description.md)
- [Architecture](ref/modules/fleet-management/architecture.md)
- [API reference](ref/modules/fleet-management/api-reference.md)
- [Enrollment agent assistant](ref/modules/fleet-management/enrollment-agent-assistant.md)
- [Upgrade](ref/upgrade.md)
- [Uninstall](ref/uninstall.md)
- [Back Up and Restore](ref/backup-restore.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/ref/modules/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Modules

- [Fleet management](./fleet-management/description.md)
1 change: 1 addition & 0 deletions docs/ref/modules/fleet-management/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# API reference
1 change: 1 addition & 0 deletions docs/ref/modules/fleet-management/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Architecture
9 changes: 9 additions & 0 deletions docs/ref/modules/fleet-management/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Fleet management

## Description

This module allows to manage the fleet of agents.

## Contents

- [Enrollment agent assistant](./enrollment-agent-assistant.md)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions docs/ref/modules/fleet-management/enrollment-agent-assistant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Enrollment agent assistant

The enrollment agent assistant provides a guide to download, install, enroll and start the agent in a new host.

![Enroll agent assistant](enroll-agent-assistant.png)

## Options:

The user can specify the required and optional parameters to enroll the agent through a form:

| Option | Type | Description | Default value | Allowed values |
| --------------------- | -------- | --------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------------- |
| Operating system | Required | Define the operating system of the host | - | Any provided in the form |
| Server address | Required | Define the URL of the Wazuh server | - | Any valid URL string (protocol://address:port) |
| Username | Required | Define the username of Wazuh server | - | Any string |
| Password | Required | Define the passowrd of the Wazuh server user | - | Any string |
| Agent name | Optional | Define the agent name. If not defined, it will be used the hostname | - | Any string with 2 or more charecters. Allowed characters: A-Za-z0-9.-\_ |
| SSL verification mode | Optional | Define the verification mode of certificates against the Wazuh server | none | none, full |
| Enrollment key | Optional | Define the enrollment key | - | Any alphanumeric string of 32 characters |

> **_NOTE:_** The user to enroll the agent must have permissions to execute this operation.

The server address option is set with the `enrollment.dns` setting if this is defined that allows to the user avoids filling the input when accesing to this page.

Once the required and optionals parameters are provided without errors, the commands to enroll the agent will be displayed, allowing to the user to copy them and execute them in the host.

## Remember parameters

Ther server address can be saved to be remember the next time the user access to the page through set the `enrollment.dns` setting using the save icon near to the server address input or through Dashboard Management > Advanced settings.

> **_NOTE:_** Save the `enrollment.dns` setting requires write permissions in the tenant.

The rest of parameters should be specified each time the user access to the enrollment agent assistant.
20 changes: 5 additions & 15 deletions plugins/wazuh-core/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,20 +594,11 @@ export const PLUGIN_SETTINGS: Record<string, TPluginSetting> = {
category: SettingCategory.GENERAL,
type: EpluginSettingType.text,
defaultValue: '',
validate: SettingsValidator.compose(
SettingsValidator.isString,
SettingsValidator.serverAddressHostnameFQDNIPv4IPv6,
),
},
'enrollment.password': {
title: 'Enrollment password',
description:
'Specifies the password used to authenticate during the agent enrollment.',
source: EConfigurationProviders.PLUGIN_UI_SETTINGS,
category: SettingCategory.GENERAL,
type: EpluginSettingType.text,
defaultValue: '',
validate: SettingsValidator.compose(SettingsValidator.isString),
// TODO: this should be enabled when the configuration service of core plugin provides a mechanism to retrieve this definition to be used in the enrollment agent wizard. See https://github.com/wazuh/wazuh-dashboard/issues/514#issuecomment-2656602679
// validate: SettingsValidator.compose(
// SettingsValidator.isString,
// SettingsValidator.serverAddressHostnameFQDNIPv4IPv6,
// ),
},
hideManagerAlerts: {
title: 'Hide manager alerts',
Expand Down Expand Up @@ -1020,7 +1011,6 @@ export const CRON_PREFIX = 'cron.prefix';
export const CUSTOMIZATION_ENABLED = 'customization.enabled';

export const ENROLLMENT_DNS = 'enrollment.dns';
export const ENROLLMENT_PASSWORD = 'enrollment.password';

export const IP_IGNORE = 'ip.ignore';
export const IP_SELECTOR = 'ip.selector';
Expand Down
3 changes: 0 additions & 3 deletions plugins/wazuh-core/common/plugin-settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ describe.skip('[settings] Input validation', () => {
${'enrollment.dns'} | ${'2001:0db8:85a3:0000:0000:8a2e:0370:7334:KL12'} | ${'It should be a valid hostname, FQDN, IPv4 or uncompressed IPv6'}
${'enrollment.dns'} | ${'example.'} | ${'It should be a valid hostname, FQDN, IPv4 or uncompressed IPv6'}
${'enrollment.dns'} | ${'127.0.0.1'} | ${undefined}
${'enrollment.password'} | ${'test'} | ${undefined}
${'enrollment.password'} | ${''} | ${'Value can not be empty.'}
${'enrollment.password'} | ${'test space'} | ${undefined}
${'ip.ignore'} | ${'["test"]'} | ${undefined}
${'ip.ignore'} | ${'["test*"]'} | ${undefined}
${'ip.ignore'} | ${'[""]'} | ${'Value can not be empty.'}
Expand Down
6 changes: 6 additions & 0 deletions plugins/wazuh-fleet/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
import { version } from '../package.json';

export const PLUGIN_ID = 'wazuhFleet';
export const PLUGIN_NAME = 'wazuh_fleet';
export const PLUGIN_VERSION_SHORT = version.split('.').splice(0, 2).join('.');

// Documentation
export const DOCUMENTATION_WEB_BASE_URL = 'https://documentation.wazuh.com';
8 changes: 1 addition & 7 deletions plugins/wazuh-fleet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,10 @@
"md5": "^2.3.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.5.2",
"@types/": "testing-library/user-event",
"@types/jest": "^29.5.14",
"@types/md5": "^2.3.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"jest": "^29.7.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"jest": "^29.7.0"
}
}
17 changes: 17 additions & 0 deletions plugins/wazuh-fleet/public/application/application.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { Router, Route, Switch, Redirect } from 'react-router-dom';
import { History } from 'history';
import { EnrollAgent } from './pages/enroll-agent';

export function Application({ history }: { history: History }) {
return (
<Router history={history}>
<Switch>
<Route path={'/enrollment/agent'} exact>
<EnrollAgent />
</Route>
<Redirect to='/enrollment/agent' />
</Switch>
</Router>
);
}
1 change: 1 addition & 0 deletions plugins/wazuh-fleet/public/application/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './mount';
32 changes: 32 additions & 0 deletions plugins/wazuh-fleet/public/application/mount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { setEnrollAgentManagement } from '../plugin-services';
import { AppSetup } from './types';

export function appSetup({ registerApp, enrollmentAgentManagement }: AppSetup) {
registerApp({
id: 'wazuh-fleet',
title: 'Fleet management',
order: 1,
mount: async (params: AppMountParameters) => {
try {
// Load application bundle
const { renderApp } = await import('./render-app');

params.element.classList.add('dscAppWrapper', 'wz-app');

const unmount = await renderApp(params);

return () => {
unmount();
};
} catch (error) {
console.debug(error);
}
},
// category: Categories.find(
// ({ id: categoryID }) => categoryID === category,
// ),
});

// TODO: This setter should be local to fleet management instead of using the related to the plugin itself. This approach was done because the integration of FleetManagement is using another setter from plugin-services.
setEnrollAgentManagement(enrollmentAgentManagement);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading