Architecture
The Notifications plugin follows a layered architecture that separates destination definitions, transport logic, and plugin orchestration.
High-Level Architecture
The Notifications plugin runs inside the Wazuh Indexer and acts as a bridge between internal producers of alerts (such as Alerting, Reporting, and ISM) and external delivery services like SMTP servers, webhooks, and AWS services.
At a high level, the architecture is composed of three main parts:
-
Notification producers (inside the Indexer)
Internal plugins such as Alerting, Reporting, ISM, and other Wazuh Indexer components generate alerts and events.
When they need to send a notification (for example, a Slack message or an email), they call the Notifications plugin either through:- The REST API exposed by the Indexer, or
- Internal transport actions.
-
Notifications plugin (inside the Indexer)
The plugin itself is structured in several layers:-
REST / Transport layer
- Exposes the
/_plugins/_notifications/...REST endpoints. - Receives requests to create, update, list, and delete notification channel configurations, send test notifications, and query features.
- Validates requests and delegates the work to internal transport actions.
- Exposes the
-
Security integration
- Uses the Security plugin to validate permissions for each request.
- When
filter_by_backend_rolesis enabled, it filters which notification configurations each user can see or use based on backend roles.
-
Core SPI layer
- Defines common contracts and models such as
NotificationCore,BaseDestination, and concrete destination types likeSlackDestination,SmtpDestination,SesDestination, andSnsDestination. - Encapsulates message content (
MessageContent) and delivery responses (DestinationMessageResponse).
- Defines common contracts and models such as
-
Core implementation (transport logic)
- Implements concrete transports:
WebhookDestinationTransportfor Slack, Microsoft Teams, Chime, and generic webhooks (HTTP/HTTPS).SmtpDestinationTransportfor email via SMTP.SesDestinationTransportfor email via AWS SES.SnsDestinationTransportfor messages via AWS SNS.
- Manages HTTP client pools, connection and socket timeouts, host deny lists, and HTTP response size limits.
- Retrieves SMTP/SES/SNS credentials from the OpenSearch Keystore or other secure settings via a credential provider.
- Implements concrete transports:
-
Persistence and configuration
- Stores notification channel configurations in an internal index (for example,
.notifications). - Uses
NotificationConfigIndexandConfigIndexingActionsto create, read, update, and delete configurations. - Exposes internal metrics through the stats endpoint so operators can inspect request counts and error patterns.
- Stores notification channel configurations in an internal index (for example,
-
-
External destination services (outside the Indexer)
After the plugin resolves the destination type, the corresponding transport sends the message to:- SMTP servers (corporate mail, Gmail, etc.),
- Webhook endpoints (Slack, Microsoft Teams, Amazon Chime, custom HTTP integrations),
- AWS services such as SES and SNS.
Once delivery is attempted, the plugin updates the notification status (for example,
sentorfailed) and returns the outcome to the caller (Alerting, Reporting, or the user calling the REST API).
Plugin Layers
1. Core SPI (core-spi)
The Service Provider Interface layer defines the contracts and models:
NotificationCore: Interface that the core implementation must satisfy. DefinessendMessage()and related operations.BaseDestination: Abstract base class for all destination types. Subclasses includeSlackDestination,ChimeDestination,MicrosoftTeamsDestination,CustomWebhookDestination,SmtpDestination,SesDestination, andSnsDestination.MessageContent: Encapsulates the notification message (title, text body, HTML body, attachment).DestinationMessageResponse: Standard response from any delivery attempt (status code, response body).
2. Core Implementation (core)
The Core layer provides the actual delivery logic:
-
Transport Providers:
WebhookDestinationTransport— handles Slack, Chime, Microsoft Teams, and custom webhook delivery via HTTP POST.SmtpDestinationTransport— sends emails using SMTP protocol (supports STARTTLS/SSL).SesDestinationTransport— sends emails via the AWS SES SDK.SnsDestinationTransport— publishes messages to AWS SNS topics.
-
HTTP Client Pool:
DestinationClientPoolmanages a pool ofDestinationHttpClientinstances with configurable connection limits, timeouts, and host deny lists. -
Credential Management: The
CredentialsProviderabstraction loads SMTP/SES/SNS credentials from the OpenSearch Keystore or from secure settings. -
Plugin Settings (
PluginSettings): All tunable parameters — email size limits, connection pools, timeouts, allowed config types, host deny lists — are centralized here and dynamically updatable via cluster settings.
3. Notification Plugin (notifications)
The Plugin module ties everything together:
- REST Handlers: Map HTTP requests to internal transport actions (see API Reference).
- Transport Actions: Asynchronous action classes (
CreateNotificationConfigAction,DeleteNotificationConfigAction,GetNotificationConfigAction,UpdateNotificationConfigAction,SendNotificationAction,SendTestNotificationAction,GetPluginFeaturesAction,GetChannelListAction,PublishNotificationAction). - Index Operations:
NotificationConfigIndexmanages the.notificationsindex for storing channel configurations.ConfigIndexingActionshandles create/read/update/delete operations on the index. - Metrics: The
Metricsclass tracks counters for all API operations (create, update, delete, info, features, channels, send test). - Security:
UserAccessManagerenforces RBAC based on backend roles whenfilter_by_backend_rolesis enabled.
Send Notification Sequence
The following sequence describes the flow when an internal plugin (e.g., Alerting) sends a notification:
- The Alerting Monitor triggers an alert and calls the Notification plugin via the Transport Interface.
- The Security Plugin verifies the caller’s permissions.
- The notification is persisted in the notifications index with status
pending/in-progress. - The plugin resolves the destination type and delegates to the appropriate transport:
- Email:
SmtpDestinationTransportorSesDestinationTransportsends the email. On failure, retries up to the configured limit. - Webhook:
WebhookDestinationTransportsends the HTTP request to Slack, Chime, Teams, or a custom endpoint. - SNS:
SnsDestinationTransportpublishes to the SNS topic.
- Email:
- The delivery status is returned and the notification record is updated.
- The Alerting plugin acknowledges the result and updates the alert status.
Configuration Management Sequence
- A user (via Dashboard or REST API) creates or updates a notification channel configuration.
- The request is routed to
NotificationConfigRestHandler. - The configuration is validated and persisted in the
.notificationsindex. - On retrieval, configurations can be filtered by type, name, status, and other fields.