Skip to content

Comprehensive Wazuh Architecture: High-Level Overview and Codebase Deep Dive

Published: at 10:00 AM

Table of Contents

Open Table of Contents

Introduction

This document provides a comprehensive overview of the Wazuh security platform (v4.11.2), including its high-level architecture, component relationships, data flows, codebase organization, and security considerations. Wazuh is an open-source security monitoring solution that provides threat detection, integrity monitoring, incident response, and compliance capabilities.

System Architecture

The Wazuh security monitoring platform consists of several interconnected components that work together to provide comprehensive security monitoring capabilities:

graph TB
    subgraph "Endpoints"
        A1[Wazuh Agent<br/>Linux/Windows/macOS]
        A2[Wazuh Agent<br/>Containers]
        A3[Wazuh Agent<br/>Cloud Instances]
    end

    subgraph "Central Components"
        LB[Load Balancer<br/>Optional]

        subgraph "Wazuh Manager"
            LC[Log Collector]
            CF[Core Framework]
            RD[Rules & Decoders]
            API[RESTful API]
            FB[Filebeat Integration]

            subgraph "Wodles"
                W1[Syscheck]
                W2[Vulnerability<br/>Detector]
                W3[CIS-CAT]
                W4[Command<br/>Execution]
                W5[osquery]
            end
        end
    end

    subgraph "Storage & Visualization"
        ES[Elasticsearch/<br/>OpenSearch]
        WD[Wazuh Dashboard]
    end

    A1 -->|TLS| LB
    A2 -->|TLS| LB
    A3 -->|TLS| LB
    LB --> LC

    LC --> CF
    CF --> RD
    CF --> W1
    CF --> W2
    CF --> W3
    CF --> W4
    CF --> W5

    RD --> API
    API --> WD
    FB --> ES
    WD --> ES

    style A1 fill:#e1f5fe
    style A2 fill:#e1f5fe
    style A3 fill:#e1f5fe
    style CF fill:#fff9c4
    style ES fill:#f3e5f5
    style WD fill:#e8f5e9

Component Descriptions

External Components

Wazuh Agent

Load Balancer (Optional)

Wazuh Dashboard

Indexer/Storage

Central Components (Wazuh Manager)

Log Collector

Core Framework

Rules & Decoders

Dynamic Modules (“Wodles”)

Specialized security modules that extend functionality:

RESTful API

Filebeat Integration

Security Data Flow

The security data flow in Wazuh follows this sequence:

sequenceDiagram
    participant Agent as Wazuh Agent
    participant Manager as Wazuh Manager
    participant Indexer as Elasticsearch/OpenSearch
    participant Dashboard as Wazuh Dashboard
    participant Admin as Administrator

    Agent->>Agent: Collect logs & events
    Agent->>Manager: Send encrypted data (TLS)
    Manager->>Manager: Decode & analyze events
    Manager->>Manager: Apply rules & generate alerts
    Manager->>Indexer: Forward alerts via Filebeat
    Indexer->>Indexer: Index and store data
    Admin->>Dashboard: Access web interface
    Dashboard->>Indexer: Query security data
    Indexer->>Dashboard: Return results
    Dashboard->>Admin: Display visualizations
    Admin->>Dashboard: Update configurations
    Dashboard->>Manager: Apply changes via API
    Manager->>Agent: Push new configurations
  1. Data Collection: Agents collect logs and security events from endpoints
  2. Secure Transport: Data is sent to the Manager using TLS encryption
  3. Event Processing: The Manager processes events through its analysis pipeline
  4. Alert Generation: Matching events trigger alerts based on rule definitions
  5. Data Indexing: Alerts and events are stored in Elasticsearch/OpenSearch
  6. Visualization: The Dashboard queries and displays security information
  7. Management: Configuration changes flow from Dashboard through API to Agents

Deployment Models

Small Deployment

For small environments (< 50 agents):

Distributed Deployment

For large environments (> 100 agents):

Wazuh Codebase Architecture

Codebase Organization

The Wazuh codebase is organized into several major directories:

wazuh/
├── src/                    # Core C codebase
│   ├── analysisd/         # Event analysis daemon
│   ├── remoted/           # Remote daemon (agent communication)
│   ├── syscheckd/         # File integrity monitoring
│   ├── wazuh_modules/     # Wazuh modules framework
│   ├── shared/            # Common libraries
│   ├── headers/           # Shared header files
│   ├── monitord/          # Monitoring daemon
│   └── os_*/              # OS-specific libraries
├── framework/             # Python framework
│   ├── core/              # Core Python libraries
│   ├── wazuh/             # Main Wazuh Python package
│   └── scripts/           # Utility scripts
├── api/                   # RESTful API
│   ├── framework/         # API framework code
│   └── scripts/           # API scripts
├── ruleset/               # Rules and decoders
│   ├── rules/             # XML rule definitions
│   ├── decoders/          # XML decoder definitions
│   └── lists/             # CDB list files
├── wodles/                # Wazuh modules
│   ├── aws/               # AWS integration
│   ├── azure/             # Azure integration
│   ├── gcp/               # GCP integration
│   ├── docker/            # Docker monitoring
│   └── oscap/             # OpenSCAP integration
├── integrations/          # External integrations
│   ├── virustotal/        # VirusTotal integration
│   ├── pagerduty/         # PagerDuty integration
│   └── slack/             # Slack notifications
└── tests/                 # Test suite

Manager Component Architecture

graph TB
    subgraph "Wazuh Manager Codebase"
        subgraph "Core Daemons (C)"
            AD[analysisd<br/>Event Analysis]
            RD[remoted<br/>Agent Communication]
            SD[syscheckd<br/>FIM]
            MD[monitord<br/>System Monitor]
        end

        subgraph "Shared Libraries"
            SL[shared/<br/>Common Functions]
            OS[os_*/<br/>OS Abstractions]
            HD[headers/<br/>Definitions]
        end

        subgraph "Modules Framework"
            WM[wazuh_modules/<br/>Module Core]
            WD[wodles/<br/>Module Implementations]
        end

        subgraph "Management Layer (Python)"
            FW[framework/<br/>Python Core]
            AP[api/<br/>RESTful API]
            SC[scripts/<br/>Utilities]
        end

        subgraph "Configuration"
            RL[ruleset/<br/>Rules & Decoders]
            CF[etc/<br/>Config Files]
        end
    end

    AD --> SL
    RD --> SL
    SD --> SL
    MD --> SL

    WM --> WD
    WM --> SL

    FW --> AD
    FW --> RD
    AP --> FW

    AD --> RL

    style AD fill:#ffebee
    style RD fill:#e3f2fd
    style SD fill:#f3e5f5
    style FW fill:#fff9c4
    style AP fill:#e8f5e9

Event Processing Workflow

flowchart LR
    subgraph "Event Processing Pipeline"
        A[Log Reception<br/>remoted] --> B[Decoding<br/>analysisd/decoders]
        B --> C[Pre-decoding<br/>analysisd/cleanevent]
        C --> D[Rule Matching<br/>analysisd/rules]
        D --> E[Alert Generation<br/>analysisd/alerts]
        E --> F[Output<br/>Filebeat/API]

        D --> G[Correlation<br/>analysisd/accumulate]
        G --> E

        D --> H[Active Response<br/>analysisd/active-response]
    end

    style A fill:#e3f2fd
    style D fill:#ffebee
    style E fill:#e8f5e9

Core Components Detailed

Analysisd (Event Analysis Engine)

Key source files:

Remoted (Agent Communication)

Key source files:

Wazuh Modules Framework

Key source files:

Security Considerations

Authentication & Authorization

Encryption

Integrity Verification

Network Security

Regular Updates

Integration Points

Wazuh provides several integration points for extending its capabilities:

RESTful API

Custom Rules and Decoders

Alert Integration

Custom Modules (Wodles)

Performance Optimization

Manager Optimization

Storage Optimization

Network Optimization

Troubleshooting Guide

Common Issues

Agent Connection Problems

High Resource Usage

Alert Delays

Diagnostic Tools

Best Practices

Deployment

  1. Start with a pilot deployment
  2. Document your architecture
  3. Implement proper change management
  4. Plan for growth and scalability

Configuration

  1. Use configuration management tools
  2. Version control for rules and decoders
  3. Test changes in non-production first
  4. Document custom configurations

Monitoring

  1. Monitor Wazuh component health
  2. Track resource utilization trends
  3. Set up alerting for critical issues
  4. Regular performance reviews

Security

  1. Regular security assessments
  2. Penetration testing
  3. Compliance audits
  4. Incident response procedures

Conclusion

Wazuh provides a comprehensive security monitoring solution with a modular, scalable architecture. Its design supports everything from small single-server deployments to large distributed clusters. The codebase is well-organized with clear separation between core components, modules, and management layers.

By understanding both the high-level architecture and the underlying codebase structure, organizations can effectively deploy, customize, and maintain Wazuh as a core component of their security strategy. The platform’s extensibility through APIs, custom rules, and modules makes it adaptable to various security requirements and environments.

This architecture overview is based on Wazuh v4.11.2. For the most current information and detailed implementation guides, please refer to the official Wazuh documentation.