Wazuh RuleOpsX: Auto-Validate, Deploy & Elevate Detection - n8n Workflow

Use this robust n8n workflow template to automate Wazuh custom rule deployment via GitHub push events. Features XML validation, SSH file transfer, and Telegram alerts using the powerful n8n node ecosystem.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Security Engineers and SOC Analysts managing Wazuh rulesets.

  • DevOps teams looking to implement GitOps principles for security infrastructure.

  • System Administrators who need reliable, automated SSH-based deployment.

  • Users searching for advanced n8n templates integrating version control and system monitoring.

Overview

Managing custom security rules in systems like Wazuh requires rigorous testing and controlled deployment. This sophisticated n8n workflow solves the problem of manual deployment by establishing an automated GitOps pipeline. Whenever a new custom XML rule is committed to a designated GitHub repository, this n8n workflow takes over. It ensures the rule is downloaded, uploaded securely via an SSH n8n node, validated on the Wazuh manager, and only if successful, deployed and activated.

This robust n8n template significantly reduces human error, speeds up the response time for new threats, and provides instant notification via Telegram if validation or deployment fails. It demonstrates the power of the n8n platform for mission-critical IT and security automation tasks. The combination of the GitHub n8n trigger, SSH operations, and Telegram notifications makes this a professional-grade automated solution.

How it Works

This automation initiates with the GitHub n8n trigger, monitoring a specific repository for relevant commit events.


  1. Trigger & Filtering: The n8n trigger catches a new push event. The 'Valid Commit for Deployment' n8n node checks specific parameters (e.g., branch or commit message) to determine if deployment is required. Irrelevant commits are routed to the 'No Operation' node.

  2. Extraction & Download: If valid, the 'Extract Changed Files' code n8n node parses the GitHub payload to identify the URL of the new XML rule file. The 'Download Rule' HTTP Request n8n node fetches the content of this file.

  3. Secure Upload: The content is passed to the 'Upload a file' SSH n8n node, which securely transfers the file to a temporary location on the Wazuh Manager server.

  4. XML Validation: The 'Rule Validation' SSH n8n node executes a remote command (like wazuh-logtest -t) to verify the XML structure and rule syntax.

  5. Validation Check: The 'Rule Validation check' n8n node evaluates the SSH output. If validation fails, an alert is sent via the 'Rules deployment failed' Telegram n8n node.

  6. Deployment & Restart: If validation passes, the 'Deploying the Rules' SSH n8n node moves the file to the active rules directory. The 'Restart Wazuh_manager' SSH n8n node then restarts the service to load the new detection logic.

  7. Final Confirmation: The 'Final Confirmation check' n8n node verifies the success of the restart/deployment sequence. A successful path sends a confirmation via the '✅ Success Message' Telegram n8n node, while failure routes to the '❌ Failure Message' Telegram n8n node.

Installation Guide

To use this powerful n8n workflow, follow these setup steps:


  1. Import: Copy the provided n8n workflow JSON and import it into your n8n instance.

  2. GitHub Credentials: Configure the 'Github Trigger' n8n node. You will need to select or create OAuth credentials for GitHub and set up the repository and events you wish to monitor.

  3. SSH Credentials: Configure all SSH n8n nodes ('Upload a file', 'Rule Validation', 'Deploying the Rules', 'Restart Wazuh_manager') with credentials that allow remote execution and file transfer on your Wazuh Manager server.

  4. Telegram Webhooks: Configure the four Telegram n8n nodes with your specific chat IDs and API tokens for notifications. Each n8n node requires its own webhook setup.

  5. Activation: Once credentials and webhooks are set, activate the n8n workflow to enable automated monitoring.

Node Details

Github Trigger: The starting n8n trigger. It listens for specific events (e.g., push) on a configured repository to initiate the pipeline.
Extract Changed Files (Code n8n node): Custom JavaScript used to parse the incoming GitHub webhook payload, specifically looking for the paths and URLs of new or modified files (the Wazuh rules).
Download Rule (HTTP Request n8n node): Fetches the raw content of the new rule file identified by the previous n8n node, preparing it for secure transfer.
Upload a file & Rule Validation (SSH n8n nodes): These n8n nodes execute remote commands. The first handles file transfer, and the second runs critical validation commands (like ossec-logtest) on the Wazuh server using remote SSH.
Rule Validation check & Final Confirmation check (If n8n nodes): Core logic components of this n8n workflow. They branch the execution flow based on the exit codes or output messages received from the SSH commands, ensuring failed deployments halt safely.
Telegram n8n nodes: Used extensively for instant alerts, providing real-time feedback on successful deployments, validation failures, or service restart issues.

Related n8n Workflows

Paid

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

An Open-source enthusiast driving next-gen Detection Engineering, Threat Hunting, and SOC Automation — turning ideas into tools that empower security teams to detect and respond faster than ever.

Featured*