<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://suniltiwari.me/feed.xml" rel="self" type="application/atom+xml" /><link href="https://suniltiwari.me/" rel="alternate" type="text/html" /><updated>2026-05-02T03:35:53+00:00</updated><id>https://suniltiwari.me/feed.xml</id><title type="html">Sunil Tiwari - AI Security Engineer</title><subtitle>Specializing in Autonomous Threat Containment (ATCE) and AI-driven Security Orchestration.</subtitle><author><name>Sunil Tiwari</name><email>bishwast77@gmail.com</email></author><entry><title type="html">Ai Soc Analyst Blog</title><link href="https://suniltiwari.me/ai-soc-analyst-blog/" rel="alternate" type="text/html" title="Ai Soc Analyst Blog" /><published>2025-12-21T00:00:00+00:00</published><updated>2025-12-21T00:00:00+00:00</updated><id>https://suniltiwari.me/ai-soc-analyst-blog</id><content type="html" xml:base="https://suniltiwari.me/ai-soc-analyst-blog/"><![CDATA[<h1 id="building-a-privacy-first-ai-soc-native-wazuh-and-llama-32-on-nvidia-arm64">Building a Privacy-First AI SOC: Native Wazuh and Llama 3.2 on NVIDIA ARM64</h1>

<p><strong>Author:</strong> Sunil Tiwari
<strong>Date:</strong> 12-22-2025</p>

<hr />

<h2 id="introduction">Introduction</h2>

<p>This blog documents a personal <strong>Security Operations Center (SOC) home lab project</strong> focused on building a <strong>privacy-first, AI-driven SOC</strong> using <strong>Wazuh</strong> and <strong>Llama 3.2</strong>, running natively on <strong>NVIDIA ARM64 infrastructure</strong>. This project was <strong>designed, deployed, and troubleshot end-to-end</strong> to translate academic cybersecurity knowledge into a practical, production-aligned environment.</p>

<p>During my academic journey in <strong>Cybersecurity Management</strong>, I worked on foundational projects such as Linux brute-force detection, packet analysis using Wireshark, and LAN troubleshooting. While these experiences strengthened my theoretical understanding, they offered limited exposure to real SOC operations, detection logic, and infrastructure constraints encountered in enterprise environments.</p>

<p>Through independent research and engagement with technical communities, I recognized that while certifications explain <em>what</em> security tools do, <strong>self-built labs teach <em>how</em> security operations actually function</strong>. This insight led me to design and implement a cybersecurity home lab using an <strong>NVIDIA DGX Spark</strong> platform.</p>

<p>Initial attempts to deploy traditional virtualized SOC environments were unsuccessful due to <strong>ARM64 compatibility and nested virtualization limitations</strong>. Rather than forcing an x86-centric approach, I intentionally pivoted to a <strong>native deployment model</strong>. This architectural decision eliminated virtualization overhead, reduced attack surface, and allowed full utilization of NVIDIA’s <strong>GPU-accelerated unified memory</strong>—a critical requirement for local AI inference.</p>

<p>The final lab architecture uses <strong>native and containerized services</strong>, including <strong>Wazuh</strong> for security monitoring, <strong>Ollama running Llama 3.2</strong> for on-premise AI inference, and <strong>Python-based automation</strong> to support SOC workflows. While my primary focus is security engineering rather than software development, Python scripting enabled automated alert enrichment and analysis aligned with real SOC operations.</p>

<p>This blog outlines the <strong>architecture, design decisions, technical challenges, and lessons learned</strong>, demonstrating how <strong>on-premise AI can enhance SOC effectiveness without compromising data privacy</strong>.</p>

<hr />

<h2 id="key-skills-demonstrated">Key Skills Demonstrated</h2>

<ul>
  <li>SOC Operations &amp; Alert Triage</li>
  <li>Detection Engineering &amp; Rule Correlation</li>
  <li>Linux System Administration (Ubuntu, ARM64)</li>
  <li>Package Management &amp; Trust Repair (DPKG, APT, GPG)</li>
  <li>Wazuh SIEM (Manager, Indexer, Custom Rules)</li>
  <li>Credential Stuffing Detection</li>
  <li>Log Validation &amp; Noise Reduction</li>
  <li>ARM64 Security Engineering</li>
  <li>Python Automation for SOC Workflows</li>
  <li>On-Premise AI Inference (Llama 3.2, Ollama)</li>
  <li>Privacy-First Security Architecture</li>
</ul>

<hr />

<h2 id="arm64-infrastructure--the-virtualization-wall">ARM64 Infrastructure &amp; the “Virtualization Wall”</h2>

<p>Despite using high-performance hardware—the <strong>NVIDIA DGX Spark</strong>—the platform itself presented the first major challenge. While DGX Spark excels at AI workloads, its <strong>AARCH64 (ARM64)</strong> architecture is often unsupported or minimally addressed in traditional SOC lab tutorials designed for <strong>x86 systems</strong>.</p>

<p>Early attempts followed conventional lab designs using <strong>VirtualBox</strong> and <strong>KVM</strong>, but these approaches quickly failed due to <strong>nested virtualization performance degradation</strong> and architectural mismatches. Rather than treating this as a blocker, I reassessed the operational goal of the lab and chose a <strong>native, production-aligned deployment strategy</strong>.</p>

<p>By installing the <strong>Wazuh Manager and Indexer directly on the host operating system</strong>, I removed unnecessary abstraction layers and gained direct access to the system’s unified memory architecture. A Python virtual environment (<code class="language-plaintext highlighter-rouge">.venv</code>) was used to isolate automation dependencies while maintaining system stability. This design decision later proved critical for running <strong>Llama 3.2 efficiently on GPU</strong> without resource contention.</p>

<p><img src="/images/portfolio_images/wazuh-agent_installed.png" alt="Wazuh-Agent Successfully Installed" /></p>

<p><img src="/images/portfolio_images/wazuh_installation_complete.png" alt="Wazuh Installation Completion" /></p>

<hr />

<h2 id="linux-package-management--trust-recovery">Linux Package Management &amp; Trust Recovery</h2>

<p>During installation, I encountered critical failures related to <strong>Wazuh repository signature verification</strong>. These issues stemmed from modern Ubuntu security changes and ARM64-specific repository behavior.</p>

<h3 id="manual-gpg-key-restoration">Manual GPG Key Restoration</h3>

<p>Ubuntu 22.04 and later versions deprecate <code class="language-plaintext highlighter-rouge">apt-key</code>, and automated repository scripts occasionally fail on ARM64 systems. When the Wazuh repository returned a <strong>signature verification error</strong>, I manually restored trust by:</p>

<ol>
  <li>Downloading the Wazuh public key directly using <code class="language-plaintext highlighter-rouge">curl</code></li>
  <li>Converting the ASCII key to binary format using <code class="language-plaintext highlighter-rouge">gpg --dearmor</code></li>
  <li>Storing the key in a dedicated keyring at <code class="language-plaintext highlighter-rouge">/usr/share/keyrings/wazuh.gpg</code></li>
  <li>Explicitly binding the repository to this key in the <code class="language-plaintext highlighter-rouge">.list</code> source file</li>
</ol>

<p>This approach followed modern Linux security best practices and ensured repository integrity.</p>

<hr />

<h3 id="repairing-a-locked-dpkg-database">Repairing a Locked DPKG Database</h3>

<p>A failed installation attempt also left the <strong>DPKG database locked</strong>, preventing further package operations. To recover:</p>

<ul>
  <li>Identified background processes holding the lock using <code class="language-plaintext highlighter-rouge">ps aux | grep apt</code></li>
  <li>Attempted graceful termination of background updates</li>
  <li>
    <p>When the database remained locked:</p>

    <ul>
      <li>Manually removed stale <code class="language-plaintext highlighter-rouge">.lock</code> and <code class="language-plaintext highlighter-rouge">.lock-frontend</code> files</li>
      <li>Executed <code class="language-plaintext highlighter-rouge">sudo dpkg --configure -a</code> to complete interrupted package operations</li>
    </ul>
  </li>
</ul>

<p>This process stabilized the package manager and restored system consistency.</p>

<p>This phase reinforced a critical SOC principle: <strong>you cannot trust your security telemetry if you do not trust the underlying system producing it</strong>. Understanding Linux internals and package management is foundational to secure log collection and analysis.</p>

<hr />

<h2 id="detection-engineering-the-logic-behind-the-alerts">Detection Engineering: The Logic Behind the Alerts</h2>

<p>With the infrastructure stabilized, I moved into <strong>Detection Engineering</strong>, focusing on identifying <strong>Credential Stuffing behavior</strong>.</p>

<p>Initial custom detection rules failed to trigger as expected. Using <code class="language-plaintext highlighter-rouge">wazuh-logtest</code>, I identified that <strong>built-in Wazuh rules were evaluated before custom logic</strong>, preventing my rules from firing. Rather than duplicating detection logic, I re-engineered my approach to <strong>extend existing native rules</strong>.</p>

<p>By hooking into <strong>Rule 5760 (SSH authentication failure)</strong> and implementing <strong>stateful correlation</strong>, I defined a detection threshold of <strong>five failed authentication attempts within 60 seconds from the same source IP</strong>. Once exceeded, the event was escalated to a <strong>high-priority alert</strong>.</p>

<p>This approach ensured that alerts represented <strong>behavioral attack patterns</strong>, not isolated failures. The AI component was then able to focus on meaningful, aggregated events—reducing noise and aligning with real SOC triage workflows.</p>

<p><img src="/images/portfolio_images/finale_result.png" alt="Final Output Validating Trigger" /></p>

<hr />

<h2 id="closing-reflection">Closing Reflection</h2>

<p>This project reflects my approach to security operations: <strong>understand the system, validate the logs, reduce noise, and detect behavior—not just alerts</strong>. By overcoming architectural limitations, repairing trust chains, and engineering meaningful detections, this lab mirrors challenges faced in real SOC environments.</p>

<p>Most importantly, it demonstrates how <strong>privacy-first, on-premise AI</strong> can support SOC analysts without exporting sensitive telemetry—an increasingly critical requirement in modern security operations.</p>

<hr />

<h2 id="the-ai-analyst--bridging-telemetry-to-intelligence">The AI Analyst — Bridging Telemetry to Intelligence</h2>

<p>After completing detection engineering in Wazuh, the next challenge was making security telemetry <strong>actionable</strong>. To automate the <em>“Who, What, and Where”</em> of an attack, I developed a <strong>Python-based Telemetry Bridge</strong> that functions as a <strong>virtual Tier-1 SOC analyst</strong>—ingesting alerts, contextualizing events, and producing analyst-ready summaries in real time.</p>

<hr />

<h3 id="1-engineering-a-memory-efficient-log-watcher">1. Engineering a Memory-Efficient Log Watcher</h3>

<p>At the core of this automation is a Python script that continuously monitors the Wazuh <code class="language-plaintext highlighter-rouge">alerts.json</code> file. Because security logs can grow to gigabytes in size, loading the file into memory was not a viable option.</p>

<p>Instead, I implemented a <strong>generator-based log watcher</strong> using Python’s <code class="language-plaintext highlighter-rouge">yield</code> keyword.</p>

<ul>
  <li>
    <p><strong>The Logic:</strong><br />
By using <code class="language-plaintext highlighter-rouge">yield</code>, the script remains in a paused state until a new log entry is written. This allows it to process events line by line without polling or re-reading the file.</p>
  </li>
  <li>
    <p><strong>The Benefit:</strong><br />
This design enables <strong>real-time alert processing</strong> while maintaining a constant, minimal memory footprint. This was critical to ensure that the SIEM and the AI inference engine did not compete for RAM on the DGX Spark system.</p>
  </li>
</ul>

<p>This approach mirrors production SOC tooling, where efficiency and stability are just as important as detection accuracy.</p>

<hr />

<h3 id="2-local-inference-privacy-by-design">2. Local Inference: Privacy by Design</h3>

<p>When a high-severity alert (custom <strong>Rule ID 100001</strong>) is triggered, the script extracts relevant fields from the alert JSON and constructs a structured payload for the <strong>Ollama API</strong>.</p>

<p>Rather than relying on cloud-based AI services, I chose to run <strong>Llama 3.2 locally on NVIDIA hardware</strong>. This decision was driven by <strong>data sovereignty and operational security</strong> considerations:</p>

<ul>
  <li>
    <p><strong>Zero Data Exfiltration:</strong><br />
Sensitive telemetry—including internal IP addresses, usernames, and hostnames—never leaves the local environment.</p>
  </li>
  <li>
    <p><strong>Low Latency:</strong><br />
By eliminating network calls to external APIs, the AI generates summaries and remediation guidance within milliseconds of detection.</p>
  </li>
</ul>

<p>This architecture demonstrates how AI can be safely integrated into SOC workflows without introducing new data exposure risks.</p>

<hr />

<h3 id="3-turning-code-into-conversation">3. Turning Code into Conversation</h3>

<p>The final output of the automation is a <strong>human-readable “Executive Brief.”</strong> Instead of presenting raw log entries, the AI interprets attack behavior and provides concise, actionable intelligence.</p>

<p>For example, during a <strong>Hydra-based brute-force attack</strong>, the system does not simply report repeated authentication failures. It:</p>

<ul>
  <li>Identifies the attack pattern</li>
  <li>Attributes the source IP</li>
  <li>Summarizes the target and attack method</li>
  <li>Recommends immediate remediation actions, such as firewall blocking</li>
</ul>

<p>This translation of telemetry into decision-ready context significantly reduces <strong>Mean Time to Respond (MTTR)</strong>—from minutes to seconds.</p>

<p>To ensure reliability during high-velocity attacks, I used <code class="language-plaintext highlighter-rouge">json.loads(line)</code> to convert raw log entries into Python dictionaries and accessed fields using <code class="language-plaintext highlighter-rouge">.get()</code> for safe navigation. This defensive coding approach prevents script failure if optional fields are missing, maintaining resilience under attack conditions.</p>

<hr />

<h3 id="why-this-matters-in-a-soc-environment">Why This Matters in a SOC Environment</h3>

<p>This AI-assisted workflow reflects real SOC priorities:</p>

<ul>
  <li>Reduce alert fatigue</li>
  <li>Preserve analyst attention for high-risk events</li>
  <li>Maintain privacy and control over sensitive telemetry</li>
  <li>Accelerate response without sacrificing accuracy</li>
</ul>

<p>Rather than replacing analysts, the system acts as a <strong>force multiplier</strong>, allowing human analysts to focus on validation and decision-making instead of manual triage.</p>

<p><img src="/images/portfolio_images/ai_analyst_proof.png" alt="AI Analyst Proof: Python Script Output" /></p>]]></content><author><name>Sunil Tiwari</name><email>bishwast77@gmail.com</email></author><summary type="html"><![CDATA[Building a Privacy-First AI SOC: Native Wazuh and Llama 3.2 on NVIDIA ARM64]]></summary></entry></feed>