Skip to content

OSSEC and Wazuh host intrusion detection — the operator's view

Picking between OSSEC and Wazuh, deploying agents to Linux hosts, and turning the default rule set into something that produces actionable alerts.

OSSEC was the original open-source host intrusion detection system; Wazuh is its actively-maintained fork with a manager, a dashboard, and a SIEM-shaped frontend. Both watch log files for indicators, hash important paths, react to rootkits, and emit events to a central manager. This article covers the choice between them, the deploy that actually works in production, and the rule tuning that keeps the alert volume sane.

How to verify

If a HIDS is already installed, find out which and what it’s doing:

sudo systemctl status wazuh-agent ossec-agent 2>&1 | head
sudo /var/ossec/bin/wazuh-control status   # Wazuh
sudo cat /var/ossec/etc/ossec.conf | head -40
sudo ls /var/ossec/logs/
sudo /var/ossec/bin/agent_control -l       # on the manager

The /var/ossec/ path is shared between OSSEC and Wazuh — Wazuh kept the on-disk layout. The control binary names differ (ossec-control vs wazuh-control); both expect to be run as root.

What’s happening

A HIDS agent watches the local host for indicators an attacker is present or active: a successful root login from a new IP, a new SUID binary, a Yara rule match, a process listening on a port nobody opened. The agent computes light analytics locally and ships events to a central manager. The manager applies rules (each rule scoring an event) and decides which events are alerts and which are noise.

OSSEC is conservative and self-contained. Wazuh adds a manager that integrates with Elastic, OpenSearch, or its own indexer, plus modules for vulnerability detection, container monitoring, and AWS CloudTrail ingestion. For a Stack Harbor-style engagement Wazuh almost always wins on operability — the dashboard makes triage tolerable — but the trade is more moving parts and a larger storage footprint.

Both ship with hundreds of bundled rules. The rules are good starting points but not opinionated about your environment. The single biggest tuning task is the false-positive sweep: a noisy rule that fires daily on a known benign behaviour will train operators to ignore the alert channel.

The procedure

  1. Choose. If you already have an Elastic or OpenSearch stack, Wazuh is the natural fit. If you want minimal moving parts and have your own log aggregator, OSSEC works fine. Mixed deployments are possible but rare.
  2. Deploy the manager. For Wazuh: curl -sO https://packages.wazuh.com/4.x/wazuh-install.sh && sudo bash wazuh-install.sh -a. The script installs the manager, indexer, and dashboard on one host — split for production.
  3. Deploy agents via configuration management. Pin the version: wazuh-agent=4.7.4-1 so an unexpected upgrade does not break the rules. Set the manager address in /var/ossec/etc/ossec.conf (<address>wazuh-manager.example.com</address>).
  4. Register each agent on the manager. sudo /var/ossec/bin/manage_agents — interactive, or use agent-auth for automated enrolment: sudo /var/ossec/bin/agent-auth -m wazuh-manager.example.com. Auth keys are stored in /var/ossec/etc/client.keys.
  5. Confirm enrolment from the manager. sudo /var/ossec/bin/agent_control -l lists agents and their last-seen time. An agent that goes silent for more than 10 minutes should page someone — silent endpoints are how compromises hide.
  6. Tune the rules. The default rules live in /var/ossec/ruleset/rules/. Never edit them — overrides go in /var/ossec/etc/rules/local_rules.xml. Bump the level of a rule with <rule id="5710" level="3" overwrite="yes"> (a Wazuh-specific syntax) or write a new rule that matches the same indicator with the level you want.
  7. Plug in vulnerability detection (Wazuh only). Enable the vulnerability-detector module in the manager config — it polls CVE feeds and correlates with installed packages on each agent. The first scan is slow; subsequent scans are incremental.
  8. Forward alerts to your ticketing system. The manager writes JSON-formatted alerts to /var/ossec/logs/alerts/alerts.json; ship that to your SIEM or use Wazuh’s integrator to push to PagerDuty, Slack, or a generic webhook.

Common pitfalls

  • The agent does not auto-reconnect indefinitely on some packaged versions — a manager outage longer than a few minutes can leave agents stranded. Configure <notify_time> and <time-reconnect> in agent config to tighten the loop.
  • Wazuh’s File Integrity Monitoring (FIM) writes to a SQLite DB on the agent. On hosts with millions of files, the DB can grow large and rebuilding it from scratch (after a corruption) takes hours. Tune <frequency> and the scope under <syscheck>.
  • The bundled rule for SSH brute force is conservative — it triggers at 10 failures in 2 minutes. For an SSH-locked-down host that should never see failures, lower the threshold or write a rule that fires on the first failure from an unexpected source.
  • The manager-agent traffic is encrypted but the pre-shared key sits in client.keys on every agent in plaintext. Limit file permissions and audit reads.
  • Wazuh’s indexer storage grows fast in a busy environment. Plan a retention policy (typically 30-90 days hot, longer cold) before deploy, not after the first disk fills.

In the engagements we run, HIDS is one input to a layered detection model — paired with auditd, network flow data, and application logs. The triage, tuning, and on-call coverage of those events is part of Managed Operations — a HIDS without a human reading its output is shelfware.