<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hanif K A on Medium]]></title>
        <description><![CDATA[Stories by Hanif K A on Medium]]></description>
        <link>https://medium.com/@Hanif.ka?source=rss-356ba3f41fb1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SQ3R7ez4fK0V5FcV</url>
            <title>Stories by Hanif K A on Medium</title>
            <link>https://medium.com/@Hanif.ka?source=rss-356ba3f41fb1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 07:29:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Hanif.ka/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Detecting Noisy Alerts in Wazuh: What One Dashboard Told Us About Our Alert Volume]]></title>
            <link>https://medium.com/@Hanif.ka/detecting-noisy-alerts-in-wazuh-what-one-dashboard-told-us-about-our-alert-volume-9d634cab37db?source=rss-356ba3f41fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d634cab37db</guid>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[noise]]></category>
            <category><![CDATA[alert-fatigue]]></category>
            <category><![CDATA[detection-engineering]]></category>
            <category><![CDATA[wazuh]]></category>
            <dc:creator><![CDATA[Hanif K A]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 18:53:04 GMT</pubDate>
            <atom:updated>2026-09-23T19:04:13.034Z</atom:updated>
            <content:encoded><![CDATA[<p>Our Wazuh cluster produces millions of alerts every month. We built a dashboard to answer one question: which rules create the noise, and which ones are safe to tune?</p><p>Here is what each panel showed us.</p><h3>1. Noise Pareto</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UOhyx9RXUK7b__SOVUbccg.png" /></figure><p>Five rules produced 82% of all alerts. Rule 1007 “File system full” alone produced about half. Bars are colored by level: level 6 and below are tuning candidates, and level 7 and above need a review first.</p><p>Insight: Tuning five rules removes most of the volume. Rule 1007 is level 7 and describes a real disk problem, so the fix is on the host, not in the ruleset.</p><h3>2. Top 10 Rules and Trigger Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9o2YsgLZbRhqIeK-wFDBtw.png" /></figure><p>The table lists rule ID, description, level and count. Rule 106110 (Sysmon Event 7, image loaded) shows up many times, split by the process loading the image. The biggest group comes from the EDR agent loading its own modules.</p><p>Insight: Tune by process path, not by rule ID. The rest of 106110 keeps working.</p><h3>3. Top Noisy Agents and Alerts by Hour</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CzEe0QkvlLn4vzXcqM0Mlw.png" /></figure><p>One Linux agent sent more than twice the volume of the Windows agent. Split by level, most of the Linux volume is level 7 (the disk alert), while Windows is mostly level 3 logon events. Hourly volume stays almost flat all day.</p><p>Insight: A flat daily pattern points to machine-generated noise, not user activity. Small early morning peaks are worth checking against scheduled jobs.</p><h3>4. Rule Burst Heatmap</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZPR4mSOTdV0YLdmzXDX86A.png" /></figure><p>Each cell is a z-score against the rule’s own baseline. In one interval, “PAM: User login failed” jumped to about six times its normal volume, a z-score above 4. On another day, failed Windows logons and netsh Active Response blocks spiked at the same time.</p><p>Insight: Total volume hides bursts. The heatmap shows when a normally steady rule suddenly isn’t, and the paired rows show Active Response reacting to failed logons.</p><h3>5. Noise vs Severity Quadrant</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-xjsmkHj8kg6hURS992Dw.png" /></figure><p>Rules are split at median volume and level 6.5 into four zones: keep, investigate, tune first, and low priority. Rule 5503 (PAM login failed, level 5) lands in “tune first” because of its high volume.</p><p>Insight: This is where judgment matters. The same rule showed a clear burst in panel 4. High volume at a low level does not always mean harmless. Tune it with a frequency threshold, not a full silence.</p><h3>What changed for us</h3><p>Tuning decisions now start from data: volume, level, agent spread and timing. We no longer start from whichever alert annoys people most.</p><p>Dashboard export:<a href="https://github.com/Hanifka/wazuh-tune-dashboard"> https://github.com/Hanifka/wazuh-tune-dashboard</a></p><p>Wazuh homepage link — <a href="https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program</a></p><p>Ambassadors program link — <a href="https://wazuh.com/ambassadors-program/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">https://wazuh.com/ambassadors-program/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d634cab37db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rustinel EDR + Wazuh: Centralized Rule Management]]></title>
            <link>https://medium.com/@Hanif.ka/rustinel-edr-wazuh-centralized-rustinel-rule-management-with-wazuh-0b8e772e21dc?source=rss-356ba3f41fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b8e772e21dc</guid>
            <category><![CDATA[detection-engineering]]></category>
            <category><![CDATA[xdr]]></category>
            <category><![CDATA[wazuh]]></category>
            <dc:creator><![CDATA[Hanif K A]]></dc:creator>
            <pubDate>Sat, 11 Jul 2026 08:47:17 GMT</pubDate>
            <atom:updated>2026-07-18T04:59:35.812Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_sRBe7MlXsDMew2iX8Eqkg.png" /></figure><p>This article extends the basic Rustinel + Wazuh integration with centralized detection-rule management. Sigma, YARA, and IOC rules are authored once on the Wazuh manager and delivered to every agent through Wazuh’s group file sharing. Rustinel reads those files straight from the shared directory and hot-reloads them. No copy step, no sync script, no restart on the endpoint.</p><h3>Why centralize</h3><p>Per-host rule management does not survive contact with a real fleet. Ten endpoints with locally maintained YARA rules are ten places where a rule can quietly go stale, and nobody notices until a hunt comes up empty. Moving everything to the Wazuh manager fixes a few problems at once:</p><ul><li>The group directory on the manager becomes the single source of truth. What is in that folder is what every agent runs, so there is no drift to audit.</li><li>During an incident, adding a hash or C2 IP to one file on the manager gets the indicator to every endpoint in minutes. Wazuh delivers it on the next sync cycle and Rustinel hot-reloads it, without anyone touching an endpoint.</li><li>There is no sync tooling to build or maintain. The distribution channel is Wazuh’s own agent group sharing, which is already deployed and already monitored. Nothing extra to write, no cron job to babysit.</li><li>Rule changes become reviewable. Put the group directory under git and every change is tracked and revertible; a bad rule causing false positives can be rolled back fleet-wide with one revert.</li><li>Failures are visible. Rustinel’s operational log is shipped back through the same Wazuh agent, so a rule that fails to parse, or a reload that leaves an engine with zero rules, becomes a dashboard alert instead of a silent gap in coverage (Section 4).</li></ul><p><strong>Prerequisites:</strong> the <a href="https://medium.com/@kurniawanhanif63/rustinel-edr-wazuh-ed747cb1b8d9">basic integration guide</a> should already be done, meaning:</p><ul><li>Rustinel is installed and running on your Linux and Windows agents.</li><li>The Wazuh agents are enrolled and reporting to the manager.</li><li>The base Wazuh rule group (IDs 100030 to 100034) from the basic guide is loaded on the manager.</li></ul><h3>1. How It Works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e0pwkCIWbzwqD-gEu27u4g.png" /><figcaption><em>Figure 1. Centralized rule flow: author on the manager, Wazuh distributes, Rustinel direct-reads and hot-reloads, alerts flow back to the dashboard.</em></figcaption></figure><p>The setup glues together three things that already exist, so there is nothing new to install.</p><p><strong>Wazuh group file sharing.</strong> Each agent group has a directory on the manager under /var/ossec/etc/shared/&lt;group_name&gt;/. Any file placed there is synced to every agent in the group. On the agent, files from all of the agent&#39;s groups land in one <strong>flat</strong> directory: there are no per-group subdirectories on the endpoint.</p><p><strong>Rustinel’s configurable rule paths.</strong> Rustinel loads its rule locations from config.toml. Instead of keeping rules under /opt/rustinel/rules and copying files into place, point the rule paths straight at the Wazuh shared directory. Wazuh delivers the files; Rustinel reads them where they land. The manager is the source of truth, Wazuh handles distribution, Rustinel handles reload.</p><p><strong>Hot reload.</strong> Rustinel watches its configured rule paths with filesystem events (inotify on Linux), falling back to a 60-second poll if the watcher cannot initialize. When Wazuh delivers an updated file, that write happens inside a path Rustinel is already watching. Rustinel debounces the change, rebuilds only the affected detector, and swaps it in atomically. No copy, no restart, no signal.</p><h3>1.1 Behaviors to know</h3><p>Every configuration choice in the rest of the article follows from these four behaviors, so they come first.</p><ul><li><strong>Engines load by file extension.</strong> The Sigma loader reads .yml/.yaml files in its directory; the YARA loader reads .yar/.yara. The IOC engine is different: it points at four files by exact name. Wazuh&#39;s own control files in the shared directory (agent.conf, merged.mg) have none of those extensions, so the rule loaders ignore them. This is what makes it safe to point Sigma and YARA at the whole shared directory.</li><li><strong>The agent shared directory is flat.</strong> This fits Rustinel’s model well: point Sigma and YARA at the shared directory, and name the four IOC files exactly as Rustinel expects. A strict naming convention (sigma_*.yml, yara_*.yar, ioc_*.txt) keeps it obvious which file belongs to which engine.</li><li><strong>Empty rulesets behave differently per engine.</strong> For Sigma and YARA, an empty ruleset is accepted and swapped in, which effectively disables that engine if the folder is empty. For IOC, an empty indicator set is rejected and Rustinel keeps the last known-good set live. Keep this in mind when managing IOC files centrally.</li><li><strong>A file that fails to parse does not take the engine down.</strong> Rustinel logs the failure, skips the file, and keeps the previously loaded ruleset live. Section 4 turns those log lines into dashboard alerts.</li></ul><h3>2. Setup</h3><h3>2.1 Create groups and assign agents</h3><p>Create two groups in the Wazuh dashboard: rustinel-linux and rustinel-windows. Open <strong>Server management &gt; Groups</strong>, click <strong>Add new group</strong>, type the name, and save. Repeat for the second group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*qb1LKmA8UCITAKIFC99FBA.png" /><figcaption><em>Figure 2. Creating the rustinel-linux group from the Wazuh dashboard.</em></figcaption></figure><p>Then open each group, click <strong>Manage agents</strong>, move the right agents from Available to Current, and apply. Agents pick up group config on the next keep-alive cycle, or immediately if you restart the agent or force a sync.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*klf8mijQJHj9h1EoTSzkew.png" /><figcaption><em>Figure 3. Adding win-agent-01 to the rustinel-windows group.</em></figcaption></figure><h3>2.2 Push the log collector config (agent.conf)</h3><p>The agent.conf in each group directory is merged with the agent&#39;s local ossec.conf at runtime. Each group ships two log streams: the JSON EDR alerts that drive the detections (Section 2.5) and the plain-text operational log that drives the sensor-health rules (Section 4). Any new agent added to the group starts shipping both streams as soon as it is enrolled.</p><p><strong>Linux</strong> (/var/ossec/etc/shared/rustinel-linux/agent.conf):</p><pre>&lt;agent_config&gt;<br>  &lt;localfile&gt;<br>    &lt;log_format&gt;json&lt;/log_format&gt;<br>    &lt;location&gt;/opt/rustinel/logs/alerts.json.*&lt;/location&gt;<br>  &lt;/localfile&gt;<br>  &lt;localfile&gt;<br>    &lt;log_format&gt;syslog&lt;/log_format&gt;<br>    &lt;location&gt;/opt/rustinel/logs/rustinel.log.*&lt;/location&gt;<br>  &lt;/localfile&gt;<br>&lt;/agent_config&gt;</pre><p><strong>Windows</strong> (/var/ossec/etc/shared/rustinel-windows/agent.conf):</p><pre>&lt;agent_config&gt;<br>  &lt;localfile&gt;<br>    &lt;log_format&gt;json&lt;/log_format&gt;<br>    &lt;location&gt;C:\rustinel\rustinel*\logs\alerts.json.*&lt;/location&gt;<br>  &lt;/localfile&gt;<br>  &lt;localfile&gt;<br>    &lt;log_format&gt;syslog&lt;/log_format&gt;<br>    &lt;location&gt;C:\rustinel\rustinel*\logs\rustinel.log.*&lt;/location&gt;<br>  &lt;/localfile&gt;<br>&lt;/agent_config&gt;</pre><h3>2.3 Point Rustinel at the shared directory</h3><p>Edit config.toml on each endpoint (this is the one per-host step, done once) and restart the Rustinel service so the new paths take effect. From then on, all rule management happens on the manager.</p><p><strong>Linux</strong> (/opt/rustinel/config.toml):</p><pre>[scanner]<br>sigma_enabled = true<br># Sigma loads every .yml rule file in this directory<br>sigma_rules_path = &quot;/var/ossec/etc/shared&quot;<br>yara_enabled = true<br># YARA loads every .yar rule file in this directory<br>yara_rules_path = &quot;/var/ossec/etc/shared&quot;</pre><pre>[ioc]<br>enabled = true<br># IOC points at exact filenames inside the shared dir<br>hashes_path      = &quot;/var/ossec/etc/shared/ioc_hashes.txt&quot;<br>ips_path         = &quot;/var/ossec/etc/shared/ioc_ips.txt&quot;<br>domains_path     = &quot;/var/ossec/etc/shared/ioc_domains.txt&quot;<br>paths_regex_path = &quot;/var/ossec/etc/shared/ioc_paths_regex.txt&quot;<br>default_severity = &quot;high&quot;</pre><p><strong>Windows</strong> (C:\rustinel\...\config.toml; note the double backslashes required by TOML):</p><pre>[scanner]<br>sigma_enabled = true<br>sigma_rules_path = &quot;C:\\Program Files (x86)\\ossec-agent\\shared&quot;<br>yara_enabled = true<br>yara_rules_path = &quot;C:\\Program Files (x86)\\ossec-agent\\shared&quot;</pre><pre>[ioc]<br>enabled = true<br>hashes_path      = &quot;C:\\Program Files (x86)\\ossec-agent\\shared\\ioc_hashes.txt&quot;<br>ips_path         = &quot;C:\\Program Files (x86)\\ossec-agent\\shared\\ioc_ips.txt&quot;<br>domains_path     = &quot;C:\\Program Files (x86)\\ossec-agent\\shared\\ioc_domains.txt&quot;<br>paths_regex_path = &quot;C:\\Program Files (x86)\\ossec-agent\\shared\\ioc_paths_regex.txt&quot;<br>default_severity = &quot;high&quot;</pre><p>If Rustinel logs permission errors after pointing the paths at the Wazuh shared directory, see the troubleshooting note in Section 5.</p><h3>2.4 Lay out the rules on the manager</h3><p>Everything is authored in the group directory on the manager. The files you place there are exactly the files Rustinel will read on the agent:</p><pre>/var/ossec/etc/shared/rustinel-linux/<br>├── agent.conf            # log collector (Section 2.2)<br>├── sigma_baseline.yml    # Sigma rules<br>├── sigma_persistence.yml<br>├── yara_malware.yar      # YARA rules<br>├── yara_webshell.yar<br>├── ioc_hashes.txt        # IOC files (exact names)<br>├── ioc_ips.txt<br>├── ioc_domains.txt<br>└── ioc_paths_regex.txt</pre><p>Add the same set, with platform-appropriate rules, to rustinel-windows/. On the agent these files land in the flat shared directory next to Wazuh&#39;s own agent.conf and merged.mg, and the extension-based loading from Section 1.1 keeps each engine on its own files.</p><p>If your Rustinel version loads all files regardless of extension and warns on the Wazuh control files, the fallback is to point sigma_rules_path and yara_rules_path at dedicated subdirectories. Wazuh group sharing delivers files flat, though, so most setups are simplest with the flat layout and the naming convention above.</p><h3>2.5 Severity mapping on the manager</h3><p>The manager rules that read Rustinel’s JSON alerts and map each Rustinel severity onto a Wazuh alert level (IDs 100030 to 100034) are covered in the basic integration guide and should already be loaded as part of the prerequisites. They live in /var/ossec/etc/rules/rustinel_rules.xml on the manager; see the guide in Resources for the full ruleset and the level policy behind it.</p><p><strong>One note that matters more in a centralized setup: match on severity, not engine.</strong> The child rules match edr.rule.severity, which catches every alert regardless of which engine produced it (Sigma, YARA, or IOC). With all three engines now managed centrally, an engine-name filter would narrow the match, and alerts from the other engines would fall through unclassified. Engine context is not lost: $(edr.rule.engine) is printed in every description.</p><h3>3. Pushing a Rule: End to End</h3><p>With the setup done, day-to-day rule management is: edit a file on the manager, watch it go live everywhere. A worked example, adding a Sigma rule that detects whoami execution on Linux:</p><pre>cd /var/ossec/etc/shared/rustinel-linux/<br>nano linux-whoami.yml</pre><p><em>Figure 4. A minimal Sigma rule that detects whoami execution on Linux.</em></p><p>Save the file. From there the pipeline runs itself:</p><ul><li>Wazuh delivers the file to all agents in the group on the next sync cycle (force it with agent_control -R -u &lt;id&gt;).</li><li>The file lands in the agent’s flat shared directory, a path Rustinel’s Sigma engine is already watching.</li><li>Rustinel debounces the change, recompiles the affected detector, and swaps it in atomically. No restart.</li><li>The rule is live. A match produces an alert in alerts.json, the Wazuh agent (already collecting that file) ships it, the manager applies the 100030 to 100034 severity rules, and it appears on the dashboard.</li></ul><p><strong>Latency:</strong> Wazuh sync cycle (up to ~15 minutes, or instant with a forced sync) plus Rustinel’s debounce (2 s default). There is no intermediate copy step, so there is nothing else to wait on. The same flow applies to YARA rules (.yar) and the four IOC files: edit on the manager, Wazuh delivers, Rustinel hot-reloads the affected engine.</p><h3>3.1 Verifying on the agent</h3><pre># Confirm the file arrived in the shared dir<br>ls -la /var/ossec/etc/shared/linux-whoami.yml</pre><pre># Watch Rustinel reload (operational log)<br>tail -f /opt/rustinel/logs/rustinel.log | grep -i reload</pre><pre># Or via journal if running as a service<br>journalctl -u rustinel -f | grep -i reload</pre><pre># Trigger a process the rule should match, then watch the alert file<br>tail -f /opt/rustinel/logs/alerts.json.*</pre><p>On Windows the equivalent log is C:\rustinel\rustinel*\logs\rustinel.log. Each change in the shared directory produces a fresh load and a hot-reload line. The capture below shows two Sigma reload cycles; the second logs a WARN because a malformed YAML file was dropped into the directory, and per Section 1.1 the file is skipped while the previous ruleset stays live:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*LhEov2wvdKOKLet-zz2ayw.png" /><figcaption><em>Figure 5. Two Sigma reload cycles. The second logs a WARN for a malformed YAML file but still completes.</em></figcaption></figure><p>If the event-based watcher could not initialize, Rustinel logs “inotify is not available for the rules directory” and falls back to a 60-second poll. Reloads still happen, just on that cadence.</p><h3>4. Monitoring Sensor Health</h3><p>Because the agent already tails Rustinel’s operational log (Section 2.2), the SOC can watch the health of the detection pipeline itself: ETW and eBPF startup, Sigma and YARA rule loading, hot-reload events, and rule-load failures. A pushed rule that fails to parse, an endpoint that loses detection coverage, or a sensor that fails to start becomes a dashboard alert instead of something you discover during an incident.</p><p>The custom decoders and rules that parse this stream are in <strong>Appendix B</strong>. In summary: the rule IDs sit in the 100200 range so they do not clash with the EDR alert rules from Section 2.5, informational events (rule loads, reloads, ETW session start) fire at level 3, rule-load failures at level 7, and a reload that leaves an engine with zero rules, meaning loss of detection coverage, at level 10. A frequency rule (100220) escalates three load failures within five minutes as possible tampering, mapped to MITRE ATT&amp;CK T1562.001.</p><h3>4.1 What it looks like on the dashboard</h3><p>Pushing the whoami rule from Section 3 and triggering it on a Linux agent produces the EDR detection with full process context (executable, command line, parent command line, user), classified by the severity rules:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Z09Ql055UfDxN6TTZwFzUA.png" /></figure><p><em>Figure 6. Rustinel EDR alert for whoami execution on the Wazuh dashboard.</em></p><p>Filtering Discover on rule.groups: rustinel surfaces both the EDR detections and the operational events in one view, with the time histogram showing when reloads and detections happen across the fleet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*GOQ_6R2ZzQpRxkdLzrnVlA.png" /><figcaption><em>Figure 7. Discover filtered on rule.groups: rustinel shows EDR detections and operational events together.</em></figcaption></figure><p>The operational rules classify the sensor-health events. Below, a series of Sigma and YARA reloads plus the level-7 failure case for a rule that did not parse:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*TyANWUtib0weEQGf90IV5w.png" /><figcaption><em>Figure 8. Operational rules firing: YARA and Sigma reloads, plus a Failed to load rule alert.</em></figcaption></figure><h3>5. Troubleshooting: Rustinel Cannot Read the Shared Directory</h3><p>On some Linux distributions /var/ossec/etc/ and the shared directory are mode 0770 owned by wazuh:wazuh, and Rustinel&#39;s systemd unit drops most capabilities through CapabilityBoundingSet. If Rustinel cannot read the rules, or the hot-reload watcher does not fire after pointing the paths at the shared directory, look for lines like:</p><pre>WARN rustinel::engine::loader: Rules directory does not exist: &quot;/var/ossec/etc/shared&quot;<br>WARN ioc: IOC file missing or unreadable ... error=Permission denied (os error 13)</pre><p>Grant Rustinel the CAP_DAC_READ_SEARCH capability so it can read through the restricted Wazuh directories without modifying their permissions. Create a systemd drop-in:</p><pre>sudo systemctl edit rustinel</pre><p>Add the following between the two comment blocks shown in the editor:</p><pre>[Service]<br>AmbientCapabilities=CAP_BPF CAP_NET_ADMIN CAP_SYS_RESOURCE CAP_PERFMON CAP_DAC_READ_SEARCH<br>CapabilityBoundingSet=CAP_BPF CAP_NET_ADMIN CAP_SYS_RESOURCE CAP_PERFMON CAP_DAC_READ_SEARCH</pre><p>Reload systemd and restart Rustinel:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl restart rustinel</pre><p>After the restart, Rustinel reads the shared directory and the hot-reload watcher fires on every file change delivered by the manager. CAP_DAC_READ_SEARCH only grants read and directory traversal; it cannot modify or delete files, so the Wazuh-owned files remain untouched.</p><h3>Conclusion</h3><p>Centralizing Rustinel on Wazuh is less about any individual Sigma or YARA rule and more about the operating model it puts in place. The same channel that already ships every agent’s telemetry now also carries its detection content and its health signals, and that single channel is what turns a pile of endpoints into a fleet you can actually run. Three properties make that possible.</p><p><strong>Centralized deployment.</strong> The log-collector configuration lives once in agent.conf and is bound to the group, so every Rustinel sensor inherits the same collection policy from a single place on the manager. Onboarding a new host is an act of group membership, not a login to the endpoint — assign the agent to the group and it starts shipping both its alert stream and its operational log on the next sync. There are no per-host config files to drift, and no bespoke sync tooling to build or babysit, because Wazuh&#39;s own group file sharing is doing the distribution.</p><p><strong>Centralized rule management.</strong> Detection logic is authored, reviewed, and version-controlled in one directory on the manager, and it goes live the moment Rustinel hot-reloads the shared folder. Shipping a new indicator, tuning a noisy rule, or retiring a stale one never involves touching an endpoint, which keeps detection content identical across the entire fleet and makes a bad rule a one-revert rollback rather than a scramble across ten hosts. The manager is the source of truth, Wazuh handles distribution, and Rustinel handles reload — cleanly separated, each doing the one job it is good at.</p><p><strong>Operational visibility.</strong> Because the same Wazuh agent carries Rustinel’s operational log back to the manager, the health of every sensor is observable instead of assumed. The rules in Appendix B turn reload failures, empty rulesets, and repeated load errors into dashboard alerts, so a rule that fails to parse or an engine that reloads to zero rules surfaces immediately rather than becoming a silent gap in coverage. Deployment, rules, and visibility centralized on the same platform let a small team operate Rustinel at scale with confidence that what is defined on the manager is exactly what is running in the field.</p><h3>Appendix A. Rule Path Reference</h3><p>Rustinel loads configuration from config.toml (and EDR__ environment variables). The rule locations:</p><p>Engine config.toml key Type Sigma scanner.sigma_rules_path Directory (.yml / .yaml) YARA scanner.yara_rules_path Directory (.yar / .yara) IOC: hashes ioc.hashes_path Single file, exact name IOC: IPs / CIDRs ioc.ips_path Single file, exact name IOC: domains ioc.domains_path Single file, exact name IOC: path regex ioc.paths_regex_path Single file, exact name</p><p>Agent shared directory, the target for the paths above: /var/ossec/etc/shared/ on Linux, C:\Program Files (x86)\ossec-agent\shared on Windows.</p><h3>Appendix B. Operational Decoders and Rules</h3><p>Two parent decoders are used so the operational log is matched whether it arrives via syslog (program_name rustinel) or as raw lines carrying the reload: prefix. All extracted fields are namespaced under rustinel.* to avoid colliding with other decoders on the manager.</p><p><strong>File:</strong> /var/ossec/etc/decoders/rustinel_decoders.xml</p><pre>&lt;decoder name=&quot;rustinel&quot;&gt;<br>  &lt;program_name&gt;^rustinel&lt;/program_name&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-reload&quot;&gt;<br>  &lt;program_name&gt;^reload&lt;/program_name&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-etw-provider&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;Enabling ETW provider: &lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\.+) \((\S+)\) with keywords: (\S+)&lt;/regex&gt;<br>  &lt;order&gt;rustinel.provider, rustinel.guid, rustinel.keywords&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-etw&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;ETW trace session &#39;&lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\S+)&#39; &lt;/regex&gt;<br>  &lt;order&gt;rustinel.session&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-sigma-loading&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;Loading Sigma rules from: &quot;&lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\.+)&quot;&lt;/regex&gt;<br>  &lt;order&gt;rustinel.path&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-sigma-loaded&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;Loaded &lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\d+) Sigma rules total&lt;/regex&gt;<br>  &lt;order&gt;rustinel.count&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-logsource&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;Logsource &#39;&lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\.+)&#39;: (\d+) rules&lt;/regex&gt;<br>  &lt;order&gt;rustinel.logsource, rustinel.count&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-skipped&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;Skipped rules - deferred: &lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\d+), unknown_logsource: (\d+), product_mismatch: (\d+), inactive_collectors: (\d+)&lt;/regex&gt;<br>  &lt;order&gt;rustinel.deferred, rustinel.unknown, rustinel.mismatch, rustinel.inactive&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-failed&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;Failed to load rule &quot;&lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\.+)&quot;: (\.+)$&lt;/regex&gt;<br>  &lt;order&gt;rustinel.path, rustinel.reason&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-yara-loading&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;Loading YARA rules from: &quot;&lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\.+)&quot;&lt;/regex&gt;<br>  &lt;order&gt;rustinel.path&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-yara-compiled&quot;&gt;<br>  &lt;parent&gt;rustinel&lt;/parent&gt;<br>  &lt;prematch&gt;YARA Scanner: Found &lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;(\d+) rule files, compiled (\d+) &lt;/regex&gt;<br>  &lt;order&gt;rustinel.found, rustinel.compiled&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-sigma-reload&quot;&gt;<br>  &lt;parent&gt;rustinel-reload&lt;/parent&gt;<br>  &lt;prematch&gt;Sigma rules hot-reloaded &lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;total_rules=(\d+) elapsed_ms=(\d+)&lt;/regex&gt;<br>  &lt;order&gt;rustinel.count, rustinel.elapsed&lt;/order&gt;<br>&lt;/decoder&gt;</pre><pre>&lt;decoder name=&quot;rustinel-yara-reload&quot;&gt;<br>  &lt;parent&gt;rustinel-reload&lt;/parent&gt;<br>  &lt;prematch&gt;YARA rules hot-reloaded &lt;/prematch&gt;<br>  &lt;regex offset=&quot;after_prematch&quot;&gt;compiled_files=(\d+) elapsed_ms=(\d+)&lt;/regex&gt;<br>  &lt;order&gt;rustinel.compiled, rustinel.elapsed&lt;/order&gt;<br>&lt;/decoder&gt;</pre><p><strong>File:</strong> /var/ossec/etc/rules/rustinel_rules_operational.xml</p><pre>&lt;group name=&quot;rustinel,&quot;&gt;</pre><pre>  &lt;rule id=&quot;100200&quot; level=&quot;0&quot;&gt;<br>    &lt;decoded_as&gt;rustinel&lt;/decoded_as&gt;<br>    &lt;description&gt;Rustinel event.&lt;/description&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100201&quot; level=&quot;0&quot;&gt;<br>    &lt;decoded_as&gt;rustinel-reload&lt;/decoded_as&gt;<br>    &lt;description&gt;Rustinel reload event.&lt;/description&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100202&quot; level=&quot;3&quot;&gt;<br>    &lt;if_sid&gt;100200&lt;/if_sid&gt;<br>    &lt;match&gt;Enabling ETW provider:&lt;/match&gt;<br>    &lt;description&gt;Rustinel: Enabling ETW provider $(rustinel.provider).&lt;/description&gt;<br>    &lt;group&gt;service_start,&lt;/group&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100203&quot; level=&quot;3&quot;&gt;<br>    &lt;if_sid&gt;100200&lt;/if_sid&gt;<br>    &lt;match&gt;ETW trace session&lt;/match&gt;<br>    &lt;match&gt;started successfully&lt;/match&gt;<br>    &lt;description&gt;Rustinel: ETW session $(rustinel.session) started.&lt;/description&gt;<br>    &lt;group&gt;service_start,&lt;/group&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100204&quot; level=&quot;3&quot;&gt;<br>    &lt;if_sid&gt;100200&lt;/if_sid&gt;<br>    &lt;match&gt;Sigma rules total&lt;/match&gt;<br>    &lt;description&gt;Rustinel: $(rustinel.count) Sigma rules loaded.&lt;/description&gt;<br>    &lt;group&gt;sigma,&lt;/group&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100205&quot; level=&quot;3&quot;&gt;<br>    &lt;if_sid&gt;100200&lt;/if_sid&gt;<br>    &lt;match&gt;YARA Scanner: Found&lt;/match&gt;<br>    &lt;description&gt;Rustinel: YARA found $(rustinel.found), compiled $(rustinel.compiled).&lt;/description&gt;<br>    &lt;group&gt;yara,&lt;/group&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100206&quot; level=&quot;3&quot;&gt;<br>    &lt;if_sid&gt;100201&lt;/if_sid&gt;<br>    &lt;match&gt;Sigma rules hot-reloaded&lt;/match&gt;<br>    &lt;description&gt;Rustinel: Sigma rules reloaded ($(rustinel.count) rules, $(rustinel.elapsed) ms).&lt;/description&gt;<br>    &lt;group&gt;sigma,config_changed,&lt;/group&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100207&quot; level=&quot;3&quot;&gt;<br>    &lt;if_sid&gt;100201&lt;/if_sid&gt;<br>    &lt;match&gt;YARA rules hot-reloaded&lt;/match&gt;<br>    &lt;description&gt;Rustinel: YARA rules reloaded ($(rustinel.compiled) files, $(rustinel.elapsed) ms).&lt;/description&gt;<br>    &lt;group&gt;yara,config_changed,&lt;/group&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100210&quot; level=&quot;7&quot;&gt;<br>    &lt;if_sid&gt;100200&lt;/if_sid&gt;<br>    &lt;match&gt;Failed to load rule&lt;/match&gt;<br>    &lt;description&gt;Rustinel: Failed to load $(rustinel.path) - $(rustinel.reason).&lt;/description&gt;<br>    &lt;group&gt;configuration_error,&lt;/group&gt;<br>    &lt;mitre&gt;<br>      &lt;id&gt;T1562&lt;/id&gt;<br>    &lt;/mitre&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100211&quot; level=&quot;10&quot;&gt;<br>    &lt;if_sid&gt;100200&lt;/if_sid&gt;<br>    &lt;match&gt;Loaded 0 Sigma rules total&lt;/match&gt;<br>    &lt;description&gt;Rustinel: Zero Sigma rules loaded - no detection coverage.&lt;/description&gt;<br>    &lt;group&gt;sigma,configuration_error,&lt;/group&gt;<br>    &lt;mitre&gt;<br>      &lt;id&gt;T1562.001&lt;/id&gt;<br>    &lt;/mitre&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100212&quot; level=&quot;10&quot;&gt;<br>    &lt;if_sid&gt;100201&lt;/if_sid&gt;<br>    &lt;match&gt;Sigma rules hot-reloaded&lt;/match&gt;<br>    &lt;match&gt;total_rules=0 &lt;/match&gt;<br>    &lt;description&gt;Rustinel: Sigma reload resulted in zero rules.&lt;/description&gt;<br>    &lt;group&gt;sigma,configuration_error,&lt;/group&gt;<br>    &lt;mitre&gt;<br>      &lt;id&gt;T1562.001&lt;/id&gt;<br>    &lt;/mitre&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100213&quot; level=&quot;10&quot;&gt;<br>    &lt;if_sid&gt;100201&lt;/if_sid&gt;<br>    &lt;match&gt;YARA rules hot-reloaded&lt;/match&gt;<br>    &lt;match&gt;compiled_files=0 &lt;/match&gt;<br>    &lt;description&gt;Rustinel: YARA reload resulted in zero compiled rules.&lt;/description&gt;<br>    &lt;group&gt;yara,configuration_error,&lt;/group&gt;<br>    &lt;mitre&gt;<br>      &lt;id&gt;T1562.001&lt;/id&gt;<br>    &lt;/mitre&gt;<br>  &lt;/rule&gt;</pre><pre>  &lt;rule id=&quot;100220&quot; level=&quot;10&quot; frequency=&quot;3&quot; timeframe=&quot;300&quot;&gt;<br>    &lt;if_matched_sid&gt;100210&lt;/if_matched_sid&gt;<br>    &lt;description&gt;Rustinel: Multiple rule load failures - possible tampering.&lt;/description&gt;<br>    &lt;group&gt;configuration_error,&lt;/group&gt;<br>    &lt;mitre&gt;<br>      &lt;id&gt;T1562.001&lt;/id&gt;<br>    &lt;/mitre&gt;<br>  &lt;/rule&gt;</pre><pre>&lt;/group&gt;</pre><h3>Resources</h3><ul><li>Rustinel EDR + Wazuh, the basic integration guide (install, service setup, and the 100030 to 100034 ruleset): <a href="https://medium.com/@kurniawanhanif63/rustinel-edr-wazuh-ed747cb1b8d9">medium.com/@kurniawanhanif63/rustinel-edr-wazuh</a></li><li>Rustinel repository: <a href="https://github.com/Karib0u/rustinel">github.com/Karib0u/rustinel</a></li><li>Rustinel configuration docs: <a href="https://docs.rustinel.io/configuration/">docs.rustinel.io/configuration</a></li><li>Rustinel architecture (hot reload): <a href="https://docs.rustinel.io/architecture/">docs.rustinel.io/architecture</a></li><li>Wazuh centralized configuration: <a href="https://documentation.wazuh.com/current/user-manual/reference/centralized-configuration.html">documentation.wazuh.com/…/centralized-configuration.html</a></li><li>Wazuh webpage:<a href="https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">Wazuh — Open Source XDR. Open Source SIEM.</a></li><li>Ambassadors program landing page:<a href="https://wazuh.com/ambassadors-program/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">Ambassadors Program | Wazuh</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b8e772e21dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rustinel EDR + Wazuh]]></title>
            <link>https://medium.com/@Hanif.ka/rustinel-edr-wazuh-ed747cb1b8d9?source=rss-356ba3f41fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed747cb1b8d9</guid>
            <category><![CDATA[edr]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[detection-engineering]]></category>
            <dc:creator><![CDATA[Hanif K A]]></dc:creator>
            <pubDate>Mon, 29 Jun 2026 03:56:24 GMT</pubDate>
            <atom:updated>2026-06-29T03:56:24.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z7BBwFTCpxWuBWFeuRiogw.png" /></figure><h3>Deploying an open-source EDR on Linux and Windows and shipping its alerts into Wazuh</h3><p>Rustinel is an open-source EDR written in Rust. It collects telemetry with eBPF on Linux and ETW on Windows, runs Sigma, YARA, and IOC detections against that telemetry, and writes alerts as ECS NDJSON. This is a walkthrough of getting it running on both platforms and forwarding the alerts to Wazuh.</p><p>This guide was tested with Rustinel v1.0.2 on Debian 12 (kernel 5.10, eBPF) and a Windows host (ETW).</p><h3>Prerequisites</h3><p>Before starting, make sure the following are in place:</p><ul><li><strong>A running Wazuh deployment.</strong> A Wazuh manager with the dashboard reachable, and the agents already enrolled and reporting to it.</li><li><strong>Linux host — kernel 5.8+ with BTF.</strong> Rustinel uses eBPF, which needs a recent kernel.</li><li><strong>Windows host — Windows 10/11 or Server 2016+.</strong> ETW collection needs an elevated (Administrator) session.</li><li><strong>Root / Administrator access.</strong> Required on both platforms to load the sensors and install the service.</li><li><strong>Outbound access to GitHub.</strong> To download the Rustinel release binaries.</li></ul><blockquote><strong><em>Install via the official docs first.</em></strong><em> Use the Rustinel getting-started guide at </em><a href="https://docs.rustinel.io/getting-started/#manual-package-install"><em>docs.rustinel.io/getting-started</em></a><em>. If you run into the same install errors I did on Linux or Windows, the rest of this document covers the workarounds that got mine running.</em></blockquote><h3>1. Linux setup</h3><h3>Install</h3><p>Download the release, extract it, and move it into /opt:</p><pre>curl -LO https://github.com/Karib0u/rustinel/releases/download/v1.0.2/rustinel-1.0.2-x86_64-unknown-linux-musl.tar.gz<br>tar xzf rustinel-1.0.2-x86_64-unknown-linux-musl.tar.gz<br>sudo mv rustinel-1.0.2-x86_64-unknown-linux-musl /opt/rustinel</pre><h3>Run it as a service</h3><p>Rustinel ships a rustinel.service file. In our environment it needed two small adjustments before it started cleanly, both related to the eBPF permissions a service needs on this host. We are feeding these back so the shipped unit works out of the box on more setups.</p><p><strong>Adjustment 1 — eBPF capabilities for the service.</strong> The bundled unit ships with sensible hardening, including NoNewPrivileges=true. On this particular host that hardening was stricter than the eBPF sensor needed: the kernel refused the BPF_PROG_LOAD syscall, and the sensor failed to attach, even when running as root with CAP_BPF. For this lab we simply relaxed the hardening and ran the service as full root, which let the sensor attach. This looks specific to our environment; the likely refinement is to grant the precise capabilities the sensor uses (probably CAP_PERFMON alongside CAP_BPF) rather than relax hardening, and we are sharing this with the Rustinel maintainers as a small unit-file improvement.</p><p><strong>Adjustment 2 — memlock limit for eBPF maps.</strong> eBPF maps need locked memory. On our host the effective LimitMEMLOCK ended up at the 64 KiB default, and map creation failed with <em>Operation not permitted</em>. Setting LimitMEMLOCK=infinity in the unit file resolves it cleanly; systemd then applies the limit directly to the service process. This is a one-line addition to the unit that we have suggested upstream.</p><p>The working unit file looks like this:</p><pre>[Unit]<br>Description=Rustinel eBPF Sentinel<br>After=network.target</pre><pre>[Service]<br>ExecStart=/opt/rustinel/rustinel run<br>WorkingDirectory=/opt/rustinel<br>Restart=on-failure<br>RestartSec=5<br>LimitMEMLOCK=infinity<br>StandardOutput=journal<br>StandardError=journal<br>SyslogIdentifier=rustinel</pre><pre>[Install]<br>WantedBy=multi-user.target</pre><p>Then enable and start:</p><pre>sudo cp /opt/rustinel/rustinel.service /etc/systemd/system/<br>sudo systemctl daemon-reload<br>sudo systemctl enable --now rustinel<br>sudo systemctl status rustinel</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Wkwjc1-bv2is79Gk7iCeg.png" /><figcaption>Rustinel Linux Running</figcaption></figure><p><em>Rustinel running on Linux — eBPF tracepoints attached.</em></p><p><em>systemctl status showing the Rustinel service active and running.</em></p><h3>2. Windows setup</h3><h3>Install</h3><p>From an elevated PowerShell, download and extract the Windows build:</p><pre>Invoke-WebRequest -Uri &quot;https://github.com/Karib0u/rustinel/releases/download/v1.0.2/rustinel-1.0.2-x86_64-pc-windows-msvc.zip&quot; -OutFile &quot;rustinel.zip&quot;<br>Expand-Archive -Path rustinel.zip -DestinationPath &quot;C:\rustinel&quot;<br>cd &quot;C:\rustinel\rustinel-1.0.2-x86_64-pc-windows-msvc&quot;</pre><h3>Run it as a service</h3><p>Registering it manually with sc.exe, wrapping the launch in cmd /c cd so the service starts in the install directory. This keeps Rustinel&#39;s relative paths to its config, rules, and logs resolving correctly when the Service Control Manager launches it from a different working directory. It is a small startup-path detail we have flagged upstream so a future build can set the working directory automatically:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*xBUV04-kicbWqDQMPqSTtg.png" /></figure><pre>sc.exe create rustinel binPath= &quot;cmd /c cd C:\rustinel\rustinel-1.0.2-x86_64-pc-windows-msvc &amp;&amp; rustinel.exe run&quot; start= auto DisplayName= &quot;Rustinel ETW Sentinel&quot;<br>sc.exe start rustinel<br>sc.exe query rustinel</pre><h3>3. Testing</h3><p>With the service installed and running on each platform, the steps below verify detection only — they are separate from the install and service setup above, and each detection engine is exercised on its own. Note that the deployment issues described in the setup sections may be specific to our test environment rather than affecting every installation.</p><h3>Linux — Sigma rule test</h3><p>The default ruleset has one demo Sigma rule that fires on whoami. Run it, then tail the alert file:</p><pre>whoami<br>tail -f /opt/rustinel/logs/alerts.json.*</pre><p><em>Sigma demo rule firing on </em><em>whoami, one NDJSON alert per line.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhYxig9_N-SNMvTZXnigZA.png" /></figure><h3>Windows — YARA rule test</h3><p>YARA only scans an executable when a process starts, so the test needs a real binary that contains the marker string. The test has three steps: build a small marker binary, watch the alert file in a second window, then run the binary to trigger a scan.</p><p><strong>Step 1 — build a test binary.</strong> Compile a tiny one with the .NET compiler that already ships with Windows — no toolchain needed:</p><pre>New-Item -ItemType Directory -Path &quot;C:\temp&quot; -Force</pre><pre>$code = @&quot;<br>using System;<br>class Program {<br>    static void Main() {<br>        Console.WriteLine(&quot;RUSTINEL_TEST_MARKER&quot;);<br>    }<br>}<br>&quot;@</pre><pre>Add-Type -TypeDefinition $code -Language CSharp -OutputAssembly &quot;C:\temp\test_marker2.exe&quot; -OutputType ConsoleApplication</pre><p><strong>Step 2 — watch the alert file.</strong> In a second PowerShell window, tail Rustinel’s alert log so you can see the detection as it fires:</p><pre>Get-Content &quot;C:\rustinel\rustinel-1.0.2-x86_64-pc-windows-msvc\logs\alerts.json.*&quot; -Wait</pre><p><strong>Step 3 — run the binary to trigger a scan.</strong> Back in the first window, run the marker binary. Rustinel scans the process executable as it starts:</p><pre>&amp; &quot;C:\temp\test_marker2.exe&quot;</pre><blockquote><em>Keep the binary out of </em><em>C:\Windows and </em><em>C:\Program Files — those are on the default allowlist and get skipped.</em></blockquote><h3>Windows — Sigma rule test</h3><p>Run the built-in Sigma demo rule on its own, separately from the YARA executable test above, so the two detections can be confirmed independently:</p><pre>whoami /all</pre><p>The marker prints and Rustinel fires the YARA match. The Sigma whoami /all check runs separately (next section). With both run, the YARA match and the whoami Sigma rule fire on this host:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*E68wkpV43RUvHa1se953sw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kPX7mO6peeujiv4LorvbWQ.png" /></figure><p><em>Windows: YARA marker executable and </em><em>whoami both triggering detections.</em></p><h3>4. Wazuh integration</h3><p>Rustinel writes ECS NDJSON — one JSON object per line — which is exactly what the Wazuh log collector expects with log_format json. No middleware or reformatting needed; point the agent at the alert file.</p><h3>Agent configuration</h3><p><strong>Linux</strong> — add to /var/ossec/etc/ossec.conf:</p><pre>&lt;ossec_config&gt;<br>  &lt;localfile&gt;<br>    &lt;log_format&gt;json&lt;/log_format&gt;<br>    &lt;location&gt;/opt/rustinel/logs/alerts.json.*&lt;/location&gt;<br>  &lt;/localfile&gt;<br>&lt;/ossec_config&gt;</pre><p><strong>Windows</strong> — add to ossec.conf under the agent install folder:</p><pre>&lt;ossec_config&gt;<br>  &lt;localfile&gt;<br>    &lt;log_format&gt;json&lt;/log_format&gt;<br>    &lt;location&gt;C:\rustinel\rustinel*\logs\alerts.json.*&lt;/location&gt;<br>  &lt;/localfile&gt;<br>&lt;/ossec_config&gt;</pre><h3>Rules on the Wazuh server</h3><p>On the manager, a small rule group reads the JSON fields and maps Rustinel severity onto Wazuh alert levels. The mapping below is one example policy — adjust the levels to suit your own alerting thresholds. The decoder is the built-in JSON decoder, so only rules are needed. These match on event.kind and event.module first, then branch on edr.rule.severity:</p><p>Rustinel severity Wazuh level Wazuh classification (default policy) Rule ID (base rule) 0 Ignored — no action; groups the EDR events 100030 Low 5 User generated error 100031 Medium 10 Multiple user generated errors 100032 High 13 Unusual error (high importance) 100033 Critical 15 Severe attack (immediate attention) 100034</p><p><em>The Wazuh classifications above follow Wazuh’s official rule-classification policy (levels 0–15) [1]. The level chosen for each Rustinel severity is an example mapping; tune it to your own alerting thresholds.</em></p><pre>&lt;group name=&quot;rustinel,edr,&quot;&gt;<br><br>  &lt;rule id=&quot;100030&quot; level=&quot;0&quot;&gt;<br>    &lt;field name=&quot;event.kind&quot;&gt;alert&lt;/field&gt;<br>    &lt;field name=&quot;event.module&quot;&gt;edr&lt;/field&gt;<br>    &lt;description&gt;Rustinel EDR alert&lt;/description&gt;<br>  &lt;/rule&gt;<br><br>  &lt;rule id=&quot;100031&quot; level=&quot;5&quot;&gt;<br>    &lt;if_sid&gt;100030&lt;/if_sid&gt;<br>    &lt;field name=&quot;edr.rule.severity&quot;&gt;^Low$&lt;/field&gt;<br>    &lt;description&gt;Rustinel [Low] $(edr.rule.engine) | $(rule.name)&lt;/description&gt;<br>    &lt;group&gt;edr_low,&lt;/group&gt;<br>  &lt;/rule&gt;<br>  &lt;rule id=&quot;100032&quot; level=&quot;10&quot;&gt;<br>    &lt;if_sid&gt;100030&lt;/if_sid&gt;<br>    &lt;field name=&quot;edr.rule.severity&quot;&gt;^Medium$&lt;/field&gt;<br>    &lt;description&gt;Rustinel [Medium] $(edr.rule.engine) | $(rule.name)&lt;/description&gt;<br>    &lt;group&gt;edr_medium,&lt;/group&gt;<br>  &lt;/rule&gt;<br>  &lt;rule id=&quot;100033&quot; level=&quot;13&quot;&gt;<br>    &lt;if_sid&gt;100030&lt;/if_sid&gt;<br>    &lt;field name=&quot;edr.rule.severity&quot;&gt;^High$&lt;/field&gt;<br>    &lt;description&gt;Rustinel [High] $(edr.rule.engine) | $(rule.name)&lt;/description&gt;<br>    &lt;group&gt;edr_high,&lt;/group&gt;<br>  &lt;/rule&gt;<br>  &lt;rule id=&quot;100034&quot; level=&quot;15&quot;&gt;<br>    &lt;if_sid&gt;100030&lt;/if_sid&gt;<br>    &lt;field name=&quot;edr.rule.severity&quot;&gt;^Critical$&lt;/field&gt;<br>    &lt;description&gt;Rustinel [CRITICAL] $(edr.rule.engine) | $(rule.name)&lt;/description&gt;<br>    &lt;group&gt;edr_critical,&lt;/group&gt;<br>  &lt;/rule&gt;<br>&lt;/group&gt;</pre><p>Restart the manager and the agents, then generate some activity — whoami on Linux, the YARA marker on Windows. The alerts from both platforms appear in the dashboard.</p><h3>5. Result</h3><p>With both agents reporting, the Rustinel alerts show up in the Wazuh dashboard. Filtering on rule.groups: rustinel gives a single view across both hosts — Sigma alerts from the Linux agent (deb12) and the Windows agent, plus the Critical YARA match from the marker test. The engine, severity, and mapped alert level all come through as their own fields.</p><p><em>Rustinel alerts in the Wazuh dashboard — Sigma and YARA, across the Linux and Windows agents.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bj1TXyBioTlLsJ67UEomWw.jpeg" /></figure><h3>Resources</h3><ul><li>Rustinel project repository: <a href="https://github.com/Karib0u/rustinel">github.com/Karib0u/rustinel</a></li><li>Wazuh — Open Source XDR / SIEM: <a href="https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">wazuh.com</a></li><li>Wazuh Ambassadors Program: <a href="https://wazuh.com/ambassadors-program/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">wazuh.com/ambassadors-program</a></li></ul><h3>References</h3><p>[1] Wazuh, “Rules classification,” <em>Wazuh Documentation.</em> Available: <a href="https://documentation.wazuh.com/current/user-manual/ruleset/rules/rules-classification.html">documentation.wazuh.com/…/rules-classification.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed747cb1b8d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wazuh Vulnerability Enrichment EPSS + CISA KEV]]></title>
            <link>https://medium.com/@Hanif.ka/wazuh-vulnerability-enrichment-epss-cisa-kev-a989474877ad?source=rss-356ba3f41fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a989474877ad</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[vulnerability-management]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[vulnerability]]></category>
            <dc:creator><![CDATA[Hanif K A]]></dc:creator>
            <pubDate>Wed, 28 Jan 2026 16:30:09 GMT</pubDate>
            <atom:updated>2026-01-29T14:06:52.661Z</atom:updated>
            <content:encoded><![CDATA[<p>Quick Installation Guide for Wazuh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SONx6-yZp-1oEG76s8mZjg.png" /></figure><h3>Overview</h3><p>This guide walks you through integrating EPSS (Exploit Prediction Scoring System) and CISA KEV (Known Exploited Vulnerabilities) data with your Wazuh vulnerability management system. <a href="https://arxiv.org/pdf/2506.01220">The integration enriches your CVE data with real-world exploit probability scores, helping you prioritize vulnerabilities that matter most</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NaR7v4XPL4WiwJDci9JizQ.png" /><figcaption>EPSS + CISA KEV Dashboard [Big]</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3MZdWJqv8q0DHC-yxod29g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*th-oD9xe1mCtH9i14hKiTQ.png" /></figure><h3>What You Get</h3><ul><li>EPSS scores for every detected CVE (0–1 probability scale)</li><li>CISA KEV flagging for actively exploited vulnerabilities</li></ul><h3>Prerequisites</h3><ul><li>Wazuh Manager must be installed and running (tested on version 4.14.1), or you must have the wazuh-states-vulnerabilities* index available.</li><li>Python 3.x available on the Wazuh server</li><li>Network access to EPSS and CISA data feeds</li></ul><h3>Installation Steps</h3><h4>Step 1: Create Indexer User</h4><p>Create a dedicated read-only user for the enrichment script to query vulnerability data from your Wazuh indexer. Assign the readall role to this user.</p><ol><li>Navigate to User Creation: In the Wazuh dashboard, go to Indexer management -&gt; Security -&gt; Internal users -&gt; Create internal user.</li><li>Define Credentials:<br>- Username: Provide a descriptive name for the account.<br>- Password: Set a secure password that meets your organization’s requirements. Avoid using the characters &lt;, &gt;, and ‘.</li><li>Assign Permissions: Under the Backend roles section, add the readall role to ensure the user has the necessary read-only access.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iom9H8fMp-_O_-XLttIN9Q.png" /></figure><h4>Step 2: Deploy the Enrichment Script</h4><p>Download or clone the Python vulnerability enrichment script from the following repository to your Wazuh server:</p><p><a href="https://github.com/Hanifka/Wazuh-Vulnerability-Enrichment">https://github.com/Hanifka/Wazuh-Vulnerability-Enrichment</a></p><p>Place the script in the recommended integrations directory:</p><pre>/var/ossec/integrations/vuln-enrichment.py</pre><p>After copying the file, update the permissions and ownership to ensure the script can be executed securely by the Wazuh manager:</p><pre>chmod 750 /var/ossec/integrations/vuln-enrichment.py<br>chown root:wazuh /var/ossec/integrations/vuln-enrichment.py</pre><h4>Step 3: Configure Wazuh Wodle</h4><p>Add the following configuration to your ossec.conf file (it will run in):</p><pre>&lt;wodle name=&quot;command&quot;&gt;<br>  &lt;disabled&gt;no&lt;/disabled&gt;<br>  &lt;tag&gt;epss-enrichment&lt;/tag&gt;<br>  &lt;command&gt;/usr/bin/python3 /var/ossec/integrations/vuln-enrichment.py &#39;MIN_EPSS&#39; &#39;Username&#39; ‘Password’ https://&#39;Indexer URL&#39;:9200&lt;/command&gt;<br>  &lt;interval&gt;1d&lt;/interval&gt;<br>  &lt;run_on_start&gt;yes&lt;/run_on_start&gt;<br>  &lt;timeout&gt;1200&lt;/timeout&gt;<br>&lt;/wodle&gt;</pre><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X4U48WcjQHfIXn7bnfVa-Q.png" /><figcaption>Example</figcaption></figure><p>Implementation Notes:</p><ul><li>All-in-One Deployment: If your Wazuh manager and indexer are on the same server, you can leave the IP as <a href="https://127.0.0.1:9200.">https://127.0.0.1:9200.</a></li><li>Distributed Deployment: If you are using a separate node for the Wazuh Indexer, replace 127.0.0.1 with the specific IP address of your Wazuh Indexer.</li><li>The <strong>interval </strong>field controls how often the command runs. In this example, 1d means the script will execute once per day. Adjust this value to match how frequently you want the vulnerability enrichment to be updated.</li></ul><p>Command Parameters</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lft6KE6cKH5xMNIlJBgGPQ.png" /></figure><h4>Step 4: Configure Wazuh to Consume Integration Logs</h4><p>To enable Wazuh to ingest and process the vulnerability enrichment logs, add the following configuration to the Wazuh manager. This configuration instructs Wazuh to monitor the specified log file and apply custom rules for event classification.</p><p>First, configure Wazuh to read the integration output log in JSON format. This allows structured fields from the log to be parsed and indexed correctly.</p><pre>&lt;localfile&gt;<br>  &lt;log_format&gt;json&lt;/log_format&gt;<br>  &lt;location&gt;/var/log/wazuh/enrich-vuln.log&lt;/location&gt;<br>&lt;/localfile&gt;</pre><p>Next, define a custom rule group to identify and label events generated by the vulnerability enrichment integration. The rule matches events based on a specific JSON field and assigns them a dedicated rule ID and alert level.</p><pre>&lt;group name=&quot;integration-vuln,&quot;&gt;<br>  &lt;rule id=&quot;999013&quot; level=&quot;3&quot;&gt;<br>    &lt;decoded_as&gt;json&lt;/decoded_as&gt;<br>    &lt;field name=&quot;integration&quot;&gt;enrich-vuln&lt;/field&gt;<br>    &lt;description&gt;VULN Integration Events&lt;/description&gt;<br>  &lt;/rule&gt;<br>&lt;/group&gt;</pre><p>After applying the configuration, restart the Wazuh manager service to load the new settings and begin processing the logs.</p><pre>sudo systemctl restart wazuh-manager</pre><p>Once the Wazuh manager is restarted, the integration script begins running and Wazuh ingests any events written to /var/log/wazuh/enrich-vuln.log. These events are evaluated against the custom rule and, when matched, are generated as alerts and displayed in the Wazuh dashboard. This configuration ensures that vulnerability enrichment activity is continuously monitored and centrally visible for analysis.</p><h3>Understanding the Output</h3><p>The script generates enriched vulnerability events in JSON format at:</p><pre>/var/log/wazuh/enrich-vuln.log</pre><h4>EPSS Severity Mapping</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LRsBUL5N99FG6D_nOmbkPA.png" /></figure><h4><strong>Output Event Fields</strong></h4><p><strong>{“timestamp”:”2026–01–27T21:14:32.803891&quot;,”integration”:”enrich-vuln”,”agent_name”:”test”,”data_vuln”:{“package”:”Git”,”cve”:”CVE-2025–48384&quot;,”cve_link”:”https://cti.wazuh.com/vulnerabilities/cves/CVE-2025-48384&quot;,&quot;wazuh_severity&quot;:&quot;High&quot;,&quot;epss_score&quot;:0.0032,&quot;epss_severity&quot;:&quot;Low&quot;,&quot;is_cisa_kev&quot;:true,&quot;priority&quot;:&quot;EMERGENCY — EXPLOITED”,”hours”:21}}</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1OPLGliupqx16LM2EyPYg.png" /></figure><h4><strong>File Locations</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pcjcKnpAhoZAzxEUttD0Nw.png" /></figure><h3>Troubleshooting</h3><p>If the script is not producing output, check the following:</p><ol><li>Verify the debug log for errors: /var/log/wazuh/epss-vuln.debug.log</li><li>Confirm the indexer user has readall permissions</li><li>Test network connectivity to EPSS and CISA endpoints</li><li>Ensure Python requests library is installed</li><li>Check that vulnerability data exists in your indexer</li></ol><h3>Conclusion</h3><p>This research addresses a critical challenge in modern cybersecurity: the overwhelming volume of vulnerabilities that organizations must evaluate and prioritize for remediation. By systematically integrating complementary vulnerability intelligence sources, we demonstrate that significant efficiency gains are possible while still maintaining comprehensive security coverage.</p><p>Based on this approach, organizations can filter and prioritize high-risk vulnerabilities using multiple data sources. However, accurately determining true exploitability still requires critical contextual knowledge from asset owners, such as whether the affected asset or service is exposed to the internet.</p><h3>Experimental (Still on RnD)</h3><p>AI integration for remediation (Gemini)</p><p>This AI integration helps you find solutions (remediations) for security problems. While it is very helpful, please remember that the AI is not always 100% perfect.</p><p>To help you work safely, the system includes two important features:</p><ul><li>Source Links: Every suggestion comes with a link. Use these to cross-check the information and make sure it is correct for your system.</li><li>Confidence Rate: The AI shows a percentage score. This tells you how “sure” the AI is about the advice it is giving.</li><li>It’s a known challenge that AI can be inconsistent, sometimes generating different links or results for the same request. Because reliability is crucial for security workflows, I am looking for an alternative: if you know of any high-performing AI API keys that are both effective and its free, please let me know.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*grKw9ur4Vd3hZ9t1CTm8vQ.png" /><figcaption>Ai Recommendation Windows</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wP1cG9YEt5QaVqn6_Epk5Q.png" /><figcaption>Ai Recommendation Linux</figcaption></figure><h3>References</h3><ul><li><a href="https://documentation.wazuh.com/">Wazuh Documentation</a></li><li>CISA Known Exploited Vulnerabilities Catalog</li><li><a href="https://www.first.org/epss/">Exploit Prediction Scoring System (EPSS)</a></li><li><a href="https://arxiv.org/pdf/2506.01220">Vulnerability Management Chaining: An Integrated Framework for Efficient Cybersecurity Risk Prioritization</a></li></ul><h4>Linked In: <a href="https://www.linkedin.com/in/hanifka">https://www.linkedin.com/in/hanifka</a></h4><p><strong>Visit Wazuh webpage </strong><a href="https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program"><strong>here</strong></a><strong> , join Wazuh ambassador program </strong><a href="https://wazuh.com/ambassadors-program/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program"><strong>here</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a989474877ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Centralized Sysmon Configuration Management with Wazuh]]></title>
            <link>https://medium.com/@Hanif.ka/centralized-sysmon-configuration-management-with-wazuh-0375b121ede8?source=rss-356ba3f41fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/0375b121ede8</guid>
            <category><![CDATA[sysmon]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Hanif K A]]></dc:creator>
            <pubDate>Wed, 24 Dec 2025 07:34:54 GMT</pubDate>
            <atom:updated>2025-12-25T07:29:50.442Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VBFFAFQJwFmRVEpFl8ldCg.png" /></figure><h3>Overview</h3><p>This guide explains how to centrally manage and apply Sysmon configuration updates on Windows endpoints using the Wazuh Wodle Command, shared configuration, and PowerShell. The solution is designed to provide deterministic, hash-based Sysmon configuration management across Windows environments in an enterprise-ready and production-safe manner.</p><p>The solution provides:</p><ul><li><strong>Centralized distribution</strong>: Sysmon XML configuration files are managed and distributed from the Wazuh Server to Windows agents</li><li><strong>Automated execution</strong>: The Wodle Command automatically runs a PowerShell script on the agent to detect and process configuration changes. Because this mechanism involves remote command execution on endpoints, it should be used with caution and implemented with proper controls to avoid any risks.</li><li><strong>Safe and controlled updates</strong>: Sysmon configurations are applied only when the XML hash differs from the active Sysmon configuration, preventing unnecessary reloads</li><li><strong>Audit and visibility</strong>: Execution results are logged on the agent and forwarded to the Wazuh Server, with status and audit trail visible in the Wazuh dashboard</li></ul><h3>Infrastructure</h3><p>The following infrastructure is used in this guide:</p><ul><li><strong>Wazuh Manager: </strong>Wazuh 4.14.1 server (central management)</li><li><strong>Windows Endpoint: </strong>Windows Server 2019 with Wazuh Agent installed</li><li><strong>Sysmon: </strong>Microsoft Sysinternals System Monitor (v13.x or later)</li></ul><h3>Prerequisites</h3><p>Before implementing this solution, ensure the following requirements are met.</p><h3>1. Wazuh Agent (Windows)</h3><ul><li>Wazuh Agent installed on Windows endpoints</li><li>Agent version must support Wodle Command (Wazuh 4.x or later)</li></ul><h3>2. Sysmon Installed</h3><ul><li>Sysmon must be installed on the endpoint</li><li>Default path: C:\Windows\Sysmon64.exe</li><li>Sysmon service must be running</li></ul><p><em>Reference: </em><a href="https://wazuh.com/blog/using-wazuh-to-monitor-sysmon-events/">Using Wazuh to monitor Sysmon events</a></p><h3>3. PowerShell</h3><ul><li>PowerShell available (default on Windows)</li><li>Script execution allowed using -ExecutionPolicy Bypass</li></ul><h3>4. Enable Remote Commands (Mandatory)</h3><p>On each Windows agent, you must enable remote command execution.</p><p><strong>❗ IMPORTANT: </strong>Without this setting, the Wodle Command will start but never execute correctly.</p><p><strong>Configuration file:</strong></p><blockquote>C:\Program Files (x86)\ossec-agent\local_internal_options.conf</blockquote><p><strong>Add the following line:</strong></p><blockquote>wazuh_command.remote_commands=1</blockquote><p><strong>Restart the Wazuh agent</strong></p><h3>Configuration</h3><p>Follow these steps to set up automated Sysmon configuration updates.</p><h3>Step 1: Create an Agent Group</h3><p>Create a dedicated group for agents that will receive automatic Sysmon updates. Navigate to <strong>Management → Groups</strong> in the Wazuh dashboard and create a new group named <strong>autosysmon</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgtQviX34czV3wOYHPZFDg.png" /></figure><p><strong>Group directory on manager:</strong></p><p>/var/ossec/etc/shared/autosysmon/</p><h3>Step 2: Configure the Agent Group</h3><p>Add the following configuration to your group’s agent.conf file. This configuration:</p><ul><li>Enables file integrity monitoring on the shared directory</li><li>Schedules the PowerShell script to run on start and every 15 days</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cStnu9N06-5I1xnN3X0pbQ.png" /></figure><blockquote>&lt;agent_config&gt;</blockquote><blockquote>&lt;syscheck&gt;</blockquote><blockquote>&lt;directories realtime=”yes”&gt;C:\Program Files (x86)\ossec-agent\shared&lt;/directories&gt;</blockquote><blockquote>&lt;/syscheck&gt;</blockquote><blockquote>&lt;wodle name=”command”&gt;</blockquote><blockquote>&lt;disabled&gt;no&lt;/disabled&gt;</blockquote><blockquote>&lt;tag&gt;sysmon_update&lt;/tag&gt;</blockquote><blockquote>&lt;command&gt;powershell.exe -ExecutionPolicy Bypass -File “C:\Program Files (x86)\ossec-agent\shared\autosysmon.ps1”&lt;/command&gt;</blockquote><blockquote>&lt;interval&gt;15d&lt;/interval&gt;</blockquote><blockquote>&lt;ignore_output&gt;no&lt;/ignore_output&gt;</blockquote><blockquote>&lt;run_on_start&gt;yes&lt;/run_on_start&gt;</blockquote><blockquote>&lt;timeout&gt;30&lt;/timeout&gt;</blockquote><blockquote>&lt;/wodle&gt;</blockquote><blockquote>&lt;/agent_config&gt;</blockquote><h3>Step 3: Create the PowerShell Script</h3><p>Create the autosysmon.ps1 script and place it in the shared folder on the Wazuh manager:</p><p>/var/ossec/etc/shared/autosysmon/autosysmon.ps1</p><p><strong>Script content:</strong></p><p><a href="https://raw.githubusercontent.com/Hanifka/WazuhBA/refs/heads/main/autosysmon.ps1">raw.githubusercontent.com/Hanifka/WazuhBA/refs/heads/main/autosysmon.ps1</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTBCEComSfeGTy-8JJamLw.png" /></figure><h3>Step 4: Assign Agents to the Group</h3><p>Add the target Windows agents to the autosysmon group. Navigate to <strong>Agents → [Select Agent] → Groups</strong> and add the agent to the group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jeUPnZA2uXVRrmupvlsYpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*Hg-xRXDsq6qkiX1M_YOi9w.png" /></figure><p>Once assigned, the configuration files will automatically sync to the agent’s shared directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCrbfBerMRIQIhwrasaRWw.png" /></figure><h3>Step 5: Add Sysmon Configuration XML</h3><p>Place your Sysmon configuration XML file in the shared folder. You can use community-maintained configurations:</p><ul><li><a href="https://github.com/olafhartong/sysmon-modular">Olaf Hartong’s sysmon-modular</a> — Modular configuration with MITRE ATT&amp;CK mapping</li><li><a href="https://github.com/SwiftOnSecurity/sysmon-config">SwiftOnSecurity’s sysmon-config</a> — High-quality baseline configuration</li></ul><p><strong>Example — Download SwiftOnSecurity config:</strong></p><blockquote>cd /var/ossec/etc/shared/autosysmon/</blockquote><blockquote>wget <a href="https://raw.githubusercontent.com/SwiftOnSecurity/sysmon-config/master/sysmonconfig-export.xml">https://raw.githubusercontent.com/SwiftOnSecurity/sysmon-config/master/sysmonconfig-export.xml</a> -O sysmon_config.xml</blockquote><p>When its added, the sysmon configuration on windows will automatically changed,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UGlKTUt7I9hy2MOpIDrXag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxUyWxlYdqRvs6iHWweYSA.png" /></figure><h3>Custom Detection Rules</h3><p>Add the following rules to your Wazuh manager to monitor and visualize Sysmon configuration updates in the dashboard. Add these rules to /var/ossec/etc/rules/local_rules.xml.</p><blockquote>&lt;group name=”autosysmon,”&gt;</blockquote><blockquote>&lt;rule id=”500103&quot; level=”3&quot;&gt;</blockquote><blockquote>&lt;match&gt;Autosysmon -&lt;/match&gt;</blockquote><blockquote>&lt;description&gt;Autosysmon: Script execution logged&lt;/description&gt;</blockquote><blockquote>&lt;/rule&gt;</blockquote><blockquote>&lt;rule id=”500104&quot; level=”4&quot;&gt;</blockquote><blockquote>&lt;match&gt;Detected XML&lt;/match&gt;</blockquote><blockquote>&lt;description&gt;Autosysmon: XML configuration change detected&lt;/description&gt;</blockquote><blockquote>&lt;/rule&gt;</blockquote><blockquote>&lt;rule id=”500105&quot; level=”5&quot;&gt;</blockquote><blockquote>&lt;match&gt;applied&lt;/match&gt;</blockquote><blockquote>&lt;description&gt;Autosysmon: Sysmon configuration applied successfully&lt;/description&gt;</blockquote><blockquote>&lt;/rule&gt;</blockquote><blockquote>&lt;/group&gt;</blockquote><p><strong>Restart the Wazuh manager to apply the rules:</strong></p><blockquote>systemctl restart wazuh-manager</blockquote><h3>Proof of Concept</h3><p>This section demonstrates the automated Sysmon configuration update in action. We will push a new configuration from the Wazuh manager and observe it being automatically applied on the Windows endpoint.</p><h3>Step 1: Verify Initial Sysmon Configuration</h3><p>First, check the current Sysmon configuration on the Windows endpoint to establish a baseline.</p><p><strong>Run the following command in an elevated PowerShell:</strong></p><blockquote>sysmon64.exe -c</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxUyWxlYdqRvs6iHWweYSA.png" /></figure><h3>Step 2: Add New Sysmon Configuration on Manager with the same hash</h3><p>On the Wazuh server, move the Sysmon XML configuration file into the shared directory.<br> This can be done by placing an existing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X66_RMHw2py5imPZqkc2Yw.png" /></figure><h3>Step 3: Observe Script Execution</h3><p>The Wodle Command automatically triggers the PowerShell script when the agent restarts or at the configured interval. Since run_on_start is enabled, the script runs immediately after synchronization.</p><p><strong>Expected output:</strong></p><blockquote>2025–12–24 11.56.02 Autosysmon — Sysmon Wodle script started</blockquote><blockquote>2025–12–24 11.56.02 Autosysmon — Detected XML: C:\Program Files (x86)\ossec-agent\shared\sysmon_hanif2.xml</blockquote><blockquote>2025–12–24 11.56.02 Autosysmon — Current Sysmon hash: B6337ED4C9FB838166ABB2D4A68244B68311E373CD587CF74EEF4427514492A2</blockquote><blockquote>2025–12–24 11.56.02 Autosysmon — New XML hash: B6337ED4C9FB838166ABB2D4A68244B68311E373CD587CF74EEF4427514492A2</blockquote><blockquote>2025–12–24 11.56.02 Autosysmon — Sysmon configuration already up-to-date. No action required.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7sFBV1OguneogXQ45ArhPw.png" /></figure><h3>Step 4: Verify Sysmon Configuration not Applied</h3><p>Verify that Sysmon is currently running with the intended configuration by executing the following command:</p><blockquote>sysmon64.exe -c</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxUyWxlYdqRvs6iHWweYSA.png" /></figure><p>Since the configuration hash remains unchanged, this confirms that the new configuration was not reapplied because Sysmon was already using the same configuration.</p><h3>Step 5: Test Remote Update (Scalability)</h3><p>To demonstrate scalability, modify the Sysmon configuration on the manager and observe automatic propagation to agent in the group.</p><p><strong>On the Wazuh manager, update the configuration:</strong></p><p># Modify or replace the XML</p><blockquote>vi /var/ossec/etc/shared/autosysmon/sysmon_hanif2.xml</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-wgPdcfPRc08PumISUpi_Q.png" /></figure><p>agent in the <em>autosysmon </em>group will automatically receive and apply the updated configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNm569uAGlveHb9Jdxg2Kw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wym-vYYNV7ThnK4B4x1uxA.png" /></figure><h3>Execution Flow</h3><p>The following diagram illustrates the complete execution flow:</p><ol><li>An administrator adds or updates the Sysmon XML file on the Wazuh manager.</li><li>The Wazuh manager syncs the XML file to the agents in the assigned group.</li><li>The agent receives the XML file in the shared directory.</li><li>The Wodle command runs the PowerShell script on the agent, including the run_on_start option.</li><li>The script checks for a recently modified Sysmon XML file within the defined time window.</li><li>The script gets the current Sysmon configuration hash.</li><li>The XML file hash is calculated and compared with the current Sysmon hash.</li><li>If the hashes are different, the new Sysmon configuration is applied.</li><li>If the hashes are the same, no action is taken.</li><li>The script writes the execution result to active-responses.log.</li><li>The Wazuh agent sends the log entries back to the manager.</li><li>The execution result can be seen in the Wazuh dashboard.</li></ol><h3>Scaling to Multiple Configurations</h3><p>You can scale this implementation by creating <strong>multiple agent groups</strong>, each using a different Sysmon configuration to match specific security needs. New agents can be assigned to a group, and their Sysmon configuration will automatically adjust based on the XML applied.</p><p>Examples:</p><ul><li><strong>autosysmon-standard</strong> — Basic Sysmon monitoring for most endpoints</li><li><strong>autosysmon-robust</strong> — Stronger detection rules for sensitive or critical systems</li><li><strong>autosysmon-verbose</strong> — Maximum visibility for security and SOC operations</li></ul><p>This approach allows flexible security posture management without manual reconfiguration on each endpoint.</p><h3>Conclusion</h3><p>This implementation proves that Wazuh can be reliably used to automate Sysmon configuration management on Windows endpoints using only native features: Wodle command, and shared configuration.</p><h3>References</h3><ul><li><a href="https://documentation.wazuh.com/">Wazuh Documentation</a></li><li><a href="https://wazuh.com/blog/using-wazuh-to-monitor-sysmon-events/">Using Wazuh to monitor Sysmon events</a></li><li><a href="https://wazuh.com/blog/learn-to-detect-threats-on-windows-by-monitoring-sysmon-events/">Learn to detect threats on Windows by monitoring Sysmon events</a></li><li><a href="https://docs.microsoft.com/en-us/sysinternals/downloads/sysmon">Microsoft Sysmon Documentation</a></li><li><a href="https://github.com/SwiftOnSecurity/sysmon-config">SwiftOnSecurity Sysmon Config</a></li><li><a href="https://github.com/olafhartong/sysmon-modular">Olaf Hartong’s sysmon-modular</a></li></ul><p>linked in :https://www.linkedin.com/in/hanifka</p><p><strong>Visit Wazuh webpage </strong><a href="https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program"><strong>here</strong></a><strong> , join Wazuh ambassador program </strong><a href="https://wazuh.com/ambassadors-program/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program"><strong>here</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0375b121ede8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wazuh × Tines SOAR Integration Lab — Phase 2]]></title>
            <link>https://medium.com/@Hanif.ka/wazuh-tines-soar-integration-lab-phase-2-c8d1f8409b58?source=rss-356ba3f41fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8d1f8409b58</guid>
            <category><![CDATA[soar]]></category>
            <category><![CDATA[wazuh-active-response]]></category>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[wazuh]]></category>
            <dc:creator><![CDATA[Hanif K A]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 10:30:02 GMT</pubDate>
            <atom:updated>2025-12-10T10:30:02.384Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Wazuh × Tines SOAR Integration Lab — Phase 2</strong></h3><h3>Tines → Wazuh Response Automation Layer</h3><p><em>How Wazuh Executes Tines SOAR Decisions Using a Secure Webhook Pipeline</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oetLP8lV9cOnlA25POvrSg.png" /></figure><h3>1. Introduction</h3><p>In Phase 1, we connected Wazuh and Tines so that alerts from Wazuh could be enriched and processed by Tines enabling analysis, AI summarization, scoring, and logic-based decisions.</p><p>That completed the <strong>detection → enrichment → decision</strong> side of the SOAR pipeline.</p><p>Now, in Phase 2, we close the loop:</p><p><strong>Tines sends response actions back to Wazuh and Wazuh enforces them.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*qzH3fE9Mupw-iUnqtR9FzQ.png" /></figure><p>We prioritize IP blocking as the first automated response use case because it is impactful and easy to test. This makes it a good starting point for anyone replicating this lab — especially since all response actions from Tines must go through the webhook pathway before Wazuh can execute them.</p><h3>2. Architecture Overview</h3><p>Here is the complete Tines → Wazuh response path:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oetLP8lV9cOnlA25POvrSg.png" /></figure><p>Each component has a specific role:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sE090z2ktjSn9LrSu1ABZg.jpeg" /></figure><h3>Why Not Just Open a Syslog Port?</h3><p>Two security reasons make this approach impossible:</p><p><strong>1. Dynamic IPs</strong> Tines Community Edition runs on shared cloud infrastructure. Their outbound IP addresses rotate frequently — so IP-based whitelisting is not reliable.</p><p><strong>2. Zero-Trust Principle</strong> Since we cannot trust the source IP, we must validate what the request carries. A webhook receiver with Bearer Token authentication solves this.</p><p><strong>The Solution:</strong> Nginx + Flask as a webhook receiver.</p><ul><li>Does not rely on IP whitelisting</li><li>Enforces Bearer Token authentication</li><li>Requests with valid tokens are accepted and logged</li><li>Invalid requests are logged by Nginx and flagged by Wazuh’s zero-tolerance rule</li></ul><h3>3. Webhook Layer (Nginx + Flask)</h3><p>This section is an overview of the webhook receiver logic — not a step-by-step installation guide.</p><h3>Nginx Role</h3><p>Nginx sits in front of the Flask application and handles: — HTTPS termination (using Let’s Encrypt via Certbot + DuckDNS) — Forwarding valid requests to Flask at 127.0.0.1:Port , Logging all incoming requests for Wazuh monitoring</p><h3>Flask Receiver Logic</h3><p>The Flask app is the internal API layer that processes automation payloads from Tines. It runs on localhost only — never exposed directly to the internet.</p><p><strong>Core behavior:</strong></p><ul><li><strong>POST-only : </strong>Rejects other HTTP methods to prevent scanning/misuse</li><li><strong>Bearer Token validation :</strong>Checks the Authorization header; rejects unauthorized requests</li><li><strong>Structured JSON logging</strong> : Writes each valid event to /var/log/tines-receiver.log in a format Wazuh can ingest directly</li></ul><p><strong>Example output event:</strong></p><p>{<br> “timestamp”: “2025–10–23T00:17:03Z”,<br> “remote_ip”: “18.202.159.115”,<br> “field”: {<br> “integration”: “tines”,<br> “soar_action”: “block”,<br> “ioc”: “185.246.128.171”<br> }<br>}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*TFGa8VZt32Y2oOXrGXk9jA.png" /></figure><h3>4. Wazuh Log Collection Setup</h3><p>Wazuh needs to monitor logs from both the Flask receiver and Nginx. Add these entries to /var/ossec/etc/ossec.conf:</p><blockquote>&lt;<strong>localfile</strong>&gt;<br> &lt;<strong>location</strong>&gt;/var/log/nginx/tines-receiver-access.log&lt;/<strong>location</strong>&gt;<br> &lt;<strong>log_format</strong>&gt;json&lt;/<strong>log_format</strong>&gt;<br>&lt;/<strong>localfile</strong>&gt;</blockquote><blockquote>&lt;<strong>localfile</strong>&gt;<br> &lt;<strong>location</strong>&gt;/var/log/tines-receiver.log&lt;/<strong>location</strong>&gt;<br> &lt;<strong>log_format</strong>&gt;json&lt;/<strong>log_format</strong>&gt;<br>&lt;/<strong>localfile</strong>&gt;</blockquote><blockquote>&lt;<strong>localfile</strong>&gt;<br> &lt;<strong>location</strong>&gt;/var/log/nginx/error.log&lt;/<strong>location</strong>&gt;<br> &lt;<strong>log_format</strong>&gt;syslog&lt;/<strong>log_format</strong>&gt;<br>&lt;/<strong>localfile</strong>&gt;</blockquote><p>Restart Wazuh to apply:</p><blockquote>systemctl restart wazuh-manager</blockquote><p>The Flask receiver log uses JSON format, so Wazuh can parse and index it without a custom decoder. The Nginx logs provide visibility into all requests — including unauthorized attempts.</p><h3>5. Active Response Configuration</h3><p>Active Response tells Wazuh what to execute when a rule matches. Add this to ossec.conf:</p><blockquote>&lt;<strong>command</strong>&gt;<br> &lt;<strong>name</strong>&gt;tines-block&lt;/<strong>name</strong>&gt;<br> &lt;<strong>executable</strong>&gt;tines-block.sh&lt;/<strong>executable</strong>&gt;<br> &lt;<strong>expect</strong>&gt;json&lt;/<strong>expect</strong>&gt;<br> &lt;<strong>timeout_allowed</strong>&gt;yes&lt;/<strong>timeout_allowed</strong>&gt;<br>&lt;/<strong>command</strong>&gt;</blockquote><blockquote>&lt;<strong>active-response</strong>&gt;<br> &lt;<strong>command</strong>&gt;tines-block&lt;/<strong>command</strong>&gt;<br> &lt;<strong>location</strong>&gt;all&lt;/<strong>location</strong>&gt;<br> &lt;<strong>rules_id</strong>&gt;500105&lt;/<strong>rules_id</strong>&gt;<br> &lt;<strong>timeout</strong>&gt;5184000&lt;/<strong>timeout</strong>&gt;<br>&lt;/<strong>active-response</strong>&gt;</blockquote><blockquote>&lt;<strong>active-response</strong>&gt;<br> &lt;<strong>command</strong>&gt;tines-block&lt;/<strong>command</strong>&gt;<br> &lt;<strong>location</strong>&gt;server&lt;/<strong>location</strong>&gt;<br> &lt;<strong>rules_id</strong>&gt;500105&lt;/<strong>rules_id</strong>&gt;<br> &lt;<strong>timeout</strong>&gt;36000&lt;/<strong>timeout</strong>&gt;<br>&lt;/<strong>active-response</strong>&gt;</blockquote><h3>6. Active Response Script</h3><p>The script tines-block.sh is responsible for the actual enforcement — blocking or unblocking an IP using iptables.</p><p><strong>Location:</strong> /var/ossec/active-response/bin/tines-block.sh</p><h3>Script Logic Flow</h3><p>stdin (JSON payload)<br> ↓<br>Parse with jq<br> ↓<br>Extract: command (add/delete), IOC (IP address), rule_id<br> ↓<br>Validate IPv4 format<br> ↓<br>Acquire lock (prevent race conditions)<br> ↓<br>Execute iptables (INPUT + FORWARD chains)<br> ↓<br>Log result to active-responses.log</p><h3>Core Logic (Simplified)</h3><p>The script handles two commands:</p><p><strong>add</strong> — Block the IP</p><p>iptables -w -I INPUT -s “$IOC” -j DROP<br>iptables -w -I FORWARD -s “$IOC” -j DROP</p><p><strong>delete</strong> — Unblock the IP (when timeout expires)</p><p>iptables -w -D INPUT -s “$IOC” -j DROP<br>iptables -w -D FORWARD -s “$IOC” -j DROP</p><p>The script also includes: — IPv4 validation (prevents injection of invalid data) — File locking (prevents race conditions when multiple alerts fire) — Detailed logging for troubleshooting</p><p><strong>Full script available on GitHub:</strong></p><p><a href="https://raw.githubusercontent.com/Hanifka/WazuhBA/refs/heads/main/tines-block.sh">raw.githubusercontent.com/Hanifka/WazuhBA/refs/heads/main/tines-block.sh</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qfw4goGPfLJJ1KGVUkqTHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ap6aOZoMh1vpzVks6FoG8Q.png" /></figure><p><strong>Next Content:</strong> In a future article, we’ll extend this script to handle other response actions such as isolating hosts, disabling user accounts, or triggering remediation workflows.</p><h3>7. Detection Rules</h3><p>These rules allow Wazuh to identify and classify events from Tines.</p><h3>Rule 500104 — Detect Tines Integration Payloads</h3><p>This rule serves as the baseline. It catches all events with &quot;integration&quot;: &quot;tines&quot; in the payload, and we can extend it for more scenarios.</p><blockquote>&lt;<strong>rule</strong> id=”500104&quot; level=”5&quot;&gt;<br> &lt;<strong>field</strong> name=”field.integration”&gt;tines&lt;/<strong>field</strong>&gt;<br> &lt;<strong>description</strong>&gt;Tines Integration Event&lt;/<strong>description</strong>&gt;<br> &lt;<strong>group</strong>&gt;tines,soar,&lt;/<strong>group</strong>&gt;<br>&lt;/<strong>rule</strong>&gt;</blockquote><h3>Rule 500105 — Trigger Block Action</h3><p>This rule builds on 500104. When it detects “soar-action”: “block”, it escalates the alert and triggers Active Response.</p><blockquote>&lt;<strong>rule</strong> id=”500105&quot; level=”10&quot;&gt;<br> &lt;<strong>if_sid</strong>&gt;500104&lt;/<strong>if_sid</strong>&gt;<br> &lt;<strong>field</strong> name=”field.soar-action”&gt;block&lt;/<strong>field</strong>&gt;<br> &lt;<strong>description</strong>&gt;Tines Integration: Block IP $(field.ioc)&lt;/<strong>description</strong>&gt;<br> &lt;<strong>group</strong>&gt;tines,soar,active_response,&lt;/<strong>group</strong>&gt;<br>&lt;/<strong>rule</strong>&gt;</blockquote><p>Once rule 500105 fires, the Active Response sequence begins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qfw4goGPfLJJ1KGVUkqTHA.png" /></figure><h3>8. Decoder for Active Response Logs (Optional)</h3><p>If you want to monitor Active Response execution from the Wazuh dashboard, add this decoder to parse the log output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f-ezPkfstDCuLc4CgRNX3g.png" /></figure><blockquote>&lt;<strong>decoder</strong> name=”tines-blocks”&gt;<br> &lt;<strong>program_name</strong>&gt;tines-block&lt;/<strong>program_name</strong>&gt;<br>&lt;/<strong>decoder</strong>&gt;</blockquote><blockquote>&lt;<strong>decoder</strong> name=”tines-block-field”&gt;<br> &lt;<strong>parent</strong>&gt;tines-blocks&lt;/<strong>parent</strong>&gt;<br> &lt;<strong>regex</strong> type=”pcre2&quot;&gt;(SUCCESS|INFO|ERROR):\s+(blocked|unblocked)\s+([0–9]{1,3}(?:\.[0–9]{1,3}){3})&lt;/<strong>regex</strong>&gt;<br> &lt;<strong>order</strong>&gt;status_script,action_soar,srcip_ioc&lt;/<strong>order</strong>&gt;<br>&lt;/<strong>decoder</strong>&gt;</blockquote><p>With this decoder, you can create dashboards or alerts based on Active Response outcomes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvmKkYBTP0ABtex1xs3PWg.png" /></figure><h3>9. Zero-Tolerance Rule (Webhook Security)</h3><p>Only Tines should access the webhook endpoint. Any other request is treated as suspicious.</p><p>The validation is based on User-Agent header. Tines sends a distinctive signature:</p><p>Tines (Advanced Security Automation; billowing-sea-1356.tines.com)</p><h3>How It Works</h3><p>Looking at the Nginx access log:</p><p>103.153.61.108 — — […] “POST / HTTP/1.1” 200 28 “-” “curl/7.74.0”<br>18.202.159.115 — — […] “POST /receiver HTTP/1.1” 200 30 “-” “Tines (Advanced Security Automation; …)”</p><ul><li>First request: curl/7.74.0 — <strong>Not from Tines</strong> → Triggers alert</li><li>Second request: Tines (Advanced Security Automation…) — <strong>Valid</strong> → No alert</li></ul><h3>Rules</h3><p><strong>Zero-tolerance rule:</strong></p><blockquote>&lt;<strong>rule</strong> id=”500110&quot; level=”12&quot;&gt;<br> &lt;<strong>if_sid</strong>&gt;31100&lt;/<strong>if_sid</strong>&gt;<br> &lt;<strong>location</strong>&gt;/var/log/nginx/tines-receiver-access.log&lt;/<strong>location</strong>&gt;<br> &lt;<strong>regex</strong> type=”pcre2&quot; negate=”yes”&gt;”Tines \(Advanced Security Automation&lt;/<strong>regex</strong>&gt;<br> &lt;<strong>description</strong>&gt;Invalid Request to Tines Webhook&lt;/<strong>description</strong>&gt;<br> &lt;<strong>group</strong>&gt;attack,pci_dss_6.5,pci_dss_11.4,gdpr_IV_35.7.d,nist_800_53_SA.11,nist_800_53_SI.4,&lt;/<strong>group</strong>&gt;<br>&lt;/<strong>rule</strong>&gt;</blockquote><p>The negate=”yes” means: if the User-Agent does NOT contain the Tines signature, fire this rule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aMJ_io0XktQd46kJiEwQgQ.png" /></figure><h3>Summary</h3><p>Phase 2 completes the SOAR loop by enabling Wazuh to execute response actions from Tines:</p><ol><li>Tines sends a response via webhook</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*qzH3fE9Mupw-iUnqtR9FzQ.png" /></figure><p>2. Flask validates the token and logs the payload</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c9sX1HYEpc2ivCpZxY3jLg.png" /></figure><p>3. Wazuh ingests the log and matches detection rules</p><p>4. Active Response executes the enforcement (iptables block)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f-ezPkfstDCuLc4CgRNX3g.png" /></figure><p>5. Invalid requests trigger zero-tolerance alerts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tX3e0RMzGU0Q3dzdFjT91A.png" /></figure><p>The webhook layer ensures that even without a static IP from Tines, we maintain secure and auditable communication between platforms.</p><p><strong>Next in this series:</strong> Extending Active Response for more use cases — host isolation, user disable, and callback to Tines.</p><ul><li>Link to Wazuh webpage:<a href="https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program</a></li><li>Link to Ambassadors program landing page:<a href="https://wazuh.com/ambassadors-program/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">https://wazuh.com/ambassadors-program/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program</a></li><li>LinkedIn : <a href="http://www.linkedin.com/in/hanifka">www.linkedin.com/in/hanifka</a></li><li>Github: <a href="https://github.com/Hanifka">Hanifka (Hanifka)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8d1f8409b58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wazuh × Tines SOAR Integration: Lab Setup Phase 1]]></title>
            <link>https://medium.com/@Hanif.ka/wazuh-tines-soar-integration-lab-setup-phase-1-536c4a6137f5?source=rss-356ba3f41fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/536c4a6137f5</guid>
            <category><![CDATA[soar]]></category>
            <category><![CDATA[detection-and-response]]></category>
            <category><![CDATA[wazuh-active-response]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[wazuh]]></category>
            <dc:creator><![CDATA[Hanif K A]]></dc:creator>
            <pubDate>Thu, 30 Oct 2025 18:01:52 GMT</pubDate>
            <atom:updated>2025-11-11T09:07:05.447Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IX_OhWNYFIrhTTo817CRqQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_L1eMlOxUhlCYgKDb3GvNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*M-hicig6B4LOPL0DlOz91A.png" /></figure><h3>Introduction</h3><p>This lab documents a simple integration between Wazuh (SIEM) and Tines (SOAR). The objective was to build a functional SOAR pipeline for alert enrichment and automated response. Tines’ SaaS-based platform is ideal for learners with limited VM resources (Need SaaS SOAR) or Organizations seeking SOAR Saas solution.</p><p>Tines provides a SaaS-based SOAR platform with a free community plan.<br> The limits are:</p><ul><li>1 team / 3 users</li><li>3 playbooks (stories)</li><li>5,000 daily events</li></ul><h3>Overview</h3><p>The integration runs in two directions:</p><ol><li><strong>Wazuh → Tines<br></strong> Wazuh sends alerts to Tines via a webhook for enrichment, decision-making, and active response, such as automatically blocking the IOC.</li><li><strong>Tines → Wazuh<br></strong>Tines receives an alert, evaluates the IP reputation, and if the result is malicious, it sends a webhook back to Wazuh. Since there’s no dedicated network firewall, blocking actions are handled directly by Wazuh through an active response — for example, automatically blocking the IOC.</li></ol><h3>Setting Up Tines</h3><p>Once you’ve signed up for a free Tines account:</p><ol><li>Create a <strong>new Story</strong>.</li><li>Drag and drop a <strong>Webhook Action</strong> into your Story.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lbM17BZKXNY4NMS39zLcXQ.png" /></figure><p>3. Copy the <strong>Webhook URL</strong> : this will be used in Wazuh for integration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S6sbMaSmPkMIF7-Bsn5QDg.png" /></figure><p>Example URL:<br><a href="https://tines.com/webhook/your-story/example">https://tines.com/webhook/your-story/example</a></p><p>That’s all you need to start receiving alerts from Wazuh.</p><h3>Integrating Wazuh with Tines</h3><ol><li>On your Wazuh server, go to:</li></ol><pre>cd /var/ossec/integrations/</pre><p>2. You can use the built-in <strong>shuffle</strong> integration as a base or clone it for customization:</p><pre>cp shuffle custom-tines<br>cp shuffle.py custom-tines.py<br>sudo chown root:wazuh /var/ossec/integrations/custom-tines*<br>sudo chmod 750 /var/ossec/integrations/custom-tines*</pre><p>Once you’ve created your Tines integration, update your <strong>Wazuh Server configuration</strong> to include it like this:</p><pre>&lt;integration&gt;<br>  &lt;name&gt;custom-tines&lt;/name&gt;<br>  &lt;hook_url&gt;https://tines.com/webhook/your-story/example&lt;/hook_url&gt;<br>  &lt;rule_id&gt;500107,500106&lt;/rule_id&gt;<br>  &lt;alert_format&gt;json&lt;/alert_format&gt;<br>&lt;/integration&gt;</pre><p>3. This configuration defines <strong>which alerts Wazuh will send to Tines</strong>.</p><p><a href="https://documentation.wazuh.com/current/user-manual/manager/integration-with-external-apis.html">https://documentation.wazuh.com/current/user-manual/manager/integration-with-external-apis.html</a></p><ul><li>You can specify the <strong>rule IDs</strong> (500107, 500106) that should trigger the webhook.</li><li>You can also set a <strong>minimum alert level</strong>, for example, 12, so only high-severity alerts are sent.</li><li>The optional <strong>group</strong> filter (tinessoar) lets you restrict the integration to alerts in a specific category.</li></ul><p>4. Restart Wazuh after editing the configuration:</p><pre>sudo systemctl restart wazuh-manager</pre><h3><strong>Tines </strong>human-in-the-loop automation <strong>Workflow Stages</strong></h3><p>In this workflow, we automate end-to-end incident handling between Wazuh and Tines. Wazuh continuously monitors and detects potential security events. Only high-severity or specific alerts are sent to Tines, where they are enriched with threat-intelligence data, summarized using AI, and logged for reporting.</p><p>Depending on severity, Tines either triggers automated blocking actions back in Wazuh or waits for manual analyst input through an email-reply workflow. This setup helps your SOC team respond faster and gives them both automation and control in one simple system.</p><blockquote>Note: This documentation focuses on workflow logic and data flow.</blockquote><h4>Stage 1 : Tines Entry Point</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*KKgU1VM1goro5k-HTF60VQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*hkddqtlWX0HCI0OKu-anaw.png" /></figure><p><strong>Action:<br></strong> Tines begins by receiving alerts directly from <strong>Wazuh</strong> through a <strong>webhook</strong> Receiver Alerts that we add.</p><ul><li><strong>Integration in Wazuh:<br></strong> Wazuh’s &lt;integration&gt; block points to the Tines webhook URL, sending alerts that match specific settings that we add</li><li><strong>Purpose:<br></strong> This ensures only meaningful, high-impact alerts (e.g., failed SSH brute force, malware infection, etc.) are passed into Tines.</li></ul><h4>Stage 2 : AbuseIPDB Reputation Lookup</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*klmdfMyML2NljAM_OMoHHA.png" /></figure><p><strong>Action:<br></strong> Tines queries the <strong>AbuseIPDB API</strong> using the attacker’s IP address extracted from the alert JSON.</p><p>These fields form the <strong>Threat Context</strong> enrichment, later seen in the security email report.</p><p><strong>AbuseIPDB API Key</strong> is configured directly within Tines : no external script needed.</p><h4>Stage 3 : Reputation-Based Trigger</h4><p>After the lookup, a <strong>Trigger</strong> node called “Check Reputation” determines the next step:</p><ul><li>If <strong>Abuse Confidence ≥ 10</strong>, it continues to enrichment and reporting.</li><li>Otherwise, it may stop or be logged silently, depending on the workflow.</li></ul><p>This lets you focus only on IPs with measurable risk.</p><h4>Stage 4 : AI Summary &amp; Email Generation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KiuA3eLYJwczaax8Pbk-wA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0HshWCnhzp6phDlD1KELA.png" /></figure><p>Once a risk IP is detected, an <strong>HTTP Request</strong> action calls an AI summarizer or LLM API (gemini-2.0-flash) to generate a <strong>human-readable incident report</strong>.</p><p>Then a <strong>Send Email</strong> action dispatches a detailed <strong>Security Alert</strong> message</p><h4>Stage 5 : Data Logging to Google Sheets</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSBIzKSlDxV19GfdJ8iLiA.png" /></figure><p>Tines logs every processed alert to a central Google Sheet for tracking and metrics.</p><p><strong>Columns include:</strong></p><p>This helps calculate <strong>Mean Time to Detect (MTTD)</strong>, <strong>Mean Time to Respond (MTTR)</strong>, and shows your response workflow efficiency.</p><blockquote>Notes:<br>The difference between the two timestamps is due to a<strong> </strong>time zone offset, not an actual delay in the event.</blockquote><blockquote>The left timestamp (2025–10–24T22:58:52.155+0700) represents the local server time (UTC+7), while the correct timestamp (Fri, 24 Oct 2025 15:59:02 GMT) represents the exact moment converted to Coordinated Universal Time (UTC/GMT).</blockquote><h4>Stage 6 : High-Severity Filter (&gt; 80%)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SHfyQXekZl2E1hq-k2-iBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*IP8G4W55zvrFD4QjIUgq-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-iBuRBHjAwTVwvvvfICMA.png" /><figcaption>Action Immediately Added</figcaption></figure><p>When the Abuse Confidence Score exceeds <strong>80</strong>, another trigger, <strong>HighscoreAbuseConfidence,</strong> runs.</p><p>It automatically adds <strong>“Action Immediately”</strong> to the spreadsheet, marking the IP as requiring urgent blocking.</p><h4>Stage 7 : Send to Wazuh (HTTP POST)</h4><p>Finally, Tines sends the formatted JSON payload back to Wazuh via a <strong>custom HTTP receiver</strong> or <strong>Tines-Receiver Flask service</strong> listening on the Wazuh server.</p><p><strong>Verification:</strong></p><p>You can verify the IP block with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qfw4goGPfLJJ1KGVUkqTHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ap6aOZoMh1vpzVks6FoG8Q.png" /></figure><h4>Stage 8 : Email Reply Workflow (Manual Response Hook for Under 80 %)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*0jU5vXsMYAydJYu2yx0HFA.png" /></figure><p>This stage handles alerts with an <strong>Abuse Confidence Score below 80%</strong>. Such alerts are not automatically blocked but can still be <strong>manually responded to</strong> by replying to the alert email that was sent from Tines.</p><p>When an analyst responds (for example, by saying <em>“Good morning, please block it”</em>), the second Tines story detects the reply, automatically sends a data request to Wazuh to perform the corresponding action, and logs the associated message into the spreadsheet for tracking and audit purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w453K8GxSslLVNOjJ-_XhA.png" /><figcaption>After receiving the AI-generated security alert, the analyst simply replies to the email: “Good Morning, Please Block it”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LZy8hxh5E13UfEsyuJN9IQ.png" /><figcaption>Analyst Response: “Good Morning, Please Block it” — Response Time: Tracked automatically</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ajP43VPSvFswnoShOF6iAg.png" /><figcaption>Tines triggers Wazuh Active Response, which executes the iptables block. The terminal verification confirms:</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AriQM0b4qkSHZzBN3E2iew.png" /><figcaption>Wazuh logs two events: the incoming webhook payload from Tines and the successful Active Response blocking action.</figcaption></figure><p>- LinkedIn : <a href="http://www.linkedin.com/in/hanifka">www.linkedin.com/in/hanifka</a><br>- Github: <a href="https://github.com/Hanifka">Hanifka (Hanifka)</a><br>- Wazuh : <a href="https://wazuh.com/?utm_source=ambassadors&amp;utm_medium=referral&amp;utm_campaign=ambassadors+program">Wazuh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=536c4a6137f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zero-Log Checker: Automating Log Absence Detection in Wazuh]]></title>
            <link>https://medium.com/@Hanif.ka/zero-log-checker-automating-log-absence-detection-in-wazuh-b8e1e86b488e?source=rss-356ba3f41fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8e1e86b488e</guid>
            <category><![CDATA[detection-engineering]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Hanif K A]]></dc:creator>
            <pubDate>Sat, 13 Sep 2025 17:23:57 GMT</pubDate>
            <atom:updated>2025-09-13T18:26:13.695Z</atom:updated>
            <content:encoded><![CDATA[<p>When managing Wazuh in production, one of the biggest blind spots is <strong>silent log sources</strong> — agents or pipelines that stop producing data without notice. To close that gap, I built a <strong>Zero-Log Checker</strong>: a Python script that automatically detects inactive log sources based on agent and location (log sources).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xbUT4uWa5Tand7ntHdFFcA.png" /></figure><h3>Goal</h3><p>The Zero-Log Checker ensures that all expected Wazuh agents and log sources are producing events within the last hour.</p><ul><li>If an agent or log source is <strong>silent for 1 hour</strong>, the script writes:</li><li>/var/log/zerolog.log → alerts about zero activity</li><li>/var/log/zerolog_kb.txt → snapshot of active agents and logs</li></ul><p>It runs automatically via <strong>cron</strong>, every hour.</p><h3>Prerequisites</h3><ul><li>Python 3.8+</li></ul><pre>python3 --version</pre><ul><li>Access to the Wazuh alerts.json file (default: /var/ossec/logs/alerts/alerts.json)</li><li>Root (sudo) privileges</li></ul><h3>Installation</h3><h4>1. Create Script Directory &amp; File</h4><pre>sudo nano /opt/zero_log_check.py</pre><pre>#!/usr/bin/env python3<br># -*- coding: utf-8 -*-<br><br>&quot;&quot;&quot;<br>Zero-log checker for Wazuh alerts.json (last 1 hour window).<br><br>- Reads newline-delimited JSON from alerts.json (Wazuh manager or forwarded copy)<br>- Collects active agent names/IDs and &#39;location&#39; fields seen in the last 1 hour<br>- Compares against expected lists provided in /etc/zero-log-check.yml (optional)<br>- Appends any zero-activity items to /var/log/zerolog.log<br>- Writes a knowledge snapshot to /var/log/zerolog_kb.txt<br><br>Tested on Python 3.8+ (no external deps).<br>&quot;&quot;&quot;<br><br>import argparse<br>import datetime as dt<br>import json<br>import os<br>import re<br>import sys<br>from typing import Dict, Set, Tuple, Iterable<br><br>DEFAULT_ALERTS = &quot;/var/ossec/logs/alerts/alerts.json&quot;<br>DEFAULT_CONFIG  = &quot;/etc/zero-log-check.yml&quot;<br>DEFAULT_LOG     = &quot;/var/log/zerolog.log&quot;<br>KB_FILE         = &quot;/var/log/zerolog_kb.txt&quot;<br><br><br>def load_yaml_minimal(path: str) -&gt; Dict:<br>    &quot;&quot;&quot;<br>    Minimal YAML reader for a tiny config like:<br>      expected_agents:<br>        - VN-ADDC1VPRD-UP<br>        - VN-ADDC2VPRD-UP<br>      expected_log_locations:<br>        - EventChannel<br>        - /tmp/packetbeat/packetbeat-*.ndjson<br>    Falls back to {} if file missing/empty.<br>    &quot;&quot;&quot;<br>    if not os.path.exists(path):<br>        return {}<br>    try:<br>        data: Dict = {}<br>        current_key = None<br>        with open(path, &quot;r&quot;, encoding=&quot;utf-8&quot;, errors=&quot;replace&quot;) as f:<br>            for raw in f:<br>                line = raw.strip()<br>                if not line or line.startswith(&quot;#&quot;):<br>                    continue<br>                # key:<br>                m = re.match(r&quot;^([A-Za-z0-9_\-]+)\s*:\s*$&quot;, line)<br>                if m:<br>                    current_key = m.group(1)<br>                    data[current_key] = []<br>                    continue<br>                # - item<br>                m2 = re.match(r&quot;^-\s*(.+?)\s*$&quot;, line)<br>                if m2 and current_key:<br>                    data[current_key].append(m2.group(1))<br>        return data<br>    except Exception:<br>        return {}<br><br># ---------- time parsing ----------<br>_TZ_COLON_RE = re.compile(r&quot;([+-]\d{2})(\d{2})$&quot;)<br><br>def _iso_fix_tz(s: str) -&gt; str:<br>    # &quot;2025-09-01T08:47:55.554+0000&quot; -&gt; &quot;+00:00&quot;<br>    s = s.replace(&quot;Z&quot;, &quot;+00:00&quot;)<br>    return _TZ_COLON_RE.sub(r&quot;\1:\2&quot;, s)<br><br>def parse_any_ts(s: str) -&gt; dt.datetime:<br><br>    s2 = _iso_fix_tz(s)<br>    try:<br>        t = dt.datetime.fromisoformat(s2)<br>        if t.tzinfo is None:<br>            t = t.replace(tzinfo=dt.timezone.utc)<br>        return t.astimezone(dt.timezone.utc)<br>    except Exception:<br>        # last-ditch: strip fractional seconds if needed<br>        s3 = re.sub(r&quot;\.\d+&quot;, &quot;&quot;, s2)<br>        t = dt.datetime.fromisoformat(s3)<br>        if t.tzinfo is None:<br>            t = t.replace(tzinfo=dt.timezone.utc)<br>        return t.astimezone(dt.timezone.utc)<br><br># ---------- file tail read (size-limited) ----------<br>def iter_tail_lines(path: str, max_bytes: int = 50 * 1024 * 1024) -&gt; Iterable[str]:<br>    &quot;&quot;&quot;<br>    Reads only the last `max_bytes` of a potentially large file, yielding lines.<br>    If file is smaller, reads all.<br>    &quot;&quot;&quot;<br>    with open(path, &quot;rb&quot;) as f:<br>        size = f.seek(0, os.SEEK_END)<br>        start = max(0, size - max_bytes)<br>        f.seek(start)<br>        # discard first partial line if we started in the middle<br>        if start &gt; 0:<br>            f.readline()<br>        for b in f:<br>            yield b.decode(&quot;utf-8&quot;, errors=&quot;replace&quot;)<br><br># ---------- core scan ----------<br>def scan_alerts(alerts_path: str, window_secs: int, tail_bytes: int) -&gt; Tuple[Set[str], Set[str], int]:<br>  <br>    now = dt.datetime.now(dt.timezone.utc)<br>    window_start = now - dt.timedelta(seconds=window_secs)<br><br>    active_agents: Set[str] = set()<br>    active_locations: Set[str] = set()<br>    total = 0<br><br>    if not os.path.exists(alerts_path):<br>        return active_agents, active_locations, 0<br><br>    for line in iter_tail_lines(alerts_path, max_bytes=tail_bytes):<br>        line = line.strip()<br>        if not line or line[0] != &quot;{&quot;:<br>            continue<br>        try:<br>            obj = json.loads(line)<br>        except Exception:<br>            continue<br><br>        # timestamp candidates<br>        ts = None<br>        if &quot;timestamp&quot; in obj:<br>            ts = obj[&quot;timestamp&quot;]<br>        elif &quot;data&quot; in obj and isinstance(obj[&quot;data&quot;], dict):<br>            ts = obj[&quot;data&quot;].get(&quot;@timestamp&quot;)<br><br>        if not ts:<br>            continue<br>        try:<br>            t = parse_any_ts(ts)<br>        except Exception:<br>            continue<br><br>        if t &lt; window_start:<br>            continue<br><br>        total += 1<br><br>        # Agent name/id<br>        ag = obj.get(&quot;agent&quot;, {})<br>        ag_name = ag.get(&quot;name&quot;) or ag.get(&quot;id&quot;)<br>        if ag_name:<br>            active_agents.add(str(ag_name))<br><br>        # Location (e.g., &quot;EventChannel&quot; or packetbeat ndjson path)<br>        loc = obj.get(&quot;location&quot;)<br>        if loc:<br>            active_locations.add(str(loc))<br><br>    return active_agents, active_locations, total<br><br># ---------- main ----------<br>def main():<br>    ap = argparse.ArgumentParser(description=&quot;Check zero-log agents and locations in last 1 hour.&quot;)<br>    ap.add_argument(&quot;--alerts&quot;, default=DEFAULT_ALERTS, help=&quot;Path to Wazuh alerts.json (newline-delimited JSON).&quot;)<br>    ap.add_argument(&quot;--config&quot;, default=DEFAULT_CONFIG, help=&quot;YAML config with expected agents/locations.&quot;)<br>    ap.add_argument(&quot;--log&quot;,    default=DEFAULT_LOG,    help=&quot;Where to append zero-log findings.&quot;)<br>    ap.add_argument(&quot;--window&quot;, type=int, default=3600, help=&quot;Window in seconds (default 3600 = 1h).&quot;)<br>    ap.add_argument(&quot;--tail-bytes&quot;, type=int, default=50*1024*1024, help=&quot;Max bytes to read from end of file.&quot;)<br>    args = ap.parse_args()<br><br>    cfg = load_yaml_minimal(args.config)<br>    expected_agents = set(cfg.get(&quot;expected_agents&quot;, []))<br>    expected_locations = set(cfg.get(&quot;expected_log_locations&quot;, []))<br><br>    try:<br>        active_agents, active_locations, total = scan_alerts(args.alerts, args.window, args.tail_bytes)<br>    except Exception as e:<br>        print(f&quot;[ERROR] Failed to scan {args.alerts}: {e}&quot;, file=sys.stderr)<br>        sys.exit(2)<br><br>    try:<br>        write_kb(KB_FILE, total, active_agents, active_locations)<br>    except Exception as e:<br>        print(f&quot;[WARN] Could not write knowledge file {KB_FILE}: {e}&quot;, file=sys.stderr)<br><br>    zero_agents = set()<br>    zero_locations = set()<br><br>    if expected_agents:<br>        zero_agents = expected_agents - active_agents<br>    if expected_locations:<br>        import fnmatch<br>        globs = [p for p in expected_locations if any(ch in p for ch in &quot;*?[]&quot;)]<br>        literals = expected_locations - set(globs)<br>        zero_locations |= (literals - active_locations)<br>        for pat in globs:<br>            matched = any(fnmatch.fnmatch(loc, pat) for loc in active_locations)<br>            if not matched:<br>                zero_locations.add(pat)<br><br>    append_zero_log(args.log, zero_agents, &quot;agent(s)&quot;)<br>    append_zero_log(args.log, zero_locations, &quot;log location(s)&quot;)<br><br>    if zero_agents or zero_locations:<br>        sys.exit(1)<br>    sys.exit(0)<br><br># ---------- main ----------<br>def append_zero_log(log_path: str, items: Iterable[str], kind: str):<br>    if not items:<br>        return<br>    ts = dt.datetime.now().strftime(&quot;%Y-%m-%d %H:%M:%S&quot;)<br>    lines = [f&quot;[{ts}] ZERO activity in last 1h for {kind}: {item}\n&quot; for item in sorted(items)]<br>    os.makedirs(os.path.dirname(log_path), exist_ok=True)<br>    with open(log_path, &quot;a&quot;, encoding=&quot;utf-8&quot;) as f:<br>        f.writelines(lines)<br><br>def write_kb(snapshot_path: str, total: int, active_agents: Set[str], active_locations: Set[str]):<br>    ts = dt.datetime.now().strftime(&quot;%Y-%m-%d %H:%M:%S %z&quot;)<br>    body = [<br>        f&quot;=== zero-log knowledge snapshot === {ts}\n&quot;,<br>        f&quot;Window: last 1 hour\n&quot;,<br>        f&quot;Total events seen: {total}\n&quot;,<br>        f&quot;Active agents ({len(active_agents)}): {&#39;, &#39;.join(sorted(active_agents)) or &#39;-&#39;}\n&quot;,<br>        f&quot;Active log locations ({len(active_locations)}):\n&quot;,<br>    ]<br>    for loc in sorted(active_locations):<br>        body.append(f&quot;  - {loc}\n&quot;)<br>    body.append(&quot;\n&quot;)<br>    with open(snapshot_path, &quot;w&quot;, encoding=&quot;utf-8&quot;) as f:<br>        f.writelines(body)<br><br>def main():<br>    ap = argparse.ArgumentParser(description=&quot;Check zero-log agents and locations in last 1 hour.&quot;)<br>    ap.add_argument(&quot;--alerts&quot;, default=DEFAULT_ALERTS, help=&quot;Path to Wazuh alerts.json (newline-delimited JSON).&quot;)<br>    ap.add_argument(&quot;--config&quot;, default=DEFAULT_CONFIG, help=&quot;YAML config with expected agents/locations.&quot;)<br>    ap.add_argument(&quot;--log&quot;,    default=DEFAULT_LOG,    help=&quot;Where to append zero-log findings.&quot;)<br>    ap.add_argument(&quot;--window&quot;, type=int, default=3600, help=&quot;Window in seconds (default 3600 = 1h).&quot;)<br>    ap.add_argument(&quot;--tail-bytes&quot;, type=int, default=50*1024*1024, help=&quot;Max bytes to read from end of file.&quot;)<br>    args = ap.parse_args()<br><br>    cfg = load_yaml_minimal(args.config)<br>    expected_agents = set(cfg.get(&quot;expected_agents&quot;, []))<br>    expected_locations = set(cfg.get(&quot;expected_log_locations&quot;, []))<br><br>    try:<br>        active_agents, active_locations, total = scan_alerts(args.alerts, args.window, args.tail_bytes)<br>    except Exception as e:<br>        print(f&quot;[ERROR] Failed to scan {args.alerts}: {e}&quot;, file=sys.stderr)<br>        sys.exit(2)<br><br>    try:<br>        write_kb(KB_FILE, total, active_agents, active_locations)<br>    except Exception as e:<br>        print(f&quot;[WARN] Could not write knowledge file {KB_FILE}: {e}&quot;, file=sys.stderr)<br><br>    zero_agents = set()<br>    zero_locations = set()<br><br>    if expected_agents:<br>        zero_agents = expected_agents - active_agents<br>    if expected_locations:<br>        import fnmatch<br>        globs = [p for p in expected_locations if any(ch in p for ch in &quot;*?[]&quot;)]<br>        literals = expected_locations - set(globs)<br>        zero_locations |= (literals - active_locations)<br>        for pat in globs:<br>            matched = any(fnmatch.fnmatch(loc, pat) for loc in active_locations)<br>            if not matched:<br>                zero_locations.add(pat)<br><br>    append_zero_log(args.log, zero_agents, &quot;agent(s)&quot;)<br>    append_zero_log(args.log, zero_locations, &quot;log location(s)&quot;)<br><br>    if zero_agents or zero_locations:<br>        sys.exit(1)<br>    sys.exit(0)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><h4>2. Create Configuration File</h4><pre>sudo nano /etc/zero-log-check.yml</pre><p>Example config:</p><pre>expected_agents:<br>  - ssa<br>  - Windows-Lab<br>  - APP-DRC-01<br><br>expected_log_locations:<br>  - EventChannel<br>  - /tmp/packetbeat/packetbeat-*.ndjson</pre><h4>3. Prepare Log Files</h4><pre>sudo touch /var/log/zerolog.log /var/log/zerolog_kb.txt<br>sudo chown root:adm /var/log/zerolog.log /var/log/zerolog_kb.txt<br>sudo chmod 0640 /var/log/zerolog.log /var/log/zerolog_kb.txt</pre><h4>4. Test the Script Manually</h4><pre>sudo python3 /opt/zero_log_check.py \<br> - alerts /var/ossec/logs/alerts/alerts.json \<br> - config /etc/zero-log-check.yml \<br> - log /var/log/zerolog.log</pre><h4>5. Edit Wazuh Manager:</h4><p>A. Decoders</p><pre>&lt;decoder name=&quot;Zero_Activity&quot;&gt;<br>    &lt;prematch&gt;\D+ ZERO&lt;/prematch&gt;<br>&lt;/decoder&gt;<br><br>&lt;decoder name=&quot;Zero_Activity_fields&quot;&gt;<br>  &lt;parent&gt;Zero_Activity&lt;/parent&gt; <br>  &lt;regex type=&quot;pcre2&quot;&gt;\]\s+(.*?)\: (.*)&lt;/regex&gt;<br>  &lt;order&gt;msg,log_location&lt;/order&gt;<br>&lt;/decoder&gt;</pre><p>B. Rules</p><pre>&lt;group name=&quot;zero,&quot;&gt;<br>  &lt;rule id=&quot;500103&quot; level=&quot;12&quot;&gt;<br>    &lt;decoded_as&gt;Zero_Activity&lt;/decoded_as&gt;<br>    &lt;description&gt;Zero Log Activity detected: Agent $(agent), Location $(log_location)&lt;/description&gt;<br>    &lt;group&gt;zerolog,&lt;/group&gt;<br>  &lt;/rule&gt;<br>&lt;/group&gt;</pre><p>C. Add log input (ossec.conf)</p><pre>&lt;ossec_config&gt;<br>  ...<br>  #Add this<br>  &lt;localfile&gt;<br>    &lt;log_format&gt;syslog&lt;/log_format&gt;<br>    &lt;location&gt;/var/log/zerolog.log&lt;/location&gt;<br>  &lt;/localfile&gt;<br>  #Until here<br>  ...<br>&lt;/ossec_config&gt;</pre><h4>6. Automating with Cron</h4><p>Add this to root’s crontab:</p><pre>sudo crontab -e</pre><p>Insert:</p><pre>5 * * * * /usr/bin/python3 /opt/zero_log_check.py \<br>  --alerts /var/ossec/logs/alerts/alerts.json \<br>  --config /etc/zero-log-check.yml \<br>  --log /var/log/zerolog.log</pre><h3>Output</h3><p>Example output on /var/log/zerolog_kb.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FbdP0gZfQp8xJLfLBKVGzg.png" /></figure><p>Example output on the Wazuh Discover:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFY8GI-rc3HE7m9dcpkkcQ.jpeg" /></figure><ul><li><strong>Agents</strong>: If an agent (e.g., Windows-Lab, APP-DRC-01) hasn’t reported any events in the past hour, it is Alerted.</li><li><strong>Log Locations</strong>: If a specific data source (e.g., /tmp/packetbeat/packetbeat-*.ndjson) has been silent, it is also Alerted.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8e1e86b488e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>