<?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 Root on Medium]]></title>
        <description><![CDATA[Stories by Root on Medium]]></description>
        <link>https://medium.com/@basharraed?source=rss-415cded1860d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xDM1fH9ZaY7xx2LAbdiMHQ.png</url>
            <title>Stories by Root on Medium</title>
            <link>https://medium.com/@basharraed?source=rss-415cded1860d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:15:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@basharraed/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[I Knew Every AWS Security Service. I Still Failed the Exam. Here’s How I Passed.]]></title>
            <link>https://medium.com/@basharraed/how-i-passed-the-aws-security-specialty-scs-c03-on-my-second-attempt-9e81e1751cee?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e81e1751cee</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-security]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 18:02:38 GMT</pubDate>
            <atom:updated>2026-11-16T14:25:03.956Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>How I passed SCS-C03 on my second attempt by learning how the services fit together.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*9mkSA5R-eLgu5K8H4rt9bQ.png" /></figure><p>I failed the AWS Certified Security — Specialty exam in July. Four months later, I sat for it again. This time, I passed.</p><p>It took much longer than I expected to get here. I started studying back in August 2025, spent months going through AWS services, practice questions and scenarios, and eventually had to deal with the disappointment of failing my first attempt.</p><p>Looking back, the biggest difference between the two attempts wasn’t how many hours I studied. It was how I approached the questions.</p><p>I wanted to share what I used, where I struggled, and what I would do differently if I had to start again. This isn’t a study roadmap or a list of guaranteed exam topics. It’s simply my experience.</p><h3>A little background</h3><p>I currently work as an IT Coordinator at a school in Dubai, where I deal with infrastructure, networking and security.</p><p>Most of my previous experience has been on the offensive security side. I’ve performed internal penetration testing, and spent a lot of time working with Active Directory, networks and web applications.</p><p>AWS was a different challenge, though. I understood how to find vulnerabilities and think like an attacker, but I wanted to get better at understanding how cloud environments are secured, monitored and managed from a defensive perspective. That’s what pushed me towards the Security Specialty.</p><h3>How long did it take?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BUMPPPhGt9FpKTr1aeC-gQ.png" /></figure><p>I officially started studying in August 2025, but I didn’t become fully committed until March 2026.</p><p>From March onwards, I decided to put a lot of things on hold. I stepped away from LinkedIn, reduced my Hack The Box sessions, paused some personal projects and freelance work, and dedicated most of my evenings and weekends to studying. I knew I couldn’t give everything my attention at the same time, so I had to make a choice and commit to it.</p><p>My first attempt was on July 18, 2026, at a test centre in Amman, Jordan. I had spent months preparing, but I didn’t get the result I wanted. I remember walking out of there feeling frustrated, but somewhere in that frustration I already knew I’d book it again.</p><p>I took my second attempt in November, this time at a test centre in Dubai. On November 9, I finally got the result I had been working towards: I passed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jq9yNF4QxnwT8eln.png" /></figure><p><a href="https://www.credly.com/badges/7149c193-bc63-4321-addc-fc4e48056f2e/public_url">AWS Certified Security - Specialty was issued by Amazon Web Services Training and Certification to Bashar Abdalla.</a></p><p>Between the two attempts, finding time to study wasn’t always easy. I had my regular work responsibilities, dealing with day-to-day IT issues and supporting people at work, while also trying to keep up with my preparation. Some days, finding the time and energy to study after work was a challenge. But I kept going, revisited the areas I struggled with, and tried to improve my understanding rather than just go through the same material again.</p><h3><strong>About the exam</strong></h3><p>Before I get into how I prepared, here’s a quick overview of what the SCS-C03 exam actually looks like.</p><ul><li><strong>65 questions in 170 minutes</strong>, so just under three hours.</li><li><strong>Only 50 questions count toward your score.</strong> The other 15 are unscored questions AWS is trying out for future exams. You won’t know which ones they are, so treat every question as if it counts.</li><li><strong>Scored from 100 to 1,000. You need 750 to pass.</strong></li><li><strong>The exam fee is $300 USD.</strong></li></ul><p>There are four question types:</p><ul><li><strong>Multiple choice:</strong> one correct answer out of four options.</li><li><strong>Multiple response:</strong> two or more correct answers out of five or more options.</li><li><strong>Ordering:</strong> you pick the correct 3–5 steps for a task and put them in the right order.</li><li><strong>Matching:</strong> you match answers to a list of 3–7 prompts.</li></ul><p>On ordering and matching questions you have to get everything right to receive credit. Unanswered questions are marked wrong and there’s no penalty for guessing, so never leave a question blank.</p><p>The exam covers six domains:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*5jhj7vlrxXLUM4K19JU-XQ.png" /></figure><p>You don’t need to pass each domain separately. You only need to pass the exam overall. Your score report does show how you did in each section, though, and that’s exactly what I used to plan my second attempt.</p><h3>The resources I actually used</h3><p>I kept my resources relatively simple.</p><h4>1. <a href="https://medium.com/u/98189c4cef0">Stéphane Maarek</a> ’s<strong> AWS Certified Security Specialty course (Udemy)</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*9efGqcT88vOmbITeUHwUDQ.png" /></figure><p>This was my main resource throughout the preparation.</p><p>The course is around 17 hours long. It’s quite fast-paced and primarily slide-based, but Stéphane also includes practical demonstrations at the end of each service, showing how to navigate the AWS console, configure services and work with different settings. I found these demonstrations particularly helpful because they allowed me to see how things actually worked rather than just learning the concepts theoretically.</p><p>I actually started studying AWS from scratch, so there were quite a few concepts and services that I had to spend extra time understanding. I didn’t want to just watch a video, recognise a service name and move on. Whenever I came across a new service or an unfamiliar scenario, I’d research it further outside Udemy to make sure I understood how it worked and where it fitted into AWS.</p><p>Whenever possible, I’d also log in to my AWS account and try things out myself. I’d deploy services, experiment with configurations and test different scenarios to see how things actually worked rather than relying entirely on theory.</p><p>Of course, you can’t do this with every service or scenario. Some AWS resources can become expensive if you leave them running, so I kept my practical testing relatively simple and made sure to clean up resources afterwards.</p><p>The course gave me a good starting point, but a lot of the learning happened outside the course itself.</p><h4><strong>2. Working through the scenarios (Very Important)</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*jcsNCFykd-L21rgpAlzRoA.png" /></figure><p>Alongside the main course, I also purchased Stéphane’s separate scenario-based practice question package on Udemy, and I spent a lot of time working through those questions</p><p>I didn’t just want to know which option was correct. I wanted to understand the reasoning behind it. So, whenever I went through a scenario, I’d take the time to break it down:</p><ul><li>Why is this answer correct?</li><li>Why wouldn’t the other options work?</li><li>What exactly does each service mentioned in the question do?</li><li>How do these services interact with each other?</li><li>Could the same requirement be achieved using a different approach?</li></ul><p>I also didn’t limit myself to what was explained in the course. If a question introduced a service or feature I wasn’t completely familiar with, I’d research it further and, whenever possible, try it out in my AWS account.</p><p>Sometimes, a single scenario would send me down a rabbit hole of researching AWS documentation and testing different configurations for another 20–30 minutes.</p><p><strong>Honestly, I think this was one of the most important parts of my preparation.</strong> Scenario-based questions do more than test whether you’ve learned what individual AWS services do. They show you how well you’ve actually understood them and whether you can apply that knowledge when several services are involved in solving the same problem.</p><p>You also start seeing the relationships between services that you might not fully appreciate when studying them individually. You learn how permissions, networking, encryption, logging and monitoring all fit together, and how changing one part of the configuration can affect everything else.</p><p>Beyond preparing for the exam, I think this approach is much closer to what you’ll encounter when working with real AWS environments. In practice, you’re rarely dealing with one service in isolation. You’re dealing with multiple services, configurations and permissions that depend on each other.</p><p>That’s why I wouldn’t rush through these scenarios just to finish them. Take the time to understand them. You’ll get much more out of the experience.</p><h3>Why I failed the first time</h3><p>This was probably the biggest lesson from the entire experience.</p><p>Before my first attempt, I was comfortable with individual AWS services. I knew what KMS did, what AWS Config was responsible for, how GuardDuty worked, and what CloudTrail was used for.</p><p>The problem was that the exam wasn’t simply testing whether I knew these services, but whether I understood how to use them together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HcBdcyntyecs5biAK9dYDA.png" /></figure><p>You might get a scenario involving S3 encryption, KMS key policies, IAM permissions and cross-account access, all within the same question. Knowing each service individually doesn’t necessarily tell you how to solve that scenario.</p><p>I realised I had spent too much time learning services separately and not enough time understanding how they fit together.</p><p>I also started paying much more attention to the incorrect answers. Previously, once I found the right answer, I would move on. That was a mistake.</p><p>Some of the most useful learning came from understanding why the other three options wouldn’t satisfy the requirement.</p><p>That became a major part of my preparation for the second attempt.</p><h3>Topics I spent a lot of time understanding</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7QmTmpGjZ4j_PvW13xs0Mg.png" /></figure><h4>1. KMS and key policies</h4><p>KMS was one of the areas where understanding the relationship between different permissions really mattered.</p><p>A few things I made sure I understood:</p><ul><li><strong>Key policies are fundamental.</strong> IAM permissions alone aren’t always enough to access a KMS key. The key policy must allow the access directly or delegate permissions to IAM.</li><li><strong>SSE-KMS requires two permissions.</strong> Reading an encrypted S3 object generally requires both s3:GetObject and kms:Decrypt.</li><li><strong>AWS-managed keys and customer-managed keys are different.</strong> Customer-managed keys give you control over the key policy and support scenarios such as cross-account access.</li></ul><p>I found that many questions become easier once you understand which policy controls what.</p><h4>2. S3 encryption and immutability</h4><p>There are several encryption options in AWS, and knowing their differences is important.</p><p>I spent time comparing SSE-S3, SSE-KMS, DSSE-KMS and SSE-C, particularly in terms of who manages the encryption keys and what level of control or auditing is available.</p><p>Another area worth understanding is Object Lock and Backup Vault Lock.</p><p>Governance mode and compliance mode might sound similar, but the difference is significant. Governance mode can be bypassed by users with the appropriate permissions, whereas compliance mode prevents deletion or modification of protected data even by the root user during the retention period.</p><p>Also, don’t confuse versioning with immutability. Versioning helps recover previous versions, but it doesn’t prevent someone with the necessary permissions from permanently deleting an object version.</p><h4>3. Private connectivity</h4><p>Interface endpoints and gateway endpoints are easy to mix up if you only memorise their definitions.</p><p>The important distinction is that gateway endpoints are available for S3 and DynamoDB, while services such as KMS use interface endpoints.</p><p>I also spent time understanding network-related IAM condition keys:</p><ul><li>aws:SourceVpce</li><li>aws:SourceVpc</li><li>aws:VpcSourceIp</li><li>aws:SourceIp</li></ul><p>Knowing what each condition actually evaluates makes a big difference when you’re dealing with private connectivity and endpoint policies.</p><h4>4. Incident response</h4><p>This was an interesting area because I could relate a lot of it to my offensive security background.</p><p>For example, imagine an AWS access key has been exposed publicly.</p><ul><li>What do you do?</li><li>You need to disable the compromised key, investigate the activity, understand whether temporary credentials have already been issued, review CloudTrail logs, identify any changes made by the attacker and clean up the affected resources.</li></ul><p>Another scenario involves a compromised EC2 instance.</p><ul><li>You need to isolate it, preserve evidence and understand how Auto Scaling might affect your investigation. Simply terminating the instance could mean losing important evidence.</li></ul><p>Also, remember that GuardDuty is a detection service. It identifies suspicious activity and generates findings, but it doesn’t automatically block an attacker.</p><h4>5. Logging and detection</h4><p>I spent quite a bit of time understanding how different AWS logging services work together.</p><p>Some areas worth looking into:</p><ul><li>CloudTrail multi-Region trails and organization trails.</li><li>CloudTrail log file integrity validation.</li><li>CloudWatch Logs and the CloudWatch agent.</li><li>Log retention policies.</li><li>EventBridge rules and automated responses.</li><li>AWS Cost Anomaly Detection.</li></ul><p>One thing I found particularly interesting was the relationship between logging and incident response.</p><p>For example, if an EC2 instance is compromised and eventually terminated, you don’t want all the useful logs to disappear with it. Shipping logs to CloudWatch Logs helps preserve that information independently of the instance.</p><h4>6. Prevent, detect and remediate</h4><p>If there is one broader concept I’d recommend understanding, it’s the difference between prevention, detection and remediation, because they’re not interchangeable.</p><p>For example:</p><ul><li><strong>SCPs:</strong> Restrict what accounts and principals can do within an AWS Organization.</li><li><strong>AWS Config:</strong> Evaluates resource configurations and identifies non-compliant resources.</li><li><strong>GuardDuty:</strong> Detects suspicious activity and potential threats.</li><li><strong>EventBridge:</strong> Can respond to events and trigger automated workflows.</li><li><strong>Systems Manager:</strong> Can be used to perform automated remediation tasks.</li></ul><p>Understanding how these services work together is much more useful than memorising a definition for each one.</p><h3>How I approached the questions differently</h3><p>During my second preparation, I started paying much closer attention to the wording of each scenario.</p><p>Sometimes a single phrase completely changes which answer makes sense.</p><p>For example:</p><h4><strong>“Least operational overhead”</strong></h4><ul><li>I’d immediately look at managed AWS features rather than solutions that require building and maintaining custom Lambda functions.</li></ul><h4><strong>“Even the root user or administrators must not be able to delete the data”</strong></h4><ul><li>This should make you think about compliance mode and controls that cannot simply be bypassed by an administrator.</li></ul><h4><strong>“Detect the issue as early as possible”</strong></h4><ul><li>I’d look for continuous or automated detection rather than something that requires someone to manually review a dashboard.</li></ul><h4><strong>“Prevent, detect or remediate”</strong></h4><ul><li>These words are important. They tell you what the solution is actually expected to accomplish.</li></ul><p>I also became more careful about eliminating answers.</p><p>Sometimes an option sounds technically correct until you look at what the service actually supports. A service might detect an issue but not prevent it. Another might require a manual action when the question specifically asks for automation.</p><p>For questions asking you to choose two answers, I found it useful to break the requirement into two separate parts and match each one to the appropriate solution.</p><h3>My offensive security background actually helped</h3><p>One thing I didn’t expect was how useful my offensive security experience would be while studying for this certification.</p><p>When I read a scenario, I naturally started thinking about how an attacker could exploit it.</p><p>What happens if someone gets hold of an access key? What if they disable CloudTrail? What if an IAM policy is too permissive? What if an S3 bucket is exposed or a KMS key policy allows more access than intended?</p><p>Instead of looking at the scenario only from the defender’s perspective, I tried to understand the attack path first.</p><p>It’s similar to how I approach Active Directory assessments with BloodHound. You identify the possible attack paths, understand what makes them possible, and then work out which controls would break those paths.</p><p>Interestingly, studying AWS security also made me more aware of how much visibility defenders can have into cloud environments.</p><p>That’s something I found particularly interesting coming from the penetration testing side.</p><h3>If you’ve failed your first attempt</h3><p>I know how frustrating it can be.</p><p>You spend months studying, sacrifice evenings and weekends, and walk out of the exam knowing that you didn’t get the result you wanted.</p><p>That’s exactly what happened to me in July.</p><p>But looking back, failing wasn’t the end of the process. It showed me that the way I was preparing wasn’t enough.</p><p>If you’re in the same situation, my advice would be:</p><blockquote><strong>Don’t rush into another attempt without understanding what went wrong.</strong></blockquote><p>Go through your score report and identify the areas where you need improvement. Use it as a starting point rather than simply going back to the same course and watching everything again.</p><p>More importantly, change how you approach practice questions. Don’t just look for the correct answer. Understand why it works and why the alternatives don’t.</p><p>And don’t let one failed attempt convince you that you’re not capable of passing.</p><p>It took me a second attempt, but I got there.</p><h3>What’s next?</h3><p>Now that I’ve completed the Security Specialty, I want to get back to some of the things I had to put on hold while preparing for the exam.</p><p>First, I want to get back into Hack The Box and start solving machines again. It’s easy to get caught up in studying for certifications, but I don’t want to lose touch with the practical side of penetration testing. I want to keep challenging myself, working through different attack paths and keeping my skills sharp.</p><p>I also have a few personal projects that I want to pick up again, along with some freelance work and business-related plans that I’ve been putting aside for a while.</p><p>Of course, I don’t want to leave AWS behind either. Passing the certification gave me a much better understanding of cloud security, and I’d like to keep building on that knowledge through hands-on practice and practical projects along the way.</p><p>For now, I’m looking forward to getting back into building, breaking things, learning and exploring areas of security beyond exam preparation.</p><p>I’ll continue sharing my experiences and things I learn here, whether it’s offensive security, cloud security, Active Directory or SOC architecture.</p><p>If you’re preparing for SCS-C03 or have recently failed your first attempt, feel free to reach out. I’m happy to share what worked for me.</p><p><strong>On to the next challenge!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e81e1751cee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Complete AI-Powered SOC: From Detection to Automated Response with Wazuh, n8n, Claude AI, and MCP]]></title>
            <link>https://medium.com/@basharraed/a-complete-ai-powered-soc-from-detection-to-automated-response-with-wazuh-n8n-claude-ai-and-mcp-78e7fa80d986?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/78e7fa80d986</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Fri, 13 Mar 2026 17:30:04 GMT</pubDate>
            <atom:updated>2026-03-13T17:30:04.199Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong><em>Designing a Human-in-the-Loop Security Operations Center with Automated Threat Analysis and Response</em></strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tV7oR8LkAqIhkab6WVbf1Q.jpeg" /></figure><p>I work as an IT technician at a school. My job is simple on paper: keep the network running and make sure the machines stay clean.</p><p>In reality, students are endlessly creative. USB drives with malware show up in computer labs, someone inevitably tries to escalate privileges on a lab machine, and occasionally a curious student starts exploring parts of the network they shouldn’t be touching.</p><p>Incidents like these happen more often than you might expect, and traditional monitoring tools don’t make them easier to handle. I wanted a system that could not only detect threats, but also <strong>analyze them, explain them clearly, and help me respond quickly.</strong></p><p>That is how this project started.</p><p>I built a SOC automation platform using Anthropic’s MCP (Model Context Protocol) that connects Claude directly to my SIEM database and gives it the ability to isolate compromised Windows machines over SSH. Instead of logging into dashboards and running manual commands, I can type a single sentence and Claude does the rest which includes query the alerts, analyse what happened, and cut the machine off the network if needed.</p><p>The whole thing runs on Kali Linux in Docker and connects to Claude Desktop on Windows.</p><blockquote><strong><em>Important Note:</em></strong></blockquote><p>The core project was already complete and working when Anthropic released a new feature called Claude Code Remote Control, a tool that lets you access an active Claude Code session from any device through a browser or the Claude mobile app.</p><blockquote>For more info: <a href="https://code.claude.com/docs/en/remote-control">https://code.claude.com/docs/en/remote-control</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SISfhk8Q_JNgDOvMUM4YRA.png" /></figure><p>I added this on top of the finished project because the timing was perfect. Instead of being tied to my desk at work to query alerts or isolate a machine, I can now open a browser at home, connect to the session running at the office, and have full access to both MCP servers remotely. No VPN, no port forwarding, no extra infrastructure, just claude.ai/code and the session is right there.</p><p>It was not part of the original plan but it turned out to be the most powerful addition to the whole setup.</p><p>This guide documents exactly how I built it, every step, every file, every error I hit along the way, and how I fixed each one.</p><h3>The Problem With Traditional SIEMs</h3><p>Traditional SIEMs generate thousands of alerts per day. The signal-to-noise ratio is brutal. Security teams spend 60–70% of their time triaging low-fidelity alerts instead of responding to real incidents. The tools exist to detect threats , but the missing piece is intelligent triage and automated, human-controlled response.</p><p>My goals were simple:</p><p>• Detect real threats across all machines including viruses, privilege escalation, lateral movement, suspicious processes</p><p>• Use AI to analyze and explain each alert in plain English</p><p>• Keep a human in the loop before anything happens</p><p>• Automatically isolate machines when the threat is confirmed as critical</p><h3>The Architecture at a Glance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iQ1WSBc6KFl6GVqntuenfg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2C42-19KIK9R5vgijOf7pg.gif" /></figure><p>The pipeline has six phases:</p><p>• <strong>Phase 1</strong>: Wazuh agents monitor endpoints and send alerts to the Wazuh Manager</p><p>• <strong>Phase 2</strong>: Wazuh fires a webhook into n8n, triggering an automation workflow</p><p>• <strong>Phase 3</strong>: Claude AI analyzes the alert and emails a security report to the analyst</p><p>• <strong>Phase 4:</strong> The analyst approves or rejects; approved alerts are saved to MariaDB</p><p>•<strong> Phase 5:</strong> Claude queries MariaDB via MCP, and if critical, isolates the host via a second MCP server</p><p>• <strong>Phase 6:</strong> Remote Access with Claude Code Remote Control</p><blockquote>Each phase has its own infrastructure and configuration.</blockquote><blockquote>Instead of including every implementation detail here, each component has its own deep-dive guide.</blockquote><h4>Phase 1: Wazuh (The Detection Engine)</h4><p>Wazuh is an open-source SIEM and XDR platform. You deploy lightweight agents onto every machine you want to monitor Windows, Linux, macOS and they report back to a central Wazuh Manager.</p><p><strong>What Wazuh Detects Out of the Box</strong></p><p>• Privilege escalation (sudo abuse, SUID exploits, token manipulation)</p><p>• Malware and virus activity via VirusTotal and YARA rule integration</p><p>• File integrity monitoring — any change to sensitive files or directories</p><p>• Brute force and authentication anomalies</p><p>• Lateral movement patterns (PsExec, WMI, scheduled task abuse)</p><p>• MITRE ATT&amp;CK technique tagging on every alert</p><p>📖 <strong>Detailed Guide:</strong></p><p><a href="https://medium.com/@basharraed/phase-1-wazuh-the-detection-engine-08a7e8d8c6de">Phase 1: Wazuh (The Detection Engine)</a></p><h4>Phase 2: n8n (The Workflow Orchestrator)</h4><p>n8n is an open-source workflow automation tool (think Zapier, but self-hosted and developer-friendly). It’s the connective tissue of the entire pipeline.</p><p>I configured Wazuh to send alerts to an n8n webhook using its built-in integration framework.</p><p>📖 <strong>Detailed Guide:</strong></p><p><a href="https://medium.com/@basharraed/phase-2-n8n-the-workflow-orchestrator-e730afc77573">Phase 2: n8n (The Workflow Orchestrator)</a></p><h4>Phase 3: Human Approval (The Immovable Gate)</h4><p>The analyst receives an email with Claude’s full analysis, including the original alert details, AI interpretation, and recommended actions. They have two options:</p><p>• Approve: the workflow resumes, saves the alert to MariaDB, and marks it for potential action</p><p>• Reject: the alert is discarded, and a brief note can optionally be added for audit purposes</p><p>No automated action ever happens before this step. I deliberately made the approval gate impossible to bypass in the workflow design. The Wait node will sit there forever until a human responds.</p><p>📖 <strong>Detailed Guide:</strong></p><p><a href="https://medium.com/@basharraed/phase-3-human-approval-the-immovable-gate-03a1ed685ce4">Phase 3: Human Approval (The Immovable Gate)</a></p><h4>Phase 4: MariaDB (Approved Alert Storage)</h4><p>Once approved, the alert and its full AI analysis are written to a MariaDB database. The schema includes key fields such as:</p><ul><li><strong>id: </strong>the unique identifier of the approved alert</li><li><strong>summary:</strong> a plain-English explanation generated by the AI analysis</li><li><strong>timestamp:</strong> the time the alert was approved and stored in the database</li></ul><p>This database becomes your institutional memory of security incidents every event that a human reviewed and confirmed as real, enriched with AI analysis. Over time, it becomes invaluable for trend analysis, compliance reporting, and incident post-mortems.</p><p>📖 <strong>Detailed Guide:</strong></p><p><a href="https://medium.com/@basharraed/phase-4-mariadb-approved-alert-storage-29b56e047edc">Phase 4: MariaDB (Approved Alert Storage)</a></p><h4>Phase 5: Claude + MCP (Intelligent Response)</h4><p>This is the most sophisticated part of the system. I built two custom MCP (Model Context Protocol) servers as lightweight containers using <strong>Docker</strong> that allow Claude to take actions in the real world, not just analyze text.</p><p><strong>MCP Server 1: MariaDB Reader</strong></p><p>This MCP server exposes the approved_alerts table to Claude. When an analyst opens a Claude conversation and asks ‘What are the high-severity alerts from the past 24 hours?’, Claude can query the database directly and respond with structured findings.</p><p>Example Claude interaction:</p><blockquote><em>User: Show me all critical alerts from the past 12 hours</em></blockquote><blockquote><em>Claude: I found 3 critical alerts. The most concerning is from HOST-FINANCE-01,</em></blockquote><blockquote><em>flagged at 14:23 UTC. Rule 100210 detected a privilege escalation attempt</em></blockquote><blockquote><em>matching MITRE T1548.002 (Abuse Elevation Control Mechanism). The process</em></blockquote><blockquote><em>‘python3’ spawned a shell with SUID bit on /usr/bin/python3. This pattern</em></blockquote><blockquote><em>is consistent with post-exploitation activity. Isolation is recommended.</em></blockquote><p><strong>MCP Server 2: Network Isolation</strong></p><p>This MCP server exposes a single, powerful tool: isolate_host(hostname). When Claude determines a host poses a critical, active threat, it can trigger this tool to:</p><p>• Disconnect the host from internet acces</p><p>In this implementation, its effectively preventing:</p><ul><li>Command-and-control communication</li><li>Data exfiltration</li><li>Further lateral movement outside the monitored environment</li></ul><p>📖 <strong>Detailed Guide:</strong></p><p><a href="https://medium.com/@basharraed/phase-5-claude-mcp-intelligent-response-60cd4c265b24">Phase 5: Claude + MCP (Intelligent Response)</a></p><h4>Phase 6: Remote Access with Claude Code Remote Control</h4><p><strong>Why I Added This After the Project Was Finished</strong></p><p>When I finished the project the setup was already working exactly as intended. Both MCP servers were running on Kali in Docker, Claude Desktop on Windows was connected, and I could query SIEM alerts and isolate hosts through natural language. The core goal was complete.</p><p>Then Anthropic released a new feature called Claude Code Remote Control.</p><p>I came across it while browsing Anthropic’s documentation. The idea was simple, install Claude Code on your machine, start a remote control session, and you can access that exact session from any browser or mobile device anywhere in the world. No VPN. No port forwarding. No extra infrastructure.</p><p>The moment I read that I knew I had to add it to this project. The MCP servers were already running at the office. The only missing piece was being able to reach them from home. Remote Control solved that in a way I had not anticipated when I started building.</p><p>Before this addition, if something happened on the school network at night or over the weekend, I had two options, drive in or do nothing. With Remote Control I can now open claude.ai/code from my couch, connect to the session running at the office, and have full access to both MCP servers. Query the alerts, check what happened, isolate the machine if needed, all from home, all through a browser.</p><p>It was not part of the original plan. But it turned out to be the most impactful addition to the whole setup.</p><p>📖 <strong>Detailed Guide:</strong></p><p><a href="https://medium.com/@basharraed/phase-6-what-is-claude-code-and-how-is-it-different-from-claude-desktop-39967f272dc0">Phase 6: What Is Claude Code and How Is It Different from Claude Desktop</a></p><h3>Live Demo: AI-Assisted Incident Response</h3><p>To demonstrate the full pipeline in action, I recorded a short walkthrough showing how an alert flows through the system:</p><ol><li><strong>Wazuh detects a suspicious event</strong></li><li>The alert is sent to <strong>n8n</strong> via webhook</li><li><strong>Claude AI</strong> analyzes the alert and generates a security report</li><li>The analyst receives the email and approves the incident</li><li>The alert is stored in <strong>MariaDB</strong></li><li>Claude queries the database through the <strong>Model Context Protocol</strong></li><li>The system isolates the compromised host</li></ol><p>The video below shows the entire workflow end-to-end.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FU1bfkD2HpCQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DU1bfkD2HpCQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FU1bfkD2HpCQ%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/21d05e048d9b746cde93e1755c6efab1/href">https://medium.com/media/21d05e048d9b746cde93e1755c6efab1/href</a></iframe><h3>Live Demo: AI-Assisted Incident Response Remotely</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FN9-DNqnwRc0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DN9-DNqnwRc0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FN9-DNqnwRc0%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b428bb362b3ae8fb0174c1bd2845e770/href">https://medium.com/media/b428bb362b3ae8fb0174c1bd2845e770/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78e7fa80d986" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 6: What Is Claude Code and How Is It Different from Claude Desktop]]></title>
            <link>https://medium.com/@basharraed/phase-6-what-is-claude-code-and-how-is-it-different-from-claude-desktop-39967f272dc0?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/39967f272dc0</guid>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 17:17:58 GMT</pubDate>
            <atom:updated>2026-03-12T17:17:58.262Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Is Claude Code and How Is It Different from Claude Desktop</h3><p>Before getting into the setup it is important to understand the difference between the two tools because they are easy to confuse.</p><p><strong>Claude Desktop</strong> is the application you install on Windows. It has a chat interface, supports MCP servers through a config file, and is designed for everyday conversations with Claude.</p><p>It has no remote access feature, it is tied to the machine it is installed on.</p><p><strong>Claude Code</strong> is a terminal tool. You install it with npm and run it from the command line. It is designed for agentic coding tasks but it also supports MCP servers and most importantly, it has a Remote Control feature that lets you access an active session from any device through a browser or the Claude mobile app.</p><p>The key difference for this project is that Claude Code can be accessed remotely and Claude Desktop cannot. So to enable remote access we install Claude Code on the work machine alongside the existing setup, connect the same MCP servers to it, and start a remote control session. Claude Desktop stays installed and working exactly as before, Claude Code is just added on top for remote access.</p><h3>Installing Claude Code</h3><p>Installing Claude Code on the machine that has a connection with your MCP Servers which is my work Machine.</p><h4>Step 1: Install Node.js on the Work Windows Machine</h4><p>Claude Code requires Node.js. If it is not already installed go to <strong>nodejs.org</strong> and download the LTS version (We already explained how in Phase 5). Install with default settings and make sure Add to PATH is checked. Verify in PowerShell:</p><p>powershell</p><pre>node --version<br>npm --version</pre><h4>Step 2: Install Claude Code</h4><p>powershell</p><pre>npm install -g @anthropic-ai/claude-code</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g-W4fL1AmhzYAY21raUrNA.png" /></figure><p>Verify it installed:</p><p>powershell</p><pre>claude --version</pre><h4>Step 3: Installing Git for Windows And Why Claude Code Needs It</h4><p>During the setup you will hit this error when trying to run Claude Code commands:</p><pre>Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). <br>If installed but not in PATH, set environment variable pointing to your bash.exe, <br>similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe</pre><p><strong>This confused me at first. Why does a tool for talking to Claude need Git?</strong></p><p>The reason is that Claude Code is built to run on Unix-style systems, Linux and macOS. On those systems it uses bash as its shell to execute commands, run scripts, and interact with the filesystem. Windows does not have bash natively, so Claude Code cannot function without it.</p><p>Git for Windows solves this by bundling <strong>Git Bash,</strong> a bash shell for Windows as part of the Git installation. Claude Code uses Git Bash as its shell on Windows, not PowerShell or CMD. Without it Claude Code cannot run properly.</p><p>So even if you never use Git for version control in this project, you still need to install it because it brings Git Bash along with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2EfFnrw_gw266k4emYVmSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-imhiuoZnlWkaQWh2_O9g.png" /></figure><h4>Step 4: Add the MCP Servers to Claude Code</h4><p>Claude Code supports SSE transport natively so we do not need mcp-remote here. Add both servers directly:</p><p>powershell</p><pre>claude mcp add siem-query --transport sse http://10.0.0.5:8001/sse</pre><p>powershell</p><pre>claude mcp add isolation --transport sse http://10.0.0.5:8002/sse</pre><p>Verify they were added:</p><p>powershell</p><pre>claude mcp list</pre><p>You should see both servers listed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xC9WkWzgXzjptX_4ggROpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puBh4adidTVjc4hQC1lBKA.png" /></figure><h4>Step 5: Sign In</h4><p>powershell</p><pre>claude</pre><p>This opens the Claude Code interface. Type /login and it will open a browser window asking you to sign in with your claude.ai account. Sign in and authorize it. Once done type /exit to close the session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Irv716OHWNIDj59DllBPyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fqh3LcWCHDRhh0mjC_CQoQ.png" /></figure><h4>Step 6: Accept Workspace Trust</h4><p>Claude Code requires you to explicitly trust the workspace directory before it will run properly. This is a one time step. Since we exited, we need to run claude again:</p><pre>claude</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IdJgdPHCjpYWyOvZnOxNyQ.png" /></figure><h4>Step 7: Start the Remote Control Session</h4><p>Open Claude Code and start the remote control session:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85UxjK0NMDyWMG44lAoAYg.png" /></figure><h4>Step 8: Connect from Home</h4><p>On your home device open any browser and paste your Session URL, however,, you need Sign in with the same claude.ai account you used on the work machine ofcourse for it to work.</p><p>You will see your active session listed with a green dot next to it. Click it and you are connected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rQQ_9ui4woRJm-L2EDL4Iw.png" /></figure><h4>Step 9: Live Test from Home</h4><p>This is the moment everything comes together. Two machines, two locations, one conversation.</p><p><strong>What is happening on the work machine:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ef05qbT4Ig0Z1bXS13HwsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZTnbZoLqX49MDJToVHM_tA.png" /></figure><p>The work machine is sitting at the office with Claude Code running in the terminal. The remote control session is active and the two MCP servers are running in Docker on Kali. Nobody is touching anything. The terminal just shows:</p><pre>/remote-control is active. Code in CLI or at<br>https://claude.ai/code/session_123456789</pre><p>The work machine is waiting silently in the background.</p><p><strong>What is happening on the home machine:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2T-PAQUIxRNboNNju4c4qA.png" /></figure><p>At home I open a browser, go to claude.ai/code, sign in, and find the active session. I type:</p><pre>Retrieve all SIEM alerts from the database</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TkQVN0H7gy80W0652RPaag.png" /></figure><p>That message travels from my home browser over HTTPS to Anthropic’s servers, gets routed to the Claude Code session running at the office, and Claude wakes up on the work machine.</p><p><strong>Back at the work machine:</strong></p><p>The terminal starts showing activity. Claude Code is now running — you can see it executing commands, connecting to the MCP server, making the database call:</p><pre>● Bash(python.exe ...)<br>  ⎿  Session ID: 1234567890<br>     Init response: Accepted<br>     Tool call response: Accepted</pre><p>Claude connected to the SIEM MCP server on Kali at port 8001, which connected to MariaDB and pulled the alerts from the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wohN8IXN3iWqoB6HCEU4dA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NRbCMdIvJHiAXh6tB5ESQw.png" /></figure><p><strong>Back at home:</strong></p><p>The results appear in my browser. A real alert from the live database:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nx7wczDc-77MZ1vEUIsLxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jM3TKI31y8_ph5yDWulqtA.png" /></figure><h3>Live Demo: AI-Assisted Incident Response Remotely</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FN9-DNqnwRc0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DN9-DNqnwRc0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FN9-DNqnwRc0%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b428bb362b3ae8fb0174c1bd2845e770/href">https://medium.com/media/b428bb362b3ae8fb0174c1bd2845e770/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39967f272dc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 5: Claude + MCP (Intelligent Response)]]></title>
            <link>https://medium.com/@basharraed/phase-5-claude-mcp-intelligent-response-60cd4c265b24?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/60cd4c265b24</guid>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 17:16:17 GMT</pubDate>
            <atom:updated>2026-03-12T17:16:17.193Z</atom:updated>
            <content:encoded><![CDATA[<h3>Key Concepts You Should Know</h3><p><strong>At this stage of the project, the system can already:</strong></p><ul><li>Detect suspicious activity using <strong>Wazuh</strong></li><li>Process alerts using <strong>n8n</strong></li><li>Analyze them with <strong>Claude</strong></li><li>Require <strong>human approval</strong></li><li>Store approved alerts in <strong>MariaDB</strong></li></ul><p>However, I wanted to take the system one step further.</p><p>My goal was to allow an <strong>AI model to interact directly with system tools</strong> so it could:</p><ul><li>check recent SIEM alerts</li><li>query the alert database</li><li>assist with response actions</li><li>isolate compromised machines from the network if necessary</li></ul><p>To achieve this, I used <strong>MCP (Model Context Protocol)</strong>.</p><p>This blog post walks through exactly how I built it: two custom MCP (Model Context Protocol) servers running in Docker on Kali Linux, connected to Claude Desktop on a Windows machine across different subnets. It was not easy. There were corrupted files, 421 errors, subnet routing issues, Docker networking problems, and SSH timeouts. But it works, and this is the full story of how.</p><h4>What is MCP?</h4><p><strong>MCP (Model Context Protocol)</strong> is a framework that allows AI models to interact with external tools and services.</p><p>Instead of the AI only generating text responses, MCP allows it to <strong>use tools and perform actions</strong>.</p><p>For example, an AI model could:</p><ul><li>query a database</li><li>retrieve system logs</li><li>run a function</li><li>interact with security tools</li></ul><p>In simple terms:</p><blockquote><strong><em>MCP allows AI models to interact with real system functionality.</em></strong></blockquote><h4>Why MCP is Useful for a SIEM</h4><p>In a traditional setup, a SIEM system simply <strong>detects and logs alerts</strong>.</p><p>But with MCP, the AI model can actually <strong>interact with the security environment</strong>.</p><p>For example, the AI could:</p><ul><li>check the <strong>MariaDB alerts database</strong></li><li>identify <strong>recent approved alerts</strong></li><li>determine if a host shows repeated suspicious activity</li><li>assist with <strong>incident response actions</strong></li></ul><p>This transforms the system from a <strong>passive alerting system</strong> into an <strong>AI-assisted security platform</strong>.</p><h4>The Goal of My MCP Integration</h4><p>The idea behind using MCP in this project was simple.</p><p>I wanted an AI model that could:</p><ol><li><strong>Query the SIEM alerts stored in MariaDB</strong></li><li><strong>Analyze recent incidents</strong></li><li><strong>Help respond to threats</strong></li></ol><p>For example, if multiple suspicious alerts originate from a host, the AI could assist in initiating an action such as:</p><ul><li><strong>isolating the host from the network</strong></li></ul><p>This makes the AI not just an analyst, but also a <strong>security assistant capable of interacting with defensive tools</strong>.</p><h4>Why Claude Was Used</h4><p>In this project, I used <strong>Claude Desktop</strong> as the client to interact with my MCP servers. Claude acts as the interface that sends prompts and tool requests to the MCP tools running on the system.</p><p>Claude acts as the <strong>interface that communicates with MCP tools</strong>, allowing me to:</p><ul><li>send prompts</li><li>query alerts</li><li>trigger tool-based actions</li></ul><p>However, Claude is <strong>not the only client that can be used with MCP</strong>.</p><p>Examples of MCP clients include:</p><p><strong>Claude Desktop</strong></p><p>The AI client used in this project. It provides a user interface where prompts can be sent to the AI model, which can then call MCP tools to perform actions such as retrieving SIEM alerts or executing response functions.</p><p><strong>LM Studio</strong></p><p>LM Studio is a local AI application that allows users to run large language models on their own machines. With MCP support or integration, it can act as a client that sends tool requests to MCP servers.</p><p>For example, a locally running model could query a SIEM database or trigger automated security responses through MCP tools.</p><p><strong>Cursor</strong></p><p>Cursor is an AI-powered development environment based on Visual Studio Code. Because it supports AI integrations and tool execution, it can potentially function as an MCP client that interacts with external MCP servers.</p><p>This would allow developers or security engineers to control infrastructure or query systems directly from their development environment.</p><p><strong>Custom Applications</strong></p><p>Organizations can also build their own MCP clients, such as:</p><ul><li>SOC dashboards</li><li>internal security platforms</li><li>web-based AI assistants</li></ul><p>These applications can communicate with MCP servers to perform tasks such as retrieving alerts, querying logs, or triggering automated responses.</p><h4>Why This Matters</h4><p>With MCP, the AI model is no longer limited to answering questions.</p><p>It can <strong>interact with real infrastructure</strong>, such as:</p><ul><li>SIEM databases</li><li>security tools</li><li>incident response functions</li></ul><p>This creates a system where AI can <strong>assist analysts in monitoring alerts and responding to threats in real time</strong>.</p><h3><em>A Complete Step-by-Step Guide to Dual MCP Servers with Claude</em></h3><h4>What You Will Build</h4><p>• SIEM Query MCP Server (port 8001): Python server that connects to MariaDB and query security alerts</p><p>• Isolation MCP Server (port 8002): Python server that SSHes into Windows machines and runs PowerShell to disable/enable network adapters</p><p>• Both servers run in Docker on Kali Linux, connected to Claude Desktop on Windows via SSE transport over HTTP</p><h4>Network Topology</h4><p>Kali Linux (SOC station) : 10.0.0.5</p><p>Windows Target Machine : 10.0.7.172</p><p>MariaDB : running on Kali (port 3306)</p><p>Bitvise SSH Server : running on Windows (port 22)</p><p>The two machines are on different subnets (10.0.0.x vs 10.0.7.x). Routing between them works — ping and SSH both succeed once configured correctly.</p><h3>Part 1: Installing All Required Software</h3><h4>Step 1: Install Docker &amp; Docker Compose on Kali Linux</h4><p><strong>Why We Did This</strong></p><p>Our two MCP servers are Python applications that need specific dependencies to run — libraries like mcp, uvicorn, starlette, pymysql, and paramiko. If we installed all of these directly on Kali, we&#39;d be cluttering the system, risking version conflicts, and making the setup hard to reproduce or move to another machine.</p><p>Docker solves this by packaging each server into its own isolated container. Think of a container as a lightweight, self-contained box that includes the Python environment, all the dependencies, and the server code — nothing leaks out, nothing conflicts with the host system.</p><p>Docker Compose is the tool that lets us manage both containers together with a single file (docker-compose.yml). Instead of running two separate docker run commands with a dozen flags each time, we just run docker-compose up and both the SIEM server and the isolation server start together, with all their environment variables, port mappings, and network settings applied automatically.</p><p>systemctl enable --now docker makes Docker start automatically on boot so our MCP servers come back up if Kali reboots.</p><p>usermod -aG docker $USER lets us run Docker commands without sudo every time.</p><p>newgrp docker applies the group change immediately without requiring you to log out and log back in.</p><p>When you run usermod -aG docker $USER, Linux adds your user to the docker group , but that change only takes effect in new login sessions. Without newgrp docker, you&#39;d run the next command and get a &quot;permission denied&quot; error because your current terminal session still doesn&#39;t know you&#39;re in the docker group yet.</p><ul><li>newgrp docker starts a new shell session with the updated group applied, so you can immediately run docker commands without sudo in the same terminal window you&#39;re already in.</li></ul><p>In short, Docker is what lets our MCP servers run reliably and cleanly on Kali without turning the system into a mess.</p><pre>sudo apt update &amp;&amp; sudo apt install -y docker.io docker-compose<br>sudo systemctl enable --now docker<br>sudo usermod -aG docker $USER<br>newgrp docker</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WosUKqTu8spVUGksv0ECYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZRhZ5pazbg_p5a1_UbdHPg.png" /></figure><p>Verify:</p><pre>docker - version<br>docker-compose - version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYMYxJJqN5esfcytUo6lKw.png" /></figure><h4><strong>Step 2 : Install Claude Desktop on Windows</strong></h4><p>Go to claude.ai/download on the Windows machine and download Claude Desktop. Install it normally. You will need a Claude account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l0dLsMFJb1-bH354Ayz7IQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bkpE9PsUEq6mY0v5ebbcMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RnF-XW9pZYd1QWH3bo3zzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*QdOzQ_es5LGYjtLzlICZ0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*X7dUKrY2cNGMjCU9IslnOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvAWaj31EgYSu3XTNbRHRg.png" /></figure><h4>Step 3: Install Node.js on Windows</h4><p>Node.js is required because Claude Desktop uses npx to run the mcp-remote bridge package.</p><p>Go to nodejs.org and download the LTS version. Install with default settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3yhKCQk3kNSwqJgOA5pvQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H84-QXsNA-usX1J8lMuXSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQfrGHZQqc4n7aUdRUjwvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bbY5C5aDTfdLQ8nJeytQdg.png" /></figure><p>Verify in PowerShell:</p><pre>node -version<br>npm -version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JvJ5CJEiqvRIEHZwb2bG4Q.png" /></figure><h4>Step 4: Install and Configure Bitvise SSH Server on Windows</h4><p>Download Bitvise SSH Server from bitvise.com/ssh-server. After installing:</p><p>1. Open Bitvise SSH Server Control Panel</p><p>2. Click “Open easy settings”</p><p>3. Under Authentication, ensure Password authentication is set to Allow</p><p>4. Under Windows accounts, confirm your Windows username (admin) is listed</p><p>5. Click Start Server if it is not already running</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*-7prvnc1RUnwfiY5Gx34dg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ePqTFbslimntEasdAQMcVQ.png" /></figure><p>6. Note the port: default is 22</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rejCR6iwessrFb9z0u7TaQ.png" /></figure><p>Verify from Kali:</p><pre>ssh admin@10.0.7.172</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tzYkd3w7RDoWPotOfgPu1w.png" /></figure><p>When you see the Windows command prompt, SSH is working. Type exit to disconnect.</p><p>For reference: check out this blog to understand how to install bitvise SSH in details:</p><p><a href="https://medium.com/@basharraed/winhub-controller-a63969bef5bb">WinHub-Controller</a></p><h3>Part 2: Project Structure</h3><pre>mkdir -p /home/it3/Desktop/SIEM/siem-server<br>mkdir -p /home/it3/Desktop/SIEM/isolation-server<br>cd /home/it3/Desktop/SIEM<br><br>Final layout:<br>SIEM/<br>├── docker-compose.yml<br>├── siem-server/<br>│   ├── Dockerfile<br>│   ├── requirements.txt<br>│   └── siem_server.py<br>└── isolation-server/<br>    ├── Dockerfile<br>    ├── requirements.txt<br>    ├── isolation_server.py<br>    └── ssh_relay.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*hIq2UyPoaX9ff-jFECKx-w.png" /></figure><h3>Part 3: How It Started (NetworkChuck’s MCP Prompt)</h3><p>Before writing a single line of code, I came across NetworkChuck’s MCP prompt on his GitHub. NetworkChuck is a well-known cybersecurity content creator who had published a ready-made prompt specifically designed to help Claude build MCP servers from scratch.</p><p>I took that prompt, fed it directly into Claude, and described what I wanted: a SOC automation system with two servers , one to query SIEM alerts from a database, and one to remotely isolate Windows machines over SSH. Claude used the prompt as a blueprint and generated the initial code for both servers.</p><p>From there, the real work began, deploying it on Kali Linux inside Docker, connecting Claude Desktop on Windows across different subnets, and fixing a long series of errors that the initial generated code could not anticipate. Every one of those fixes is documented in this guide</p><p>If you want to try it yourself, find NetworkChuck’s MCP prompt on his GitHub at <strong>github.com/networkchuck</strong> and use it the same way: paste it into Claude, describe your use case, and let Claude generate the server structure for you.</p><pre>https://github.com/theNetworkChuck/docker-mcp-tutorial</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67y-ffptEKK8PHMGXW3Xwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZIenmMCMl4lWHe4wufhAbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DelqXj7eExt_v5v22Zx8SQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*awx7xu4_Z4-qXfpFLVT3Sg.png" /></figure><p>I copied the prompt into a word file to start feeding AI a prompt describing:</p><ul><li>The SIEM database structure (approved_alerts table in MariaDB)</li><li>The actions I wanted for Windows endpoints (disable/enable network adapters)</li><li>The communication flow (Docker containers on Kali → Claude Desktop on Windows via SSE)</li></ul><h4>Using ChatGPT to Generate the Claude MCP Prompt</h4><p>One interesting part of this project was how I combined AI tools. I didn’t write the MCP prompt for Claude myself. Instead, I first asked <strong>ChatGPT</strong> to generate a detailed prompt for Claude, describing exactly what I wanted the servers to do:</p><ul><li>Query approved alerts from the SIEM database</li><li>Remotely isolate Windows endpoints over SSH</li><li>Expose MCP tools via HTTP for Claude Desktop</li></ul><p>I then copied this ChatGPT-generated prompt into Claude’s <strong>Network Check MCP workflow</strong>. Claude processed the prompt and generated the initial Python code for both MCP servers.</p><p>This workflow had several benefits:</p><ul><li>ChatGPT helped structure a precise, complete prompt for Claude</li><li>Claude then acted on the prompt to produce working server code</li><li>It created a <strong>two-step AI-assisted development process</strong>, where one AI helped another, making the SOC automation build much faster and less error-prone</li></ul><p>In other words, I let ChatGPT act as a <strong>prompt engineer for Claude</strong>, giving me a jump-start on building the SIEM and isolation MCP servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*XXvylZawb-nALTopbaJxOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MfA6UKYdMmyI8I93w3i4sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*WXVBITAGNYS8lfeYtGCwmA.png" /></figure><h4>Preparing the prompt to be used by Claude to Generate the MCP Servers</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nucMjWZf3MwY4Vltr9EwYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B4ll9TbZj1jIXNIw5T0BZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pDairveh5lTveiVGH7TnHA.png" /></figure><h4>Using Claude to Generate the MCP Servers</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UIUuDvG8DYI6Infu8Iz-iA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ko2Jaf4i4G2N_BRAMdqElg.png" /></figure><p>After Claude wrote the code, i had to mention to Claude that i want the MCP client to access MCP servers across the network not within the same machine hosting the MCP Servers. So it edited some part of the code all over again based on what i told it to do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*MEScsd46xkBztwv-xzCuvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TMza3CBIU4-jyTpaSdkDoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bFRQeG-0jnmFSv4UiSlb4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zecPVB0UnrWZyDiuDkE-JA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAJ0OTuP5h_rl36m5iRgRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yYrZP7wvEcFszwURHNM6Ng.png" /></figure><h4>Claude Generated the Project Files</h4><p>After feeding NetworkChuck’s MCP prompt into Claude and describing what I wanted to build, Claude generated the entire project structure for me, ready to deploy.</p><p>Every file was produced by Claude:</p><ul><li><strong>siem_server.py:</strong> the full SIEM query MCP server code</li><li><strong>Dockerfile</strong> (SIEM): container build instructions for the SIEM server</li><li><strong>requirements.txt</strong> (SIEM): Python dependencies for the SIEM server</li><li><strong>isolation_server.py:</strong> the full isolation MCP server code</li><li><strong>Dockerfile</strong> (Isolation): container build instructions for the isolation server</li><li><strong>requirements.txt</strong> (Isolation): Python dependencies for the isolation server</li><li><strong>docker-compose.yml</strong>: the orchestration file that runs both containers together</li><li><strong>README.txt: </strong>documentation explaining the project</li></ul><h3>Part 4: <strong>SIEM Query MCP Server</strong></h3><p>The SIEM Query server is the first of the two MCP servers. Its job is simple , connect to the MariaDB database on Kali, query the siem_alerts table, and expose the results to Claude as tools. When you type something like &quot;show me all alerts&quot; in Claude Desktop, this server is what receives that request and returns the data.</p><p>It runs inside Docker on port 8001 and communicates with Claude Desktop over SSE (Server-Sent Events).</p><h4>siem-server/Dockerfile</h4><p>The Dockerfile tells Docker how to build the container that runs siem_server.py. It answers the question: &quot;what environment does this Python file need to run?&quot;</p><p>It specifies the base image (Python 3.11), installs the dependencies, copies the code in, creates a non-root user for security, and defines the command that starts the server when the container launches.</p><p>You never run this file manually. Docker reads it automatically when you run docker-compose up --build. Think of it as a set of instructions Docker follows once to build a ready-to-run box for your server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFgvI-y1yPV50GBlRssQrg.png" /></figure><pre>FROM python:3.11-slim<br><br>WORKDIR /app<br><br>ENV PYTHONUNBUFFERED=1<br><br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br><br>COPY siem_server.py .<br><br>RUN useradd -m -u 1000 mcpuser &amp;&amp; \<br>    chown -R mcpuser:mcpuser /app<br><br>USER mcpuser<br><br># SSE listens on this port - must match SIEM_SSE_PORT env var<br>EXPOSE 8001<br><br>CMD [&quot;python&quot;, &quot;siem_server.py&quot;]</pre><h4>siem-server/requirements.txt</h4><p>This file lists every Python library the server needs. When Docker builds the container it runs pip install -r requirements.txt to install all of them inside the container.</p><p>It exists as a separate file (rather than hardcoding installs in the Dockerfile) because it is cleaner and easier to update. If you need to add a new library, you add one line here and rebuild. Docker also caches this layer separately if requirements haven’t changed, Docker skips the pip install step on the next build and goes straight to copying your code, which makes rebuilds much faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*USkMjYTW9USowVYhb_Zltw.png" /></figure><pre>mcp[cli]&gt;=1.2.0<br>PyMySQL&gt;=1.1.0<br>cryptography&gt;=41.0.0<br>uvicorn&gt;=0.30.0<br>starlette&gt;=0.40.0</pre><h4>siem-server/siem_server.py: Full Code</h4><p>This is the actual MCP server. It contains all the logic, how to connect to the database, what tools exist, what each tool does, and how to respond to Claude’s requests. This is the file you edit when you want to add a new tool, change a query, or modify what gets returned to Claude.</p><p>Without this file there is no server. Everything else exists to support it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_d16znbRBWwj0pxaLHLuNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sd3PdyjGtnBZN6ubEP0bJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nBPnFAIW0zYucSV-KzZ_7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PoieTMcuNTh2gt8_WvnyQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*78W4k19wuR18iy6NELYkQQ.png" /></figure><pre>#!/usr/bin/env python3<br>&quot;&quot;&quot;<br>SIEM Query MCP Server - Raw SSE implementation<br>&quot;&quot;&quot;<br>import os<br>import sys<br>import logging<br>import pymysql<br>import pymysql.cursors<br>import uvicorn<br>from starlette.applications import Starlette<br>from starlette.requests import Request<br>from starlette.responses import Response, JSONResponse<br>from starlette.routing import Route<br>from mcp.server import Server<br>from mcp.server.sse import SseServerTransport<br>from mcp import types<br><br>logging.basicConfig(<br>    level=logging.INFO,<br>    format=&#39;%(asctime)s - %(name)s - %(levelname)s - %(message)s&#39;,<br>    stream=sys.stderr<br>)<br>logger = logging.getLogger(&quot;siem-server&quot;)<br><br>SSE_PORT = int(os.environ.get(&quot;SIEM_SSE_PORT&quot;, &quot;8001&quot;))<br>DB_HOST  = os.environ.get(&quot;SIEM_DB_HOST&quot;, &quot;127.0.0.1&quot;)<br>DB_PORT  = int(os.environ.get(&quot;SIEM_DB_PORT&quot;, &quot;3306&quot;))<br>DB_USER  = os.environ.get(&quot;SIEM_DB_USER&quot;, &quot;&quot;)<br>DB_PASS  = os.environ.get(&quot;SIEM_DB_PASS&quot;, &quot;&quot;)<br>DB_NAME  = os.environ.get(&quot;SIEM_DB_NAME&quot;, &quot;siem_alerts&quot;)<br><br><br>def get_connection():<br>    return pymysql.connect(<br>        host=DB_HOST, port=DB_PORT, user=DB_USER,<br>        password=DB_PASS, database=DB_NAME,<br>        cursorclass=pymysql.cursors.DictCursor, connect_timeout=10<br>    )<br><br><br>server = Server(&quot;siem-query&quot;)<br><br><br>@server.list_tools()<br>async def list_tools():<br>    return [<br>        types.Tool(name=&quot;get_all_alerts&quot;,     description=&quot;Get all SIEM alerts&quot;,           inputSchema={&quot;type&quot;:&quot;object&quot;,&quot;properties&quot;:{&quot;limit&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;default&quot;:&quot;50&quot;}}}),<br>        types.Tool(name=&quot;get_alert_by_id&quot;,    description=&quot;Get a SIEM alert by ID&quot;,        inputSchema={&quot;type&quot;:&quot;object&quot;,&quot;properties&quot;:{&quot;alert_id&quot;:{&quot;type&quot;:&quot;string&quot;}},&quot;required&quot;:[&quot;alert_id&quot;]}),<br>        types.Tool(name=&quot;search_alerts&quot;,      description=&quot;Search SIEM alerts by keyword&quot;, inputSchema={&quot;type&quot;:&quot;object&quot;,&quot;properties&quot;:{&quot;keyword&quot;:{&quot;type&quot;:&quot;string&quot;}},&quot;required&quot;:[&quot;keyword&quot;]}),<br>        types.Tool(name=&quot;get_alert_count&quot;,    description=&quot;Get total SIEM alert count&quot;,    inputSchema={&quot;type&quot;:&quot;object&quot;,&quot;properties&quot;:{}}),<br>        types.Tool(name=&quot;test_db_connection&quot;, description=&quot;Test MariaDB connection&quot;,       inputSchema={&quot;type&quot;:&quot;object&quot;,&quot;properties&quot;:{}}),<br>    ]<br><br><br>@server.call_tool()<br>async def call_tool(name: str, arguments: dict):<br>    try:<br>        if name == &quot;get_all_alerts&quot;:<br>            limit = int(arguments.get(&quot;limit&quot;, &quot;50&quot;) or &quot;50&quot;)<br>            conn = get_connection()<br>            with conn:<br>                with conn.cursor() as c:<br>                    c.execute(&quot;SELECT id, summary FROM approved_alerts ORDER BY id DESC LIMIT %s&quot;, (limit,))<br>                    rows = c.fetchall()<br>            if not rows:<br>                text = &quot;📊 No alerts found.&quot;<br>            else:<br>                text = f&quot;📊 SIEM Alerts ({len(rows)} records):\n&quot; + &quot;=&quot;*60 + &quot;\n&quot;<br>                for r in rows:<br>                    text += f&quot;🔍 ID: {r[&#39;id&#39;]}\n   Summary: {r[&#39;summary&#39;]}\n&quot; + &quot;-&quot;*40 + &quot;\n&quot;<br><br>        elif name == &quot;get_alert_by_id&quot;:<br>            aid = int(arguments.get(&quot;alert_id&quot;, &quot;0&quot;))<br>            conn = get_connection()<br>            with conn:<br>                with conn.cursor() as c:<br>                    c.execute(&quot;SELECT id, summary FROM approved_alerts WHERE id=%s&quot;, (aid,))<br>                    row = c.fetchone()<br>            text = f&quot;🔍 ID: {row[&#39;id&#39;]}\n   Summary: {row[&#39;summary&#39;]}&quot; if row else f&quot;⚠️ No alert with ID {aid}&quot;<br><br>        elif name == &quot;search_alerts&quot;:<br>            kw = arguments.get(&quot;keyword&quot;, &quot;&quot;)<br>            conn = get_connection()<br>            with conn:<br>                with conn.cursor() as c:<br>                    c.execute(&quot;SELECT id, summary FROM approved_alerts WHERE summary LIKE %s ORDER BY id DESC LIMIT 100&quot;, (f&quot;%{kw}%&quot;,))<br>                    rows = c.fetchall()<br>            text = f&quot;🔍 {len(rows)} matches for &#39;{kw}&#39;:\n&quot; + &quot;\n&quot;.join(f&quot;ID:{r[&#39;id&#39;]} | {r[&#39;summary&#39;]}&quot; for r in rows) if rows else f&quot;No results for &#39;{kw}&#39;&quot;<br><br>        elif name == &quot;get_alert_count&quot;:<br>            conn = get_connection()<br>            with conn:<br>                with conn.cursor() as c:<br>                    c.execute(&quot;SELECT COUNT(*) as total FROM approved_alerts&quot;)<br>                    row = c.fetchone()<br>            text = f&quot;📊 Total alerts: {row[&#39;total&#39;]}&quot;<br><br>        elif name == &quot;test_db_connection&quot;:<br>            conn = get_connection()<br>            with conn:<br>                with conn.cursor() as c:<br>                    c.execute(&quot;SELECT VERSION() as v&quot;)<br>                    row = c.fetchone()<br>            text = f&quot;✅ Connected to {DB_HOST}:{DB_PORT}/{DB_NAME} — MariaDB {row[&#39;v&#39;]}&quot;<br><br>        else:<br>            text = f&quot;❌ Unknown tool: {name}&quot;<br><br>    except Exception as e:<br>        text = f&quot;❌ Error: {str(e)}&quot;<br><br>    return [types.TextContent(type=&quot;text&quot;, text=text)]<br><br><br>sse = SseServerTransport(&quot;/messages/&quot;)<br><br><br>async def handle_sse(request: Request):<br>    async with sse.connect_sse(request.scope, request.receive, request._send) as (r, w):<br>        await server.run(r, w, server.create_initialization_options())<br>    return Response()<br><br><br>async def handle_messages(request: Request):<br>    await sse.handle_post_message(request.scope, request.receive, request._send)<br>    return Response()<br><br><br>async def health(request: Request):<br>    return JSONResponse({&quot;status&quot;: &quot;ok&quot;})<br><br><br>app = Starlette(routes=[<br>    Route(&quot;/sse&quot;,       handle_sse,      methods=[&quot;GET&quot;]),<br>    Route(&quot;/messages/&quot;, handle_messages, methods=[&quot;POST&quot;]),<br>    Route(&quot;/health&quot;,    health,          methods=[&quot;GET&quot;]),<br>])<br><br><br>if __name__ == &quot;__main__&quot;:<br>    logger.info(f&quot;Starting SIEM server on 0.0.0.0:{SSE_PORT}&quot;)<br>    uvicorn.run(app, host=&quot;0.0.0.0&quot;, port=SSE_PORT)</pre><h3>Part 5: <strong>Build the Isolation MCP Server</strong></h3><h4>Architecture: SSH Relay Pattern</h4><p><strong>Why the SSH Relay Exists</strong></p><p>To understand this you need to know what was happening without it.</p><p><strong>The Original Plan</strong></p><p>The original isolation server used a Python library called <strong>paramiko</strong> to SSH into the Windows machine and run PowerShell commands. Paramiko is a pure Python SSH library, no external tools needed, just import it and call client.connect().</p><p>It worked perfectly when tested manually inside the container. But the moment Claude called an isolation tool, it always timed out. The reason is shown below:</p><p><strong>Problem 1: Paramiko Freezes the Async Event Loop</strong></p><p>The MCP server runs on an <strong>async</strong> event loop. Think of the event loop like a single worker who handles everything, incoming connections, outgoing responses, tool calls, by rapidly switching between tasks. The MCP server is always running, always listening, always ready. It cannot stop and wait for an SSH connection to finish. If it stops and waits, it becomes unresponsive and Claude times out. The problem was Paramiko does not wait, it blocks. That is why it broke the event loop and why the relay was needed.</p><p><strong>The Fix: ssh_relay.py</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQQLbeMQpUk6j_t9bFgXBA.png" /></figure><pre>#!/usr/bin/env python3<br>&quot;&quot;&quot;<br>SSH relay - runs on Kali host, called by the isolation container via subprocess<br>&quot;&quot;&quot;<br>import sys<br>import json<br>import subprocess<br><br>def run(host, user, passwd, command, port=22):<br>    proc = subprocess.run(<br>        [&quot;sshpass&quot;, &quot;-p&quot;, passwd, &quot;ssh&quot;,<br>         &quot;-o&quot;, &quot;StrictHostKeyChecking=no&quot;,<br>         &quot;-o&quot;, &quot;ConnectTimeout=10&quot;,<br>         &quot;-p&quot;, str(port),<br>         f&quot;{user}@{host}&quot;,<br>         command],<br>        capture_output=True, text=True, timeout=30<br>    )<br>    return proc.stdout.strip(), proc.stderr.strip(), proc.returncode<br><br>if __name__ == &quot;__main__&quot;:<br>    data = json.loads(sys.argv[1])<br>    out, err, code = run(<br>        data[&quot;host&quot;], data[&quot;user&quot;], data[&quot;pass&quot;],<br>        data[&quot;cmd&quot;], data.get(&quot;port&quot;, 22)<br>    )<br>    print(json.dumps({&quot;out&quot;: out, &quot;err&quot;: err, &quot;code&quot;: code}))</pre><p>ssh_relay.py is a completely separate Python script that runs as a <strong>subprocess, </strong>meaning it is a brand new process spawned by the operating system <strong>inside the container</strong>, completely outside the asyncio event loop.</p><p>Instead of using paramiko, we made the server run this exact command:</p><pre>sshpass -p &quot;Passwordforthetargetmachine&quot; ssh admin@10.0.7.172</pre><p>That is literally the same as typing it in a terminal. sshpass just handles the password automatically so it does not ask for it interactively.</p><p>Both isolation_server.py and ssh_relay.py are inside the same Docker container. But they are <strong>separate processes</strong>. The MCP server spawns the relay as a child process and continues running normally on the event loop , it does not freeze waiting for the SSH connection. The relay handles the SSH completely independently and when it is done it hands the result back to the server.</p><p>So to be precise:</p><ul><li>Same container</li><li>Same Docker environment</li><li>Different process</li><li>Outside the async event loop</li></ul><h4>isolation-server/requirements.txt</h4><pre>mcp[cli]&gt;=1.2.0<br>paramiko&gt;=3.4.0<br>uvicorn&gt;=0.30.0<br>starlette&gt;=0.40.0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srEfU8a9pOsFQ8P0dwj_8w.png" /></figure><h4>isolation-server/isolation_server.py: Full Code</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2uVrgk8R_exsEWMqMRwPmA.png" /></figure><pre>#!/usr/bin/env python3<br>import os<br>import sys<br>import asyncio<br>import logging<br>import paramiko<br>import uvicorn<br>from starlette.applications import Starlette<br>from starlette.requests import Request<br>from starlette.responses import Response, JSONResponse<br>from starlette.routing import Route<br>from mcp.server import Server<br>from mcp.server.sse import SseServerTransport<br>from mcp import types<br><br>logging.basicConfig(level=logging.INFO, format=&#39;%(asctime)s - %(name)s - %(levelname)s - %(message)s&#39;, stream=sys.stderr)<br>logger = logging.getLogger(&quot;isolation-server&quot;)<br><br>SSE_PORT         = int(os.environ.get(&quot;ISOLATION_SSE_PORT&quot;, &quot;8002&quot;))<br>DEFAULT_SSH_USER = os.environ.get(&quot;ISOLATION_SSH_USER&quot;, &quot;&quot;)<br>DEFAULT_SSH_PASS = os.environ.get(&quot;ISOLATION_SSH_PASS&quot;, &quot;&quot;)<br>DEFAULT_SSH_PORT = int(os.environ.get(&quot;ISOLATION_SSH_PORT&quot;, &quot;22&quot;))<br><br><br>def run_ssh(host, user, passwd, command, port=22):<br>    import subprocess, json<br>    payload = json.dumps({&quot;host&quot;: host, &quot;user&quot;: user, &quot;pass&quot;: passwd, &quot;cmd&quot;: command, &quot;port&quot;: int(port) if port else 22})<br>    proc = subprocess.run(<br>        [&quot;python3&quot;, &quot;/app/ssh_relay.py&quot;, payload],<br>        capture_output=True, text=True, timeout=35<br>    )<br>    if proc.returncode != 0 and not proc.stdout:<br>        return &quot;&quot;, proc.stderr.strip(), proc.returncode<br>    result = json.loads(proc.stdout.strip())<br>    return result[&quot;out&quot;], result[&quot;err&quot;], result[&quot;code&quot;]<br><br>def creds(args):<br>    user   = args.get(&quot;username&quot;, &quot;&quot;).strip() or DEFAULT_SSH_USER<br>    passwd = args.get(&quot;password&quot;, &quot;&quot;).strip() or DEFAULT_SSH_PASS<br>    port = int(args.get(&quot;ssh_port&quot;) or DEFAULT_SSH_PORT or 22)<br>    return user, passwd, port<br><br><br>server = Server(&quot;isolation&quot;)<br><br><br>@server.list_tools()<br>async def list_tools():<br>    props_base  = {<br>        &quot;target_ip&quot;:  {&quot;type&quot;: &quot;string&quot;},<br>        &quot;username&quot;:   {&quot;type&quot;: &quot;string&quot;, &quot;default&quot;: &quot;&quot;},<br>        &quot;password&quot;:   {&quot;type&quot;: &quot;string&quot;, &quot;default&quot;: &quot;&quot;},<br>        &quot;ssh_port&quot;:   {&quot;type&quot;: &quot;string&quot;, &quot;default&quot;: &quot;&quot;},<br>    }<br>    props_iface = {**props_base, &quot;interface_name&quot;: {&quot;type&quot;: &quot;string&quot;}}<br>    props_cmd   = {**props_base, &quot;command&quot;: {&quot;type&quot;: &quot;string&quot;}}<br>    return [<br>        types.Tool(name=&quot;isolate_host&quot;,          description=&quot;Disable a Windows network adapter via SSH&quot;,  inputSchema={&quot;type&quot;: &quot;object&quot;, &quot;properties&quot;: props_iface, &quot;required&quot;: [&quot;target_ip&quot;, &quot;interface_name&quot;]}),<br>        types.Tool(name=&quot;restore_host&quot;,          description=&quot;Re-enable a Windows network adapter via SSH&quot;,inputSchema={&quot;type&quot;: &quot;object&quot;, &quot;properties&quot;: props_iface, &quot;required&quot;: [&quot;target_ip&quot;, &quot;interface_name&quot;]}),<br>        types.Tool(name=&quot;list_network_adapters&quot;, description=&quot;List network adapters on a Windows host&quot;,    inputSchema={&quot;type&quot;: &quot;object&quot;, &quot;properties&quot;: props_base,  &quot;required&quot;: [&quot;target_ip&quot;]}),<br>        types.Tool(name=&quot;run_powershell&quot;,        description=&quot;Run a PowerShell command via SSH&quot;,           inputSchema={&quot;type&quot;: &quot;object&quot;, &quot;properties&quot;: props_cmd,   &quot;required&quot;: [&quot;target_ip&quot;, &quot;command&quot;]}),<br>        types.Tool(name=&quot;test_ssh_connection&quot;,   description=&quot;Test SSH connectivity to a Windows host&quot;,   inputSchema={&quot;type&quot;: &quot;object&quot;, &quot;properties&quot;: props_base,  &quot;required&quot;: [&quot;target_ip&quot;]}),<br>    ]<br><br><br>@server.call_tool()<br>async def call_tool(name: str, arguments: dict):<br>    try:<br>        ip = arguments.get(&quot;target_ip&quot;, &quot;&quot;).strip()<br>        user, passwd, port = creds(arguments)<br><br>        if not ip:<br>            return [types.TextContent(type=&quot;text&quot;, text=&quot;❌ target_ip is required&quot;)]<br>        if not user:<br>            return [types.TextContent(type=&quot;text&quot;, text=&quot;❌ SSH username not provided&quot;)]<br>        if not passwd:<br>            return [types.TextContent(type=&quot;text&quot;, text=&quot;❌ SSH password not provided&quot;)]<br><br>        if name == &quot;isolate_host&quot;:<br>            iface = arguments.get(&quot;interface_name&quot;, &quot;&quot;).strip()<br>            out, err, code = await asyncio.to_thread(<br>                run_ssh, ip, user, passwd,<br>                f&#39;powershell -Command &quot;Disable-NetAdapter -Name \\&quot;{iface}\\&quot; -Confirm:$false&quot;&#39;,<br>                port<br>            )<br>            text = f&quot;⚡ Isolation {&#39;SUCCESS&#39; if code == 0 else &#39;FAILED&#39;}\n- Target: {ip}\n- Interface: {iface}\n- Exit Code: {code}\n{out or err}&quot;<br><br>        elif name == &quot;restore_host&quot;:<br>            iface = arguments.get(&quot;interface_name&quot;, &quot;&quot;).strip()<br>            out, err, code = await asyncio.to_thread(<br>                run_ssh, ip, user, passwd,<br>                f&#39;powershell -Command &quot;Enable-NetAdapter -Name \\&quot;{iface}\\&quot; -Confirm:$false&quot;&#39;,<br>                port<br>            )<br>            text = f&quot;✅ Restore {&#39;SUCCESS&#39; if code == 0 else &#39;FAILED&#39;}\n- Target: {ip}\n- Interface: {iface}\n- Exit Code: {code}\n{out or err}&quot;<br><br>        elif name == &quot;list_network_adapters&quot;:<br>            out, err, code = await asyncio.to_thread(<br>                run_ssh, ip, user, passwd,<br>                &#39;powershell -Command &quot;Get-NetAdapter | Select-Object Name,Status,MacAddress | Format-List&quot;&#39;,<br>                port<br>            )<br>            text = f&quot;🌐 Adapters on {ip}:\n{&#39;=&#39;*50}\n{out or err}&quot;<br><br>        elif name == &quot;run_powershell&quot;:<br>            command = arguments.get(&quot;command&quot;, &quot;&quot;).strip()<br>            out, err, code = await asyncio.to_thread(<br>                run_ssh, ip, user, passwd,<br>                f&#39;powershell -Command &quot;{command}&quot;&#39;,<br>                port<br>            )<br>            text = f&quot;⚡ PowerShell on {ip} (exit {code}):\n{&#39;=&#39;*50}\n{out or err or &#39;(no output)&#39;}&quot;<br><br>        elif name == &quot;test_ssh_connection&quot;:<br>            out, err, code = await asyncio.to_thread(<br>                run_ssh, ip, user, passwd, &quot;echo OK&quot;, port<br>            )<br>            text = f&quot;✅ SSH connected to {ip}:{port} as {user}&quot; if code == 0 else f&quot;❌ SSH failed: {err}&quot;<br><br>        else:<br>            text = f&quot;❌ Unknown tool: {name}&quot;<br><br>    except paramiko.AuthenticationException:<br>        text = f&quot;❌ Auth failed for {arguments.get(&#39;target_ip&#39;, &#39;&#39;)} as {arguments.get(&#39;username&#39;, &#39;&#39;)}&quot;<br>    except Exception as e:<br>        logger.error(f&quot;Tool error: {e}&quot;, exc_info=True)<br>        text = f&quot;❌ Error: {str(e)}&quot;<br><br>    return [types.TextContent(type=&quot;text&quot;, text=text)]<br><br><br>sse = SseServerTransport(&quot;/messages/&quot;)<br><br><br>async def handle_sse(request: Request):<br>    async with sse.connect_sse(request.scope, request.receive, request._send) as (r, w):<br>        await server.run(r, w, server.create_initialization_options())<br>    return Response()<br><br><br>async def handle_messages(request: Request):<br>    await sse.handle_post_message(request.scope, request.receive, request._send)<br>    return Response()<br><br><br>async def health(request: Request):<br>    return JSONResponse({&quot;status&quot;: &quot;ok&quot;})<br><br><br>app = Starlette(routes=[<br>    Route(&quot;/sse&quot;,       handle_sse,      methods=[&quot;GET&quot;]),<br>    Route(&quot;/messages/&quot;, handle_messages, methods=[&quot;POST&quot;]),<br>    Route(&quot;/health&quot;,    health,          methods=[&quot;GET&quot;]),<br>])<br><br><br>if __name__ == &quot;__main__&quot;:<br>    logger.info(f&quot;Starting Isolation server on 0.0.0.0:{SSE_PORT}&quot;)<br>    uvicorn.run(app, host=&quot;0.0.0.0&quot;, port=SSE_PORT)</pre><h3>Part 6: <strong>How Docker Compose connected with those MCP Servers:</strong></h3><p>Docker Compose is how we run both MCP servers together with a single command instead of managing them separately.</p><p>In this SOC lab we have two servers that need to run simultaneously , the SIEM server that connects to MariaDB to query alerts, and the isolation server that SSHes into Windows machines to disconnect and reconnect network interfaces. Without Docker Compose, you’d need to manually start each one in a separate terminal, remember all the port flags, pass in every environment variable by hand, and watch them individually.</p><p>Here is what that would look like:</p><p><strong>Build the SIEM server image:</strong></p><pre>docker build -t siem-query ./siem-server</pre><p><strong>Run the SIEM server container:</strong></p><pre>docker run -d \<br>  --name siem-query-mcp \<br>  -p 8001:8001 \<br>  -e SIEM_SSE_HOST=0.0.0.0 \<br>  -e SIEM_SSE_PORT=8001 \<br>  -e SIEM_DB_HOST=172.17.0.1 \<br>  -e SIEM_DB_PORT=3306 \<br>  -e SIEM_DB_NAME=siem_alerts \<br>  -e SIEM_DB_USER=n8n_user \<br>  -e SIEM_DB_PASS=YourPassword \<br>  --restart unless-stopped \<br>  siem-query</pre><p><strong>Build the isolation server image:</strong></p><pre>docker build -t isolation ./isolation-server</pre><p><strong>Run the isolation server container:</strong></p><pre>docker run -d \<br>  --name isolation-mcp \<br>  -p 8002:8002 \<br>  -e ISOLATION_SSE_HOST=0.0.0.0 \<br>  -e ISOLATION_SSE_PORT=8002 \<br>  -e ISOLATION_SSH_USER=admin \<br>  -e ISOLATION_SSH_PASS=YourPassword \<br>  -e ISOLATION_SSH_PORT=22 \<br>  --restart unless-stopped \<br>  isolatio</pre><p>Docker Compose replaces all of that with one file ( docker-compose.yml)which acts as a blueprint for both servers. It defines the ports, environment variables, networking, and build instructions for every container in one place. When something needs to change, you change it in that one file and rebuild.</p><p><strong>The docker-compose.yml File</strong></p><p>Here is the full configuration file that runs both MCP servers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NmRNSEdk7W0EmuOSXwSHJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z5J066d_6kBhwEJqaJ5hqQ.png" /></figure><pre>version: &quot;3.9&quot;<br>services:<br># ─────────────────────────────────────────────<br>  # SIEM Query Server  →  http://KALI_IP:8001/sse<br>  # ─────────────────────────────────────────────<br>  siem-query:<br>    build:<br>      context: ./siem-server<br>    container_name: siem-query-mcp<br>    restart: unless-stopped<br>    ports:<br>      - &quot;8001:8001&quot;<br>    environment:<br>      SIEM_SSE_HOST: &quot;0.0.0.0&quot;<br>      SIEM_SSE_PORT: &quot;8001&quot;<br>      SIEM_DB_HOST: &quot;172.17.0.1&quot;        # Docker bridge gateway to reach host MariaDB<br>      SIEM_DB_PORT: &quot;3306&quot;<br>      SIEM_DB_NAME: &quot;siem_alerts&quot;<br>      SIEM_DB_USER: &quot;n8n_user&quot;          # Change to your MariaDB username<br>      SIEM_DB_PASS: &quot;yourpassword&quot; # Change to your MariaDB password<br>    networks:<br>      - mcp-net<br>  # ─────────────────────────────────────────────<br>  # Isolation Server  →  http://KALI_IP:8002/sse<br>  # ─────────────────────────────────────────────<br>  isolation:<br>    build:<br>      context: ./isolation-server<br>    container_name: isolation-mcp<br>    restart: unless-stopped<br>    ports:<br>      - &quot;8002:8002&quot;<br>    environment:<br>      ISOLATION_SSE_HOST: &quot;0.0.0.0&quot;<br>      ISOLATION_SSE_PORT: &quot;8002&quot;<br>      ISOLATION_SSH_USER: &quot;admin&quot;<br>      ISOLATION_SSH_PASS: &quot;yourpassword&quot;<br>      ISOLATION_SSH_PORT: &quot;22&quot;<br>    networks:<br>      - mcp-net<br>networks:<br>  mcp-net:<br>    driver: bridge</pre><ul><li><strong>Breaking It Down</strong></li></ul><p><strong>restart: unless-stopped:</strong> Both containers automatically restart if they crash or if Kali reboots. Your MCP servers stay up without you having to manually bring them back.</p><p><strong>ports: &quot;8001:8001&quot;:</strong> Maps port 8001 on Kali to port 8001 inside the container. When Claude Desktop on Windows connects to http://10.0.0.5:8001/sse, Docker forwards that traffic to the SIEM container. Same for port 8002 and the isolation container.</p><p><strong>SIEM_DB_HOST: &quot;172.17.0.1&quot;</strong> : This is the most important and confusing line. The container cannot use localhost or 127.0.0.1 to reach MariaDB because those addresses point inside the container itself, not to the Kali host. 172.17.0.1 is Docker&#39;s bridge gateway, the address that containers use to reach the machine they&#39;re running on.</p><p><strong>SIEM_SSE_HOST: &quot;0.0.0.0&quot;</strong> — Tells the server to listen on all network interfaces inside the container, not just localhost. Without this, the server would be invisible to anything outside the container.</p><p><strong>networks: mcp-net</strong> :When Docker creates containers, by default they are isolated, they can’t see each other or talk to each other. mcp-net is a custom internal network we define so that both containers (the SIEM server and the isolation server) live on the same private network inside Docker.</p><ul><li>In this project the two containers don’t actually need to talk to each other directly, but putting them on the same named network is good practice. If you ever add a third container, for example a database container or a logging container, it can join mcp-net and communicate with both servers instantly without any extra configuration.</li></ul><p><strong>driver: bridge</strong> Bridge is Docker’s default network driver and it does two important things:</p><ul><li><strong>First:</strong> it creates a virtual network interface on Kali (usually called docker0) that acts as a switch connecting all containers on that network. Containers on mcp-net can reach each other using their container names as hostnames.</li><li><strong>Second: </strong>and this is the critical part for our setup, the bridge driver automatically writes iptables NAT rules on the Kali host that look like this:</li></ul><pre>DNAT tcp -- 0.0.0.0/0  tcp dpt:8001  to:172.18.0.3:8001<br>DNAT tcp -- 0.0.0.0/0  tcp dpt:8002  to:172.18.0.2:8002</pre><ul><li>This is what makes the whole thing work across the network. When Claude Desktop on Windows sends a request to 10.0.0.5:8001, it arrives at Kali&#39;s network interface. Docker&#39;s iptables rules intercept that traffic and automatically forward it to the SIEM container at 172.18.0.3:8001 inside Docker&#39;s internal network. The Windows machine never needs to know the container even exists, it just talks to Kali&#39;s IP and Docker handles the rest behind the scenes.</li></ul><p><strong>build: context:</strong> Points to the folder containing the Dockerfile for each server. When you run docker-compose up --build, Docker looks in that folder, reads the Dockerfile, and builds the container image from scratch.</p><h4>How They Work Together</h4><p>When you run docker-compose up --build:</p><ol><li>Docker reads the Dockerfile</li><li>The Dockerfile tells it to install everything in requirements.txt</li><li>The Dockerfile tells it to copy siem_server.py into the container</li><li>Docker starts the container and runs python siem_server.py</li><li>The server is now live and waiting for Claude Desktop to connect</li></ol><p>The same three-file pattern applies to the isolation server. Same structure, different code, different purpose.</p><ul><li>Starting everything:</li></ul><pre>docker-compose up -d --build</pre><ul><li>Checking what’s running:</li></ul><pre>docker-compose ps</pre><ul><li>Reading logs per server:</li></ul><pre>docker-compose logs siem-query<br>docker-compose logs isolation</pre><p>The -d flag runs the containers in the background (detached mode) so they keep running after you close the terminal. The --build flag forces Docker to rebuild the images from scratch, which is important whenever you change the Python code or dependencies.</p><p>You can also restart or rebuild a single server without touching the other:</p><pre>docker-compose up -d --build isolation</pre><p>This is what makes the setup manageable. Two MCP servers, one command, one config file, running cleanly in isolated containers on Kali — completely separate from the host system.</p><h4>Lets spin up these MCP Server dockers now</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_GOVJJleimGd083L2irbgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*99iuJ75Ys8U-PlF2VwMnhw.png" /></figure><h4>Double check and see if you can reach the containers by doing the followings command:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K80Png8RC9-WI0yfeuZweQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1eEa4DKZ2F-vRmiwNOfWfQ.png" /></figure><h3>Part 7: <strong>Configure Claude Desktop on Windows</strong></h3><p>Once both Docker containers are running on Kali, the last piece is telling Claude Desktop where to find them. This is done through a single JSON config file that lives on your Windows machine.</p><p>Claude Desktop connects to the MCP servers using the mcp-remote package.</p><h4>Finding the Claude Desktop Config File</h4><p>The config file lives at:</p><pre>%APPDATA%\Claude\claude_desktop_config.json</pre><p>If you cannot find it manually, here is the quickest way to get there:</p><ol><li>Press <strong>Win + R</strong> to open the Run dialog</li><li>Type %APPDATA% and hit Enter</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*j_p1-rac-RRYV2KVAL54YQ.png" /></figure><p>3. A File Explorer window opens showing your AppData\Roaming folder</p><p>4. In the search bar at the top right of the window, type <strong>Claude</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yLz4ZGW5-JwribnWoMKb8w.png" /></figure><p>5. The Claude folder will appear, open it and you will find claude_desktop_config.json inside</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kCRqJIuFfMqCcqgflE9Unw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5KGGhCTxWOQVtSsekgcJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UsTfgmqlvy5ll45SCr5NZA.png" /></figure><p>6. Replace the whole config inside with this config:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JHX4FdAPbcxlkQLFp3b4xw.png" /></figure><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;siem-query&quot;: {<br>      &quot;command&quot;: &quot;npx&quot;,<br>      &quot;args&quot;: [<br>        &quot;-y&quot;,<br>        &quot;mcp-remote&quot;,<br>        &quot;http://10.0.0.5:8001/sse&quot;,<br>        &quot;--allow-http&quot;<br>      ]<br>    },<br>    &quot;isolation&quot;: {<br>      &quot;command&quot;: &quot;npx&quot;,<br>      &quot;args&quot;: [<br>        &quot;-y&quot;,<br>        &quot;mcp-remote&quot;,<br>        &quot;http://10.0.0.5:8002/sse&quot;,<br>        &quot;--allow-http&quot;<br>      ]<br>    }<br>  },<br>  &quot;preferences&quot;: {<br>    &quot;coworkScheduledTasksEnabled&quot;: false,<br>    &quot;sidebarMode&quot;: &quot;chat&quot;,<br>    &quot;coworkWebSearchEnabled&quot;: true<br>  }<br>}</pre><h4>What Is Actually Happening Here</h4><p>When Claude Desktop starts it reads this file and for each server listed it runs the following command:</p><pre>npx -y mcp-remote http://10.0.0.5:8001/sse --allow-http</pre><p>Claude Desktop does not know how to talk to a remote MCP server directly so it uses a package called mcp-remote as a bridge. Think of mcp-remote like a translator sitting between Claude Desktop on Windows and your Python servers on Kali. Claude talks to mcp-remote locally and mcp-remote forwards everything over HTTP to Kali.</p><p>The npx -y part means Node.js will automatically download mcp-remote the first time without asking you to confirm anything. This is why Node.js needs to be installed on Windows , without it none of this works.</p><p>The allow-http flag is mandatory. By default mcp-remote only allows HTTPS connections for security reasons. Since our servers run over plain HTTP on the local network this flag tells mcp-remote to allow it. Leave this flag out and the moment Claude Desktop tries to connect you will get this error:</p><pre>Non-HTTPS URLs are only allowed for localhost or when --allow-http flag is provided</pre><p>Once the config is saved fully quit Claude Desktop from the system tray, right click the icon and hit Quit. Do not just close the window. You can kill all the process related to claude by doing the following command to ensure that its closed completely</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G7PtY1ps0EeukOk8OYLREg.png" /></figure><p>Reopen it and within a few seconds both servers will be connected. Both mcp servers will be shown, exposing tools such as quering alerts and managing windows hosts over SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-b8JYtAEwfWWeM6t41q3eA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c6yYcmuOoR5d50MhF4VLvg.png" /></figure><h3>Part 8: Testing out the MCP Servers using Claude AI</h3><p>With both servers running on Kali and the config file saved on Windows, it was time to actually test everything end to end.</p><p>Open Claude Desktop on the Windows machine. This is the same machine that is also our target , the one we are going to isolate from the network. That makes this test particularly satisfying. Claude Desktop is running on the very machine we are about to disconnect.</p><p>First let us make sure the SIEM server is working. Type this into Claude:</p><pre>Retrieve SIEM Alerts from the database</pre><p>Claude will call the get_all_alerts tool, connect to MariaDB on Kali, pull the alerts from the database, and return them formatted in the chat. If you see your alerts listed back at you, the SIEM server is fully working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yHtIxETL9KB-BZTlln9Pw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IL8yu7T_CMNV4lluzGOszw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*17KtQp7I4aKCgEJAe-q0zg.png" /></figure><p>Now the real test. Type:</p><pre>Isolate host 10.0.7.172 by disabling the Ethernet adapter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zsIt9DgDauYFeTnl4w_sGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DgsDUqKpqh-ZTc171G4Byw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4aKZLtWllheB0mGhvzcTtw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RfnqV6Lkq8g8ysFraj3EBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtYAFvP1AFZUa86p8ew0kQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j88B6NoMvIXpF9W3dM4mrA.png" /></figure><h3>Conclusion</h3><p>Building this SOC automation platform took significantly longer than expected, mostly due to a series of compounding issues with FastMCP’s SSE handling, Docker networking, and async Python. But the end result is exactly what I wanted: a natural language interface to my SIEM and endpoint isolation capability, all running on infrastructure I control.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60cd4c265b24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 4: MariaDB (Approved Alert Storage)]]></title>
            <link>https://medium.com/@basharraed/phase-4-mariadb-approved-alert-storage-29b56e047edc?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/29b56e047edc</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-technology]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 16:35:59 GMT</pubDate>
            <atom:updated>2026-03-11T16:35:59.077Z</atom:updated>
            <content:encoded><![CDATA[<p>After the analyst approves an alert, we need a place to <strong>store the validated security events</strong>.<br> For this purpose, we use <strong>MariaDB</strong>, a reliable open-source relational database that is fully compatible with MySQL.</p><p>Approved alerts will be stored here so they can later be <strong>queried, audited, or analyzed by AI</strong>.</p><h3>Phase 4a: MariaDB (Approved Alert Storage)</h3><h4>Step 1: Install MariaDB</h4><p>First, install the MariaDB database server.</p><pre>sudo apt update<br>sudo apt install mariadb-server<br>sudo systemctl start mariadb<br>sudo systemctl enable mariadb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81cOPVK2cAMLMxttw0TmBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O7P4bNcmhasooC3rLJ6Mjw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2YabytyYbzZsEUdV7JMWkg.png" /></figure><p>Explanation:</p><ul><li>apt install mariadb-server → installs the MariaDB database service.</li><li>systemctl start mariadb → starts the database server.</li><li>systemctl enable mariadb → ensures the database starts automatically when the system boots.</li></ul><p>MariaDB is <strong>fully compatible with MySQL</strong>, meaning it uses the same commands and SQL syntax.</p><h4>Step 2: Secure MariaDB</h4><p>Next, run the security setup script.</p><pre>sudo mysql_secure_installation</pre><p>This script helps secure the database by:</p><ul><li>Setting a <strong>root password</strong></li><li>Removing <strong>anonymous users</strong></li><li>Deleting the <strong>test database</strong></li><li>Disabling <strong>remote root login</strong></li></ul><p>When prompted, it is recommended to choose <strong>Y (Yes)</strong> for all security options. In my case, i kept <strong>remote root login enabled</strong>for testing purposes but you can do whatever your preference is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*scZUUj6fTJgzJHhfji1b-Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3JNqFJDLF3f5FhUFaS_dIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rKe1Oqb_1QCk_s2SG5_rYg.png" /></figure><p>This will give you a <strong>secure local MariaDB installation</strong> suitable for n8n.</p><h4>Step 3: Log in to MariaDB</h4><p>After securing the installation, log in to the database server.</p><pre>sudo mariadb -u root -p</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffQUDZuSYMYKaX5nBRybOA.png" /></figure><p>Explanation:</p><ul><li>-u root → logs in as the root database administrator</li><li>-p → prompts for the root password you created earlier</li></ul><p>Once authenticated, you will enter the <strong>MariaDB command interface</strong>, where you can create databases and tables.</p><p>Example prompt:</p><pre>MariaDB [(none)]&gt;</pre><h4>Step 4: Create the Database and User</h4><p>Now we create a <strong>dedicated database</strong> to store approved alerts and a <strong>separate user for n8n</strong> to access it.</p><p>This keeps the system secure by <strong>not using the root account</strong> for applications.</p><p><strong>Create the Database</strong></p><p>First, create the database that will store the alerts.</p><pre>CREATE DATABASE siem_alerts;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQiihbrG-AOm0hhVrGvDqA.png" /></figure><p>This database will hold all <strong>analyst-approved security alerts</strong> coming from the n8n workflow.</p><p><strong>Create a User for n8n</strong></p><p>Instead of using the root account, we create a <strong>dedicated user for n8n</strong>.</p><pre>CREATE USER &#39;n8n_user&#39;@&#39;%&#39; IDENTIFIED BY &#39;YourPassword&#39;;</pre><p>Explanation:</p><ul><li><strong>n8n_user</strong> → the account n8n will use</li><li><strong>%</strong> → allows connections from other machines on the network</li><li>YourPassword → password for the database user</li></ul><p>Using % allows your <strong>n8n server or other machines in the LAN</strong> to access the database.</p><h4>Step 5: Grant Database Permissions</h4><p>Now give the user permission to access the alerts database.</p><pre>GRANT ALL PRIVILEGES ON siem_alerts.* TO &#39;n8n_user&#39;@&#39;%&#39;;<br>FLUSH PRIVILEGES;</pre><p>This allows the user to:</p><ul><li>Insert alerts</li><li>Read stored alerts</li><li>Update alert information</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Ebwm9MVSuvk-szSBm1wwg.png" /></figure><h4>Step 6: Create the approved_alerts Table</h4><p>Switch to your database and create a table to store approved alerts.</p><pre>USE siem_alerts;</pre><pre>CREATE TABLE approved_alerts (<br>    id INT AUTO_INCREMENT PRIMARY KEY,<br>    summary TEXT NOT NULL,<br>    timestamp DATETIME DEFAULT CURRENT_TIMESTAMP<br>);</pre><p>Explanation:</p><ul><li><strong>id</strong> → unique identifier for each alert</li><li><strong>summary</strong> → plain-English explanation from the AI analysis</li><li><strong>timestamp</strong> → when the alert was approved and stored</li></ul><p>This table will be the core of your <strong>SIEM’s institutional memory</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sdGjWa0MdR7TBLI1vZEr_Q.png" /></figure><h4>Step 7: Allow MariaDB to Accept Network Connections</h4><p>By default MariaDB only listens on <strong>localhost</strong>.<br> We need to allow it to listen on the network.</p><p>Open the configuration file:</p><pre>sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6LkWE1fKsBpasy8x3rsVBQ.png" /></figure><p>Find this line:</p><pre>bind-address = 127.0.0.1</pre><p>Change it to:</p><pre>bind-address = 0.0.0.0</pre><p>Explanation:</p><ul><li><strong>127.0.0.1</strong> → only local connections allowed</li><li><strong>0.0.0.0</strong> → allows connections from other devices on the network</li></ul><p>Save the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCfnCkmKcIcNjYMqWu1JSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7dsG7fyjvLXhd2Jwk5AZVQ.png" /></figure><h4>Step 8: Restart MariaDB</h4><p>Apply the configuration change by restarting the service.</p><pre>sudo systemctl restart mariadb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxhCAZA5Ewyhhp7uUmGVJA.png" /></figure><h4>Step 9: Test Remote Connection</h4><p>Finally, test the connection from another machine (for example your Windows system).</p><pre>mysql -h 10.0.0.5 -u n8n_user -p siem_alerts</pre><p>Enter the password:</p><pre>YourPassword</pre><p>If the connection succeeds, you should see:</p><pre>MariaDB [siem_alerts]&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4DS74BJBV29QNyaLdaxOfg.png" /></figure><p>This confirms that <strong>remote access is working correctly</strong>.</p><h3>Phase 4b: Insert Approved Alerts into MariaDB</h3><h4>Step 1: Add a MariaDB Node in n8n</h4><ol><li>In your n8n workflow, <strong>after the Send &amp; Wait / Human Approval node</strong>:</li></ol><ul><li>Click <strong>➕ Add Node</strong></li><li>Search for MySQL</li><li>Choose <strong>Insert rows in a table </strong>operation</li></ul><p>2. Configure the database credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*LDFZDjICOWYz8luaJBOV8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*YYwzxKz7LVTl1FZQ7VFhQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlnXGr8d5n_ntrFkIY0zeQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*sgzA39krpxYai3aFwkmqsA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oTc-oaQDQ3QE2CXkcfwXEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-HP_hKKmpBunCR_SH002cg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yy78nDM34jBioiIYOQ1lbQ.png" /></figure><h4>Step 2: Map Workflow Data to Table Columns</h4><p>Map the fields from the workflow to the table columns. Example:</p><p>Table Columnn8n Workflow Valuesummary{{$json.summary}}timestamp{{$json.timestamp}}</p><blockquote><em>If you expand your table later to include agent, IP, rule_id, level, etc., you can map all those fields similarly.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oy4wq0dX0wm7sJ43-nql5w.png" /></figure><h4>Step 3: Test the Insert</h4><ol><li>Trigger a test alert in Wazuh</li><li>Go through your <strong>Human Approval node</strong> and click <strong>Approve</strong></li><li>The MariaDB node should <strong>insert a new row</strong> into approved_alerts</li></ol><p>You can verify:</p><pre>USE siem_alerts;<br>SELECT * FROM approved_alerts;</pre><p>You should see a row like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*--BtJIM68wTastClUee1cQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D_F--mkNShZlM62BIIo3kg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m86skSx04iUf4QMi075xfQ.png" /></figure><p>After deploying the Wazuh agent on my Windows PC (IT3), I received an alert showing this IP: <strong>10.0.7.172</strong>.</p><p>To confirm it was truly from that machine, I ran:</p><pre>ipconfig</pre><p>The output showed the <strong>same IP: 10.0.7.172</strong>, proving that the alert was correctly <strong>associated with the Windows PC</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z7Sp3CLLy8vDYVHBEXfREg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29b56e047edc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 3: Human Approval (The Immovable Gate)]]></title>
            <link>https://medium.com/@basharraed/phase-3-human-approval-the-immovable-gate-03a1ed685ce4?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/03a1ed685ce4</guid>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 16:35:46 GMT</pubDate>
            <atom:updated>2026-03-13T16:08:19.753Z</atom:updated>
            <content:encoded><![CDATA[<p>Once the Wazuh alert reaches n8n and is cleaned up by the Function/Code node, the next step is <strong>Human-in-the-Loop analysis</strong>. This is the “gate” where <strong>no automated action happens</strong> until a human reviews the alert.</p><h3>Why this step exists</h3><ul><li>Wazuh detects thousands of events, some are <strong>false positives</strong>.</li><li>Claude AI provides <strong>natural language analysis</strong>, but AI is <strong>not perfect</strong>.</li><li>You want <strong>human confirmation</strong> before taking any action, like isolating a host or blocking traffic.</li><li>This prevents <strong>accidental disruption</strong> of production systems.</li></ul><p>Philosophy:</p><blockquote><em>“The AI is an analyst, not an actor until you explicitly approve.”</em></blockquote><h3>How AI Node works in n8n</h3><ul><li>Connect a <strong>Claude AI node</strong> (or OpenAI Chat Completion) to the Function/Code node.</li><li>Prompt Claude with the cleaned alert JSON:</li></ul><pre>You are a SOC Tier-1 security analyst.<br><br>Analyze the following Wazuh security alert.<br><br>Return your answer in this exact format:<br>- Summary: one short sentence explaining what happened<br>- Risk: Low, Medium, High, or Critical<br>- False Positive: Yes or No<br>- Recommended Action: Ignore, Monitor, Investigate, or Block<br>- Mention the IP Address and the name of the agent<br><br>Alert data:<br>{{ JSON.stringify($json, null, 2) }} {{ $json.ip }}{{ $json.agent }}</pre><ul><li>Claude returns a structured response with <strong>plain-English analysis</strong> and suggested next steps.</li></ul><blockquote>Setting Up Claude AI for n8n Integration</blockquote><p>To analyze alerts in natural language, I connected n8n to <strong>Claude AI</strong>. Here’s how I set it up:</p><p><strong>Create a Claude Account</strong></p><ol><li>Go to <a href="https://www.anthropic.com/">https://www.anthropic.com/</a> and <strong>sign up</strong> for a Claude account.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8D4loJbtXIgDtE_ajx_7Yw.png" /></figure><p>2. Complete any email verification or account setup steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogsFQnYES8G91tKyf7kU2g.png" /></figure><p><strong>Get an API Key</strong></p><ol><li>Log in to your Claude account.</li><li>Navigate to <strong>API / Developer Settings</strong>.</li><li>Generate a <strong>new API key</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B-YlJ_5ioxHDESdXULZNeQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*thoVM7QcibKmNNm9RiGwJQ.png" /></figure><ul><li>Keep this key safe — it’s your “password” for programmatic access.</li><li>You will use this key in n8n to connect your workflow to Claude.</li></ul><p><strong>Purchase Tokens / Credits</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fBJWJ5ODqovUAgueIxGRjw.png" /></figure><p>Claude AI uses a <strong>token-based billing system</strong>:</p><ul><li>Each API request consumes tokens depending on <strong>input size + output size</strong>.</li><li>Go to <strong>Billing / Subscription</strong> in your Claude account.</li><li>Purchase the desired amount of <strong>tokens or usage credits</strong>.</li><li>For example, a small plan might give <strong>100,000 tokens per month</strong>, enough for dozens of alert analyses.</li></ul><p>💡 Tip: Start small while testing, then scale as your alert volume increases.</p><p><strong>Connect Claude to n8n</strong></p><ul><li>In n8n, add a <strong>Claude AI node which is called Anthropic here. (Claude is developed by Anthropic). Select Message a model node.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*d5WOryZ9kICPrtGkYDgX8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*NIKzHjm9asbiMce9h1J0Cw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-9udEDpGiRF88e4E_RX6A.png" /></figure><ul><li>Enter your <strong>API Key by creating a new credential and paste it there:</strong> The key you generated</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*Eokv-0wqSBOUvotrLb15bA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OhEmfteOPQTiAAoOKAtyrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DqmeZ1tTwJiJ7gmxxdCPGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aIn6siY3KgN042Qv0ytyyw.png" /></figure><p><strong>Choose the Model and Write a Prompt</strong></p><p>Once your Claude API is connected to n8n, you need to <strong>tell Claude what to do</strong> with your alerts. This is done by selecting a model and writing a clear prompt.</p><p><strong>- Step 1: Choose a Model</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*6xUhe71zRbcf5Okvg1Lm_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*SNQViY4mxWMfaZSjHXWxNw.png" /></figure><ul><li>Claude offers different models</li><li>For security alert analysis, choose a model that is:</li></ul><p>⠀⠀-⠀<strong>Fast </strong>so alerts are analyzed quickly</p><p>⠀⠀-⠀<strong>Accurate with reasoning, </strong>can explain technical events in plain ⠀⠀⠀English</p><p><strong>- Step 2: Write a Prompt</strong></p><p>The prompt tells Claude <strong>exactly what you want it to do</strong> with the incoming alert. Here’s an example you can use:</p><pre>You are a SOC Tier-1 security analyst.<br><br>Analyze the following Wazuh security alert.<br><br>Return your answer in this exact format:<br>- Summary: one short sentence explaining what happened<br>- Risk: Low, Medium, High, or Critical<br>- False Positive: Yes or No<br>- Recommended Action: Ignore, Monitor, Investigate, or Block<br>- Mention the IP Address and the name of the agent<br><br>Alert data:<br>{{ JSON.stringify($json, null, 2) }} {{ $json.ip }}{{ $json.agent }}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*a7xGwMdaWPz5xmylSArTvA.png" /></figure><ul><li>{{ JSON.stringify($json, null, 2) }} {{ $json.ip }}{{ $json.agent }} → this is n8n’s placeholder for the cleaned alert object from your Function/Code node.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*uYW7k9tsj1q6GwtH8Z36vQ.png" /></figure><ul><li>The prompt ensures Claude <strong>analyzes the alert, summarizes it, and suggests actions</strong> in human-readable language.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*g1S8gpNI1ufHs7Wk1pKPeA.png" /></figure><p><strong>Test the connection</strong></p><p>If successful, you can send alerts to Claude and receive <strong>human-readable analysis</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-vhhvLTlF3Zuw0wd10Q-UA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_yeL7nk3_SGfN4dQHWdZQ.png" /></figure><h3><strong>How Email Notification / Approval Step in n8n</strong></h3><p>After Claude AI analyzes a Wazuh alert, your workflow doesn’t act automatically. Instead, it <strong>pauses for human review</strong> to ensure that only verified alerts trigger critical actions.</p><h4>How the Analyst Reviews Alerts</h4><ul><li>n8n sends the <strong>AI-analyzed alert</strong> to the SOC analyst using the <strong>“Send &amp; Wait” node</strong>.</li><li>The analyst sees:</li></ul><p>⠀⠀- The original Wazuh alert</p><p>⠀⠀- The AI’s plain-English summary</p><p>⠀⠀- Recommended actions (ignore, monitor, block, investigate)</p><ul><li>The analyst can respond with <strong>Approve</strong> or <strong>Reject</strong>.</li></ul><h4>How n8n Enforces the Gate</h4><ul><li>The <strong>“Send &amp; Wait” node</strong> holds the workflow until a response is received.</li><li><strong>No automated action happens before approval</strong>.</li><li>The workflow will wait indefinitely if needed, ensuring <strong>every action passes through a human</strong>.</li></ul><p>💡 This keeps Claude as a <strong>review assistant</strong>, not a decision-maker, balancing <strong>automation speed</strong> with <strong>human judgment</strong>.</p><h4>Setting Up the “Send &amp; Wait” Node in n8n</h4><p>The <strong>Send &amp; Wait</strong> node is the core of your Human-in-the-Loop approval system. It ensures that <strong>no automated actions happen until the SOC analyst approves or rejects an alert</strong>.</p><p><strong>Add the Node</strong></p><ol><li>In your n8n workflow, click <strong>+ Add Node</strong>.</li><li>Search for <strong>Send &amp; Wait</strong> and select it.</li><li>Place it <strong>after your AI node</strong> (Claude) that analyzes the Wazuh alert.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7jJz9phXCF2o3ecmqa_SVA.png" /></figure><p><strong>Configure the Node</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SdvLgpq0RGpLqK1OMF3qSw.png" /></figure><ul><li>Configure Gmail Settings</li></ul><p>⠀⠀- <strong>Service / Credential:</strong> I created another app password for my ⠀⠀alert@example.ae <strong>Gmail account</strong> other than the one configured in n8n ⠀⠀to keep things seperately .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EAKjGF8iL95RklKWSzJuWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MHwfaZ-FuHJIeL1DvlTK5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fbnb-5p8l3MGB8-CkZzRHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*nJjpgO-RWTtz2P-p2mg9HQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whfuINc_QmOCEusUC5RJ2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SOrPNuTkZu0tPfewkVeNfw.png" /><figcaption>Before/After</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QcpfN0fboY0a26equbXJQg.png" /></figure><p>⠀- <strong>To:</strong> The analyst’s email (e.g., alert@example.ae).</p><p>⠀⠀- <strong>Subject:</strong> Include key info, e.g., Security Alert Approval Needed: ⠀⠀{{$json.agent}}.</p><p>⠀⠀- <strong>Body:</strong> Include the AI analysis and important alert fields:</p><pre>SOC Alert Notification<br><br>AI Analysis:<br>{{$json[&quot;content&quot;][0][&quot;text&quot;]}}<br><br>⚠️ Action Required: Please reply with ONE of the following:<br>- APPROVE → Execute the suggested action<br>- IGNORE → No action needed<br>- INVESTIGATE → Further review required</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ubq6nTMz1Tg0fYecJgtSfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xHjzcNurEwY3mxnzYCMC1w.png" /></figure><h3>Testing the n8n → Claude → Gmail Approval Workflow</h3><p>We click execute step on SendAndWait Email where it takes AI input analysis we received and send it to us for approval/rejection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IW7FsnPbsCvdUTp9ijvh4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uB-_R2nkGUQh9BmiXicpBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8sYgJ_G6dIJiq9H7lVI2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EEQYRSiUu1TiNGWMEme0pQ.png" /></figure><p>During the <strong>Human Approval stage</strong>, n8n sends the analyst an email containing an <strong>approval link</strong>.</p><blockquote>I wanted to show here an example that if the WEBHOOK_URL parameter was <strong>not configured when deploying n8n docker</strong>, n8n automatically generates the link using <strong>localhost</strong>.</blockquote><blockquote>- Example approval link: When the analyst clicks <strong>Approve</strong>, the browser tries to open localhost:5678.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaT7HbDuJ0oT7IoeAj5ERg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uQ6KNFLhWbHEruwo1e8c0g.png" /></figure><p>However, since we already configured n8n previously to generate links using the <strong>server’s IP address as you can see below, it will work.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4JJPjzCSnDnJawKSscamzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4m-5glgERKZ2E1PHj0q84A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v7MbSGe6SMgfD7QETWDABA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6a9bzzSMDGJ5CP8_ZSA_vw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XEO5duEt-FRXLK4sUhossQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A889MmTswQmiYYm1__tjHw.png" /></figure><p>As you can see, we got redirected back to our server successfully</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RimSvUpzNgHNy7uGABOn7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0N95OWXbmllvM3MXBRIyoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3-4d0PRVB7WxkcXCNHt2Q.png" /></figure><p>We got the Approve response here as the output which means it worked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cy6DKwFCGIckMX6u8qvWVQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03a1ed685ce4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 2: n8n (The Workflow Orchestrator)]]></title>
            <link>https://medium.com/@basharraed/phase-2-n8n-the-workflow-orchestrator-e730afc77573?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e730afc77573</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 16:23:06 GMT</pubDate>
            <atom:updated>2026-03-10T17:40:49.509Z</atom:updated>
            <content:encoded><![CDATA[<p>After Wazuh detects an alert, we need a way to <strong>automate actions, route alerts, and wait for human approval</strong>. That’s where <strong>n8n</strong> comes in. It’s an open-source workflow automation tool that handles all the logic between Wazuh, Claude AI, and your human analyst.</p><h3><strong>Update Kali</strong></h3><p>Open <strong>Terminal</strong>:</p><pre>sudo apt update &amp;&amp; sudo apt upgrade -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mq97DlM6oz3nQEgVHkORuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTb3i-s-hq_3ZnExBVmKPw.png" /></figure><h3>Install Docker</h3><p><strong>Kali already supports Docker.</strong></p><pre>sudo apt install -y docker.io</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HvxqBzkbun3HlNBvg-gIug.png" /></figure><p><strong>Start and enable Docker:</strong></p><pre>sudo systemctl start docker<br>sudo systemctl enable docker</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pYE5S_XRXfMdhSpd3so-5w.png" /></figure><p><strong>Verify Docker works:</strong></p><pre>docker --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dd3pqKXdazWRGPw3S0wkEw.png" /></figure><h3>Deploying n8n Using Docker</h3><p>I deployed n8n as a Docker container on my server. Here’s the exact command I used:</p><pre>sudo docker run -d \<br>  --name n8n \<br>  -p 5678:5678 \<br>  -v n8n_data:/home/node/.n8n \<br>  -e WEBHOOK_URL=http://10.0.0.5:5678/ \<br>  -e N8N_SECURE_COOKIE=false \<br>  n8nio/n8n</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oJB5wCw7KBPyNLI2bUnzLA.png" /></figure><p><strong>Explanation of each part:</strong></p><ul><li>-d → Runs the container in <strong>detached mode</strong> (background).</li><li>--name n8n → Names the container n8n for easy management.</li><li>-p 5678:5678 → Exposes port 5678 so you can access the n8n web interface.</li><li>-v n8n_data:/home/node/.n8n → This will prevent loss of data in n8n if the container stopped. To do this, you need to create a volume to save your data into which will help persist your workflow data across container restarts. So it basically will help workflows <strong>persist after reboot</strong>.</li></ul><p>⠀⠀⠀⠀•⠀You need to create this volume before deploying the docker by ⠀⠀⠀⠀⠀⠀running the following command:</p><pre>docker volume create n8n_data</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PErN0U-xZdjUAodjoQEJw.png" /></figure><ul><li>-e WEBHOOK_URL=http://10.0.0.5:5678/</li></ul><p>⠀⠀⠀-⠀This tells <strong>n8n what address to use when creating links</strong>.</p><p>⠀⠀⠀-⠀Normally, n8n uses <strong>localhost</strong>. But localhost only works on the ⠀⠀⠀same machine where n8n is running.</p><p>⠀⠀⠀-⠀During the <strong>Human Approval step later when we get to it</strong>, the <strong>Send &amp; </strong>⠀⠀⠀<strong>Wait node</strong> sends an email to the analyst with a link to approve or reject ⠀⠀⠀the alert.</p><p>⠀⠀⠀-⠀If the link uses localhost, the analyst <strong>cannot open it</strong> because it only ⠀⠀⠀works on the server itself.</p><p>⠀⠀⠀-⠀By setting:</p><pre>WEBHOOK_URL=http://10.0.0.5:5678/</pre><p>⠀⠀⠀-⠀n8n will create links using <strong>10.0.0.5:5678</strong>, which other devices on the ⠀⠀⠀network can access.</p><p>⠀⠀⠀-⠀This allows the analyst to <strong>open the approval link from their email </strong>⠀⠀⠀<strong>and respond to the alert.</strong></p><ul><li>-e N8N_SECURE_COOKIE=false → Allows insecure cookies for local testing (optional, safe in internal environments).</li><li>n8nio/n8n → The official n8n Docker image.</li><li>That line you see below is<strong> </strong>Docker’s way of telling you: your container has successfully started in the background and outputs the container ID. → <strong>605999b4173f2f7eb1592f838097c485a5514f7d8f983b6f509d8cad27e91fe0d</strong></li></ul><h4><strong>Open browser:</strong></h4><pre>http://localhost:5678</pre><p>If you see n8n UI → install is successful</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QN9N7bKs7SF_6mJnWjkCRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QEtLq-T49FR8gW__NLPQ7A.png" /></figure><h4>You can check your dockers running by running the following commands:</h4><pre>docker ps </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_bIzNWL1TdhjK0bSFAGQtA.png" /></figure><blockquote>Note: docker ps shows only running containers. If you want to see <strong>all containers (including stopped ones)</strong>, you can run:</blockquote><pre>docker ps -a</pre><p>Sometimes the container may be <strong>created successfully but not currently running</strong>. In that case, you can simply start it manually.</p><pre>docker start n8n</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*71vKrnqRjlcU2phvAsl31Q.png" /></figure><h3>Integrating Wazuh with n8n</h3><h4>Step 1: Create a Webhook Trigger in n8n</h4><p>To allow <strong>Wazuh alerts to trigger automation workflows</strong>, we first need to create a <strong>Webhook trigger in n8n</strong>. This webhook will act as the <strong>entry point for all incoming Wazuh alerts</strong>.</p><p><strong>Create a New Workflow</strong></p><ol><li>Open your n8n interface in the browser:</li></ol><pre>http://10.0.0.5:5678</pre><p>2. Click <strong>“New Workflow”</strong> to start building a new automation pipeline and name it “Wazuh-Alert”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2j19REK5cUG5onbPqma9tQ.png" /></figure><p><strong>Add a Webhook Node</strong></p><p>In the workflow editor:</p><ol><li>Click <strong>Add Node (+)</strong></li><li>Search for <strong>Webhook</strong></li><li>Select the <strong>Webhook node</strong></li></ol><p>This node will act as the <strong>trigger</strong> for your workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XSkwLU1FkS2pX044OzEGkQ.png" /></figure><h4>Step 2: Configure the Webhook</h4><p>Configure the following settings:</p><p>SettingValue<strong>HTTP Method</strong>POST<strong>Path</strong>wazuh-alert</p><p>Your configuration should look like:</p><pre>Method: POST<br>Path: wazuh-alert</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HgddPDlZnGSpa8LKx3Z9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fICGP8BtuRUxDredOKbHvg.png" /><figcaption>Before / After</figcaption></figure><p><strong>Test the webhook: </strong>Before connecting Wazuh to n8n, I first tested whether the webhook endpoint was working correctly. The easiest way to do this was by sending a <strong>manual HTTP POST request</strong> directly from the browser using <strong>Chrome DevTools</strong>.</p><ul><li>Step 1: Open Chrome DevTools</li></ul><ol><li>Open <strong>Google Chrome</strong></li><li>Press:</li></ol><pre>F12</pre><p>or</p><pre>Ctrl + Shift + I</pre><p>3. Go to the <strong>Console</strong> tab.</p><p>The console allows you to run <strong>JavaScript commands directly in the browser</strong>.</p><ul><li><strong>Step 2: Send a Test POST Request</strong></li></ul><p>Inside the console, I used the fetch() function to simulate a POST request to the n8n webhook.</p><p>Example:</p><pre>fetch(&quot;http://10.0.0.5:5678/webhook-test/wazuh-alert&quot;, {<br>  method: &quot;POST&quot;,<br>  headers: {<br>    &quot;Content-Type&quot;: &quot;application/json&quot;<br>  },<br>  body: JSON.stringify({<br>    username: &quot;admin&quot;,<br>    password: &quot;test123&quot;<br>  })<br>})<br>.then(res =&gt; res.json())<br>.then(data =&gt; console.log(data))<br>.catch(err =&gt; console.error(err));</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1fPQgt4H1-pUcPcfYmbB7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*pwIU7WgJtGfY_XgaC8FFMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*BZ1WvpusmYRTfFGO-7U59A.png" /><figcaption>Webhook Received</figcaption></figure><h4>Step 3: <strong>Bridge between Wazuh and n8n</strong></h4><p>Wazuh actually comes with <strong>built-in integrations</strong> to forward alerts to external systems via webhooks. I initially tried using this integrated functionality to send alerts directly to n8n.</p><p>However, for some reason, it <strong>wasn’t working reliably</strong> in my environment:</p><ul><li>Some alerts weren’t being sent consistently</li><li>Filtering by severity didn’t behave as expected</li><li>Debugging failures was difficult with the built-in method</li></ul><p>To solve this, I created a <strong>custom Python forwarder called “wazuh_to_n8n.py”</strong>.</p><blockquote>Note: This script has to be kept running in the background to send the webhook to n8n.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8Yx12vfl-aFV-MpcjqtIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ifCL_Vj8a7AnTdhOLSCfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jjFF1aTsAEWdzpOOOn8hkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iZlLnd0HLx5mBWhkAfzG8g.png" /></figure><pre>#!/usr/bin/env python3<br>import json<br>import time<br>import requests<br>import os<br><br>ALERT_FILE = &quot;/var/ossec/logs/alerts/alerts.json&quot;<br>HOOK_URL = &quot;http://10.0.0.5:5678/webhook-test/wazuh-alert&quot;<br>LOG_FILE = &quot;/var/ossec/logs/integrations.log&quot;<br><br>MIN_ALERT_LEVEL = 3  # only send alerts level 7 or higher<br><br>def log(msg):<br>    with open(LOG_FILE, &quot;a&quot;) as f:<br>        f.write(f&quot;{time.strftime(&#39;%Y/%m/%d %H:%M:%S&#39;)} {msg}\n&quot;)<br><br>def send_alert(alert):<br>    try:<br>        response = requests.post(HOOK_URL, json=alert, timeout=5)<br>        if response.status_code == 200:<br>            log(f&quot;Alert sent: rule={alert.get(&#39;rule&#39;, {}).get(&#39;id&#39;)} &quot;<br>                f&quot;level={alert.get(&#39;rule&#39;, {}).get(&#39;level&#39;)}&quot;)<br>        else:<br>            log(f&quot;Failed HTTP {response.status_code}&quot;)<br>    except Exception as e:<br>        log(f&quot;Webhook error: {str(e)}&quot;)<br><br>def tail_alerts():<br>    # Open the file in read mode<br>    with open(ALERT_FILE, &#39;r&#39;) as f:<br>        # Move to the END of file<br>        f.seek(0, os.SEEK_END)<br><br>        while True:<br>            line = f.readline()<br>            if not line:<br>                # no new line yet, wait a bit<br>                time.sleep(1)<br>                continue<br><br>            line = line.strip()<br>            if not line:<br>                continue<br><br>            try:<br>                alert = json.loads(line)<br>            except json.JSONDecodeError:<br>                continue<br><br>            level = alert.get(&quot;rule&quot;, {}).get(&quot;level&quot;, 0)<br>            if level &lt; MIN_ALERT_LEVEL:<br>                continue<br><br>            send_alert(alert)<br><br>def main():<br>    log(&quot;Starting Wazuh → n8n tail forwarder&quot;)<br>    while not os.path.exists(ALERT_FILE):<br>        log(f&quot;{ALERT_FILE} not found, waiting...&quot;)<br>        time.sleep(2)<br><br>    tail_alerts()<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>This script continuously monitors Wazuh’s alerts.json file, filters alerts by severity, logs activity locally, and reliably sends them to the n8n webhook.</p><blockquote><em>Result: I now have </em><strong><em>full control over which alerts get sent</em></strong><em>, real-time forwarding, and robust logging — ensuring my SOC pipeline triggers every critical event exactly when it happens.</em></blockquote><blockquote>How the Python Forwarder Works in general</blockquote><p>1️. <strong>Monitor Wazuh Alerts</strong><br> The script continuously watches Wazuh’s alert log:</p><pre>/var/ossec/logs/alerts/alerts.json</pre><p>Whenever a new alert appears, the script reads it in real-time, similar to tail -f.</p><p>2️. <strong>Filter Alerts by Severity</strong><br> Not all alerts are equally important. The script only forwards alerts above a minimum severity:</p><pre>MIN_ALERT_LEVEL = 3</pre><p>This prevents <strong>low-priority noise</strong> from triggering unnecessary workflows. We added a little bit of more control on the alert level received from Wazuh.</p><p>3️. <strong>Send Alerts to n8n</strong><br> If an alert passes the filter, the script forwards it to the n8n webhook:</p><pre>http://10.0.0.5:5678/webhook-test/wazuh-alert</pre><p>n8n then triggers the workflow, which can:</p><ul><li>Send the alert to Claude AI for analysis</li><li>Notify the human analyst via email</li><li>Wait for approval before taking action</li><li>Store the approved alert in MariaDB</li><li>Trigger automated host isolation if necessary</li></ul><p>4️. <strong>Log Forwarder Activity</strong><br> Every alert sent (or failed) is logged locally:</p><pre>/var/ossec/logs/integrations.log</pre><p>This helps troubleshoot any network or workflow issues.</p><blockquote>How the Python Forwarder Works in details</blockquote><p><strong>Step 1: Define Key Variables</strong></p><p>At the top of the script we define several important paths and settings.</p><pre>ALERT_FILE = &quot;/var/ossec/logs/alerts/alerts.json&quot;<br>HOOK_URL = &quot;http://10.0.0.5:5678/webhook-test/wazuh-alert&quot;<br>LOG_FILE = &quot;/var/ossec/logs/integrations.log&quot;<br>MIN_ALERT_LEVEL = 3</pre><p>Explanation:</p><pre>ALERT_FILE = &quot;/var/ossec/logs/alerts/alerts.json&quot;<br>HOOK_URL = &quot;http://10.0.0.5:5678/webhook-test/wazuh-alert&quot;<br>LOG_FILE = &quot;/var/ossec/logs/integrations.log&quot;<br>MIN_ALERT_LEVEL = 3</pre><p>Wazuh alerts contain a <strong>severity level</strong>. Lower-level alerts can be noisy, so the script filters them before forwarding.</p><p><strong>Step 2: Logging Function</strong></p><p>The script includes a simple logging function to track activity.</p><pre>def log(msg):<br>    with open(LOG_FILE, &quot;a&quot;) as f:<br>        f.write(f&quot;{time.strftime(&#39;%Y/%m/%d %H:%M:%S&#39;)} {msg}\n&quot;)</pre><p>This writes timestamped messages to:</p><pre>/var/ossec/logs/integrations.log</pre><p>This helps troubleshoot issues such as:</p><ul><li>webhook failures</li><li>HTTP errors</li><li>connection problems</li></ul><p><strong>Step 3: Sending Alerts to n8n</strong></p><p>The send_alert() function sends alerts to the webhook.</p><pre>def send_alert(alert):<br>    try:<br>        response = requests.post(HOOK_URL, json=alert, timeout=5)</pre><p>What happens here:</p><p>1️. The script sends a <strong>POST request</strong> to the n8n webhook.<br>2. The <strong>alert JSON from Wazuh becomes the request body</strong>.<br>3. n8n receives the alert and triggers the workflow.</p><p>If the request succeeds:</p><pre>log(f&quot;Alert sent: rule={alert.get(&#39;rule&#39;, {}).get(&#39;id&#39;)}&quot;</pre><p>If it fails, the script logs the error.</p><p><strong>Step 4: Monitoring the Wazuh Alert File</strong></p><p>The script continuously monitors the Wazuh alert log using a <strong>file tailing technique</strong>.</p><pre>with open(ALERT_FILE, &#39;r&#39;) as f:<br>    f.seek(0, os.SEEK_END)</pre><p>This does two things:</p><p>1️. Opens the alert log file.<br>2. Moves to the <strong>end of the file</strong> so it only processes <strong>new alerts</strong>.</p><p>Then the script loops forever:</p><pre>while True:</pre><p>Every time a new alert is written to the file, the script reads it and processes it.</p><p><strong>Step 5: Filtering Alerts by Severity</strong></p><p>Each alert contains a severity level:</p><pre>level = alert.get(&quot;rule&quot;, {}).get(&quot;level&quot;, 0)</pre><p>The script filters out low-priority alerts:</p><pre>if level &lt; MIN_ALERT_LEVEL:<br>    continue</pre><p>This prevents unnecessary automation triggers and reduces noise in the workflow.</p><p><strong>Step 6 : Forwarding the Alert</strong></p><p>If the alert passes the filter, it is sent to n8n:</p><pre>send_alert(alert)</pre><p>At this point:</p><p>Wazuh → Python Forwarder → n8n Webhook</p><p><strong>Step 7: Starting the Script</strong></p><p>The main() function initializes the forwarder.</p><pre>log(&quot;Starting Wazuh → n8n tail forwarder&quot;)</pre><p>It also waits until the Wazuh alert file exists before starting:</p><pre>while not os.path.exists(ALERT_FILE):</pre><p>Once the file is available, the script begins monitoring alerts in real time.</p><blockquote>Run the script</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OC3p8GaBZy2-RkDkVjDmOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wOiaM_yQjIibqtQ5pp4IVg.png" /></figure><blockquote><strong>The Result</strong></blockquote><p>With this Python forwarder, my SOC pipeline now works <strong>reliably and in real-time</strong>:</p><pre>Wazuh → alerts.json → Python Forwarder → n8n Webhook → Workflow → SOC Actions</pre><p>This approach gives me:</p><ul><li><strong>Full control</strong> over alert forwarding</li><li><strong>Custom filtering</strong> by severity or type</li><li><strong>Robust logging</strong> for auditing and troubleshooting</li><li><strong>Reliable automation</strong> for human-in-the-loop security operations</li></ul><blockquote><em>Note: Even though Wazuh has native webhook support, sometimes a small custom script is the most </em><strong><em>flexible and reliable solution</em></strong><em> for real-world automation pipelines.</em></blockquote><blockquote><strong>Activate the workflow to test it out</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1xa4TwOEjCgEBHSc5rb6Xw.png" /></figure><p>We immediatly got an alert in our n8n and an email notification in our alert email address</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTShu3mV43jmCktXvimjaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASaEzOIJbgkdx6Ymy4WbXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w8pHskpfZm7W7lNyLeZJFw.png" /></figure><h3>Now we need to extract important field using a node called “Function Node”</h3><p>After receiving raw Wazuh alerts via the Webhook, the <strong>next step is to simplify the data</strong>. Wazuh alerts are detailed JSON objects containing a lot of information, some useful, some noise.</p><p>The <strong>Function (or Code) node</strong> acts as a <strong>filter and formatter</strong>. It keeps only the fields that are <strong>relevant for analysis and automation</strong>, which helps:</p><ul><li>Reduce clutter in AI analysis</li><li>Save processing time and costs</li><li>Make alerts easier for humans to read and act on</li></ul><blockquote><em>Pre-Note: In case you don’t get confused</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*pmKA9tNcy9bFFKeoVQjeyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*9kf1xc4XOFHQ_vv1DEhdug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*NXZUfAMTS5yjEx9FvCdClw.png" /></figure><blockquote><strong>In n8n</strong></blockquote><ul><li>$json is already a <strong>JavaScript object</strong>, not a string.</li><li>That’s why in your Function/Code node you <strong>don’t need to parse it</strong>.</li><li>You can just access its fields:</li></ul><pre>const agentName = $json.agent.name;<br>const ruleLevel = $json.rule.level;</pre><h4>How It Works</h4><p>The node takes the raw JSON payload from Wazuh and returns a smaller, structured JSON object.</p><p><strong>Our JavaScript Code</strong></p><pre>// Get the body from the Webhook input<br>const alert = $input.first().json.body;<br><br>return [{<br>  json: {<br>    timestamp: alert.timestamp || &quot;N/A&quot;,<br>    agent: alert.agent?.name || &quot;N/A&quot;,<br>    ip: alert.agent?.ip || &quot;N/A&quot;,<br>    rule_id: alert.rule?.id || &quot;N/A&quot;,<br>    level: alert.rule?.level || &quot;N/A&quot;,<br>    description: alert.rule?.description || &quot;N/A&quot;,<br>    full_log: alert.data?.win?.system?.message || &quot;N/A&quot;,<br>    user: alert.data?.win?.eventdata?.subjectUserName || &quot;N/A&quot;,<br>    host: alert.data?.win?.system?.computer || &quot;N/A&quot;<br>  }<br>}];</pre><p><strong>Getting the alert from the Webhook</strong></p><pre>const alert = $input.first().json.body;</pre><p>⠀⠀⠀•⠀$input.first() → grabs the <strong>first item</strong> from the incoming node (your ⠀⠀⠀Webhook node).</p><p>⠀⠀⠀•⠀.json → the parsed JSON object from n8n.</p><p>⠀⠀⠀•⠀.body → the actual alert data sent by Wazuh (sometimes the ⠀⠀⠀⠀Webhook wraps it inside a body property).</p><p>⠀⠀⠀•⠀So after this line, alert is a <strong>JavaScript object</strong>, ready to use.</p><p>⠀⠀⠀•⠀<strong>No JSON parsing needed</strong> because n8n already converted the ⠀⠀⠀⠀incoming JSON string into a JS object for you.</p><ul><li><strong>Extracting only the relevant fields</strong></li></ul><pre>return [{<br>  json: {<br>    timestamp: alert.timestamp || &quot;N/A&quot;,<br>    agent: alert.agent?.name || &quot;N/A&quot;,<br>    ip: alert.agent?.ip || &quot;N/A&quot;,<br>    rule_id: alert.rule?.id || &quot;N/A&quot;,<br>    level: alert.rule?.level || &quot;N/A&quot;,<br>    description: alert.rule?.description || &quot;N/A&quot;,<br>    full_log: alert.data?.win?.system?.message || &quot;N/A&quot;,<br>    user: alert.data?.win?.eventdata?.subjectUserName || &quot;N/A&quot;,<br>    host: alert.data?.win?.system?.computer || &quot;N/A&quot;<br>  }<br>}];</pre><p>This is returning an <strong>array with one object</strong> that has a json property. n8n expects this structure for nodes to pass data forward.⠀⠀⠀</p><p>⠀⠀⠀•⠀ Each line is <strong>pulling a specific field</strong> from the alert object.</p><p>⠀⠀⠀•⠀ ?. → optional chaining: if any intermediate property doesn’t exist, ⠀⠀⠀it doesn’t throw an error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUZkSnyLyxa-zb1tlIY7RA.png" /></figure><p>⠀⠀⠀•⠀ || &quot;N/A&quot; → fallback value in case the field is missing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MdteqIBBd1-GWu97mQ1gAQ.png" /></figure><h4>Deploy it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DucFuxiiQ-nTDqVB0Mx7gQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eJyF2W2U0Xh9jg7FkqMF8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t1_NUUIugUDvZczu3BUp_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JWPX4V2XbipY2ruSOGG5vA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e730afc77573" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 1: Wazuh (The Detection Engine)]]></title>
            <link>https://medium.com/@basharraed/phase-1-wazuh-the-detection-engine-08a7e8d8c6de?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/08a7e8d8c6de</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 16:18:04 GMT</pubDate>
            <atom:updated>2026-03-12T23:21:21.110Z</atom:updated>
            <content:encoded><![CDATA[<h3>Installing and Configuring Wazuh for Endpoint Threat Detection</h3><p>In the AI-powered SOC pipeline described in the main architecture article, <strong>Wazuh</strong> acts as the <strong>detection engine</strong>. It collects security activity from endpoints and generates alerts for suspicious activity such as privilege escalation, malware execution, and authentication anomalies.</p><p>This guide walks through how I deployed the Wazuh infrastructure used in the project.</p><h4>Step 1: Deploy the Wazuh Server</h4><p>The Wazuh server consists of three main components:</p><ul><li><strong>Wazuh Manager: </strong>processes alerts from agents</li><li><strong>Indexer: </strong>stores security events</li><li><strong>Dashboard</strong>: web interface for monitoring alerts</li></ul><p>For simplicity, I deployed all components on a single Linux server. In my case, the environment runs on <strong>Kali Linux deployed as a virtual machine inside VMware on a Windows Server host</strong>.</p><p>Minimum recommended specs:</p><ul><li>4 CPU cores</li><li>8 GB RAM</li><li>Ubuntu 22.04 / Debian / Rocky Linux</li></ul><h4>Step 2: Install Wazuh Using the Official Script</h4><p>The easiest way to install the full Wazuh stack is using the official installation script provided by the project.</p><pre>curl -sO https://packages.wazuh.com/4.14/wazuh-install.sh &amp;&amp; sudo bash ./wazuh-install.sh -a</pre><blockquote>Reference: <a href="https://documentation.wazuh.com/current/quickstart.html">https://documentation.wazuh.com/current/quickstart.html</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y6TO45GPeK4ckUB1LY_2vw.png" /></figure><p>The -a option installs the entire Wazuh stack:</p><ul><li>Manager</li><li>Indexer</li><li>Dashboard</li></ul><p>Once the installation completes, the dashboard becomes accessible through a web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6IP03NrJB0OYgUfmcwHyHw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BNHSax8OyL8V_pHLKy2r-g.png" /></figure><p>The installation will generate credentials for you as you can see below but i redacted my password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVS7O4NDHT7qJEmDx3fSvw.png" /></figure><h4>Step 3: Access the Wazuh Dashboard</h4><p>After installation, open the dashboard:</p><pre>https://&lt;your-server-ip&gt;</pre><p>Log in using the credentials generated during installation.</p><p>From here you can:</p><ul><li>Monitor alerts</li><li>View agent status</li><li>Analyze security events</li><li>Create custom detection rules</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m455bKCdO2USgxN-6jFyGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QnggNN-JPDB4Ae8xNzELLA.png" /></figure><p><strong>Note:</strong> By default, Wazuh monitors the host it’s installed on. On my Kali Linux manager, the <strong>Vulnerability Detection module automatically scanned the local system</strong> and reported any outdated or vulnerable packages even without a separate agent deployed.</p><blockquote>To monitor other machines, you’ll need to <strong>install Wazuh agents</strong> on those hosts, which then report their activity and vulnerabilities to the manager.</blockquote><h4>Step 4: Install Wazuh Agents on Endpoints</h4><p>To monitor other machines, Wazuh requires <strong>agents installed on each endpoint</strong>. Supported systems include:</p><ul><li>Windows</li><li>Linux</li><li>macOS</li></ul><p>The agent collects logs and security telemetry and forwards them to the Wazuh manager, enabling <strong>centralized alerting and analysis</strong>.</p><h4>Using the Wazuh Dashboard to Deploy Agents</h4><p>Instead of manually editing configuration files, I used the <strong>Wazuh dashboard agent registration wizard</strong>:</p><ol><li>Open the Wazuh dashboard and navigate to the <strong>Agents</strong> section.</li></ol><p>2. Click <strong>“Add agent”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eUu7ap4-GKwvHuxZd9xmtw.png" /></figure><p>3. Choose the <strong>operating system</strong> of the target endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ryuKEdHUwhp4F2Cz2DPHg.png" /></figure><p>4. Specify the <strong>Wazuh manager IP (Kali Linux IP) </strong>and assign a <strong>name</strong> to the agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s_hzLIKQSXvDB7Ctm6BPKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cRtazfksSEbZuyPG9p-VFg.png" /></figure><p>5. The dashboard generates a <strong>custom installation command</strong> for that endpoint. Follow the requirments provided by Wazuh too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IaUHftbxeWfpOmGZTOcfvA.png" /></figure><pre>Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-4.14.2-1.msi -OutFile $env:tmp\wazuh-agent; msiexec.exe /i $env:tmp\wazuh-agent /q WAZUH_MANAGER=&#39;10.0.0.5&#39; WAZUH_AGENT_NAME=&#39;IT3PC&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bRuIX7iY9oJ46v3nYkRNzw.png" /></figure><p>6. Run the generated command on the target endpoint. Once the agent starts, it automatically connects to the manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mc9jWM88NdnGTPDGbupy3A.png" /></figure><p>After installation, the endpoint appears in the Wazuh dashboard with <strong>status: Active</strong>, and alerts from that host (In my case: IT3 Host) begin flowing to the manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1orQsj4_-NXf-L8u0JSXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XIhDhRtoS52bxCSHqFnuFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyJxblqrbMvaXV28k8ArJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXjqZ-GCkqR1lsxTijKm5g.png" /></figure><h3>Understanding Wazuh Vulnerability Reports</h3><p>One of the most powerful features of Wazuh is its <strong>Vulnerability Detector module</strong>, which automatically scans endpoints for known vulnerabilities and assigns <strong>severity levels</strong> based on CVSS (Common Vulnerability Scoring System).</p><p>Here’s what I observed on a monitored machine (IT3PC) in my office:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sh48ODfqVY7GoySN8UFLvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dFsvYOol-W_NsHEJYXrL5w.png" /></figure><h4>Severity Levels</h4><p>Wazuh categorizes vulnerabilities as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5n7NiHSL0KULC6XmH_YHJQ.png" /></figure><p>On IT3PC, Wazuh reported:</p><ul><li>Critical → 32</li><li>High → 0</li><li>Medium → 0</li><li>Low → 0</li></ul><p>All 32 vulnerabilities were <strong>critical</strong>, indicating the system is at very high risk.</p><h4>Top 5 Vulnerabilities</h4><p>Some examples of critical CVEs flagged by Wazuh:</p><ul><li>CVE-2025–11708</li><li>CVE-2025–11709</li><li>CVE-2025–11710</li><li>CVE-2025–13021</li><li>CVE-2025–13022</li></ul><p>Each CVE represents a <strong>specific security flaw</strong>. Critical vulnerabilities often allow:</p><ul><li>Remote code execution (attacker can run code from another system)</li><li>Privilege escalation (gain admin/root access)</li><li>Security bypasses</li><li>Data exfiltration</li></ul><p>The <strong>CVSS base scores</strong> for these CVEs ranged from <strong>9.8 to 10</strong>, confirming their high severity.</p><h4>Affected OS and Applications</h4><p>In this case, all critical vulnerabilities came from:</p><ul><li><strong>Microsoft Windows 11 Pro 10.0.26100.7623</strong></li><li><strong>Mozilla Firefox (x86 en-US)</strong></li></ul><p>⚠️ Likely scenario: unpatched Windows updates + outdated Firefox triggered Wazuh to flag <strong>known CVEs</strong>.</p><h3>Recommended Actions</h3><ol><li><strong>Patch the OS</strong></li></ol><ul><li>Run Windows Update and install all critical updates.</li></ul><p><strong>2. Update Applications</strong></p><ul><li>Update Firefox to the latest version.</li><li>Check for updates on other installed software.</li></ul><p><strong>3. Monitor</strong></p><ul><li>After patching, let the Wazuh agent rescan the endpoint → severity should drop.</li><li>Continue monitoring for new vulnerabilities.</li></ul><p><strong>4. Prioritize Critical First</strong></p><ul><li>Immediate attention to critical CVEs.</li><li>Address high/medium issues next.</li></ul><h4>Summary</h4><ul><li>Critical = extremely high risk, CVSS 9–10</li><li>IT3PC had <strong>32 critical vulnerabilities</strong>, all from Windows + Firefox</li><li>Immediate patching is required to avoid exploitation</li></ul><h3>Enabling Email Alerts in Wazuh</h3><p>To make your SOC truly actionable, Wazuh needs a way to <strong>notify analysts immediately</strong> when a critical alert is detected. In my setup, I configured Wazuh to send email alerts.</p><p>To send alerts securely from Wazuh, it’s recommended to <strong>use a local mail relay</strong> (Postfix) to handle authentication with Gmail or another SMTP server. This approach avoids putting credentials directly in Wazuh’s configuration.</p><h4>Postfix</h4><p>Postfix is a <strong>mail transfer agent (MTA) </strong>basically a local program on your server that can <strong>send emails</strong>. By default, it doesn’t know how to send emails through Gmail.</p><p>When you “configure Postfix to use Gmail,” you are telling it:</p><ol><li><strong>Which email server to use</strong> → Gmail’s SMTP server (smtp.gmail.com).</li><li><strong>Which port to connect to</strong> → Gmail uses port 587 for secure mail sending (TLS).</li><li><strong>Which credentials to use</strong> → your Gmail address and <strong>App Password</strong> so Gmail knows you’re allowed to send mail.</li><li><strong>Secure the connection</strong> → TLS encryption to protect your credentials and messages.</li></ol><p>In short:</p><blockquote><em>You are turning your local Postfix server into a </em><strong><em>secure relay</em></strong><em> that can send emails </em><strong><em>through Gmail</em></strong><em>.</em></blockquote><p>So instead of Wazuh trying to send emails directly (which often fails with Gmail), Wazuh sends the alert to <strong>Postfix locally</strong>, and Postfix <strong>forwards it through Gmail</strong> to your inbox.</p><h4>Step 1: Install Postfix and Mail Utilities</h4><pre>sudo apt update<br>sudo apt install postfix mailutils -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kVzbcmAVh30Z84pK8ZqwQQ.png" /></figure><p>During installation:</p><ul><li><strong>Mail server type:</strong> Internet Site</li></ul><p>⠀⠀⠀⠀▪ <strong>Internet Site</strong> → The server sends emails <strong>directly over the internet</strong> ⠀⠀⠀⠀using standard SMTP.</p><p>⠀⠀⠀⠀▪ Emails can be sent to any external address (like Gmail, Outlook, ⠀⠀⠀⠀etc.) without needing another relay.</p><p>⠀‌⠀⠀⠀▪ This is exactly what you want for Wazuh alerts that go to your Gmail ⠀⠀⠀⠀account.</p><ul><li>‌<strong>System mail name:</strong> anything (e.g., TAPS.local)</li></ul><p>⠀⠀⠀▪ Example: if you set TAPS.local, your emails will appear as coming ⠀‌⠀⠀⠀from ....@TAPS.local <em>if you don’t specify a From address</em>.</p><p>⠀⠀⠀▪ If Postfix sent emails directly without authentication, the “From” ⠀⠀⠀address would look like user@taps.local. When we configure Postfix ⠀⠀⠀to <strong>relay via Gmail</strong> using your Gmail account + App Password, Gmail ⠀⠀⠀<strong>overrides the system mail name</strong>.</p><p>⠀⠀⠀⠀⠀⠀- Gmail requires that all outgoing emails come from the ⠀⠀⠀⠀⠀⠀<strong>authenticated Gmail account</strong> to prevent spoofing.</p><p>⠀⠀⠀⠀⠀⠀- That’s why your test email (you will see below in the guide) shows ⠀⠀⠀⠀⠀⠀as coming from it3@&lt;example.ae&gt;, not example@taps.local.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JqW4XJrjR3MsHi0XsP81-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-fAZf43UrjbKwS9SgRKGig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1nJcBT4u01aIiLgtXoVzUQ.png" /></figure><h4>Step 2: Configure Postfix to Use Gmail</h4><p><strong>Edit the main Postfix configuration:</strong></p><pre>sudo nano /etc/postfix/main.cf</pre><ul><li>Add <strong>at the end</strong>:</li></ul><pre>relayhost = [smtp.gmail.com]:587<br>smtp_use_tls = yes<br>smtp_tls_security_level = encrypt<br>smtp_sasl_auth_enable = yes<br>smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd<br>smtp_sasl_security_options = noanonymous<br>smtp_sasl_tls_security_options = noanonymous</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tqHIj16mLqjTdtx_molzTw.png" /></figure><p><strong>Create a Gmail App password for authentication:</strong></p><ul><li><strong>Step 1: Enable 2-Step Verification on Gmail</strong></li></ul><p>⠀⠀▪ Before creating an App Password, make sure your Gmail account has <strong>2-</strong>⠀⠀<strong>Step Verification enabled</strong>:</p><p>⠀⠀⠀⠀1 .Go to <strong>Google Account → Security → 2-Step Verification</strong></p><p>⠀⠀⠀⠀2. Enable 2FA using your preferred method (SMS, Authenticator app, ⠀⠀⠀⠀etc.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hNiUT804ol8RqKlWKZOfQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GDruH7oUNunE7QSisQ3E6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lT2n_IsvlXI-K69gA81yxg.png" /></figure><blockquote><em>✅ This is mandatory. App Passwords only work for accounts with 2FA enabled.</em></blockquote><ul><li><strong>Step 2: Generate a Gmail App Password</strong></li></ul><p>⠀⠀▪ In your Google Account, navigate to <strong>Security → App Passwords</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eb2D3tTupDXppLIl--189w.png" /></figure><p>⠀⠀⠀⠀1 . Choose a name for this specific app password. We choose the ⠀⠀⠀⠀name “Wazuh”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ApJW0Uepf8yoGFhWsJDGQ.png" /></figure><p>⠀⠀⠀⠀2. Click <strong>Generate</strong> → Google will show a <strong>16-character App Password</strong> ⠀⠀⠀⠀(e.g., abcd-efgh-ijkl-mnop)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*hbbWmAkSOuuNJK7U9_7pxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMVh1zzvFLJ_sFi28CkjHg.png" /></figure><p>⠀⠀⠀⠀3. Copy this password , this will be used by Postfix to send emails</p><blockquote><em>Tip: App Passwords are safer than your normal Gmail password and can be revoked at any time.</em></blockquote><p><strong>Add Gmail credentials:</strong></p><pre>sudo nano /etc/postfix/sasl_passwd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*cDrCdElo9tNRy7xgCiGmiA.png" /></figure><ul><li><strong>Purpose:</strong> This file stores the <strong>SMTP credentials</strong> that Postfix uses to authenticate with Gmail.</li><li>Add the following line (replace with your Gmail and App Password):</li></ul><pre>[smtp.gmail.com]:587 yourgmail@gmail.com:APP_PASSWORD</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*enMTaUK9X7Uscl9HoQxcPA.png" /></figure><p><strong>Secure and hash the file:</strong></p><pre>sudo chmod 600 /etc/postfix/sasl_passwd<br>sudo postmap /etc/postfix/sasl_passwd<br>sudo systemctl restart postfix</pre><ul><li>chmod 600 ensures only root can read the password file.</li><li>postmap converts it to a hashed format Postfix can use efficiently.</li></ul><h4>Step 3: Test Gmail SMTP</h4><p>Before configuring Wazuh, test sending an email:</p><pre>echo &quot;Wazuh alert test&quot; | mail -s &quot;TEST EMAIL&quot; yourgmail@gmail.com</pre><p>If you receive the email, Postfix is correctly relaying through Gmail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmKTb9XHZgtoYxfU1so5Rg.png" /></figure><ul><li>Postfix takes the input from mail and sends it using the configured SMTP server (localhost → Gmail)</li><li>Gmail receives the email with:</li></ul><p>⠀⠀- Subject: TEST EMAIL</p><p>⠀⠀- Body: Wazuh alert test</p><ul><li>If you get the email in your inbox → <strong>Postfix and Gmail SMTP authentication are working correctly</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tR-3pPMQltvXnNl7I4X3FQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*picwLEgpLh_cGgS9M65y5A.png" /></figure><h4>Step 4: Configure Wazuh to Use Local Mail</h4><p>Edit /var/ossec/etc/ossec.conf:</p><pre>&lt;global&gt;<br>  &lt;email_notification&gt;yes&lt;/email_notification&gt;<br>  &lt;email_to&gt;yourgmail@gmail.com&lt;/email_to&gt;<br>  &lt;email_from&gt;yourgmail@gmail.com&lt;/email_from&gt;<br>  &lt;smtp_server&gt;localhost&lt;/smtp_server&gt;<br>&lt;/global&gt;</pre><blockquote><em>Note: </em><em>smtp_server=localhost is crucial. Wazuh sends emails to Postfix, which handles Gmail authentication.</em></blockquote><blockquote>- email_to: <em>will be the receipient email address. This is the recipient’s email address alert@example.ae. I’ve set it to my own email so that </em><strong><em>all alerts are sent here</em></strong><em>, since I created this email specifically to receive and monitor notifications from the alerts.</em></blockquote><blockquote>- email_from:</blockquote><blockquote>• <em>Wazuh shows the desired sender, but </em><strong><em>Gmail will always use the authenticated account</em></strong><em> configured in Postfix.</em></blockquote><blockquote><em>• Even if you set a different email here, the outgoing email will </em><strong><em>pick the Gmail account from Postfix and its App Password</em></strong><em>.</em></blockquote><blockquote><em>• In short: Wazuh handles the alert generation, Postfix handles authentication and sending. The Gmail account you configured in Postfix determines the actual sender.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ba7OVKKI7bylccdrF1SFCg.png" /></figure><p>Restart Wazuh:</p><pre>sudo systemctl restart wazuh-manager</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-a0JWQWhAnHI69TUDH4Yw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iyTMShCLDT-7fLVPjc894Q.png" /></figure><h4>Step 5: <strong>Setting Alert Levels in Wazuh</strong></h4><p>I set both the <strong>log alert level</strong> and <strong>email alert level</strong> to <strong>3 for testing purposes.</strong></p><blockquote><strong>Not recommended to leave it forever at 3 since you might face alot of false positives</strong>.</blockquote><p>This means that only alerts with <strong>medium priority or higher</strong> will be recorded in the logs and sent to my email.</p><p>This approach helps me:</p><ul><li><strong>Filter out low-level noise</strong> so I’m not overwhelmed with minor events.</li><li><strong>Focus on important security alerts</strong> that need attention.</li><li><strong>Keep my alert email organized</strong>, receiving only actionable notifications.</li></ul><p>By adjusting these levels, you can control which events get logged and which trigger email notifications, making alert management much easier.</p><p><strong>Steps to Change Log and Email Alert Levels</strong></p><ol><li><strong>Open the </strong><strong>ossec.conf file</strong> with a text editor:</li></ol><pre>sudo nano /var/ossec/etc/ossec.conf</pre><p><strong>2. Find the </strong><strong>&lt;global&gt; or </strong><strong>&lt;alerts&gt; section</strong> where alert levels are defined. It usually looks like this:</p><pre>&lt;global&gt;<br>  &lt;email_notification&gt;yes&lt;/email_notification&gt;<br>  &lt;email_to&gt;alert@example.ae&lt;/email_to&gt;<br>  &lt;smtp_server&gt;localhost&lt;/smtp_server&gt;<br>  &lt;smtp_port&gt;587&lt;/smtp_port&gt;<br>  &lt;email_from&gt;alert@example.ae&lt;/email_from&gt;<br>  &lt;log_alert_level&gt;3&lt;/log_alert_level&gt;<br>  &lt;email_alert_level&gt;3&lt;/email_alert_level&gt;<br>&lt;/global&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SetuUP_rDdKr4nkg_PcAXA.png" /></figure><p><strong>3. Change the log alert level</strong></p><ul><li>&lt;log_alert_level&gt; controls <strong>which events are written to the Wazuh log</strong>.</li><li>Example:</li><li>1 = low priority</li><li>5 = medium</li><li>10 = critical only</li><li>Set it according to what you want to log.</li></ul><p><strong>4. Change the email alert level</strong></p><ul><li>&lt;email_alert_level&gt; controls <strong>which alerts trigger an email</strong>.</li><li>Example:</li><li>5 = only medium and higher alerts will send an email</li><li>10 = only critical alerts will send an email</li></ul><p><strong>5. Save and close</strong> the file (Ctrl+O, Enter, Ctrl+X in nano).</p><p><strong>6. Restart the Wazuh manager</strong> to apply changes:</p><pre>sudo systemctl restart wazuh-manager</pre><p>7. <strong>Double Check:</strong></p><p><strong>Check if the Windows agent is installed</strong></p><p>⠀•⠀On your Windows machine:</p><p>⠀⠀⠀- Look for the <strong>Wazuh agent service</strong> (ossec-agent) in Services ⠀⠀⠀(services.msc)</p><p>⠀⠀⠀- Or run in PowerShell:</p><pre>Get-Service -Name wazuh*</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Ut1ttSawPVyUN0nGeTj_w.png" /></figure><p><strong>Verify agent registration</strong></p><p>⠀•⠀ On <strong>Kali (Wazuh Manager)</strong>, check the registered agents:</p><pre>sudo /var/ossec/bin/manage_agents -l</pre><p>⠀⠀⠀- You should see your Windows agent listed with its <strong>ID, IP, and name</strong>.</p><p>⠀⠀⠀- If it’s not listed → the agent hasn’t registered with the manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olWCIeWDTXMRVT99gZc3QQ.png" /></figure><h4>Step 6: View Alerts in Gmail</h4><p>Once your &lt;email_alert_level&gt; is set and Wazuh is sending alerts, you can check them directly in your Gmail inbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cpPb_5MqTZW3jdJOFu4Dyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JeEQbUCriq29fIxPxVI0Tw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aXaGFJarIGpznFInCm7p1g.png" /></figure><p>You’re seeing Kali alerts because they are “local” to the Wazuh Manager, but the Windows Agent alerts are reaching the email because of the windows agent installed.</p><p><strong>Why You See Alerts From Both Kali and Windows Machines</strong></p><ol><li><strong>Kali Linux (Wazuh Manager Host) Alerts</strong></li></ol><ul><li>Wazuh always monitors its <strong>own server by default</strong>, even if no agent is installed.</li><li>That’s why vulnerabilities or security events on your Kali server itself appear in the dashboard.</li><li>These are “local” alerts generated by the <strong>manager host</strong>.</li></ul><p><strong>2. Windows Agent Alerts</strong></p><ul><li>Installed on your Windows endpoints.</li><li>Agents send logs, events, and security telemetry to the Wazuh Manager.</li><li>When Wazuh detects something on these endpoints, it triggers email notifications.</li></ul><p><strong>3. Email Delivery to Gmail</strong></p><ul><li>Both Kali and Windows alerts <strong>go through Postfix</strong> and are delivered to your Gmail inbox.</li><li>Gmail doesn’t care whether the alert came from a local server or an endpoint, it only sees the email relayed through Postfix using your authenticated Gmail account.</li></ul><p><strong>Example: Look at this alert below</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WVzjEzpsWhMMNDqpP1Q5tg.png" /></figure><p>This notification is a standard <strong>Wazuh Alert</strong> sent via email. It’s essentially Wazuh saying: <em>“Hey, I saw something happen on your Windows machine that matched a rule, so I’m letting you know.”</em></p><p>Here is the breakdown of what this specific alert actually means:</p><p>1. The “Who and When”</p><p>· <strong>Timestamp:</strong> 2026 Feb 02 12:11:21 — When the event happened.</p><p>· <strong>Received From:</strong> (IT3PC) any-&gt;EventChannel — This tells you the alert came from your Windows Agent (named <strong>IT3PC</strong>) via the Windows Event Channel (the place where Windows stores its logs).</p><p>2. The “Why” (The Rule)</p><p>· <strong>Rule 60642:</strong> This is the internal ID Wazuh uses to categorize this specific event.</p><p>· <strong>Level 3:</strong> This is the “Importance” level. As we discussed, Level 3 is <strong>low priority</strong>. It’s basically “informational.”</p><p>· <strong>Description:</strong> &quot;Software protection service scheduled successfully.&quot; — This is the human-readable summary.</p><p>3. The “What” (The Technical Data)</p><p>The section inside the curly brackets {...} is the <strong>JSON data</strong>. It contains the raw details from Windows:</p><p>· <strong>EventID 16384:</strong> This is a standard Microsoft Windows ID.</p><p>· <strong>Message:</strong> &quot;Successfully scheduled Software Protection service...&quot;</p><ul><li><strong>Translation:</strong> This is just Windows checking its license/activation status. It’s a completely normal background process that happens automatically.</li></ul><p><strong>Summary: Is this a threat?</strong></p><p><strong>No.</strong> This is a perfect example of a <strong>“False Positive”</strong> or <strong>“Noise.”</strong> It isn’t a security risk; it’s just Windows being chatty. Because you set your email threshold to <strong>Level 3</strong>, Wazuh is now emailing you about <em>everything</em>, including these boring background tasks.</p><p>Now that you know the email system works, you should probably <strong>stop</strong> these specific alerts so they don’t fill up your inbox.</p><ul><li><strong>You do that by Raising the Global Level:</strong> Change your &lt;email_alert_level&gt; in ossec.conf from <strong>3</strong> to <strong>7</strong> or <strong>10</strong>. This will silence these &quot;Information&quot; alerts but still email you if someone tries to hack the password.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08a7e8d8c6de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Red Team Operator to Active Directory Administrator]]></title>
            <link>https://medium.com/@basharraed/from-red-team-operator-to-active-directory-administrator-8e98e683c69c?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e98e683c69c</guid>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Sun, 11 Jan 2026 14:14:26 GMT</pubDate>
            <atom:updated>2026-01-11T14:14:26.595Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tg-_RwPRQdz-e1JcR3ZsHA.jpeg" /></figure><h3>From Owning Domains to Administering Them (A highly detailed walkthrough)</h3><p>Coming from a red-team background, I bring deep experience in analyzing Active Directory from an attacker’s perspective including enumerating misconfigurations, exploiting trust relationships, and moving laterally through poorly protected environments. Now, stepping into the defensive and administrative side, I decided to design and deploy a fully operational, secure, and automated Active Directory domain from the ground up.<br> Here’s everything I implemented as part of this build.</p><p>I went from attacker to architect, and built an Active Directory environment for a K–12 school, implementing automation, monitoring, and best-practice security controls to protect students, staff, and school systems.</p><p>In this blog, I’ll take you through that journey:</p><ul><li>Preparing the Environment for Active Directory</li><li>Installing and deploying a Domain Controller from scratch</li><li>Planning a structured OU and group hierarchy</li><li>Designing custom GPOs for each OU based on role and security needs</li><li>Automating OS deployment using MDT and WDS</li><li>Deploying software at scale, converting EXE installers into MSI packages for GPO deployment</li><li>Implementing Microsoft best-practice baselines and hardening policies</li><li>Configuring WSUS to centrally manage and approve Windows updates</li><li>Deploying Microsoft LAPS for secure local admin password rotation</li><li>Assigning RDP permissions so only approved users can log in to specific machines</li><li>Configuring user-rights assignments (e.g., shutdown permissions, logon rights)</li><li>Setting up a print server with auditing and deploying printers via GPO</li><li>Delegating administrative rights securely on specific OUs</li><li>Monitoring logins and key events in real time using a custom Discord bot</li><li>Backing up domain controllers and performing full restore tests</li><li>Enforcing an RDP IP whitelist on the server firewall to allow remote logins only from trusted source addresses</li><li>Validating everything on client machines</li></ul><p>Think of this as <strong>Active Directory from the perspective of someone who’s seen both sides of the firewall</strong> , the attacker and the admin.</p><h3>The Backstory: Why I Built AD</h3><p>Before building Active Directory, I spent a lot of time testing policies, GPOs, OUs, and other settings in lab environments. I wasn’t doing it for fun, I wanted to <strong>make sure everything would work reliably when deployed across all school computers</strong>.</p><p>Managing dozens of machines manually was slow and frustrating. I needed a way to <strong>control everything from one place</strong>, deploy software, map shared drives, and enforce policies automatically.</p><p>All that testing paid off. By experimenting in a controlled environment first, I created a <strong>structured, reliable, and efficient AD setup</strong> that let me roll out changes across hundreds of machines without headaches.</p><h3>How This Guide Is Organized</h3><p>Because this guide is extensive, we’ve <strong>split it into multiple sections</strong> to make it easier to read and navigate. Each section focuses on a specific part of the topic and can be read individually. Simply click the links below to jump to the section you’re most interested in.</p><ul><li><a href="https://medium.com/@basharraed/preparing-the-environment-for-active-directory-d71ba658c812">Preparing the Environment for Active Directory</a></li><li><a href="https://medium.com/@basharraed/how-to-create-ous-groups-gpos-and-join-machines-to-a-domain-c83253cc1b64">How to Create OUs, Groups, GPOs, and Join Machines to a Domain</a></li><li><a href="https://medium.com/@basharraed/configure-ad-features-part-1-configuring-baseline-gpos-centeralized-admin-control-using-174afc99098a">Configure AD Features Part 1 (Configuring Baseline GPO’s, Centeralized Admin Control using…</a></li><li><a href="https://medium.com/@basharraed/automating-os-deployment-using-mdt-and-wds-8f8d7ad068cc">Automating OS deployment using MDT and WDS</a></li><li><a href="https://medium.com/@basharraed/configuring-unique-local-administrator-passwords-using-microsoft-laps-in-active-directory-918f6e188846">Configuring Unique Local Administrator Passwords Using Microsoft LAPS in Active Directory</a></li><li><a href="https://medium.com/@basharraed/enabling-remote-desktop-in-active-directory-322d38209814">Enabling Remote Desktop in Active Directory</a></li><li><a href="https://medium.com/@basharraed/installing-windows-server-update-services-wsus-in-active-directory-59bc9a67a0b9">Installing Windows Server Update Services (WSUS) in Active Directory</a></li><li><a href="https://medium.com/@basharraed/enabling-remote-shutdown-in-active-directory-cbf7ba435e4b">Enabling Remote Shutdown in Active Directory</a></li><li><a href="https://medium.com/@basharraed/configure-ad-feature-print-server-role-abf092af1e1f">Configure AD Feature: Print Server Role</a></li><li><a href="https://medium.com/@basharraed/how-to-map-network-drives-via-gpo-157737865e49">How to Map Network Drives via GPO</a></li><li><a href="https://medium.com/@basharraed/enabling-file-share-auditing-in-active-directory-windows-server-7f71755fe8b7">Enabling File Share Auditing in Active Directory (Windows Server)</a></li><li><a href="https://medium.com/@basharraed/monitor-unauthorized-access-on-your-domain-controller-using-discord-alerts-2161a65b0bd2">Monitor Unauthorized Access on Your Domain Controller Using Discord Alerts</a></li><li><a href="https://medium.com/@basharraed/how-to-configure-a-shared-folder-in-windows-9a78989e3725">How to Configure a Shared Folder in Windows</a></li><li><a href="https://medium.com/@basharraed/creating-a-welcome-message-in-active-directory-73e913c10b76">Creating a Welcome Message in Active Directory</a></li><li><a href="https://medium.com/@basharraed/hardening-windows-environments-with-microsoft-security-baseline-templates-ddd9bace8144">Hardening Windows Environments with Microsoft Security Baseline Templates</a></li></ul><h3>Planning the AD Environment</h3><p>A solid Active Directory setup starts with a clear <strong>OU and group structure</strong>, so administration is organized and scalable. For now, I’ve created the key OUs I needed to start testing and deploying policies:</p><h4>Organizational Units (OUs) &amp; Structure:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*I5oLLoF13TDnhwnh57kNvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*2WZ6Q3NbmfvsWWDMfkRc2A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*GT3vC0q_6LXq-rKyvoUr_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*Vqx4Wy3Lg0lLUE17BKB8wQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*8EvPF8426MlUiJtUM7mOPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N3T10PTmd6zQMVRZBl7KcQ.png" /></figure><p><strong>IT Admins OU:</strong></p><ul><li>It contains a <strong>Computers OU</strong> and a <strong>Users OU</strong> for better organization.</li></ul><p>------&gt;<strong>Computers OU</strong> —For IT Admins Computers</p><p>------&gt;<strong>Users OU</strong> — ForIT Admins Users</p><ul><li>Within this OU, I created the <strong>ITAdminGroup</strong>, which contains all IT employees. This group makes it easier to assign permissions, deploy policies, and manage access for the entire IT team.</li></ul><p><strong>Labs OU:</strong></p><ul><li>Contains sub-OUs for each lab:</li></ul><p>------&gt; PrimaryLab</p><p>------&gt; BoysLab</p><p>------&gt; GirlsLab</p><ul><li>Each lab OU contains:</li></ul><p>------&gt;<strong>Computers OU</strong> — e.g., PrimaryLab Computers</p><p>------&gt;<strong>Users OU</strong> — e.g., PrimaryLab Students</p><ul><li>Within the Lab OUs, I created corresponding groups:</li></ul><p>------&gt; PrimaryLabComputers – contains all computers in the PrimaryLab</p><p>------&gt; PrimaryLabStudents – contains all student user accounts for the lab</p><p>------&gt;This group makes it easier to assign permissions, deploy policies, and manage access for each lab environment.</p><p><strong>Staff OU:</strong></p><ul><li>Contains sub-OUs for different roles:</li></ul><p>------&gt; Reception</p><p>------&gt; Supervisors</p><ul><li><strong>Reception OU:</strong></li></ul><p>------&gt;<strong>Computers OU</strong> — Reception Computers</p><p>------&gt;<strong>Users OU</strong> — Reception Users</p><p>Within these OUs, I created corresponding groups:</p><p>------&gt; ReceptionComputerGroup– contains all computers in the Reception Department</p><p>------&gt; ReceptionGroup– contains all user accounts in the Reception Department</p><p>------&gt; These groups makes it easier to assign permissions, deploy policies, and manage access for each lab environment.</p><ul><li><strong>Supervisors OU:</strong></li></ul><p>------&gt;<strong>Computers OU</strong> —Supervisors Computers</p><p>------&gt;<strong>Users OU</strong> — Supervisors Users</p><p>Within the OUs, I created corresponding groups:</p><p>------&gt; SupervisorsComputerGroup– contains all computers in the Reception Department</p><p>------&gt; SupervisorsGroup– contains all user accounts in the Reception Department</p><p>------&gt; These groups makes it easier to assign permissions, deploy policies, and manage access for each lab environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e98e683c69c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Welcome Message in Active Directory]]></title>
            <link>https://medium.com/@basharraed/creating-a-welcome-message-in-active-directory-73e913c10b76?source=rss-415cded1860d------2</link>
            <guid isPermaLink="false">https://medium.com/p/73e913c10b76</guid>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[Root]]></dc:creator>
            <pubDate>Sat, 10 Jan 2026 16:18:20 GMT</pubDate>
            <atom:updated>2026-01-10T16:18:20.752Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*hFDUk68bbZf1J9DHydW8ug.png" /></figure><h3>A <strong>welcome (logon) message</strong> in Active Directory is commonly used to:</h3><ul><li>Show a <strong>welcome banner/Policy banner </strong>to users before login</li><li>This message appears <strong>before the user logs in</strong> on domain-joined computers.</li></ul><h3>How It Works</h3><p>Windows displays two elements at logon:</p><ol><li><strong>Logon Message Title</strong></li><li><strong>Logon Message Text</strong></li></ol><p>Both are configured using <strong>Group Policy</strong> and apply at the <strong>computer level</strong>.</p><h3>🔧 Step-by-Step: Configure Welcome Message via GPO</h3><h4>Step 1: Open Group Policy Management</h4><ol><li>Log in to a <strong>Domain Controller</strong></li><li>Open:</li></ol><ul><li>gpmc.msc</li></ul><h4>Step 2: Create or Edit a GPO</h4><ol><li>Right-click the <strong>OU</strong> that contains the <strong>target computers</strong></li><li>Select <strong>Create a GPO in this domain, and Link it here</strong></li><li>Name it, for example:</li></ol><ul><li>AD Logon Welcome Message</li></ul><p>Note: Im going to use an already created LabPolicy GPO and linked it to labs OU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQr6a2lnGPssg11FOOlyzw.png" /></figure><ul><li>Make sure that Primary Lab computers/users are able to read the GPO:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p6f2vuMJ6TyUNR2_lZWjnA.png" /></figure><h3>Step 3: Navigate to Logon Message Settings</h3><p>Inside the GPO Editor, go to:</p><pre>Computer Configuration → Policies → Windows Settings → Security Settings<br>→ Local Policies → Security Options</pre><h3>Step 4: Configure the Message</h3><p>Enable and configure these two policies:</p><h4>Interactive logon: Message title for users attempting to log on</h4><ul><li>Example:</li></ul><pre>TAPS - Computer Policy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CnGxyQkZGTTUCHAcFJU1Mg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wZ5uYEAKGnBkZiVcZJgSlQ.png" /></figure><h4>Interactive logon: Message text for users attempting to log on</h4><ul><li>Example:</li></ul><pre>Please take note of the following rules .....</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLlzvuwFi4kGDPWnkThPkQ.png" /></figure><h3>Step 5: Apply the Policy</h3><p>On a client machine:</p><pre>gpupdate /force</pre><p>Or restart</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_NgZR30Tlyt7w2Z9Vkg8Yg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P_cHpfvLTBAG8aQQ-OQdxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*haASPgqVfWen8-6ZM3h2fg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73e913c10b76" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>