<?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 Sean Nelson on Medium]]></title>
        <description><![CDATA[Stories by Sean Nelson on Medium]]></description>
        <link>https://medium.com/@seancnelsonis?source=rss-e45cd545228d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*m44HyjtPkQbJdmYZQyVVpg.png</url>
            <title>Stories by Sean Nelson on Medium</title>
            <link>https://medium.com/@seancnelsonis?source=rss-e45cd545228d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:08:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@seancnelsonis/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[Part 08 — Building a Security Operations Center Homelab (Preparing TheBrainStorage: Storage, RAID…]]></title>
            <link>https://medium.com/@seancnelsonis/part-08-building-a-security-operations-center-homelab-preparing-thebrainstorage-storage-raid-379b4b010711?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/379b4b010711</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[siem]]></category>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 09:30:25 GMT</pubDate>
            <atom:updated>2026-07-02T09:30:25.834Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 08 — Building a Security Operations Center Homelab (Preparing TheBrainStorage: Storage, RAID, and the Foundation for the SIEM)</h3><p>Hello everyone, and welcome back to the Building a Security Operation Center Series. Previously is <a href="https://medium.com/@seancnelsonis/part-07-building-a-security-operations-center-homelab-installing-opencanary-on-thegatewatcher-f2f2c7a0986f"><strong>Part 07</strong> we setup OpenCanary on TheGateWatcher.</a></p><p>In this part, we will be:</p><ul><li>Setting up the initial RAID 1 storage.</li><li>Setting up the Ext4 filesystem.</li><li>Mounting the drives onto the Pi.<br>Setting up the RAID Health Monitoring with email alerts.</li><li>Enhancing the security of the endpoint by disabling Wifi.</li><li>Enhancing the security of the endpoint by creating MFA.</li></ul><p>TheGateWatcher was about traffic. This is about persistence.</p><p>For this we will be using <strong>RAID 1</strong>. It will look like single block device.<br><strong>RAID 1 protects drive failure. NOT extra storage</strong>. We don’t have a RAID controller card and Pi has <strong>no hardware RAID options.</strong> We will be using a <strong>software RAID </strong>instead. The OS kernel will be doing the RAID. Best part is that modern CPUs make software RAID <strong>cheap / fast / easy</strong>. The perfect trifecta. :)</p><p>We will be using “<strong>Ext4</strong>” file storage for <strong>simplicity and proven reliability</strong> on Pi OS. We will be storing the log files on mount point called <strong>/mnt/hot.</strong> For the cold storage we will create a mount point called <strong>/mnt/cold</strong>. This is where we will connect an <strong>HDD</strong> for future offloading, <strong>long term storage</strong>.</p><p>The hardware list I am using is Penta SATA HAT, Raspberri Pi 5 8GB. Two generic 250GB SSDS.<br><a href="https://radxa.com/products/accessories/penta-sata-hat/">https://radxa.com/products/accessories/penta-sata-hat/</a><br><a href="https://www.raspberrypi.com/products/raspberry-pi-5/">https://www.raspberrypi.com/products/raspberry-pi-5/</a></p><p>The build sequence I am going to try and follow.</p><ol><li><strong>Verify hardware</strong> — lsblk, check Penta Hat detected both SSDs and the HDD. Confirms the hat is seated correctly and PCIe is enabled before we commit data to it</li><li><strong>Wipe/zero the drives</strong> — Ensures no stale partition tables.</li><li><strong>Install mdadm</strong> — This is the <strong>Multiple Device Administrator.</strong></li><li><strong>Create the RAID 1 array on the two SSDs — </strong>The core step. We’ll discuss chunk size, metadata version, and watch the initial sync</li><li><strong>Format as ext4</strong> — Again, simplicity and proven reliability</li><li><strong>Create mount points and mount manually</strong> — Prove it works before making it permanent</li><li><strong>Add entries to /etc/fstab. (noatime, nofail)</strong> — <strong>noatime</strong> reduces write load, <strong>nofail</strong> prevents boot hangs</li><li><strong>Verify mounts persist through a reboot</strong> — Never trust fstab until you’ve rebooted</li><li><strong>Set up a RAID health monitoring script / email alert</strong> — Silent RAID degradation is how people lose data</li><li><strong>Disable Wifi</strong> — Reduce attack surface</li><li><strong>Static IP configuration on the LAN (192.168.2.x)</strong> — TheBrainStorage needs a stable address so agents can find it</li><li><strong>SSH hardening + key-based auth from the Windows laptop</strong> — Enhanced security on this host.</li></ol><p>Stages 1–10 are the storage goals that sets up the Wazuh installation. Stages 11–12 are the networking goals. They’re short, but necessary to make TheBrainStorage reachable and manageable before Wazuh arrives.</p><p>Here is where I’m starting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/0*Sb6N5q0zkdXyvR6h" /><figcaption>This is before setting up the DHCP with TheBrainStorage. wlan0 is the wifi.</figcaption></figure><p>We will setup <strong>a DHCP reservation</strong> on <strong>TheGateWatcher </strong>later. The config lives in one place, TheGateWatcher. It’s easy to audit, and if we ever re-image TheBrainStorage, it still gets the same IP automatically.</p><p>As always, <strong>please read the entire article </strong>before trying to replicate. :)</p><h3><strong>1. Verify hardware</strong></h3><p>Let’s run this command to <strong>check if the SSDs are visible to the OS</strong>:</p><pre>lsblk</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/0*xT0g5r8PnhkOesID" /></figure><p><strong>No 250GB SSDs</strong>. Shame. We are looking for <strong>/sda and /sdb</strong>. There is a small ribbon cable called the <strong>SATA breakout cable </strong>that I haven’t connected yet. I will have to connect that. One end plugs into the hat, the other plugs into the Raspberri Pi.</p><p>We will also need to <strong>enable “dtparam=pciex1”. </strong>The device tree is how ARM Linux systems describe their hardware to the kernel. We’re telling the bootloader “<strong>enable the external PCIe x1 controller node</strong> in the device tree</p><p>Let’s edit the config file:</p><pre>sudo nano /boot/firmware/config.txt</pre><p>Add this line to the bottom:</p><pre>dtparam=pciex1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*iv4daDkCggsSblyBwrRYOQ.png" /><figcaption>See bottom of image</figcaption></figure><p>After installing the cable and saving the config, we restart our Pi. This will solidify the settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/0*x6QPUQYxPzhTaEy4" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*y0XDG_Dini-2O38x" /><figcaption>See <strong>sda </strong>and <strong>sdb</strong>. These are our new the SSD hardrives</figcaption></figure><h3>2. Wipe the SSDs</h3><p>We will be using the “<strong>wipefs”</strong> and “<strong>dd”</strong> as root. <strong>wipefs is a util-linux tool </strong>that’s installed by default on Pi OS. It exists specifically to erase filesystem signatures. <strong>dd is the classic Unix disk-duplication tool.</strong> powerful, blunt, unforgiving. :)</p><p>We are erasing any trace of any data on the <strong>sda</strong> and <strong>sdb.</strong></p><p><strong>Erases all filesystem and partition-table</strong> signatures that wipefs knows about. <br>-a means “all signatures.”</p><pre>wipefs -a /dev/sda</pre><p>Writes zeros over the first 100 MB of the drive. This step nukes anything <strong>wipefs</strong> might have missed:</p><pre>dd if=/dev/zero of=/dev/sda bs=1M count=100 status=progress</pre><ul><li>if=/dev/zero → input is an endless stream of zeros</li><li>of=/dev/sda → output is the raw drive</li><li>bs=1M → write in 1 MB blocks (fast)</li><li>count=100 → stop after 100 blocks = 100 MB</li><li>status=progress → show progress as it runs (useful; dd is silent by default)</li></ul><p><strong>Run wipefs one more time</strong> to confirm there&#39;s nothing left. If the first pass + dd worked, this <strong>second call will produce no output.</strong> Silence = success.</p><pre>wipefs -a /dev/sda</pre><p>Do a final check with:</p><pre>lsblk</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/0*ejUPK9p1mqGZv6VD" /><figcaption>Everything worked correctly :)</figcaption></figure><h3>3. Install mdadm</h3><p><strong>mdadm</strong> stands for “<strong>multiple device administration.</strong>” It’s a user space tool one command. That <strong>manages the Linux kernel’s md</strong> (multiple device) driver. The driver itself lives in the kernel and does the actual RAID work. <strong>mdadm is the control panel</strong> you use to create, monitor, assemble, and tear down RAID arrays. <strong>mdadm</strong> is the tool that’ll quietly run every time our Pi boots from now until we decommission this machine.</p><p>Start the installation:</p><pre>sudo apt update<br>sudo apt install mdadm -y</pre><p>Then verify:</p><pre>mdadm --version</pre><p>Confirm the binary installed and is executable. It would suck if it wasn’t :P</p><pre>cat /proc/mdstat</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*qJfrZOX5lYafxOcw9aAvlQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*XRMUYV1tANjQ5r4p" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*I_7_p2AtKvBVysNI" /><figcaption>Everything has installed correctly</figcaption></figure><h3>4. Create the RAID 1 array on the two SSDs</h3><p>We’re creating “<strong>/dev/md0”.</strong> A virtual block device that represents the <br>RAID 1 array. From this point forward:</p><ul><li>Anything written to <strong>/dev/md0</strong> is <strong>synchronously written to both</strong> <strong>/dev/sda</strong> and <strong>/dev/sdb</strong></li><li>Reads can come from either drive</li><li>If either drive fails, <strong>/dev/md0 keeps functioning</strong> on the survivor</li><li><strong>Metadata </strong>describes the array is written to the end of each drive, so the kernel can reassemble the array at boot even if drive letters shift</li><li><strong>Run the sync on fresh drives. </strong>It’s the kernel proving the mirror actually works before you trust it with data.</li></ul><p>Lets run the command to combine the hard drives:</p><pre>sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb</pre><ul><li>sudo — creating block devices requires root</li><li>mdadm --create /dev/md0 — make a new array, call it md0</li><li>--level=1 — RAID level 1 (mirror)</li><li>--raid-devices=2 — this array has 2 members</li><li>/dev/sda /dev/sdb — the two drives to use</li></ul><p><strong>mdadm will ask for confirmation</strong> because it’s a destructive operation. It’ll say something like: “Continue creating array?” type ‘y’</p><p>When the command succeeds, we run:</p><pre>cat /proc/mdstat</pre><p>You will see something like this:</p><pre>Personalities : [raid1]<br>md0 : active raid1 sdb[1] sda[0]<br>      244066368 blocks super 1.2 [2/2] [UU]<br>      [&gt;....................]  resync =  0.8% (2105600/244066368) finish=19.1min speed=210560K/sec<br>      bitmap: 2/2 pages [8KB], 65536KB chunk<br><br>unused devices: &lt;none&gt;</pre><p><strong>The sync will take 15–25 minutes</strong> to copy 232 GiB across. We <strong>do not</strong> <strong>have to wait </strong>for it to finish before moving on. The array is fully usable during sync.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/0*nJtJN-beUvrgo0BM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/0*QxNQAYQc4jl2ETc_" /><figcaption>Loading bar looks cool doesn’t it? :)</figcaption></figure><h3><strong>5. Format /dev/md0 as ext4</strong></h3><p>We’re laying down an <strong>ext4 filesystem on /dev/md0</strong>. From mdadm’s perspective, /dev/md0 is just a block device. It doesn’t know or care what filesystem sits on top. <strong>From ext4’s perspective, /dev/md0 is just a drive.</strong></p><h4>Why ext4 specifically</h4><ul><li><strong>ext4</strong> — Default on most Linux distros. Journaling filesystem, mature (since 2008), well-understood, excellent tooling Every sysadmin alive has debugged ext4 problems. No surprises.</li><li><strong>XFS</strong> — Excellent for huge files and high parallelism, but harder to shrink, and offers no real advantage on a 232 GiB RAID with SIEM-sized files</li><li><strong>btrfs</strong> — Modern, snapshots, built-in checksums, but has a complicated history, and its RAID support specifically has had multi-year stability questions.</li><li><strong>ZFS</strong> — Enterprise-grade, but not in the mainline kernel, licensing complications, memory-hungry (typically wants 1 GB RAM per TB of storage plus overhead). The Pi 5’s limited 8 GB RAM is better spent on Wazuh and Elasticsearch</li></ul><p><strong>Ext4 is the right answer for a Pi-hosted SIEM storage tier.</strong> Boring, proven, fast enough, debuggable. Exactly the qualities we want in the foundation layer of a security tool.</p><p>Let’s start with this command:</p><pre>sudo mkfs.ext4 -L hot /dev/md0</pre><ul><li>sudo — filesystem creation needs root</li><li>mkfs.ext4 — the ext4 formatter</li><li>-L hot — set a filesystem label called hot.</li><li>/dev/md0 — the target device</li></ul><p>We will expect to see something like this:</p><pre>mke2fs 1.47.x (date)<br>Creating filesystem with 61016608 4k blocks and 15261696 inodes<br>Filesystem UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx<br>Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, ...<br><br>Allocating group tables: done<br>Writing inode tables: done<br>Creating journal (262144 blocks): done<br>Writing superblocks and filesystem accounting information: done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/0*KF7zj9snyfaw8bkK" /></figure><p>After the format, label the drive:</p><pre>sudo blkid /dev/md0</pre><p>If LABEL=”hot” and TYPE=”ext4&quot; both appear, the format succeeded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/0*Sy6i-a1SpWRZxcB9" /><figcaption>Format succeeded!</figcaption></figure><h3>6. Create Mount Points and Mount Manually</h3><p>A mount point is just an empty directory that becomes <strong>the “doorway” into a filesystem.</strong></p><p>We need to do before writing files to the hard drives:</p><ul><li><strong>Prove the filesystem works</strong> before trusting it at boot</li><li><strong>Prove the mount point exists and the syntax is right</strong> before writing it into a file the boot process reads</li></ul><p>Let’s create the mount point:</p><pre>sudo mkdir -p /mnt/hot</pre><p>Mount the filesystem:</p><pre>sudo mount LABEL=hot /mnt/hot</pre><p>Verify with:</p><pre>df -h /mnt/hot</pre><p>Write a test file to prove that it worked:</p><pre>echo &quot;TheBrainStorage hot storage initialized $(date)&quot; | sudo tee /mnt/hot/.init-marker</pre><p>Then read it back:</p><pre>cat /mnt/hot/.init-marker<br>ls -la /mnt/hot/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/0*e6j1FN1lRJdTBlgB" /><figcaption>Excellent. it worked :D</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/0*MoDj2ObQWva3iRZI" /><figcaption>We can write to this directory now :)</figcaption></figure><h3>7. Add entries to /etc/fstab</h3><p><strong>/etc/fstab is the filesystem table. </strong>A plain text file listing every filesystem that should be mounted automatically at boot. These options are the difference between “Pi boots reliably forever” and “Pi hangs at boot when a drive has a minor hiccup.”</p><blockquote>FYI The RAID setup is still running in the background</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/0*V-e4GPvuOb5xVXar" /></figure><p>Let’s generate the <strong>mdadm config line for /dev/md0</strong>:</p><pre>sudo mdadm --detail --scan</pre><p>Expected output:</p><pre>ARRAY /dev/md0 metadata=1.2 name=TheBrainStorage:0 <br>UUID=xxxxxxxx:xxxxxxxx:xxxxxxxx:xxxxxxxx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/0*pd0pbuE3L6f7VWQD" /><figcaption>as expected</figcaption></figure><p><strong>Append the ARRAY line to mdadm.conf:</strong></p><pre>sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/0*fGDFUg7Hk1JYBmyt" /></figure><p><strong>Rebuild the initramfs</strong> so the mdadm config is embedded in the early-boot image with this command:</p><pre>sudo update-initramfs -u</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/0*bBxB0jy68Ofkp07y" /></figure><p><strong>Edit fstab:</strong></p><pre>sudo nano /etc/fstab</pre><p>We are going to scroll to the bottom and add this line exactly:</p><pre>LABEL=hot  /mnt/hot  ext4  defaults,noatime,nofail,x-systemd.device-timeout=30  0  2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*qXYPT9vodRj_pvA9" /></figure><p>Save and exit with:</p><pre>Ctrl+x<br>y<br>enter</pre><p>Test fstab syntax without rebooting:</p><pre>sudo umount /mnt/hot<br>sudo mount -a<br>df -h /mnt/hot</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/0*5oH4WqRjDOyL2vOe" /></figure><p>We now need to make sure the mount is still active:</p><pre>sudo systemctl daemon-reload</pre><p>Then verify everything is still good with:</p><pre>df -h /mnt/hot<br>cat /mnt/hot/.init-marker<br>cat /proc/mdstat</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/0*nadl1hIDTVy6ACuZ" /></figure><p>The RAID sync is also completed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*VTYIV86naT2Saj3Y" /></figure><p>Everything is now set. We need to test the</p><ul><li>Pi boots without hanging</li><li>/dev/md0 assembles from /dev/sda + /dev/sdb</li><li>/mnt/hot mounts the fstab entry</li><li>.init-marker is still readable, proving the RAID + ext4 + fstab are all working</li></ul><h3>8. Verify Mounts Persist Through A Reboot</h3><p>We reboot the Pi to see if everything hold together. :)</p><pre>sudo reboot</pre><p>We’ll run the full verification check:</p><pre>df -h /mnt/hot<br>cat /mnt/hot/.init-marker<br>cat /proc/mdstat<br>mount | grep md0<br>lsblk</pre><p>What each one checks:</p><ul><li>df -h /mnt/hot → mount came up automatically at boot</li><li>cat /mnt/hot/.init-marker → data is intact, filesystem is healthy</li><li>cat /proc/mdstat → RAID 1 assembled cleanly, [2/2] [UU], no resync in progress</li><li>mount | grep md0<strong> </strong>→ shows the actual mount options that systemd applied — should include rw, noatime, nofail</li><li>lsblk → full block-device view. Now you should see sda and sdb each with an md0 child that has a mountpoint of /mnt/hot. The tree-structured view makes the whole architecture visible at a glance.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*JmIfCWKaqzhJFg0K" /><figcaption>CELEBRATE WITH ME BABY ITS ALL GREEN :D</figcaption></figure><p>We didn’t need to run “<strong>mount</strong>” manually after the reboot.</p><p>“<strong>cat /mnt/hot/.init-marker</strong>” means data integrity confirmed!</p><p><strong>“/proc/mdstat” [</strong>2/2] [UU] + no resync — both drives up, bitmap clean, no dirty pages. The bitmap did its job across the reboot.</p><p><strong>“lsblk” </strong>Both hard drives are reading and mounted correctly</p><p>We’ll also us this command to check out process:</p><pre>systemctl status mnt-hot.mount</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/0*1l889b3d32NjAYXL" /></figure><h3>9. Set Up A RAID Health Monitoring Script</h3><p>Now that the array is running, we need it to tell us proactively if anything ever goes wrong.</p><p>Silent RAID degradation is the nightmare scenario: you think you have two working drives, but actually you have one failed drive and one lonely survivor. You only find out when the survivor dies too. “mdadm — monitor” prevents that.</p><h4><strong>mdadm — monitor</strong></h4><p>This is the daemon mode of mdadm that watches our arrays and reports on events. It will email or log events when something happens. Drive failure, drive removal, spare activation, resync start/complete, array degradation.</p><p>Runs periodic redundancy checks (monthly scrubs) via those three systemd timers we saw at install time</p><p>Three categories of events get reported:</p><ul><li><strong>Fail / DegradedArray: </strong>the critical ones. A drive has died or the array is running on fewer members than it should</li><li><strong>RebuildStarted / RebuildFinished / SpareActive: </strong>lifecycle events, less urgent but good to know</li><li><strong>TestMessage: </strong>used to verify your alerting pipeline works</li></ul><p>So here is what we’re going to do. We are going to setup an email notification giving us updates on the health of the hard drives and have the alerts be emailed to us at the end of every month. To show proof of concept, we are going to setup a Gmail account to receive these emails.</p><p>Here is what it looks like:</p><pre>mdadm detects drive event<br>    ↓<br>writes mail to local user &#39;root&#39; via /usr/sbin/sendmail<br>    ↓<br>msmtp (local mail agent) picks it up<br>    ↓<br>authenticates to smtp.gmail.com:587 using your Gmail app password<br>    ↓<br>Gmail delivers to homelab-alerts@gmail.com<br>    ↓<br>You see it on your phone</pre><p>Here is the Gmail account I created for this function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*2mw4A4LVyuwwAlIv" /><figcaption>Don’t bother sending emails to this account. I’m not reading them. :P</figcaption></figure><p>We also want to create an App password in Gmail, to send emails to our email address. I will explain even more in a bit.</p><h4>Generate the App Password</h4><ol><li>Go to <a href="https://myaccount.google.com/apppasswords">https://myaccount.google.com/apppasswords</a></li><li>If the page says “The setting you are looking for is not available for your account,” it means 2FA isn’t fully active yet. wait 5 minutes and refresh, or re-verify 2FA settings</li><li>App name field: type <strong>soc-homelab-alerts</strong></li><li>Click <strong>Create</strong></li><li>Google shows a 16-character password in a yellow box. It looks like this: “<strong>xxxx xxxx xxxx xxxx”</strong></li><li><strong>Copy it to a safe location now</strong> Google will never show it again.</li><li>Click <strong>Done</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/0*F_pAHcTjRvT2mOdX" /><figcaption>Write down the app password we will use it again in a second.</figcaption></figure><p>On TheBrainStorage, we are going to setup a local mail server that can send and read emails. We don’t need the reading emails part, just the sending.</p><p>Two tools get installed. “<strong>bsd-mailx” </strong>and<strong> “sendmail</strong>”. This is for the email server infrastructure. Debian keeps its mail infrastructure modular. The <strong>mail command doesn’t know how to deliver mail.</strong> <strong>bsd-mailx </strong>will pull in a minimal <strong>sendmail </strong>wrapper as a dependency. This is the interface that <strong>mdadm </strong>actually calls (<strong>/usr/sbin/sendmail</strong>). That “something” will be <strong>msmtp-mta</strong>.</p><pre>sudo apt update<br>sudo apt install bsd-mailx -y</pre><pre>which mail<br>which sendmail</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/0*2QNbGOiSRtMwLf58" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/0*DhNQnl1uBvaDb211" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/0*Chr6frU95SBCALbk" /><figcaption><strong>AppArmor</strong> is a Linux kernel security module that enforces per-program permission policies. It’s <strong>mandatory access control</strong> (MAC).</figcaption></figure><p>Now that we’ve created the local infrastructure we now need tools to send the emails</p><p>We now install <strong>“msmtp”</strong> and “<strong>msmtp-mta”</strong></p><p>This single piece of config is what turns “mdadm has a failure event” into “email arrives on your phone.” Every future system daemon you care about like cron, fail2ban, unattended-upgrades, and Wazuh if it generates local mail, will benefit from this same pipeline. Once configured, any Pi script can run “<strong>echo “alert” | mail -s “subject” </strong><a href="/service/mailto:soc.homelab.alerts@gmail.com"><strong>soc.homelab.alerts@gmail.com</strong></a><strong><em>” </em></strong>It&#39;s foundational infrastructure. It’s fantastic. :)</p><p>Install <strong>msmtp </strong>and <strong>msmtp-mta</strong>:<br><em>MTA stand for (Mail Transfer Agent).</em></p><pre>sudo apt install msmtp msmtp-mta -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*kEN5Gq0Zu4iweyUQ" /></figure><p>Edit the <strong>msmtprc </strong>file<br>The <strong>msmtprc </strong>will look something like this:</p><pre>sudo nano /etc/msmtprc</pre><pre># msmtp system-wide configuration for TheBrainStorage<br># Sends outbound mail via Gmail SMTP for homelab alerts<br><br># Defaults for all accounts<br>defaults<br>auth           on<br>tls            on<br>tls_trust_file /etc/ssl/certs/ca-certificates.crt<br>tls_starttls   on<br>logfile        /var/log/msmtp.log<br><br># Gmail account<br>account        gmail<br>host           smtp.gmail.com<br>port           587<br>from           soc.homelab.alerts@gmail.com<br>user           soc.homelab.alerts@gmail.com<br>password       PASTE_YOUR_16_CHAR_APP_PASSWORD_HERE<br><br># Default account for mail with no explicit account<br>account default : gmail<br><br># Map local root to this account&#39;s From: address with display name<br>aliases        /etc/aliases</pre><p>Replace “<strong>PASTE_YOUR_16_CHAR_APP_PASSWORD_HERE”</strong> with your actual 16-character app password from your text file from before. No spaces. No quotes around it.</p><p>Save and exit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*_NF5lMJWVftB40Ja" /></figure><p>Set the permissions on the config:</p><pre>sudo chmod 600 /etc/msmtprc<br>sudo chown root:root /etc/msmtprc<br>ls -la /etc/msmtprc</pre><p>You should see:</p><pre>-rw------- 1 root root &lt;size&gt; &lt;date&gt; /etc/msmtprc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/0*I4KnM9I4rgtP-t3T" /></figure><p>Create the logfile and set permissions:</p><pre>sudo touch /var/log/msmtp.log<br>sudo chmod 666 /var/log/msmtp.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*bB8o6_JjV3pjiG0YqBm0-w.png" /></figure><p>Set up aliases file:</p><pre>sudo nano /etc/aliases</pre><p>Most of the file will already exist. Scroll to the bottom and add:</p><pre>root: soc.homelab.alerts@gmail.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*PyEOTfNSYG6JqKupXQ1hhA.png" /></figure><p>Save and Exit</p><p>Set the FROM display name for root’s outbound mail:</p><pre>sudo nano /etc/msmtprc</pre><p>Change:</p><pre>from           soc.homelab.alerts@gmail.com</pre><p>to:</p><pre>from           &quot;SOC Homelab Alerts&quot; &lt;soc.homelab.alerts@gmail.com&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*nWv9Myiu9gG-PZow" /></figure><p>Send a test email directly through <strong>msmtp </strong>to prove the pipeline works:</p><pre>echo -e &quot;Subject: Stage 10b test from TheBrainStorage\n\nThis is a test email sent directly via msmtp from TheBrainStorage.\n\nIf you received this, outbound SMTP works.&quot; | msmtp soc.homelab.alerts@gmail.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*NbMdBfghc6ebth9_Mn567w.png" /><figcaption>Noooooooooooooooooooooooooooooooooooooooooooooooooooo</figcaption></figure><p>It appears we’ve run into a error. Lets look at the logs:</p><pre>sudo cat /var/log/msmtp.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*CHH-tYxdSNfGQ7Zg" /></figure><p>Gmail is rejecting the envelope-from address. “<strong>smtpstatus=555”</strong> means the server doesn’t recognize the command as valid specifically, the envelope from syntax is malformed.</p><p>msmtp.log is telling us “SOC Homelab Alerts” &lt;<a href="/service/mailto:soc.homelab.alerts@gmail.com">soc.homelab.alerts@gmail.com</a>&gt; is not a valid envelope from. <br>msmtp.log is right.</p><p>Lets go back into “<strong>/etc/msmtprc”:</strong></p><pre>sudo nano /etc/msmtprc</pre><p>Change</p><pre>from           &quot;SOC Homelab Alerts&quot; &lt;soc.homelab.alerts@gmail.com&gt;</pre><p>Back to:</p><pre>from           soc.homelab.alerts@gmail.com</pre><p>Save and exit. Now we have an actual email.</p><p>We still want the display name to appear in the recipient’s inbox. Add “<strong>set_from_header on” </strong>to the bottom</p><pre># Gmail account<br>account           gmail<br>host              smtp.gmail.com<br>port              587<br>from              soc.homelab.alerts@gmail.com<br>user              soc.homelab.alerts@gmail.com<br>password          &lt;your-16-char-app-password&gt;<br>set_from_header   on</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*arSSwtQt4oHqcbvR" /><figcaption>The giant red blocks on the left are from hitting tabs a few times. Visual bug.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/0*Xyp7cx3uKp_yTAMN" /><figcaption>No errors! Woot! Woot! :D</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IzgGfivOWgpAAIMT" /><figcaption>AAYYYYYY IT WORKED!</figcaption></figure><p><em>Real quick<br></em>The “Stage 10b test” comes from my Claude chat. I relabeled and reformatted the instructions I got to make sure it flows better. All the commands should still the same. ❤</p><p>Now we aren’t done setting up the health monitoring just yet. That email was the test. Now we need the real alerts.</p><p>This stage connects mdadm’s alerting to the email pipeline we just built. Specifically:</p><ol><li>Tell mdadm.conf where to send alerts via a “<strong>MAILADDR”</strong> line</li><li>Tell mdadm.conf the “<strong>From:”</strong> address via a “<strong>MAILFROM”</strong> line (optional but useful for threading)</li><li>Restart “<strong>mdmonitor.service”</strong> so it picks up the config change</li><li>Fire a test event via “<strong>mdadm — monitor — scan — test — oneshot”</strong></li><li>Verify the test alert arrives in Gmail</li></ol><p>Add MAILADDR and MAILFROM to mdadm.conf:</p><pre>sudo nano /etc/mdadm/mdadm.conf</pre><p>Add these to the bottom of the file</p><pre>MAILADDR soc.homelab.alerts@gmail.com<br>MAILFROM soc.homelab.alerts@gmail.com</pre><p>Save and exit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/0*jQvU6IYdghP3d_4x" /></figure><p>Confirm the save landed:</p><pre>sudo cat /etc/mdadm/mdadm.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/0*VnGnqMrPUFuqwvT-" /></figure><p>Verify the mdmonitor daemon is enabled and running:</p><pre>sudo systemctl status mdmonitor.service</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*SR34tCe9ncBt1vck" /></figure><p>Restart mdmonitor so it picks up the new MAILADDR</p><pre>sudo systemctl restart mdmonitor.service<br>sudo systemctl status mdmonitor.service</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/0*ri-BDcuz1zQWwvGQ" /></figure><p>Fire a test event:</p><pre>sudo mdadm --monitor --scan --test --oneshot</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/0*YEqV7Q2kipXxq8I2" /></figure><p>Watch the journal for the test event:</p><pre>sudo journalctl -u mdmonitor.service --since &quot;2 minutes ago&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/0*5AXSbBq3xnoQE-ui" /></figure><p>Watch the msmtp log for the outbound send:</p><pre>sudo tail -20 /var/log/msmtp.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RZgxEHfxgNIi5GKR7enj1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EHq1lKfj7gatJY2TEFoeMg.png" /><figcaption>GORGEOUS BABY GORGEOUS</figcaption></figure><p>It passed the test! Now we hookup the real service, and have it run every month.</p><p>First, Let’s create the service:</p><pre>sudo nano /etc/systemd/system/mdadm-canary.service</pre><p>Copy and paste:</p><pre>[Unit]<br>Description=Monthly mdadm alert canary<br>Documentation=man:mdadm(8)<br><br>[Service]<br>Type=oneshot<br>ExecStart=/usr/sbin/mdadm --monitor --scan --test --oneshot</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*7CrDk863yV0_Ub-z" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/0*4PpFQHK5322fE6o5" /></figure><p>Create the timer unit:</p><pre>sudo nano /etc/systemd/system/mdadm-canary.timer</pre><p>Copy and paste:</p><pre>[Unit]<br>Description=Run mdadm alert canary monthly<br>Documentation=man:systemd.timer(5)<br><br>[Timer]<br>OnCalendar=monthly<br>Persistent=true<br>RandomizedDelaySec=1h<br><br>[Install]<br>WantedBy=timers.target</pre><ul><li>OnCalendar=monthly — fires at 00:00 on the 1st of every month.</li><li>Persistent=true — if the Pi was off when the timer should have fired (e.g., power outage on the 1st), it runs the task as soon as the Pi comes back online. Without this, a missed fire = missed canary for the entire month.</li><li>RandomizedDelaySec=1h — spreads the actual execution within a 1-hour window after the scheduled time. Good practice for any scheduled task. Keeps the pattern professional.</li><li>WantedBy=timers.target — the Install section is what lets us systemctl enable the timer.</li></ul><p>Exit and save.</p><p>Now I would like this alert to go off at the start of every month at 9am. I want to be able to catch it during waking hours.</p><p>I will need to update the canary timer:</p><pre>sudo nano /etc/systemd/system/mdadm-canary.timer</pre><p>Change “<strong>OnCalendar=monthly</strong>” to “<strong>OnCalendar=*-*-01 09:00:00</strong>”<br>Change: Description=Run mdadm alert canary monthly<br>to: Description=Run mdadm alert canary on the 1st of each month at 9 AM</p><pre>[Unit]<br><strong>Description=Run mdadm alert canary on the 1st of each month at 9 AM</strong><br>Documentation=man:systemd.timer(5)<br><br>[Timer]<br><strong>OnCalendar=*-*-01 09:00:00</strong><br>Persistent=true<br>RandomizedDelaySec=1h<br><br>[Install]<br>WantedBy=timers.target</pre><ul><li>* (first) → any year</li><li>* (second) → any month</li><li>01 → day 1 of the month</li><li>09:00:00 → at 9:00:00 local time</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*0Yir0ZURMlGt4-pR" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/0*zMgNYRpl_r5yhhNp" /></figure><p>Reload systemd to pick up the new config:</p><pre>sudo systemctl daemon-reload</pre><p>Enable and start the timer:</p><pre>sudo systemctl enable --now mdadm-canary.timer</pre><p>Verify the timer is scheduled correctly:</p><pre>systemctl list-timers mdadm-canary.timer</pre><p>You will see something like this:</p><pre>NEXT                         LEFT      LAST PASSED UNIT                      ACTIVATES<br>Fri 2026-05-01 09:00:00 EDT  10 days   -    -      mdadm-canary.timer        mdadm-canary.service</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/0*1QdZu4zpCLu8tVxo" /></figure><p>Verify the service unit works by triggering it manually:</p><pre>sudo systemctl start mdadm-canary.service</pre><pre>sudo systemctl status mdadm-canary.service</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/0*C1Ld66vJM8xROigL" /></figure><p>I am making this post loooooong after this has completed. Here are the photos over the months :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RtAFzXgU6pvQtRyLtywyGw.png" /><figcaption>May 1st</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gWxLbQZdUtN5TslxzyGfig.png" /><figcaption>June 1st</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KlVrocXecGSppdjqjGmb1w.png" /><figcaption>July 1st</figcaption></figure><h3>Stage 10 — Disable WiFi</h3><p><strong>“dtoverlay=disable-wifi”</strong> is a device-tree overlay that unbinds the BCM43455 wireless chip on the Pi 5 from the kernel&#39;s driver stack. The chip stops being visible as “wlan0”.</p><ul><li><strong>Reduced attack surface <br></strong>An attacker within WiFi range (neighbor, drive-by, parking lot) can’t probe a radio that isn’t powered on. They can’t fingerprint the Pi, they can’t launch KARMA attacks, they can’t even see it exists as a wireless device.</li><li><strong>Eliminates rogue-AP risk<br></strong>If TheBrainStorage ever accidentally associated with a WiFi network (e.g., if a forgotten configured SSID appeared nearby), you’d have a machine on two networks simultaneously, which would defeat the whole segmentation concept we built in TheGateWatcher.</li></ul><p>Lets start by editing the config.txt file:</p><pre>sudo nano /boot/firmware/config.txt</pre><p>Add this to the bottom:</p><pre>dtoverlay=disable-wifi</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/0*Ceee832ZJFBE-F4y" /></figure><p>Save and exit<br>Verify with:</p><pre>tail -n 10 /boot/firmware/config.txt</pre><p>and:</p><pre>sudo reboot</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/0*ZJtjDw23xtvUj4qX" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/0*unxUOLXD0xHyiO5A" /></figure><p>Once SSHed back in check to see if wlan0 is gone:</p><pre>ip addr</pre><p>Verify everything else came back up as well:</p><pre>df -h /mnt/hot<br>cat /proc/mdstat<br>sudo systemctl status mdmonitor.service<br>sudo systemctl list-timers mdadm-canary.timer</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/0*Vq38OMV8n2Iruqpv" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*ztbssJowBa-Y0Cqh" /></figure><p>After leaving the device on over night I ran some commands again to check its condition.</p><pre>df -h /mnt/hot<br>cat /proc/mdstat<br>sudo systemctl status mdmonitor.service --no-pager | head -10<br>sudo systemctl list-timers mdadm-canary.timer<br>cat /mnt/hot/.init-marker<br>ip addr</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*GzhwRmoNwxjoWEALp7Qe4Q.png" /><figcaption>Everything is still green :)</figcaption></figure><h3>Stage 11 — Static IP configuration on the LAN (192.168.2.x)</h3><p>We’re adding a static lease binding. Arule that says “Whenever MAC address “<strong>2c:cf:67:aa:ac:34”</strong> requests a DHCP lease, always respond with “<strong>192.168.2.10” </strong>for this specific hostname.&quot; Everything else about DHCP stays the same; we&#39;re just pinning one MAC to one IP.</p><ul><li><strong>“/etc/dnsmasq.d/*.conf ”</strong> — Where we&#39;ll add the reservation. Pi OS uses a <br>“/<strong>etc/dnsmasq.d/” </strong>drop-in directory pattern; we&#39;ll add a new file there rather than editing the main “<strong>/etc/dnsmasq.conf”</strong>.</li><li><strong>TheGateWatcher’s DHCP pool</strong> — currently 192.168.2.10–200. The reserved IP should be within this pool. 192.168.2.10 is at the very start of the pool, which is the cleanest placement.</li><li><strong>TheBrainStorage’s network renewal</strong> — after dnsmasq restarts with the reservation in place, TheBrainStorage will pick up the new IP the next time it renews its lease.</li></ul><h4>Why the /etc/dnsmasq.d/ pattern specifically</h4><ol><li><strong>Drop in directories let you version config as small pieces.</strong> <br>Each logical piece of DHCP configuration lives in its own file. If you need to remove DHCP reservations later, you delete one file instead of editing a big monolithic config. Much friendlier to version control and easier to audit.</li><li><strong>The main “dnsmasq.conf”</strong> <strong>stays clean.</strong> <br>Most distros ship dnsmasq.conf with hundreds of commented-out example lines. Modifying it risks breaking the upstream comments and makes later distro upgrades messier. The drop-in directory is the modern, preferred way.</li></ol><p>Lets go back over to TheGateWatcher and run:</p><pre>ls -la /etc/dnsmasq.d/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/0*7eUlNwtyHqchTbg9" /></figure><p>Create the reservations file:</p><pre>sudo nano /etc/dnsmasq.d/10-reservations.conf</pre><p>Paste:</p><pre># Static DHCP reservations for TheGateWatcher&#39;s LAN (192.168.2.0/24)<br># Format: dhcp-host=MAC,HOSTNAME,IP[,LEASE_TIME]<br><br># TheBrainStorage — SIEM host<br>dhcp-host=2c:cf:67:aa:ac:34,TheBrainStorage,192.168.2.10,infinite</pre><ul><li>2c:cf:67:aa:ac:34 — MAC address to match</li><li>TheBrainStorage — dnsmasq will also register this in its DNS.</li><li>192.168.2.10 — the reserved IP</li><li>infinite — lease never expires for this reservation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*nEVumtc2WAWrUcl1" /></figure><p>Save and exit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/0*bEue_7ylWuPqnd8v" /></figure><p>Test and restart dnsmasq:</p><pre>sudo dnsmasq --test</pre><pre>sudo systemctl restart dnsmasq<br>sudo systemctl status dnsmasq --no-pager | head -15</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/0*PEHmB7nEjMs_ajLN" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*uiSyee6-Y_vlzO0Zh6TmXQ.png" /><figcaption>The red text is an exit with an error. The error is that port 53 is already in use.</figcaption></figure><p>Verify the reservation is recognized:</p><pre>sudo grep -r &quot;dhcp-host&quot; /etc/dnsmasq.d/ /etc/dnsmasq.conf 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DKzN1BGYpoVYQrBm" /><figcaption>The reservation is recognized regardless of the error.</figcaption></figure><h4>Port 53 already in use?</h4><p>Let’s search whats on TheGateWatcher on port 53 to see whats going on.</p><p>What’s bound to port 53?<br>Is pihole-FTL running?<br>Is dnsmasq enabled at boot?<br>What does Pi-hole say about DHCP?<br>Check dnsmasq’s existing config for any port/DNS-related directives</p><p>Let’s run:</p><pre>sudo ss -tulpn | grep -E &#39;:53|:67&#39;<br>sudo systemctl status pihole-FTL --no-pager | head -10<br>sudo systemctl is-enabled dnsmasq<br>sudo systemctl is-active dnsmasq<br>grep -E &quot;^(DHCP_|DHCPv6_)&quot; /etc/pihole/pihole.toml 2&gt;/dev/null || sudo cat /etc/pihole/setupVars.conf 2&gt;/dev/null | grep -i dhcp<br>sudo grep -rE &quot;^(port|no-resolv|bind-interfaces|domain-needed|bogus-priv|except-interface|listen-address)&quot; /etc/dnsmasq.conf /etc/dnsmasq.d/ 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4-fh8vN3eplqtivx" /></figure><p>Yup. Pihole is the real boss here. Not dnsmasq. dnsmasq isn’t even active.</p><p>Let’s back track and go through Pihole’s config.</p><p>Remove the config file we created:</p><pre>sudo rm /etc/dnsmasq.d/10-reservations.conf</pre><p>Reset the dnsmasq state:</p><pre>sudo systemctl reset-failed dnsmasq<br>sudo systemctl is-active dnsmasq</pre><p>Verify Pihole’s DHCP config</p><pre>sudo pihole-FTL --config dhcp.active<br>sudo pihole-FTL --config dhcp.start<br>sudo pihole-FTL --config dhcp.end<br>sudo pihole-FTL --config dhcp.hosts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/0*OOE2qlXnvtaGwQrM" /></figure><pre>sudo pihole-FTL --config dhcp.active<br>sudo pihole-FTL --config dhcp.hosts<br>sudo cat /var/lib/pihole/dhcp.leases</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*ek4KG4XTRJn5s7WU" /></figure><ul><li><strong>dhcp.active = true</strong> — Pi-hole owns DHCP</li><li><strong>dhcp.start = 192.168.2.10, dhcp.end = 192.168.2.200</strong> — correct range</li><li><strong>dhcp.hosts = []</strong> — empty, no reservations yet</li><li><strong>dhcp.leases</strong> file doesn&#39;t exist yet — TheBrainStorage hasn&#39;t gotten a lease from Pi-hole yet. This makes sense if it&#39;s been sitting on a static IP set directly via NetworkManager</li></ul><h4>Add the DHCP Reservation</h4><p>The syntax for “<strong>dhcp.hosts”</strong> is a JSON array of strings, each in the format <strong>“MAC,IP,hostname,leasetime”</strong>. Let’s run:</p><pre>sudo pihole-FTL --config dhcp.hosts &#39;[&quot;2c:cf:67:aa:ac:34,192.168.2.10,TheBrainStorage,24h&quot;]&#39;</pre><p>Verify it worked:</p><pre>sudo pihole-FTL --config dhcp.hosts</pre><p>Restart Pihole to apply changes</p><pre>sudo systemctl restart pihole-FTL<br>sudo systemctl status pihole-FTL</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/0*EMZQRTjYLqWab0m_" /><figcaption>We did something like this in Part 4. I was connecting my Xbox. Talk about déjà vu eh? :P</figcaption></figure><p>TheBrainStorage actually needs to pick up the lease. SSH into <strong>TheBrainStorage</strong> and let’s run to reset the connection:</p><pre>sudo nmcli connection down &quot;Wired connection 1&quot; &amp;&amp; sudo nmcli connection up &quot;Wired connection 1&quot;</pre><p>Check which IP it got:</p><pre>ip addr show eth0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/0*dnueFWdlmQoSQBYY" /><figcaption>Look closely. Host has the wrong IP address. It needs to be 192.168.2.10 not 192.168.2.97.</figcaption></figure><p>Let’s try again and get the actual connection name:</p><pre>nmcli connection show</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/0*pQjx2FXbv3UeBAdb" /></figure><p>The connection name is <strong>netplan-eth0</strong></p><pre>sudo nmcli connection down netplan-eth0 &amp;&amp; sudo nmcli connection up netplan-eth0</pre><p>Check the IP:</p><pre>ip addr show eth0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/0*s1Cr46UQV24BDZ3p" /><figcaption>The change landed! Look at the IP in purple. 192.168.2.10.</figcaption></figure><h3>Stage 12- SSH Hardening / Key Based Auth</h3><p>An SSH key is a cryptographic key pair. A private key that never leaves your laptop and a public key on the server. Authentication works by the server challenging your client to prove it holds the private key, without the private key ever traveling over the wire. An attacker watching the network sees nothing useful. An attacker who gets into TheGateWatcher gets your public key, which is worthless without the private half.</p><p>Why should we do this anyway? What does this prevent?</p><ul><li><strong>Brute force</strong> — an attacker can try millions of passwords per second against your SSH port.</li><li><strong>Credential stuffing</strong> — if you reuse passwords, a breach elsewhere compromises this too.</li><li><strong>Keyloggers</strong> — malware on your Windows laptop captures the password as you type it</li><li><strong>Phishing</strong> — you can be tricked into typing it somewhere you shouldn’t</li></ul><p>None of these attacks work because they need the key file. Classic MFA.</p><h4>Generate the key pair (Windows laptop)</h4><pre>ssh-keygen -t ed25519 -C &quot;chipmunk-laptop-to-brainstorage&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ydL-HV75PYstD8VY" /></figure><p><strong>Copy the public key to TheBrainStorage:</strong></p><pre>type $env:USERPROFILE\.ssh\sshkey_brainstorage.pub | ssh brainstorage@192.168.2.10 &quot;mkdir -p ~/.ssh &amp;&amp; chmod 700 ~/.ssh &amp;&amp; cat &gt;&gt; ~/.ssh/authorized_keys &amp;&amp; chmod 600 ~/.ssh/authorized_keys&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1tRMnJxeajsYGEi7nkbB4Q.png" /><figcaption>The .pub file can&#39;t be found at the default .ssh path. That&#39;s because we saved it as sshkey_brainstorage during keygen, which likely put it in the current directory PowerShell was running from, not in ~\.ssh\.</figcaption></figure><p>Then move the keys into the proper storage folder:</p><pre>Move-Item .\sshkey_brainstorage $env:USERPROFILE\.ssh\sshkey_brainstorage<br>Move-Item .\sshkey_brainstorage.pub $env:USERPROFILE\.ssh\sshkey_brainstorage.pub</pre><p>Retry the copy:</p><pre>type $env:USERPROFILE\.ssh\sshkey_brainstorage.pub | ssh brainstorage@192.168.2.10 &quot;mkdir -p ~/.ssh &amp;&amp; chmod 700 ~/.ssh &amp;&amp; cat &gt;&gt; ~/.ssh/authorized_keys &amp;&amp; chmod 600 ~/.ssh/authorized_keys&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AlsqGH6usUGUvy_c" /></figure><p>Verify the key landed on TheBrainStorage:</p><pre>cat ~/.ssh/authorized_keys</pre><p>Move the keys into the correct folder and make it readable:</p><pre>sort -u ~/.ssh/authorized_keys &gt; ~/.ssh/authorized_keys.tmp &amp;&amp; mv ~/.ssh/authorized_keys.tmp ~/.ssh/authorized_keys<br>chmod 600 ~/.ssh/authorized_keys</pre><pre>cat ~/.ssh/authorized_keys</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/0*9_ZGBGY-VjjErxNK" /></figure><p>Now lets harden <strong>sshd_config </strong>to require both key and password. <br>On TheBrainStorage:</p><pre>sudo nano /etc/ssh/sshd_config</pre><p>We have to find these lines and set them accordingly:</p><pre>PubkeyAuthentication yes<br>PasswordAuthentication yes<br>AuthenticationMethods publickey,password<br>PermitRootLogin no</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/0*cReNUtRquBtunpIf" /><figcaption>Do you see the syntax error that I made? :)</figcaption></figure><p>Save and exit.</p><p>Restart SSH for the changes to take effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/0*mXRrgpCjPicK7s-i" /><figcaption>The status=255/EXCEPTION from sshd -t means there&#39;s a syntax problem in the config. Look at the previous image. See that one line at the bottom that says “<strong>ation no”?</strong> That’s the error. it must have come of the other white text above it “<strong>KbdInteractiveAuthentication no” </strong>while copying and pasting</figcaption></figure><p>After deleting “ation bo” we restart SSH to apply the changes</p><pre>sudo systemctl restart ssh<br>sudo systemctl status ssh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/0*aUeTDntUzAhfrKzU" /></figure><p>Now lets try logging in with the new key:</p><pre>ssh -i $env:USERPROFILE\.ssh\sshkey_brainstorage brainstorage@192.168.2.10</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/0*wW0fQnRQwa581QwF" /><figcaption>2FA has been enabled. :)</figcaption></figure><h3>Conclusion</h3><p>Thank you for joining me in part 08.<br>This was a long one and I’m happy you stuck with me through this. :)</p><p>In this part we:</p><p>Setup the initial RAID 1 storage.<br>Setup the Ext4 filesystem.<br>Mounted the drives onto the Pi<br>Setup the RAID Health Monitoring with email alerts<br>Enhanced the security of the endpoint by disabling Wifi<br>Enhanced the security of the endpoint by creating MFA</p><p>With this now complete. We can now look towards setting up the Wazuh SIEM in the next part. I hope to see you there. ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=379b4b010711" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 07 — Building a Security Operations Center Homelab (Installing OpenCanary on TheGateWatcher)]]></title>
            <link>https://medium.com/@seancnelsonis/part-07-building-a-security-operations-center-homelab-installing-opencanary-on-thegatewatcher-f2f2c7a0986f?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2f2c7a0986f</guid>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[honeypot]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[opencanary]]></category>
            <category><![CDATA[cybersecurity-engineer]]></category>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 15:28:01 GMT</pubDate>
            <atom:updated>2026-04-19T16:09:28.229Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, and welcome back to the Building a Security Operation Center Series. :) Previously, in <strong>Part 06 </strong>we installed and setup <strong>Zeek</strong>.<br><a href="https://medium.com/@seancnelsonis/part-06-building-a-security-operations-center-homelab-installing-zeek-on-thegatewatcher-89180cfc0fa7">Part 06 — Building a Security Operations Center Homelab (Installing Zeek on TheGateWatcher)</a></p><p>Today, we are installing <strong>OpenCanary</strong> on our perimeter host.</p><h3>OpenCanary — The Who, What, Where, When, Why &amp; How</h3><h4>WHO made it?</h4><p>OpenCanary was built by <strong>Thinkst Canary. </strong>ASouth African cybersecurity company founded by Haroon Meer and Marco Slaviero. Thinkst is known in the security industry for making deception technology genuinely practical rather than theoretical. Their commercial product (Canary Tokens and physical Canary devices) is used by enterprise SOCs worldwide. <strong>OpenCanary is the open-source version</strong> of that same philosophy, released so that home labbers and small security teams can deploy the same honeypot logic without the commercial price tag.</p><p>The project lives on GitHub at <strong>thinkst/opencanary</strong> and is actively maintained.</p><h4>WHAT is it?</h4><p>OpenCanary is a <strong>low-interaction honeypot daemon</strong>. It runs as a service and simulates a variety of network services without actually running those services for real. When anything connects to one of those fake services, OpenCanary logs it and fires an alert.</p><p>Here’s the critical distinction worth understanding before installation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*ozrJXi9acBbBiGJ7eVpsPQ.png" /></figure><p>The daemon is <strong>intentionally shallow. </strong>It’s not meant to fool a sophisticated attacker for long. It doesn’t need to. Its job is to be the first thing a scanner or lateral-movement tool touches, log that contact, and alert. Even a single packet hitting OpenCanary is meaningful intelligence.</p><p><strong>Services OpenCanary can emulate:</strong></p><ul><li>SSH</li><li>HTTP / HTTPS</li><li>FTP</li><li>Telnet</li><li>SMB (Windows file shares)</li><li>MySQL</li><li>MSSQL</li><li>VNC</li><li>RDP</li><li>SIP (VoIP)</li><li>SNMP</li><li>NTP</li><li>TFTP</li><li>Git</li><li>Redis</li><li>TCP banner (generic)</li></ul><p>We can configure which ones to enable.</p><h4>WHERE does it live in our architecture?</h4><pre>Internet<br>    │<br>    ▼<br>[Telus Router 192.168.1.41]<br>    │ WAN (192.168.1.99)<br>    ▼<br>[TheGateWatcher - eth2]<br>    │ nftables → NAT → routing<br>    │ Suricata watching eth1 + eth2<br>    │ Zeek watching eth1 + eth2<br>    │ Pi-hole on eth1<br>    │ OpenCanary ← NEW, listening on eth1 LAN<br>    │ (eth1 = 192.168.2.1/24)<br>    ▼<br>[TP-Link Unmanaged Switch]<br>    ├── TheBrainStorage (192.168.2.x)<br>    ├── Windows Laptop (192.168.2.x)<br>    └── Xbox (192.168.2.122)</pre><p>OpenCanary listens on the <strong>LAN-side interface (eth1)</strong> with a fake IP address. One that has no business being used by any real device. If any device on our LAN reaches out to it, that’s an immediate red flag. Either something is scanning our LAN, or a device has been compromised and is doing lateral movement.</p><h4>WHEN should something trigger it?</h4><p>The answer is simple. <strong>Never, under normal operation.</strong></p><p>That’s OpenCanary’s superpower and what makes it fundamentally different from every other tool we’ve installed so far.</p><ul><li>Suricata has false positives, benign traffic that matches a rule pattern.</li><li>Zeek logs everything, most of it is completely normal.</li><li>Pi-hole blocks DNS queries, but some blocks are for legitimate sites on aggressive blocklists.</li></ul><p><strong>OpenCanary has zero false positives by design.</strong> No legitimate device on your network has any reason to connect to a fake IP running fake services. The moment something touches it, the alert is real. Full stop.</p><p>This makes it the highest signal to noise tool in our entire stack. One alert from OpenCanary is worth investigating immediately. That’s a powerful thing to have in our home SOC.</p><h4>WHY add it after Suricata and Zeek?</h4><p>Our tools so far covers <strong>perimeter traffic inspection</strong>:</p><ul><li>Suricata: signature-based alerts on traffic transiting TheGateWatcher</li><li>Zeek: behavioral forensic logs of everything transiting TheGateWatcher</li></ul><p>What they don’t cover: <strong>internal reconnaissance by an attacker who’s already inside</strong>.</p><p>If a device on your LAN is compromised malware on the Xbox, a rogue device someone plugged into the switch, a browser exploit on your laptop Suricata and Zeek see that device’s <em>outbound</em> traffic to the internet. What they don’t necessarily catch is that device <strong>quietly scanning your LAN</strong> looking for other targets.</p><p>OpenCanary is purpose-built for exactly that scenario. It sits silently on your LAN, looking like just another device, and waits. The moment that compromised device starts scanning, which attackers always do, it finds OpenCanary’s fake services, touches them, and trips the wire.</p><p>This is <strong>detection in depth</strong>: multiple layers, each catching something the others miss.</p><h4>HOW does it work technically?</h4><p>OpenCanary is a <strong>Python daemon</strong>, specifically a Twisted based async service. This is relevant because it means:</p><ul><li>It installs via <strong>pip</strong> into a virtual environment (not <strong>apt</strong>) we&#39;ll handle this carefully</li><li>It runs as a systemd service</li><li>It writes alerts as <strong>JSON logs</strong>, which means Wazuh can ingest them directly. The same pipeline you’re building for Suricata and Zeek</li></ul><p>The configuration lives in a single JSON file (<strong>/etc/opencanaryd/opencanary.conf</strong>). You define which services to enable, which ports to listen on, and how to log alerts. No complex YAML, no multi file configs deliberately simple by design.</p><pre>Device probes fake service<br>        ↓<br>OpenCanary detects connection<br>        ↓<br>Writes JSON alert to log file<br>        ↓<br>(Future) Wazuh agent ships to TheBrainStorage<br>        ↓<br>Elasticsearch indexes it<br>        ↓<br>Kibana/Grafana dashboard shows alert</pre><p>OpenCanary installed, configured, and logging locally. The Wazuh shipping piece completes when TheBrainStorage comes online.</p><h4>What services should you enable?</h4><p>Not all of them. Here’s what makes sense for your LAN and why:</p><p><strong>SSH (port 22)</strong> Most common lateral movement probe; high signal.<br><strong>HTTP (port 80) </strong>Web scanners hit this first; easy to fake convincingly.<br><strong>FTP (port 21) </strong>Old protocol, still probed; catches unsophisticated tools.<br><strong>Telnet (port 23)</strong>Nothing on our LAN uses Telnet; any hit is suspicious.<br><strong>SMB (port 445)</strong>Windows file share enumeration is extremely common.<br><strong>MySQL (port 3306)</strong>DB port probing is common. no real MySQL on our LAN yet</p><p>This gives us a fake attack surface without unnecessary complexity.</p><h4>The nine stages of Part 07</h4><p><strong>Stage 1:</strong> System prep and dependencies<br><strong>Stage 2: </strong>Create the virtual environment and install OpenCanary<strong><br>Stage 3: </strong>Generate the config file<strong><br>Stage 4: </strong>Edit the config for your network<strong><br>Stage 5: </strong>Create the systemd service<strong><br>Stage 6</strong>: Trip the honeypot and watch the alert</p><h3>Stage 1: System prep and dependencies</h3><p>First, update the package list and install the dependencies OpenCanary needs:</p><pre>sudo apt update &amp;&amp; sudo apt install -y python3-dev python3-pip python3-venv libssl-dev libffi-dev build-essential</pre><p>Confirm Python 3 is available:</p><pre>python3 --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*DcaJBS-jO9gzGYF5LhDDVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*PYHJrrVi8ZIZDFuoSoHhGw.png" /></figure><h3><strong>Stage 2: </strong>Create the virtual environment and install OpenCanary</h3><p>Let’s create a dedicated directory and virtual environment for OpenCanary:</p><pre>sudo mkdir -p /opt/opencanary<br>sudo python3 -m venv /opt/opencanary/venv</pre><h4>Command 01: sudo mkdir -p /opt/opencanary</h4><p>This creates the directory where OpenCanary will live. <strong>/opt</strong> is the conventional Linux location for optional, third-party software that isn&#39;t part of the base OS. Think of it as the &quot;Programs&quot; folder equivalent. The <strong>-p </strong>flag means &quot;create any missing parent directories without complaining.&quot;</p><p>We want OpenCanary isolated in its own directory rather than scattered across the system. That makes it easier to manage, and/or update.</p><h4>Command 02: sudo python3 -m venv /opt/opencanary/venv</h4><p>This creates a <strong>Python virtual environment</strong> inside that directory.</p><p>A virtual environment is an isolated copy of Python with its own private package library. Anything you install inside it stays inside it. It doesn’t touch the system Python or any other Python project on the machine.</p><p>OpenCanary has specific version requirements for its dependencies (Twisted 24.11.0, cryptography 38.0.1, etc.). If you installed those system-wide, they could conflict with other Python tools you install later.</p><h4>Command 03: source /opt/opencanary/venv/bin/activate</h4><p>This <strong>activates</strong> the virtual environment for our current terminal session. After this runs, every <strong>python3</strong> and <strong>pip</strong> command we type goes to the venv&#39;s Python and the venv&#39;s pip, not the system ones.</p><p>We can tell it worked because your prompt changes. <strong>(venv)</strong> appears at the start of every line. That&#39;s your indicator that you&#39;re working inside the isolated environment.</p><p>Let’s activate the virtual environment and upgrade pip inside it:</p><pre>source /opt/opencanary/venv/bin/activate<br>pip install --upgrade pip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*cmFIjAkwMTTv5MPOwc_EWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*e8G4r6Sg7zOdM8w9dERnqQ.png" /></figure><p>We got two errors here. Let me explain.</p><p><strong>Error 1: Permission denied on /opt/opencanary/venv/bin/pip</strong> The venv directory was created with <strong>sudo</strong>, so it&#39;s owned by root. But we activated it as our regular user, so pip couldn&#39;t write to it. Simple ownership mismatch.</p><p><strong>Error 2: sudo pip hitting &quot;externally-managed-environment&quot;</strong> When we added <strong>sudo</strong> to work around it, pip saw the <em>system</em> Python environment instead of the venv, and Debian 13 (Trixie) blocks that by design.</p><p>Simple fix. Take ownership of the venv directory so I can write to it without needing sudo. Then pip upgrade and install should work cleanly:</p><pre>sudo chown -R gatewatcher:gatewatcher /opt/opencanary/venv</pre><p><strong>chown </strong>changes file ownership. <strong>-R</strong> means recursive. Apply it to everything inside the directory, not just the directory itself. <strong>gatewatcher:gatewatcher</strong> sets both the owner and the group. After that, pip could write to the venv freely without needing sudo at all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*BDiwgOoOqYomhR3mKbwUHQ.png" /></figure><p>The error has been cleared. We can continue.</p><p>Install OpenCanary:</p><pre>pip install opencanary</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*SEZZuKqmnUiA_EFmDWKziw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*vl4c__o7rgikU0EXJNnLmw.png" /></figure><p>This will take a minute. It pulls in Twisted and a handful of other dependencies.</p><h4>Why the Isolation Matters Long-Term</h4><p>When TheBrainStorage comes online and you start installing Wazuh, Elasticsearch, and the rest of the stack, some of those tools also have Python dependencies. Because OpenCanary lives in its own venv, there’s zero risk of a future <strong>pip install</strong> for some other tool accidentally upgrading or downgrading one of OpenCanary&#39;s dependencies and breaking it.</p><h3><strong>Stage 3: </strong>Generate the config file</h3><p>Let’s generate the default config file:</p><pre>opencanaryd --copyconfig</pre><p>This creates the default config file at <strong>/etc/opencanaryd/opencanary.conf</strong>. Let&#39;s look at what it generated:</p><pre>sudo cat /etc/opencanaryd/opencanary.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*IbyUM6QOjurzdEFQUM9L6Q.png" /></figure><h3>Stage 4: Edit the config for your network</h3><p>Let’s write the full config tailored to TheGateWatcher. Open it in nano:</p><pre>sudo nano /etc/opencanaryd/opencanary.conf</pre><p>Here are the contents for the .conf file for our 192.168.2.x LAN:</p><pre>{<br>    &quot;device.node_id&quot;: &quot;TheGateWatcher-canary&quot;,<br>    &quot;ip.ignorelist&quot;: [&quot;192.168.2.1&quot;],<br>    &quot;logtype.ignorelist&quot;: [],<br>    &quot;git.enabled&quot;: false,<br>    &quot;git.port&quot;: 9418,<br>    &quot;ftp.enabled&quot;: true,<br>    &quot;ftp.port&quot;: 21,<br>    &quot;ftp.banner&quot;: &quot;FTP server ready&quot;,<br>    &quot;ftp.log_auth_attempt_initiated&quot;: true,<br>    &quot;http.banner&quot;: &quot;Apache/2.2.22 (Ubuntu)&quot;,<br>    &quot;http.enabled&quot;: true,<br>    &quot;http.port&quot;: 80,<br>    &quot;http.skin&quot;: &quot;nasLogin&quot;,<br>    &quot;http.log_unimplemented_method_requests&quot;: true,<br>    &quot;http.log_redirect_request&quot;: true,<br>    &quot;https.enabled&quot;: false,<br>    &quot;https.port&quot;: 443,<br>    &quot;https.skin&quot;: &quot;nasLogin&quot;,<br>    &quot;https.certificate&quot;: &quot;/etc/ssl/opencanary/opencanary.pem&quot;,<br>    &quot;https.key&quot;: &quot;/etc/ssl/opencanary/opencanary.key&quot;,<br>    &quot;httpproxy.enabled&quot;: false,<br>    &quot;httpproxy.port&quot;: 8080,<br>    &quot;httpproxy.skin&quot;: &quot;squid&quot;,<br>    &quot;llmnr.enabled&quot;: false,<br>    &quot;llmnr.query_interval&quot;: 60,<br>    &quot;llmnr.query_splay&quot;: 5,<br>    &quot;llmnr.hostname&quot;: &quot;DC03&quot;,<br>    &quot;llmnr.port&quot;: 5355,<br>    &quot;logger&quot;: {<br>        &quot;class&quot;: &quot;PyLogger&quot;,<br>        &quot;kwargs&quot;: {<br>            &quot;formatters&quot;: {<br>                &quot;plain&quot;: {<br>                    &quot;format&quot;: &quot;%(message)s&quot;<br>                },<br>                &quot;syslog_rfc&quot;: {<br>                    &quot;format&quot;: &quot;opencanaryd[%(process)-5s:%(thread)d]: %(name)s %(levelname)-5s %(message)s&quot;<br>                }<br>            },<br>            &quot;handlers&quot;: {<br>                &quot;file&quot;: {<br>                    &quot;class&quot;: &quot;logging.FileHandler&quot;,<br>                    &quot;filename&quot;: &quot;/var/log/opencanary/opencanary.log&quot;,<br>                    &quot;formatter&quot;: &quot;plain&quot;<br>                }<br>            }<br>        }<br>    },<br>    &quot;portscan.enabled&quot;: true,<br>    &quot;portscan.ignore_localhost&quot;: true,<br>    &quot;portscan.logfile&quot;: &quot;/var/log/kern.log&quot;,<br>    &quot;portscan.synrate&quot;: 5,<br>    &quot;portscan.nmaposrate&quot;: 5,<br>    &quot;portscan.lorate&quot;: 3,<br>    &quot;portscan.ignore_ports&quot;: [],<br>    &quot;smb.auditfile&quot;: &quot;/var/log/samba-audit.log&quot;,<br>    &quot;smb.enabled&quot;: true,<br>    &quot;mysql.enabled&quot;: true,<br>    &quot;mysql.port&quot;: 3306,<br>    &quot;mysql.banner&quot;: &quot;5.5.43-0ubuntu0.14.04.1&quot;,<br>    &quot;mysql.log_connection_made&quot;: true,<br>    &quot;ssh.enabled&quot;: true,<br>    &quot;ssh.port&quot;: 22,<br>    &quot;ssh.version&quot;: &quot;SSH-2.0-OpenSSH_5.1p1 Debian-4&quot;,<br>    &quot;redis.enabled&quot;: false,<br>    &quot;redis.port&quot;: 6379,<br>    &quot;rdp.enabled&quot;: false,<br>    &quot;rdp.port&quot;: 3389,<br>    &quot;sip.enabled&quot;: false,<br>    &quot;sip.port&quot;: 5060,<br>    &quot;snmp.enabled&quot;: false,<br>    &quot;snmp.port&quot;: 161,<br>    &quot;ntp.enabled&quot;: false,<br>    &quot;ntp.port&quot;: 123,<br>    &quot;tftp.enabled&quot;: false,<br>    &quot;tftp.port&quot;: 69,<br>    &quot;tcpbanner.maxnum&quot;: 10,<br>    &quot;tcpbanner.enabled&quot;: false,<br>    &quot;tcpbanner_1.enabled&quot;: false,<br>    &quot;tcpbanner_1.port&quot;: 8001,<br>    &quot;tcpbanner_1.datareceivedbanner&quot;: &quot;&quot;,<br>    &quot;tcpbanner_1.initbanner&quot;: &quot;&quot;,<br>    &quot;tcpbanner_1.alertstring.enabled&quot;: false,<br>    &quot;tcpbanner_1.alertstring&quot;: &quot;&quot;,<br>    &quot;tcpbanner_1.keep_alive.enabled&quot;: false,<br>    &quot;tcpbanner_1.keep_alive_secret&quot;: &quot;&quot;,<br>    &quot;tcpbanner_1.keep_alive_probes&quot;: 11,<br>    &quot;tcpbanner_1.keep_alive_interval&quot;: 300,<br>    &quot;tcpbanner_1.keep_alive_idle&quot;: 300,<br>    &quot;telnet.enabled&quot;: true,<br>    &quot;telnet.port&quot;: 23,<br>    &quot;telnet.banner&quot;: &quot;&quot;,<br>    &quot;telnet.honeycreds&quot;: [<br>        {<br>            &quot;username&quot;: &quot;admin&quot;,<br>            &quot;password&quot;: &quot;$pbkdf2-sha512$19000$bG1NaY3xvjdGyBlj7N37Xw$dGrmBqqWa1okTCpN3QEmeo9j5DuV2u1EuVFD8Di0GxNiM64To5O/Y66f7UASvnQr8.LCzqTm6awC8Kj/aGKvwA&quot;<br>        },<br>        {<br>            &quot;username&quot;: &quot;admin&quot;,<br>            &quot;password&quot;: &quot;admin1&quot;<br>        }<br>    ],<br>    &quot;telnet.log_tcp_connection&quot;: true,<br>    &quot;mssql.enabled&quot;: false,<br>    &quot;mssql.version&quot;: &quot;2012&quot;,<br>    &quot;mssql.port&quot;: 1433,<br>    &quot;vnc.enabled&quot;: false,<br>    &quot;vnc.port&quot;: 5000<br>}</pre><p>Reading the config. It is the file in which we will turn on or off each canary service and set each port number.</p><p>Now let’s create the log directory OpenCanary expects:</p><pre>sudo mkdir -p /var/log/opencanary<br>sudo chown gatewatcher:gatewatcher /var/log/opencanary</pre><p>Then confirm the config is valid JSON file with this command:</p><pre>python3 -c &quot;import json; json.load(open(&#39;/etc/opencanaryd/opencanary.conf&#39;)); print(&#39;Config OK&#39;)&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KKu0L3SlamfcEoo50eWEvg.png" /></figure><p>JSON validates as <strong>Config OK</strong>, log directory created and owned correctly. Let’s keep going!</p><h3>Stage 5: Create the systemd service</h3><p>OpenCanary doesn’t come with a systemd unit file, so we write one ourselves. This is what makes it start automatically on boot and run as a proper background service.</p><p>Create the service file:</p><pre>sudo nano /etc/systemd/system/opencanary.service</pre><p>Here are the settings:</p><pre>[Unit]<br>Description=OpenCanary Honeypot<br>After=network-online.target<br>Wants=network-online.target<br><br>[Service]<br>Type=simple<br>User=root<br>ExecStart=/opt/opencanary/venv/bin/opencanaryd --dev<br>Restart=on-failure<br>RestartSec=5s<br><br>[Install]<br>WantedBy=multi-user.target</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*steqldpwj_ZAFv-KYmgzLg.png" /></figure><p>Save and exit: <strong>Ctrl+X</strong> → <strong>Y</strong>→ <strong>Enter</strong></p><p>Let’s go over what the lines in the file means:</p><h4>[Unit] Metadata and dependencies</h4><p><strong>Description</strong> is just a human-readable label</p><p><strong>After </strong>and <strong>Wants</strong> together answer the question: <em>when in the boot sequence should this start?</em> OpenCanary needs to bind to network ports, so it&#39;s useless if it starts before the network interfaces are up.</p><p><strong>After=network-online.target</strong> tells systemd to wait until the network is fully online before launching OpenCanary.</p><p><strong>Wants</strong> is a softer dependency. It says &quot;try to bring up network-online.target if it isn&#39;t already, but don&#39;t fail if you can&#39;t.&quot; Together they ensure OpenCanary never starts into a state where eth1 doesn&#39;t exist yet.</p><h4>[Service ]How to actually run it</h4><p><strong>Type=simple</strong> Tell systemd that the process we&#39;re launching <em>is</em> the servic. There&#39;s no forking, no PID file handoff, no wrapper script. The process starts, systemd watches it directly.</p><p><strong>Type=simple</strong> OpenCanary runs as root. This is necessary because binding to ports below 1024 (like SSH on 22, FTP on 21, HTTP on 80, Telnet on 23) requires root privileges on Linux.</p><p><strong>ExecStart</strong> The actual command systemd runs. We&#39;re pointing directly at the binary inside the virtual environment <strong>/opt/opencanary/venv/bin/opencanaryd</strong>. So systemd uses the isolated Python and all its dependencies.</p><p><strong>Restart=on-failure</strong> If OpenCanary crashes, systemd automatically restarts the process.</p><p><strong>RestartSec=5s</strong> Adds a 5-second delay before the restart attempt. This prevents a crash loop from hammering the system if something is fundamentally broken.</p><h4>[Install] When to activate it</h4><p><strong>WantedBy=multi-user.target</strong></p><p>This is what <strong>systemctl enable</strong> uses. It tells systemd which boot target should pull OpenCanary in. <strong>multi-user.target</strong> is the standard Linux runlevel for a fully booted system with networking. Essentially &quot;normal operation.&quot; Whenever the system reaches multi-user.target during boot, OpenCanary starts automatically.</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable opencanary<br>sudo systemctl start opencanary</pre><p>Check the status:</p><pre>sudo systemctl status opencanary</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-ats1ALcPhtNrGaoKb8lw.png" /></figure><p>Opencanary appears to have hit an error.</p><p>The service is crashing on startup. <strong>status=1/FAILURE</strong> means the process exited with an error. Before we fix it, let&#39;s see exactly why it crashed:</p><pre>sudo journalctl -u opencanary --no-pager -n 50</pre><p>Unfortunately, I didn’t screenshot the output was borderline unreadable. I did catch a log worth looking at.</p><p>Apr 16 00:50:56 TheGateWatcher opencanaryd[100432]: 2026–04–16T00:50:56–0400 [stderr#error]<strong> twisted.internet.error.CannotListenError: Couldn’t listen on any:80: [Errno 98] Address already in use.</strong></p><p><strong>Port 80 is already taken.</strong> Let’s find out what’s holding it:</p><pre>sudo ss -tlnp | grep &#39;:80&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9YQ-MD4pGhEC4AdfIdX6w.png" /></figure><p>Pihole-FTL on port 80, both IPv4 and IPv6.<br>Lets look at the other ports as well.</p><pre>sudo ss -tlnp | grep -E &#39;:22|:23|:21|:3306&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8i5WfLQW8SZc3vF5C4_9A.png" /></figure><p>port 22 is already being used by SSH. duh. All other ports are open.</p><p>FTP/21<br>Telnet/23<br>MySQL/3306<br>SMB/445</p><p>Things we should note.</p><p>TheGateWatcher is a working perimeter firewall first, honeypot host second. Ports 22 and 80 are legitimately occupied by real services doing real jobs. We <strong><em>cannot </em></strong>disable these services. We will have to work around them.</p><p>Here’s what we should do:</p><ul><li><strong>ssh.enabled = True</strong> and change <strong>ssh.port</strong> to <strong>2222. </strong>A<strong> </strong>fake SSH on a non-standard port.</li><li><strong>“http.enabled”: false</strong> port 80 is Pi-hole&#39;s responsibilty</li><li>Everything else (FTP/21, Telnet/23, MySQL/3306, SMB/445) stays enabled</li></ul><p>Port 22 gets hammered by internet-wide scanners constantly. If someone on our LAN hits port 2222 on an IP that has no business running SSH, that’s a much cleaner signal, that there is suspicious behaviour going on.</p><p>Let’s go back into the config and make some changes:</p><pre>sudo nano /etc/opencanaryd/opencanary.conf</pre><pre>&quot;http.enabled&quot;: false,<br><br>&quot;ssh.enabled&quot;: true,<br>&quot;ssh.port&quot;: 2222,</pre><p>Save and exit, then restart:</p><pre>sudo systemctl restart opencanary<br>sudo systemctl status opencanary</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*thLEodSzfqmz5MlAHdnA2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*cDGbN5XRw52NR4EZMnLfYQ.png" /></figure><p>Lets restart and check for port conflicts</p><pre>sudo systemctl restart opencanary<br>sudo systemctl status opencanary</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZymhSR3zazkG5mMKMtSzYA.png" /></figure><p>We solved the issue. Everything is reading all green. :)</p><p>Let’s verify the ports are actually bound.</p><pre>sudo ss -tlnp | grep -E &#39;:21|:23|:2222|:3306|:445&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tD8mX00R1KUSn2itpAT-ng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_iv6oMeGoDqH2UwOIGe9g.png" /></figure><h3>Stage 6: Trip The Honeypot and Watch The Alert</h3><p>Let’s look at some of the logs being produced to begin with:</p><pre>sudo tail -f /var/log/opencanary/opencanary.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*IT9ARQKSnRCCqQeeYmqN1Q.png" /><figcaption>It’s also showing us “IPTables cannot be found”. This is for the other services. We can install that later.</figcaption></figure><p>The service is clearly running.</p><p>Let’s try to hit the honeypot service from our own machine.</p><pre>ssh -p 2222 admin@192.168.2.1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3lPXFk9zHjs82PkU3dkzQ.png" /></figure><p>Let’s look at the logs again.</p><p>This will simply give us that last log that was written:</p><pre>sudo tail -1 /var/log/opencanary/opencanary.log | python3 -m json.tool</pre><p>We can search for an actual SSH alert with a cleaner filter. Logtype 4000 is OpenCanary’s code for SSH login attempts specifically:</p><pre>sudo grep &#39;&quot;logtype&quot;: 4000&#39; /var/log/opencanary/opencanary.log | tail -1 | python3 -m json.tool</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*wxgHLjoth9mCkHR6VMpwBA.png" /></figure><p>OpenCanary is working perfectly! We can see the SSH log. Let’s read what this alert is actually telling us.</p><pre>{<br>    &quot;dst_host&quot;: &quot;127.0.0.1&quot;,<br>    &quot;dst_port&quot;: 2222,<br>    &quot;local_time&quot;: &quot;2026-04-16 05:19:43.342902&quot;,<br>    &quot;local_time_adjusted&quot;: &quot;2026-04-16 01:19:43.342943&quot;,<br>    &quot;logdata&quot;: {<br>        &quot;SESSION&quot;: &quot;1&quot;<br>    },<br>    &quot;logtype&quot;: 4000,<br>    &quot;node_id&quot;: &quot;TheGateWatcher-canary&quot;,<br>    &quot;src_host&quot;: &quot;127.0.0.1&quot;,<br>    &quot;src_port&quot;: 38252,<br>    &quot;utc_time&quot;: &quot;2026-04-16 05:19:43.342934&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*4tMwpu8rrcLy0UvIsseziQ.png" /></figure><h3>Part 07 Summary</h3><p>Here’s what we built:</p><ul><li>Python venv at <strong>/opt/opencanary/venv</strong></li><li>OpenCanary 0.9.7 installed</li><li>Config at <strong>/etc/opencanaryd/opencanary.conf</strong></li><li>Log at <strong>/var/log/opencanary/opencanary.log</strong></li><li>systemd service, enabled on boot</li><li>FTP honeypot (port 21)</li><li>Fake SSH honeypot (port 2222)</li><li>Telnet honeypot (port 23)</li><li>MySQL honeypot (port 3306)</li><li>SMB honeypot (port 445)</li><li>logtype 4000 alert confirmed</li><li>Wazuh-ready JSON log format</li></ul><p>Thank you for joining me in Part 07 of Building a SOC series. :) I hope to see you in the next section where we start to build our SIEM on TheBrainStorage.</p><p>I hope to see you there. :) ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2f2c7a0986f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 06 — Building a Security Operations Center Homelab (Installing Zeek on TheGateWatcher)]]></title>
            <link>https://medium.com/@seancnelsonis/part-06-building-a-security-operations-center-homelab-installing-zeek-on-thegatewatcher-89180cfc0fa7?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/89180cfc0fa7</guid>
            <category><![CDATA[security-operation-center]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[zeek]]></category>
            <category><![CDATA[cybersecurity-engineer]]></category>
            <category><![CDATA[walkthrough]]></category>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 04:19:25 GMT</pubDate>
            <atom:updated>2026-04-18T04:19:25.914Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, and welcome back to the Building a Security Operation Center Series. :) Previously, in <strong>Part 05 </strong>we installed and setup <strong>Suricata</strong>.<br><a href="https://medium.com/@seancnelsonis/part-05-building-a-security-operations-center-homelab-setting-up-suricata-on-thegatewatcher-b955e6b7962a">https://medium.com/@seancnelsonis/part-05-building-a-security-operations-center-homelab-setting-up-suricata-on-thegatewatcher-b955e6b7962a</a></p><p>Today, we are installing <strong>Zeek </strong>on our perimeter host.</p><h3>Zeek: The Who, What, Where, When &amp; Why</h3><h4>Who made it?</h4><p>Zeek was originally created by <strong>Vern Paxson</strong> at Lawrence Berkeley National Laboratory in the mid-1990s under the name <strong>“Bro”</strong>, slang for Big Brother, because it watches your network. It was renamed to <strong>Zeek in 2018</strong> to shed the surveillance connotation and better reflect its open, community-driven nature. Today it’s maintained by the <strong>Zeek Project</strong>, a non-profit with contributions from Corelight (the commercial backer), UIUC, and the broader security research community. It’s used by national labs, universities, Fortune 500 SOCs, and ISPs worldwide.</p><h4>WHAT does it do?</h4><p>This is the most important thing to get right because it’s <strong>fundamentally different from Suricata</strong>, and understanding the distinction is what makes our SOC architecture coherent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*g6G1PmA9Cnn92HA_X6pGZg.png" /></figure><p>Zeek doesn’t fire alerts by default. Instead, it <strong>parses and logs every protocol interaction</strong> it sees and writes them into organized log files:</p><ul><li><strong>conn.log: </strong>every TCP/UDP/ICMP connection (src, dst, port, bytes, duration)</li><li><strong>dns.log:</strong> every DNS query and response</li><li><strong>http.log:</strong> every HTTP request (method, URI, user-agent, status code)</li><li><strong>ssl.log</strong>: every TLS handshake (certificate details, cipher, SNI)</li><li><strong>files.log</strong>: every file transferred over the network (with MD5/SHA256 hash)</li><li><strong>ssh.log:</strong> every SSH connection attempt</li><li><strong>weird.log: </strong>protocol violations and anomalies Zeek can&#39;t classify</li></ul><p>This is <strong>network forensics gold</strong>. When an incident happens, Zeek logs tell you <em>exactly</em> what was talking to what, when, and how, even for encrypted traffic (you can’t see inside TLS, but Zeek logs the metadata around it).</p><h4>WHERE does it sit in our architecture?</h4><p>Zeek runs <strong>alongside Suricata on TheGateWatcher</strong> in passive mode it taps the same AF_PACKET socket on <strong>eth1</strong> and <strong>eth2</strong> without interfering with traffic flow. The two tools are <strong>complementary, not redundant</strong>: Suricata says &quot;alert — possible C2 beacon,&quot; and then you pivot to Zeek&#39;s <strong>conn.log</strong> to see the full connection history for that IP over the past week.</p><p><strong>Important limitation we already know:</strong> Because my switch (TP-Link TL-SG105) is unmanaged, LAN-to-LAN traffic (e.g., my Xbox talking to my laptop) never passes through TheGateWatcher, so Zeek won’t see it. Same blind spot as Suricata. That’s a future managed switch upgrade, not a blocker for now.</p><h4>WHEN Do WeUse The Logs?</h4><p>Zeek logs serve three distinct use cases in our SOC:</p><p><strong>1. Real-time ingestion into Wazuh/Elasticsearch</strong> (future TheBrainStorage work): Zeek’s TSV log format is well-supported by Filebeat and the Wazuh agent. Once TheBrainStorage is online, we’ll have Zeek’s logs searchable in Kibana alongside Suricata alerts.</p><p><strong>2. Incident investigation: </strong>An alert fires in Suricata. You pull Zeek’s <strong>conn.log</strong> and <strong>dns.log</strong> to build a timeline: <em>When did this host first contact that IP? What domains did it resolve before and after? How much data was transferred?</em> Zeek answers these questions even when you weren&#39;t actively watching.</p><p><strong>3. Threat hunting: </strong>Periodically querying Zeek logs to look for anomalies that didn’t trigger any Suricata rule. Long-duration connections, unusual port usage, DNS lookups to algorithmically generated domains, large data exfiltration, etc. These behavioral patterns are in Zeek’s logs waiting to be found.</p><h4>WHY add it on top of Suricata?</h4><p>Signature detection alone has a fundamental ceiling. Suricata can only catch what its rules describe. A zero-day, a novel C2 protocol, or an attacker carefully staying below Suricata’s thresholds will slip through but it will <strong>always leave behavioral traces</strong> in Zeek’s logs. This is why enterprise SOCs don’t pick one or the other; they run both. The combination gives you:</p><ul><li><strong>Detection coverage</strong> (Suricata) + <strong>forensic depth</strong> (Zeek)</li><li><strong>Alerting</strong> (Suricata) + <strong>investigation context</strong> (Zeek)</li><li><strong>Known-bad signatures</strong> (Suricata) + <strong>anomaly surface area</strong> (Zeek)</li></ul><h4>How it fits our log architecture</h4><p>Zeek writes logs to <strong>/var/log/zeek/current/</strong> by default. Each log rotates hourly. The same pattern we established with Suricata applies here:</p><ul><li>Zeek logs live on TheGateWatcher’s local disk</li><li>Wazuh agent (future) ships copies to TheBrainStorage in real time</li><li>Original files remain on TheGateWatcher</li></ul><p>One practical note: <strong>Zeek is significantly more verbose than Suricata.</strong> On a home network it’s manageable, but <strong>conn.log</strong> grows fast because it logs <em>every</em> connection. Logrotate config will be important here too, same story as Part 05, just more urgent.</p><h3>The nine stages of Part 06</h3><p><strong>Stage 1</strong>: Check what’s available<br><strong>Stage 2</strong>: Install build dependencies<br><strong>Stage 3</strong>: Pull the Zeek source code<br><strong>Stage 4</strong>: Configure the build<br><strong>Stage 5</strong>: Compile<br><strong>Stage 6</strong>: Install<br><strong>Stage 7</strong>:Configure Zeek for your network<br><strong>Stage 8</strong>: Auto-start on boot<br><strong>Stage 9</strong>: Logrotate</p><h3>Stage 1: Check What’s Available</h3><p>Check if Zeek is in the Debian repos:</p><pre>apt-cache show zeek 2&gt;/dev/null | grep -E &quot;Version|Package&quot; || echo &quot;Not in default repos&quot;</pre><p>Check your OS and architecture:</p><pre>cat /etc/os-release | grep -E &quot;^ID|^VERSION_ID|^PRETTY&quot;<br>uname -m</pre><p>Check current available disk space:</p><pre>df -h /</pre><p>Zeek is not always in the default Debian repos, and when it is, it’s often an older version. The Zeek Project maintains their own package feed with current releases, and for a production-grade SOC tool you generally want that over whatever Debian ships.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*w471it-tAHov-osx06bOOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*APYaelTcaKK-xCff8kWfpg.png" /></figure><p>Disk space is great. The only wrinkle is <strong>Debian 13 (Trixie). </strong>This is a newer release, and Zeek’s official package feed currently publishes builds for Debian 12 (Bookworm) but not yet Trixie. We need to confirm whether their ARM64 Bookworm packages install cleanly on Trixie before pointing it at them.</p><p>The safest path for our setup is to <strong>build Zeek from source</strong>. It sounds intimidating but it’s a well-documented process, and we’ve already done harder things in this series (compiling the r8125 driver). The upside: we get the current stable release, full aarch64 support, and it’s exactly what the Zeek Project recommends when distro packages aren’t available.</p><h3>Stage 2: Install Build Dependencies</h3><p>Let’s run this block. It’ll take a few minutes:</p><pre>sudo apt update &amp;&amp; sudo apt install -y \<br>  cmake make gcc g++ flex bison libpcap-dev \<br>  libssl-dev python3 python3-dev swig zlib1g-dev \<br>  libmaxminddb-dev libkrb5-dev libcurl4-openssl-dev \<br>  git libsasl2-dev</pre><p>We want to confirm everything installed without errors before we pull the Zeek source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*3NAQV-qE6OjCrovmCq-EMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*avq7c_OULPNr04tiPhmQCw.png" /></figure><h3>Stage 3: Pull The Zeek Source Code</h3><p>clone the Zeek repo and check out the latest stable release:</p><pre>cd ~<br>git clone --recursive https://github.com/zeek/zeek.git<br>cd zeek<br>git checkout v7.0.0<br>git submodule update --init --recursive</pre><p>The<strong> — recursive</strong> flag matters here. Zeek has a lot of submodules (broker, spicy, bifcl, etc.) and missing any of them will cause the build to fail silently later. The submodule update at the end makes sure everything is pinned to the right commit for v7.0.0.</p><p>This will take a few minutes on the clone. When it finishes run:</p><pre>git describe --tags</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*VAUjJsnmP57oekUrAf73fg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*m35JWqJax0vWFqmHD-hCrA.png" /></figure><p>All submodules checked out cleanly. we’re on the current stable release.</p><h3>Stage 4: Configure the build</h3><p>This is the step that checks your system for all the dependencies we just installed and prepares the build instructions. Run:</p><pre>./configure --prefix=/opt/zeek</pre><p><strong>— prefix=/opt/zeek:</strong> installs Zeek into its own clean directory rather than scattering files across <strong>/usr/local</strong>. Easier to manage, easier to remove if needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*-WWdKKJpzC-FU7gP-nt9yQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RTxMuwYNLXLIk0y-fqUrvg.png" /></figure><p>All the critical checks passed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*Ik7AdXXV3YgNtTd4oqV9PQ.png" /></figure><h3>Stage 5: Compile</h3><p>This is the long one.</p><p>This will be <strong>20–30 minutes</strong> on the Pi 5. I wont close our SSH session, won’t let my laptop sleep and drop the connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqZv8KJLMHHrD2PxtGg3tQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u5MPIZZc045YULgvkiwuYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Sm7jdN059R5J5Q2m-lW8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQFlC9mMHbTNZ53-ow9mdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JtIRVNFqSf4cDgiMAkCT8Q.png" /></figure><p>After 20–30 minutes. Zeek compiled successfully. No errors.</p><h3>Stage 6: Install</h3><p>This copies everything from the build directory into <strong>/opt/zeek</strong> where we told it to go.</p><pre>sudo make install</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*O5bNLdJbMJPPEzcQ9dRj5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p6JdJnIlf9avesRfm5ddcg.png" /></figure><p>Then we add Zeek to our PATH so you can call it without typing the full path every time:</p><pre>echo &#39;export PATH=/opt/zeek/bin:$PATH&#39; &gt;&gt; ~/.bashrc<br>source ~/.bashrc</pre><p>Test it with:</p><pre>zeek --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k6yokOsxR4Qgu9EEebbzNw.png" /></figure><p>Quick notes about what we did.</p><p>When you install Zeek to <strong>/opt/zeek</strong>, its binaries (<strong>zeek</strong>, <strong>zeekctl</strong>, <strong>zkg</strong>) live in /<strong>opt/zeek/bin/</strong>. My shell doesn&#39;t know to look there by default. It only searches a predefined list of directories called the <strong>PATH</strong>. If I typed <strong>zeek — version</strong> without updating PATH, you&#39;d get <strong>command not found</strong>.</p><p><strong>Line 1: echo ‘export PATH=/opt/zeek/bin:$PATH’ &gt;&gt; ~/.bashrc</strong></p><p>This appends one line to my<strong> .bashrc</strong> file. The script that runs every time I open a new shell session. That line tells my shell: &quot;add <strong>/opt/zeek/bin</strong> to the front of the directories you search for commands.&quot; The <strong>:$PATH</strong> at the end means &quot;then keep everything that was already in PATH&quot;, so nothing gets removed, I’m just prepending Zeek&#39;s bin directory to the existing list.</p><p><strong>Line 2: source ~/.bashrc</strong></p><p><strong>.bashrc</strong> only runs automatically when I open a new shell. <strong>source</strong> tells My <em>current</em> shell to re-read and apply it right now, without needing to log out and back in. Without this, <strong>zeek — version</strong> would still fail until My next SSH session.</p><p>Zeek is installed and now callable from anywhere on the system!</p><h3>Stage 7: Configure Zeek for your network</h3><p>Now we point Zeek at our interfaces. The main config file is <strong>node.cfg</strong>:</p><pre>sudo nano /opt/zeek/etc/node.cfg</pre><p>We’ll see a default <strong>[zeek]</strong> block. Replace the entire contents with this:</p><pre>[zeek]<br>type=standalone<br>host=localhost<br>interface=eth1<br><br>[worker-eth2]<br>type=worker<br>host=localhost<br>interface=eth2</pre><p>This tells Zeek to monitor both your LAN (<strong>eth1</strong>) and WAN (<strong>eth2</strong>) interfaces. Save and exit (<strong>Ctrl+X</strong>, Y, <strong>Enter</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*9NoaobQ5IYQgCVho-fTXHQ.png" /></figure><p>Then open the networks config:</p><pre>sudo nano /opt/zeek/etc/networks.cfg</pre><p>Add our LAN subnet so Zeek knows what to treat as “local” traffic:</p><pre>Add your LAN subnet so Zeek knows what to treat as &quot;local&quot; traffic:</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0KZWXLETm-e3iGnuVAXQLA.png" /></figure><p>Next step, start Zeek:</p><pre>sudo /opt/zeek/bin/zeekctl deploy</pre><p><strong>deploy</strong> does three things in one shot: checks your config, installs scripts, and starts all nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*0siSgW4tKpo-eGjn3QyaJA.png" /><figcaption>Oh no. We have an error.</figcaption></figure><p><strong>standalone</strong> mode only allows a single node definition. When we add a second block, Zeek complains. We need to restructure node.cfg to use proper multi-node mode.</p><p>Let’s go back into the node.cfg file</p><pre>sudo nano /opt/zeek/etc/node.cfg</pre><p>Replace everything with this:</p><pre>[manager]<br>type=manager<br>host=localhost<br><br>[proxy-1]<br>type=proxy<br>host=localhost<br><br>[worker-eth1]<br>type=worker<br>host=localhost<br>interface=eth1<br><br>[worker-eth2]<br>type=worker<br>host=localhost<br>interface=eth2</pre><p>We now have a proper local cluster: a manager (coordinates logging), a proxy (routes events between nodes), and two workers (one per interface). All four processes run on localhost. Nothing leaves the Pi, it&#39;s just Zeek&#39;s internal architecture for handling multiple capture points.</p><p>Save and exit, then run deploy again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*ZeQipBnBa4zrOTTZQPnagA.png" /></figure><p>Now let’s verify everything is actually running and generating logs:</p><pre>sudo /opt/zeek/bin/zeekctl status</pre><pre>ls /opt/zeek/logs/current/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*M4CgdUokKYJCsRK8eHRmgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*HgKwMHXRX6XXgvgpEfIc7g.png" /></figure><p>All four processes running, and the logs directory is already populated.</p><p>Before moving on, Let me explain the error, and correction.</p><p>When we first configured <strong>node.cfg</strong>, the top block was set to <strong>type=standalone</strong>. Standalone mode is Zeek&#39;s simplified single-process mode — it&#39;s designed for the most basic use case: one Zeek process, one interface, one machine. Because it&#39;s a single process doing everything, Zeek&#39;s standalone mode has a hard rule: <strong>only one node definition is allowed in the config file.</strong> The moment you added <strong>[worker-eth2]</strong> as a second block, Zeek saw two node definitions and threw the error: <em>&quot;more than one node defined in standalone node config.&quot;</em></p><p>The fix was to switch to <strong>cluster mode</strong>, which is Zeek’s architecture for running multiple processes — even when all of them live on the same physical machine. In cluster mode, responsibilities are divided:</p><ul><li>The <strong>manager</strong> handles log writing and coordinates the other processes</li><li>The <strong>proxy</strong> routes events and data between nodes</li><li>The <strong>workers</strong> do the actual packet capture, one per interface</li></ul><p>This might sound like overkill for a home lab, but it’s actually the correct and supported way to monitor multiple interfaces on a single Zeek installation. The key thing to understand is that “cluster” doesn’t mean multiple physical machines here — all four processes (<strong>manager</strong>, <strong>proxy</strong>, <strong>worker-eth1</strong>, <strong>worker-eth2</strong>) run on the same Pi, on <strong>localhost</strong>. It&#39;s just Zeek&#39;s internal division of labour.</p><p>That being said, let’s peek inside a couple to confirm they’re capturing real data:</p><pre>sudo tail -5 /opt/zeek/logs/current/conn.log</pre><pre>sudo tail -5 /opt/zeek/logs/current/dns.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F73Aaz0mMsm_JK1wzPCEWQ.png" /></figure><p>We’re almost done. Let’s move to the two remaining important tasks for <strong>Stage 8: Zeek start automatically on boot </strong>and <strong>log rotating</strong>.</p><h3>Stage 8: Auto-start on boot</h3><p>Zeek doesn’t create a systemd service by default. We need to make one:</p><pre>sudo nano /etc/systemd/system/zeek.service</pre><p>Paste this:</p><pre>[Unit]<br>Description=Zeek Network Security Monitor<br>After=network.target<br><br>[Service]<br>Type=forking<br>ExecStart=/opt/zeek/bin/zeekctl start<br>ExecStop=/opt/zeek/bin/zeekctl stop<br>RemainAfterExit=yes<br><br>[Install]<br>WantedBy=multi-user.target</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jB-6bRkHe3t-vUDIcV9Q1A.png" /></figure><p>Save and exit, then enable it:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable zeek<br>sudo systemctl status zeek</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uIRQEB9QTh-V2DFtW__TxQ.png" /></figure><p>The service file looks correct and the symlink was created successfully. The <strong>inactive (dead)</strong> status is expected — we enabled it for boot but haven&#39;t started it via systemd yet. Zeek is actually already running from the <strong>zeekctl deploy</strong> we did earlier, so there&#39;s no conflict.</p><p>One thing worth noting: <strong>zeekctl</strong> manages its own process lifecycle internally, which means systemd&#39;s view of &quot;<strong>active/inactive</strong>&quot; doesn&#39;t always reflect reality. Let&#39;s verify Zeek is still actually running:</p><pre>sudo /opt/zeek/bin/zeekctl status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*Nzvp7bdLDWhyezHAT3B-xA.png" /></figure><p>It still show all four nodes running from our earlier deploy. The service unit will correctly call <strong>zeekctl start</strong> on next boot and pick up where it left off.</p><h3>Stage 9: Logrotate</h3><p>Zeek actually handles its own log rotation internally via <strong>zeekctl</strong> — it rotates logs every hour by default and archives them to <strong>/opt/zeek/logs/</strong> with date stamped folders. But we want to make sure old archives get cleaned up so they don&#39;t fill your SSD over time.</p><p>Check the default rotation interval:</p><pre>grep -i logrotate /opt/zeek/etc/zeekctl.cfg</pre><p>Then set a retention limit:</p><pre>sudo nano /opt/zeek/etc/zeekctl.cfg</pre><p>Find the <strong>LogExpireInterval</strong> line and set it:</p><pre>LogExpireInterval = 7</pre><p>This tells zeekctl to automatically delete logs older than 7 days. Save and apply:</p><pre>sudo /opt/zeek/bin/zeekctl deploy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QrCqNayB2v8tqlp4yuiUGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Bxgbt7NNRwNEQru_NPXrA.png" /></figure><p>You’ll notice that the <strong>zeekctl.cfg</strong> logrotate didn’t exist from the first command? I ran it again with the proper variable name. worked.</p><p><strong>LogRotationInterval = 3600</strong> This controls how often Zeek closes the current log file and starts a new one. At 3600 seconds (1 hour), Zeek archives the current logs every hour into a timestamped folder under <strong>/opt/zeek/logs/.</strong> This is Zeek&#39;s own internal rotation, completely separate from the Linux <strong>logrotate</strong> utility.</p><p><strong>LogExpireInterval = 7 </strong>This is the retention policy. It tells <strong>zeekctl cron</strong> to automatically delete archived log folders older than 7 days. Without this set, logs accumulate forever.</p><p>That’s Part 06 complete! :D Here’s a final summary of everything we accomplished:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*Mo7SzWtUq6-6YE1F07R0Hw.png" /></figure><p>Thank you for joining me in Part 06 of Building a SOC series. :) I hope to see you in the next section where we install <strong>OpenCanary</strong>.</p><p>I hope to see you there. ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89180cfc0fa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 05 — Building a Security Operations Center Homelab (Setting up Suricata on TheGateWatcher)]]></title>
            <link>https://medium.com/@seancnelsonis/part-05-building-a-security-operations-center-homelab-setting-up-suricata-on-thegatewatcher-b955e6b7962a?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b955e6b7962a</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[suricata-ids]]></category>
            <category><![CDATA[cybersecurity-engineer]]></category>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Fri, 17 Apr 2026 21:19:10 GMT</pubDate>
            <atom:updated>2026-04-17T21:19:10.789Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, and welcome back to the Building a Security Operation Center Series. :) Previously, in <strong>Part 04 </strong>we installed and setup <strong>Pi Hole and Unbound</strong>. Today, we are installing <strong>Suricata </strong>on our perimeter host.</p><h3>What is Suricata and what does Suricata do?</h3><p>Suricata is an open-source network analysis and threat detection software developed by the Open Information Security Foundation (OISF). It serves as both an Intrusion Detection System (IDS) and an Intrusion Prevention System (IPS), allowing it to monitor and respond to potential security threats in real-time.</p><p><a href="https://en.wikipedia.org/wiki/Suricata_(software)">https://en.wikipedia.org/wiki/Suricata_(software)</a></p><p>Suricata inspects all traffic passing through TheGateWatcher matching packets against a ruleset to detect known threats, port scans, C2 beaconing, malware signatures, etc. It sees traffic <em>after</em> nftables has made its routing decisions, so you get visibility into what’s actually flowing on your LAN, not just what’s being blocked. pretty neat huh? :D</p><p>Suricata outputs to eve.json. A structured JSON log that Wazuh and Elasticsearch ingest natively. We want to configure this correctly from the start so when TheBrainStorage is online, the logs are already in the right format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*b2rqjn5p0dXGqsf9g5_gvg.png" /></figure><p>The setting I’m going with is <strong>IDS mode</strong>.</p><p>At no point does the original packet wait for Suricata. There is no choke point. If Suricata crashed completely right now, my internet connection wouldn’t skip a beat. Traffic would keep flowing normally, I’d just lose visibility.</p><p>More so,<strong> </strong>that means is I will get a full visibility of our north south traffic with no risk of accidentally taking down my own network.</p><p>Because I don’t have a managed switch as mentioned in part 01. I will be blind to East / West traffic. A known problem that will require I future update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*29jkonzZA8yf0WAto_zLfw.png" /></figure><h3>What is eve.json? What is “eve” stand for?</h3><p>Extensible Event Format. The Suricata developers coined it. “Extensible” because the format isn’t fixed — every event type (alert, dns, http, tls, flow) adds its own fields on top of the common base fields. You can also extend it further with custom logging plugins. The name has stuck as the standard output format for Suricata across the entire industry.</p><p>eve.json is Suricata&#39;s unified output log. Every single event Suricata observes such as alerts, DNS queries, HTTP requests, TLS handshakes, network flows, SSH connections, gets written as a single line of JSON to <br><strong>/var/log/suricata/eve.json</strong>. One event, one line, appended continuously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*cyFsMs3o9Aci7KpBHpsIfQ.png" /></figure><p>An alert line looks like this:</p><pre>{<br>  &quot;timestamp&quot;: &quot;2026-03-29T14:22:01.443312+0000&quot;,<br>  &quot;event_type&quot;: &quot;alert&quot;,<br>  &quot;src_ip&quot;: &quot;203.0.113.45&quot;,<br>  &quot;dest_ip&quot;: &quot;192.168.2.178&quot;,<br>  &quot;proto&quot;: &quot;TCP&quot;,<br>  &quot;alert&quot;: {<br>    &quot;signature&quot;: &quot;ET MALWARE CobaltStrike Beacon&quot;,<br>    &quot;severity&quot;: 1,<br>    &quot;category&quot;: &quot;A Network Trojan was detected&quot;<br>  }<br>}</pre><p>Most log formats such as syslog, auth.log, kernel logs are plain text. To get anything useful out of them, our SIEM has to run a parser that uses regex to extract fields. That parser breaks any time the log format changes slightly.</p><p>Lets lay out the step by step installation and configuration process.</p><h3>The five stages of Part 05</h3><p><strong>Stage 1:</strong> Install Suricata<strong><br>Stage 2: </strong>Configure suricata.yaml<br><strong>Stage 3: </strong>Pull and update rules with suricata-update<br><strong>Stage 4: </strong>Verify it’s detecting<br><strong>Stage 5: </strong>Set up log rotation</p><p>With all that said, lets get started!</p><h3>Stage 1 — Check What’s Available and Install</h3><p>First, see what version is in the Debian repos:</p><pre>apt-cache show suricata | grep Version</pre><p>Then install:</p><pre>sudo apt update &amp;&amp; sudo apt install suricata -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*Z7Yw8CrI2tWOYjY_9yW7Dg.png" /></figure><p>Verify it installed and check the version:</p><pre>suricata --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*D9qK9J5mirygRCkVSI8zDg.png" /></figure><p>Although the command didn’t work I am not worried. We can confirm the version number in the next screenshot.</p><h3><strong>Stage 2 — </strong>Configure Suricata.yaml</h3><p>During setup, Suricata will create a bunch of default settings. We have to go into these config files and change them to our network.</p><p>Check the default config location and service state</p><p>sudo systemctl status suricata:</p><pre>sudo systemctl status suricata</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*o3pd9hMqd8iBdTWtdTbZvQ.png" /><figcaption>As mentioned before. We confirm the version on the second last line as the end.</figcaption></figure><pre>ls /etc/suricata/</pre><pre>ls /var/log/suricata/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*0B4vLzksJrC0lR8iZZCmNA.png" /><figcaption>Suricata is now producing logs and all the configs are there. It’s exactly what we want.</figcaption></figure><p>The default suricata.yaml is a generic config. We need it to:<br>1. Set my home network range (192.168.2.0/24)<br>2. Configure AF_PACKET to monitor both eth1 and eth2.<br>3. Confirm eve.json output is enabled and correctly configured</p><p>let’s see what interface the default config is currently pointed at:</p><pre>grep -n &quot;interface:&quot; /etc/suricata/suricata.yaml | head -20</pre><p>And check the home network variables:</p><pre>grep -n &quot;HOME_NET&quot; /etc/suricata/suricata.yaml | head -10</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/0*ueXyfYpYN97JMdJY" /></figure><p>Let me explain what we’re looking at here.</p><p><strong>Lines 622–2069: The capture method sections</strong></p><p><strong>AF_PACKET (lines 622–700)</strong> The method we’re using. Standard Linux kernel socket interface. Works on any Linux system, no special hardware needed. The kernel makes a copy of each packet and hands it to Suricata.</p><p><strong>AF_XDP (lines 700–820)</strong> A newer, faster kernel bypass method. Packets go directly from the NIC driver to Suricata, skipping most of the kernel network stack. Significantly lower CPU overhead at high traffic volumes. Requires kernel 4.18+ and XDP-compatible drivers. This is overkill for a home network doing ~1Gbps, and the Radxa hat’s r8125 driver support for XDP is uncertain.</p><p><strong>PCAP (lines 819–846)</strong> The classic libpcap method. Simpler but slower than AF_PACKET. Used for reading from pcap capture files (for offline analysis) or legacy systems.</p><p><strong>DPDK (lines 1982–2069) </strong>Intel’s Data Plane Development Kit. Completely bypasses the kernel Suricata takes ownership of the NIC directly. Designed for telco/datacenter-scale packet processing (tens of millions of packets per second). Requires specific Intel NICs and is completely unneeded for our setup.</p><p>Suricata is technically running right now but seeing nothing. Line 1982 shows eth2 not commented out, and line 2064 shows eth1 commented out, that is a setting we’ll have to change.</p><p><strong>Lines 18–30: The variable block</strong></p><p><strong>HOME_NET (line 18) </strong>The active definition of &quot;my network.&quot; Every rule in Suricata is written relative to this. A rule might say &quot;alert if something outside “HOME_NET” connects to port 22 on “HOME_NET.&quot; If this is wrong, rules fire backwards or miss entirely. Lines 19–22 are the commented-out alternative definitions — Suricata ships with common RFC1918 ranges as examples, we uncomment the one that fits.</p><p><strong>EXTERNAL_NET (line 24)</strong> Defined as “!$HOME_NET” meaning &quot;everything that is not HOME_NET.&quot; This is how Suricata knows what &quot;the internet&quot; is without you having to list it.</p><p><strong>HTTP_SERVERS, SMTP_SERVERS, SQL_SERVERS, DNS_SERVERS (lines 27–30)</strong> All default to $HOME_NET, meaning &quot;assume any of your internal hosts could be running these services.&quot; In a production environment you&#39;d narrow these to specific IPs. For your homelab, leaving them as $HOME_NET is fine, it just means rules targeting your DNS server will apply to all LAN hosts rather than just TheGateWatcher.</p><p>Lets look at<strong> AF_PACKET Parameters. </strong>The method we’re using:</p><pre>sed -n &#39;618,700p&#39; /etc/suricata/suricata.yaml</pre><blockquote><strong>Real quick</strong>: The <strong>sed</strong> command in <strong>Linux</strong>, short for stream editor, allows users to perform operations like searching, replacing, inserting, and deleting text in files.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*jDzdRUYX7ec8drcfKQ6EVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*uPjn1cdLibzHTX_IMyZn8A.png" /></figure><p><strong>Interface:</strong> The active AF_PACKET section (line 622) is pointed at eth0, which doesn’t exist on TheGateWatcher. My interfaces are eth1(LAN) and eth2 (WAN).</p><p><strong>threads</strong>: how many CPU threads Suricata uses per interface. Default is auto, which lets Suricata pick based on your core count. The Pi 5 has 4 cores.</p><p><strong>cluster-id</strong>: A unique integer per interface when running multiple interfaces. Tells the kernel which socket belongs to which interface binding. eth1 and eth2 need different cluster-ids (e.g. 99 and 98).</p><p><strong>cluster-type: cluster_flow</strong> means all packets belonging to the same TCP /UDP flow go to the same Suricata thread. This is important for protocol reassembly. If packets from the same connection get split across threads, Suricata can&#39;t reconstruct the full session.</p><p><strong>defrag: </strong>whether Suricata handles IP defragmentation (reassembling fragmented packets). Default yes.</p><p><strong>use-mmap: </strong>uses memory-mapped I/O for the ring buffer instead of system calls. This is Significantly faster and one of the things that makes AF_PACKET competitive with more complex capture methods.</p><p><strong>buffer-size: </strong>size of the per-interface ring buffer. Larger buffers handle traffic bursts better but use more RAM. On a home network the default is fine.</p><p>Lets make a backup before we make changes:</p><pre>sudo cp /etc/suricata/suricata.yaml /etc/suricata/suricata.yaml.bak</pre><p>Open the file:</p><pre>sudo nano /etc/suricata/suricata.yaml</pre><p><strong>Change 1: Line 18: Fix HOME_NET</strong></p><p>Use <strong>Ctrl+W</strong> in nano to search for each term.</p><p>Find:</p><pre>HOME_NET: &quot;[192.168.0.0/16,10.0.0.0/8,172.16.0.0/12]&quot;</pre><p>Replace with:</p><pre>HOME_NET: &quot;[192.168.2.0/24]&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*3VhvPdr_d2fJ2-V-IkeENw.png" /></figure><p><strong>Change 2 — Line 622: Fix the AF_PACKET interface (currently eth0 → eth1)</strong></p><p>Find:</p><pre>af-packet:<br>  - interface: eth0<br>    cluster-id: 99<br>    cluster-type: cluster_flow<br>    defrag: yes<br>    #use-mmap: yes</pre><p>Replace with:</p><pre>af-packet:<br>  - interface: eth1<br>    cluster-id: 99<br>    cluster-type: cluster_flow<br>    defrag: yes<br>    use-mmap: yes<br><br>  - interface: eth2<br>    cluster-id: 98<br>    cluster-type: cluster_flow<br>    defrag: yes<br>    use-mmap: yes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*eUzy5cEuRrux7M8C3C8ncg.png" /></figure><ul><li><strong>eth1: </strong>keeps cluster-id 99, eth2 gets 98. They must be different or the kernel can&#39;t distinguish which socket belongs to which interface</li><li><strong>use-mmap</strong>: yes is now uncommented (no #) on both — actively enabled</li><li>The indentation matters in YAML . The “—” before interface must align exactly, and everything under it must be indented consistently</li></ul><p>Save with <strong>Ctrl+X → Y → Enter</strong>.</p><p>Verify our changes with:</p><pre>grep -n &quot;HOME_NET&quot; /etc/suricata/suricata.yaml | head -5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*cZmH8gy-5nrkHozE1p5mNQ.png" /></figure><p><strong>HOME_NET: </strong>Line 18 is now 192.168.2.0/24, active and correct. The four commented alternatives below it are untouched. Perfect!</p><p>and:</p><pre>sed -n &#39;618,700p&#39; /etc/suricata/suricata.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*FnO20aLtuialU62dWnrhRA.png" /></figure><p><strong>AF_PACKET section:</strong> Both interfaces are configured correctly:</p><pre>eth1: cluster-id 99, cluster_flow, defrag yes, use-mmap yes<br>eth2: cluster-id 98, cluster_flow, defrag yes, use-mmap yes</pre><p>Now we see what Suricata thinks of the config before we restart it. This is a built-in syntax validator:</p><pre>sudo suricata -T -c /etc/suricata/suricata.yaml -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*2p-h8OvtVwXt4LnYNQ7lxw.png" /></figure><p>This was a bit of a panic mode. <br>I must have misclicked when typing. I accidently put a backslash at the top of the file. Before fixing, I check to make sure my backup was intact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*2gHM4BYCEPz38gn3ygbNxw.png" /></figure><p>I fixed the issue. With the same command as before, Suricata ran smooth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*uwVQ909jKv-c5w8Kv73VTw.png" /></figure><p>There is the only issue. Suricata has no rules loaded yet! It’s running blind! This is expected at this stage.</p><p>Fixing it is the next step: running <strong>suricata-update</strong> to pull down the Emerging Threats ruleset.</p><h3><strong>Stage 3: </strong>Pull and update rules with suricata-update</h3><p>Let’s now pull the rules. It will take a minute or two:</p><pre>sudo suricata-update</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*x1jexbQw5_a_YR68Vf6Feg.png" /></figure><p>Let’s bring it back live:</p><pre>sudo systemctl restart suricata<br>sudo systemctl status suricata</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jYFbjKb50b1F5gtNDzuA-g.png" /></figure><p>Suricata is working and all green.</p><p>Let’s verify eve.json is working and receiving traffic:</p><pre>sudo tail -f /var/log/suricata/eve.json | head -20</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*q23pOy_Z3r7Pr3K8wfYHaA.png" /></figure><p>Eve.json is flowing beautifully. Suricata is alive and watching.</p><p>Let’s check if any alerts have fired:</p><pre>sudo cat /var/log/suricata/eve.json | python3 -c &quot;<br>import sys, json, collections<br>counts = collections.Counter()<br>for line in sys.stdin:<br>    try: counts[json.loads(line)[&#39;event_type&#39;]] += 1<br>    except: pass<br>for k,v in counts.most_common(): print(f&#39;{v:&gt;8} {k}&#39;)<br>&quot;</pre><p>This will give you a clean count of every event type logged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*iPzIoV-e6rc7869hDL7RnQ.png" /></figure><p>We see we already have events. Let me explain every type:</p><p><strong>stats: </strong>Suricata&#39;s internal performance counters. Every minute it writes a stats event recording packets seen, dropped, alerts fired, decoder errors, etc. 1132 of these means Suricata has been running about 18 minutes since restart. Not network traffic but internal housekeeping.</p><p><strong>dns</strong>: Every DNS query and response your LAN devices made. 957 in 18 minutes on a home network is completely normal. Browsers, apps, and OS background services are constantly resolving hostnames.</p><p><strong>flow: </strong>Every completed network conversation. A flow record is written when a TCP connection closes or a UDP exchange times out, summarising the whole session: src/dst IP, ports, bytes each direction, duration, protocol. 836 flows in 18 minutes reflects normal background activity.</p><p><strong>quic: </strong>QUIC is Google&#39;s protocol that runs HTTP/3 over UDP instead of TCP. 342 events means your devices are talking to Google services heavily. Chrome, YouTube, Android updates. All normal.</p><p><strong>tls</strong>: TLS handshake metadata for HTTPS connections. Certificate subject, issuer, SNI hostname, version. 112 events means 112 encrypted sessions were established. The actual content is encrypted. Suricata just logs the handshake.</p><p><strong>http</strong>: HTTP (unencrypted) requests. Only 4, which makes sense. Almost everything is HTTPS now.</p><p><strong>fileinfo</strong>: When Suricata can reconstruct a file being transferred over HTTP or another protocol, it logs metadata about it. 4 events here.</p><p><strong>dhcp</strong>: DHCP lease events. 2 makes sense, probably one device requesting /renewing a lease.</p><p>Let’s see what those 25 alerts actually are using python:</p><pre>sudo cat /var/log/suricata/eve.json | python3 -c &quot;<br>import sys, json, collections<br>sigs = collections.Counter()<br>for line in sys.stdin:<br>    try:<br>        e = json.loads(line)<br>        if e[&#39;event_type&#39;] == &#39;alert&#39;:<br>            sigs[e[&#39;alert&#39;][&#39;signature&#39;]] += 1<br>    except: pass<br>for k,v in sigs.most_common(): print(f&#39;{v:&gt;6} {k}&#39;)<br>&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*b33UJiLQ646jpIR_sg1oCA.png" /></figure><p><strong>None of these are actual threats. </strong>The <strong>ET INFO</strong> prefix is the key. Emerging Threats organises rules into categories:</p><p><strong>ET INFO</strong>: Informational. Something worth knowing about but not inherently malicious. Discord and Steam are legitimate applications. Suricata is correctly identifying them, but these rules exist because in a corporate environment, Discord or Steam traffic might violate policy, or their presence might help an analyst understand what a compromised machine was doing.</p><p><strong>ET ALERT / ET MALWARE / ET TROJAN</strong>: These are the rules that indicate actual threats. A clean home network shouldn&#39;t be firing these.</p><p><strong>ET USER_AGENTS</strong>: Flags specific application user-agent strings in HTTP headers. Steam&#39;s game client makes unencrypted HTTP requests with a distinctive user-agent. Again, not malicious — just identified.</p><p><strong>This is our first encounter with the false positive / noise problem: </strong>A raw IDS with no tuning will generate significant noise from legitimate traffic. We’ll handle this by adding Discord and Steam to a suppression list once you’ve confirmed they’re expected on your network.</p><h3>Stage 4— Log Rotation</h3><p>We wont need logs from a year ago being stored. For this homelab we will keep a history of logs within 7 days. This is more then enough to create an template of what we can do in the future.</p><p>Let’s set up logrotate. Create the config file:</p><pre>sudo nano /etc/logrotate.d/suricata</pre><pre>/var/log/suricata/eve.json<br>/var/log/suricata/fast.log<br>/var/log/suricata/suricata.log<br>{<br>    daily<br>    rotate 7<br>    compress<br>    delaycompress<br>    missingok<br>    notifempty<br>    sharedscripts<br>    postrotate<br>        systemctl kill --signal=USR2 suricata<br>    endscript<br>}</pre><p>Save with <strong>Ctrl+X</strong> → <strong>Y</strong> → Enter.</p><p><strong>daily</strong>: rotate logs once per day.</p><p><strong>rotate 7: </strong>keep 7 days of history, delete anything older. On a home network eve.json might grow 50–200MB/day depending on traffic — 7 days gives you a week of history without runaway disk usage.</p><p><strong>Compress: </strong>gzip rotated files. Eve.json compresses extremely well (JSON with repetitive field names) — expect 10:1 or better compression ratio, turning a 100MB daily log into a 10MB archive.delaycompress -</p><p><strong>delaycompress:</strong> don&#39;t compress the most recently rotated file yet. Wazuh agent might still be reading it — compressing it mid-read would break the stream.</p><p><strong>missingok:</strong> don&#39;t error if a log file is missing. Prevents logrotate from failing on first run before all files exist.</p><p><strong>notifempty:</strong> don&#39;t rotate empty files. Prevents creating zero-byte archives on quiet days.</p><p><strong>sharedscripts:</strong> Run the postrotate script once for all matched files, not once per file.</p><p><strong>postrotate: systemctl kill — signal=USR2 suricata:</strong> This is the critical one. After rotation, logrotate sends signal USR2 to Suricata. USR2 tells Suricata to close its current log file handles and reopen them fresh — pointing to the new empty eve.json. Without this signal, Suricata would keep writing to the rotated file even after logrotate moved it, and the new eve.json would be empty forever.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*-PA-3rToonrNXSGOQGw-6w.png" /></figure><p>Test that the config is valid:</p><pre>sudo logrotate --debug /etc/logrotate.d/suricata</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*wSyIyeQzPs45TOIPNnq5pA.png" /></figure><p>Perfect! Let’s move to scheduled rule updates with cronjob.</p><h3>Stage 5 — Scheduled rule updates / Cronjob</h3><p>Open the cron table for root and select nano:</p><pre>sudo crontab -e</pre><p>Add this line at the bottom:</p><pre>30 2 * * * /usr/bin/suricata-update &amp;&amp; /usr/bin/suricatasc -c reload-rules</pre><p><strong>30 2 * * *</strong>: cron schedule syntax: minute 30, hour 2, every day of month, every month, every day of week. Runs at 2:30am daily. We pick 2:30am because it&#39;s the quietest time on a home network, and Emerging Threats publishes their daily ruleset update around midnight UTC, so by 2:30am Eastern the new rules are reliably available.</p><p><strong>/usr/bin/suricata-update</strong>: downloads fresh rules from Emerging Threats, processes them, and writes the updated <strong>suricata.rules</strong> file to disk.</p><p><strong>&amp;&amp;</strong>: only run the next command if the first succeeded. If <strong>suricata-update</strong> fails (no internet, server down), we don&#39;t try to reload rules.</p><p><strong>/usr/bin/suricatasc -c reload-rules: </strong>This is the key piece. <strong>suricatasc</strong> is Suricata&#39;s Unix socket control interface. The <strong>reload-rules</strong> command tells the running Suricata process to re-read the rules file from disk without restarting. No downtime, no dropped packets, no gap in coverage. Suricata atomically swaps the old ruleset for the new one while continuing to process traffic.</p><p>Verify the cron job was saved:</p><pre>sudo crontab -l</pre><p>Confirm suricastasc is available on our system.</p><pre>which suricatasc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*WsX_UMTUGTW2rGz8YIWxWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*4yJMxUVA3w3tYqrBJpEvKA.png" /></figure><p>Everything saved successfully, cron job is present, and suricatasc exists at exactly the path we used in the cron job.</p><h3>Part 05 is complete!</h3><p>Here’s a summary of everything we did.</p><p><strong>Installed:</strong> Suricata 7.0.10 with suricata-update via apt. Clean 29-package install, service auto-enabled.</p><p><strong>Configured suricata.yaml:</strong></p><ul><li><strong>HOME_NET</strong> narrowed from generic RFC1918 ranges to your actual LAN: <strong>192.168.2.0/24</strong></li><li><strong>AF_PACKET</strong> capture on both eth1 (LAN) and eth2 (WAN) with unique cluster-ids (99/98)</li><li><strong>use-mmap</strong>: yes enabled on both interfaces for memory-mapped ring buffer performance</li><li><strong>IDS mode confirmed: </strong>passive copy tap, nothing inline, zero network risk</li></ul><p><strong>Rules:</strong> 49,540 Emerging Threats signatures loaded via suricata-update. Already firing real alerts on your live network traffic within minutes of starting.</p><p><strong>Logging:</strong> eve.json confirmed flowing with dns, flow, tls, quic, http, fileinfo, dhcp, and alert event types — structured JSON ready for Wazuh ingestion when TheBrainStorage comes online.</p><p><strong>Logrotate:</strong> Daily rotation, 7-day retention, gzip compression, USR2 signal to keep Suricata writing to the fresh file.</p><p><strong>Cron job:</strong> suricata-update runs at 2:30am daily, hot-reloads rules into the running process via suricatasc with no downtime.</p><p>Thank you for joining me in Part 05 of Building a SOC series. :) I hope to see you in the next section where we install <strong>Zeek</strong>. Another network tool that does <strong>behavioural / protocol analysis</strong> vs <strong>signature matching</strong>.</p><p>I hope to see you there. ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b955e6b7962a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 04 — Building a Security Operations Center Homelab (Setting up Pi Hole and Unbound)]]></title>
            <link>https://medium.com/@seancnelsonis/part-04-building-a-security-operations-center-homelab-setting-up-pi-hole-and-unbound-87babc859ea4?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/87babc859ea4</guid>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[pihole]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[unbound]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Sat, 04 Apr 2026 12:34:32 GMT</pubDate>
            <atom:updated>2026-04-05T18:27:20.835Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we will be setting up <strong>Pi Hole</strong> and <strong>Unbound</strong>. Before we install anything. We have to explain What Pi Hole and Unbound is, and how it interacts with <strong>DNS (Domain Name System)</strong>.</p><p>Please read through the entire page before replicating this setup. Enjoy :)</p><p>DNS (Domain Name System) is a way to assign IP addresses to the Names of websites. What any normal person would do is write down the IP address assigned to each website for easier memorization. DNS write this all down for us. In stead of typing in IP addresses we type in the name of the website and DNS resolves it for us.</p><p><a href="https://en.wikipedia.org/wiki/Domain_Name_System">https://en.wikipedia.org/wiki/Domain_Name_System</a></p><p>If we are curious about a websites IP address we can use a tool called “<strong>dig</strong>”. You can find an online tool here:</p><p><a href="https://www.digwebinterface.com/?hostnames=www.github.com&amp;type=&amp;ns=resolver&amp;useresolver=9.9.9.10&amp;nameservers=">https://www.digwebinterface.com/?hostnames=www.github.com&amp;type=&amp;ns=resolver&amp;useresolver=9.9.9.10&amp;nameservers=</a></p><p>If we want to go to <a href="http://www.youtube.com./"><strong><em>www.github.com</em></strong></a><strong><em>, </em></strong>The IP address assigned to Github<em>, is </em>140.82.114.4. Try it now!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-SBqaFlY886nKnp4tmHc_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UH-T4HCg4CExFaXuHeh9XQ.png" /></figure><p>So where does Pi Hole and Unbound come into this equation? How does this build into our security system?</p><p>Pi-hole’s job is filtering. It maintains blocklists of known malicious, ad, and tracking domains. Pi-hole checks its lists, finds a match, and returns <strong>0.0.0.0</strong> the device never makes the connection. Pi-hole logs every query, blocked or allowed, which is your primary DNS telemetry source for the SIEM.</p><p>Pi-hole is not a recursive resolver. It needs an upstream to ask when a query isn’t on the blocklist. Right now my dnsmasq config points at <strong>1.1.1.1 </strong>from Part 03. When completed, Pi-hole will point at Unbound on 127.0.0.1:5335 instead.</p><p>Unbound’s job is resolution. It doesn’t care about blocklists. It just resolves whatever Pi-hole hands it, recursively, without a third party.</p><p>Here is how we visualize it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*U2sE2AHaD4w_g6bGhQoxtQ.png" /></figure><p>By doing this we have <strong>total visibility</strong> over our DNS traffic. We own the complete query log , and we can enable DNSSEC validation, which means Unbound will refuse to return answers that can’t be cryptographically verified, a meaningful defense against <strong>DNS spoofing</strong> and <strong>cache poisoning attacks</strong>.</p><p>Here is how the log management will look after completion. We don’t have the Wazuh agent installed at this moment. It will be talked about during the Wazuh installation phase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*m9fbI39k2wHg7c4-G8RwAg.png" /></figure><p>Now we know how all of this works. Let’s start installing!</p><h3>Stage 1 — Install Unbound</h3><p>We install Unbound first because Pi-hole needs an upstream DNS server to point at. If we install Pi-hole first we’d have to use a temporary placeholder like 1.1.1.1 and change it afterwards. Installing Unbound first means we can point Pi-hole straight at it during the installer.</p><pre>sudo apt update &amp;&amp; sudo apt install unbound -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*t9fYAFdKEO83LnCjpkQwBA.png" /></figure><p>We need to grab the root hints file. This is the list of the 13 root DNS server clusters that Unbound uses as its starting point for recursive resolution. Without this file Unbound has to bootstrap itself each time with it, it starts immediately knowing where to begin.</p><pre>sudo curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*rsQMfKYIz2_yGNs3WEPrkA.png" /></figure><p>Now create the config file. Unbound doesn’t use the default config — we write a clean one from scratch:</p><pre>sudo nano /etc/unbound/unbound.conf.d/pi-hole.conf</pre><p>Here is the exact config:</p><pre>server:<br>    verbosity: 1<br>    interface: 127.0.0.1<br>    port: 5335<br>    do-ip4: yes<br>    do-udp: yes<br>    do-tcp: yes<br>    do-ip6: no<br><br>    root-hints: &quot;/var/lib/unbound/root.hints&quot;<br><br>    harden-glue: yes<br>    harden-dnssec-stripped: yes<br>    use-caps-for-id: yes<br>    edns-buffer-size: 1472<br><br>    prefetch: yes<br>    num-threads: 1<br><br>    so-rcvbuf: 1m<br><br>    private-address: 192.168.0.0/16<br>    private-address: 172.16.0.0/12<br>    private-address: 10.0.0.0/8<br><br>    logfile: &quot;/var/log/unbound/unbound.log&quot;<br>    log-queries: yes<br>    log-replies: yes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*MfFABEJVvDI1e5a5lOyNsg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*fmXQXRavx4chEW-MuqA-4g.png" /></figure><p>I want to explain this config file real quick.</p><blockquote><strong><em>interface: 127.0.0.1</em></strong> <em>and </em><strong><em>port: 5335</em></strong> — <em>Unbound only listens locally, never exposed on the LAN. Pi-hole will talk to it, nothing else.</em></blockquote><blockquote><strong><em>harden-glue</em></strong> <em>and </em><strong><em>harden-dnssec-stripped</em></strong> —<em> these reject responses that look tampered with. Core DNSSEC protection.</em></blockquote><blockquote><strong><em>use-caps-for-id</em></strong> — <em>randomizes capitalization in queries (0x20 encoding). Makes DNS spoofing significantly harder because an attacker has to guess the exact capitalization you used.</em></blockquote><blockquote><strong><em>private-address</em></strong> <em>blocks, prevents Unbound from ever returning a private IP range as an answer to a public domain query. Stops a class of DNS rebinding attacks where a malicious site&#39;s DNS resolves to your internal network.</em></blockquote><blockquote><strong>log-queries: yes</strong> <em>and </em><strong>log-replies: yes</strong> <em>This is what feeds your SIEM.</em></blockquote><p>Now create the log directory and set permissions:</p><pre>sudo mkdir -p /var/log/unbound<br>sudo chown unbound:unbound /var/log/unbound<br>sudo touch /var/log/unbound/unbound.log<br>sudo chown unbound:unbound /var/log/unbound/unbound.log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*VJhDrJ27bGRnHcDLRCknMA.png" /></figure><p><strong>Start Unbound</strong></p><pre>sudo systemctl enable unbound<br>sudo systemctl start unbound<br>sudo systemctl status unbound</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*52tE3fZzVM01oQsjCTUUFw.png" /></figure><p><strong>Referenced but unset environment variable </strong>It&#39;s a known cosmetic issue with Unbound&#39;s systemd unit file on Debian Trixie. Thankfully, we can ignore it.</p><p>Test that Unbound is actually resolving:</p><pre>dig github.com @127.0.0.1 -p 5335</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*pAqO5w3h9YX_gAN4go0ldA.png" /></figure><p>Dig isn’t installed on Pi OS Lite by default. Let’s install it real quick:</p><pre>sudo apt install dnsutils -y</pre><p>Always check your tools are installed before assuming a failure is a config problem. :)</p><p>Run our dig test again:</p><pre>dig github.com @127.0.0.1 -p 5335</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*ueQWOQ3A-GLc3140oUpKPQ.png" /></figure><p>Server records were returned. No errors.</p><p>Test DNSSEC validation is working:</p><pre>dig sigfail.verteiltesysteme.net @127.0.0.1 -p 5335</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*9ND62d0dHbkJkwODRVvS6A.png" /></figure><p>In this screenshot we see a <strong>SERVFAIL.</strong></p><p>There are test domains specifically designed to fail DNSSEC validation</p><p><strong>sigfail.verteiltesysteme.net</strong> is one of them and was made to test this application. If this fails, it mean our DNSSEC is working. Score!</p><p>Now its time to install Pi Hole and point it at unbound.</p><h3>Stage 2— Install Pi Hole</h3><p>Download the installer to a file first:</p><pre>curl -sSL https://install.pi-hole.net -o pihole-installer.sh</pre><p>Run the installer as root from the file. This will give us blue interactive menus to walk us through config choices.</p><pre>sudo bash pihole-installer.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*nosrG0TiM0JeKBFFi3ZNrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*5_HtRWQIxYp2Uaybt-PKBw.png" /><figcaption>Welcome Screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*YI-_3a2ql70fVmpAAdqr9g.png" /><figcaption>Pi-hole is genuinely free, maintained by volunteers.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*wmPGMintkitiegyfrRASww.png" /><figcaption>Pi-hole is correct that it needs a static IP. TheGateWatcher already has one — 192.168.2.1 on eth1 — configured via NetworkManager back in Part 03. We press Continue.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*DL1KPH8GQ1wqwW5NO8Dkyw.png" /><figcaption>This is the most important screen. The installer pre-selects eth0, which is the Pi’s onboard ethernet port, not what we want. We need eth1, which is the LAN-facing port on the Radxa hat. Why eth1 and not eth2? eth1 is the LAN interface at 192.168.2.1 — the side that faces our devices. eth2 is the WAN interface facing the Telus router. Pi-hole should only listen on the LAN side. We don’t want Pi-hole answering DNS queries coming in from the internet.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*W8TCzpQpxTcwvkeAy5eo6A.png" /><figcaption>We select Custom. All the other options point Pi-hole at a third-party resolver. We’re building Unbound specifically so we don’t need any of them.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*bIzQ_67lnnhGHc0J7ctMAA.png" /><figcaption>We enter 127.0.0.1#5335. This tells Pi-hole to forward clean queries to Unbound on localhost port 5335. The &quot;#” separates the IP from the port number. Pi-hole&#39;s syntax for non-standard ports.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*GkRyyirD6KPX5UQCQ-zdBg.png" /><figcaption>Both entries point at Unbound. We confirm Yes.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*tplasm9fj-_EXTqWQpNbuw.png" /><figcaption>We keep the default. StevenBlack’s list is a well-maintained community blocklist that combines multiple sources. It’s what pulls in the 91,978 domains you’ll see blocked.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*DY4t1PA6FpLL6BSpYJISvA.png" /><figcaption>Yes. This is non-negotiable for a SOC build. Without query logging there is nothing to ship to the SIEM.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*JUto4pnug0Ar_1GWGBrK6Q.png" /><figcaption>We select level 0. Show everything. This means every query from every client is recorded with full detail: the client IP, the domain, the result, the timestamp. Levels 1–3 progressively hide more information. For a home SOC where we are the analyst, we want everything.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*f8Lv0Imx3L9X5XHhLL4DJA.png" /><figcaption>Note the admin password shown at the end. I will also not be changing the password as this is just a homelab. In a real production environment, I would change this is a heartbeat.</figcaption></figure><p>This finishes the install.</p><p>However, we need to fix that error in the last screenshot. It appears it assigned itself to the WAN IP rather then the “eth1&quot; IP address when selecting the interface. Weird.</p><p>We have to change the configuration then restart Pi Hole</p><pre>sudo nano /etc/pihole/pihole.toml</pre><p>Find the line that says:</p><pre>interface = &quot;eth0&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*juOMDpRW-azSjxitBCtaZw.png" /></figure><p>Save, then restart FTL</p><pre>sudo systemctl restart pihole-FTL</pre><p>Verify block is working correctly:</p><pre>dig doubleclick.net @192.168.2.1<br>dig google.com @192.168.2.1<br>pihole status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*AMFS1EGPuNo3q42IApPXYA.png" /></figure><p>Excellent! We’ve fixed the error from the config file.</p><h3>The <strong>DNSMasq Conflict: A Second Problem</strong></h3><p>During part 03, I opened <strong>/etc/dnsmasq.conf</strong> in nano and saved it without changes. There is a chance it might cause issues here.</p><p>Two processes might be fighting over port 53</p><pre># Showed both pihole-FTL and dnsmasq on port 53<br>sudo ss -tulnp | grep -E &#39;53|5335&#39;</pre><p>When two processes compete for the same port, queries to that port get answered by whichever process wins the race. Some queries hit Pi-hole and get filtered correctly. Others hit standalone dnsmasq which has no blocklists and forwards to Cloudflare. The result is unpredictable, sometimes blocking works, sometimes it doesn’t, and DNS queries time out as the processes fight.</p><p>This is a critical thing to understand about Pi-hole v6: <strong>Pi-hole FTL completely replaces standalone dnsmasq</strong>. FTL is built on top of dnsmasq. It contains its own embedded DNS and DHCP engine. You do not need and should not run standalone dnsmasq alongside it.</p><p>The fix:</p><pre>sudo systemctl stop dnsmasq<br>sudo systemctl disable dnsmasq<br>sudo systemctl restart pihole-FTL</pre><p>After this, only <strong>pihole-FTL</strong> appears on port 53:</p><pre>sudo ss -tulnp | grep -E &#39;53|5335&#39;</pre><pre>udp  pihole-FTL  0.0.0.0:53<br>tcp  pihole-FTL  0.0.0.0:53<br>tcp  unbound     127.0.0.1:5335</pre><h3>Xbox Group Bypass</h3><p>One thing I want to do it make sure my Xbox gets a bypass group. I’m okay with my Xbox contacting URL sites. I also want to make sure that nothing on my Xbox gets blocked when gaming. Its hardware is monitored by Microsoft. I’ll accept the risk of Microsoft monitoring for malware on my machine.</p><p>We will created an unfiltered group, Add my Xbox as a client, then assign my Xbox to the unfiltered group. We will verify its in the group then restart for the Pi Hole to take effect.</p><pre># Create the unfiltered group<br>sudo sqlite3 /etc/pihole/gravity.db \<br>  &quot;INSERT INTO &#39;group&#39; (id, enabled, name, description) \<br>   VALUES (1, 1, &#39;unfiltered&#39;, &#39;No blocklists - logging only&#39;);&quot;</pre><pre># Add the Xbox as a client<br>sudo sqlite3 /etc/pihole/gravity.db \<br>  &quot;INSERT INTO client (id, ip, date_added, date_modified, comment) \<br>   VALUES (1, &#39;192.168.2.122&#39;, $(date +%s), $(date +%s), &#39;Xbox&#39;);&quot;</pre><pre># Assign Xbox to the unfiltered group only (remove from default group 0)<br>sudo sqlite3 /etc/pihole/gravity.db \<br>  &quot;INSERT INTO client_by_group (client_id, group_id) VALUES (1, 1);&quot;</pre><pre># Verify<br>sudo sqlite3 /etc/pihole/gravity.db &quot;SELECT * FROM client;&quot;<br>sudo sqlite3 /etc/pihole/gravity.db &quot;SELECT * FROM &#39;group&#39;;&quot;<br>sudo sqlite3 /etc/pihole/gravity.db &quot;SELECT * FROM client_by_group;&quot;</pre><pre># Restart FTL to apply the group change<br>sudo systemctl restart pihole-FTL</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*uNBDfN4pBEGMcqg2lxbd1A.png" /></figure><p>My Xbox is in both group 0 (Default) and group 1 (unfiltered). That’s actually fine because the unfiltered group has no blocklists assigned to it, so Pi-hole will still log everything but apply no blocking rules to that client.</p><h3>Make Sure DHCP Is Enabled</h3><p>Pi-hole’s embedded DHCP server hands out IP address. <br>I set up the range and router IP:</p><pre>sudo pihole-FTL --config dhcp.active true<br>sudo pihole-FTL --config dhcp.start 192.168.2.10<br>sudo pihole-FTL --config dhcp.end 192.168.2.200<br>sudo pihole-FTL --config dhcp.router 192.168.2.1<br>sudo systemctl restart pihole-FTL</pre><p>Verify it’s enabled:</p><pre>sudo ss -tulnp | grep 67<br>sudo cat /etc/pihole/pihole.toml | grep -A8 &quot;\[dhcp\]&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/0*RY6s9YRiFQXrEkHa" /></figure><h3>Final State — <strong>Full Test</strong></h3><p><strong>Dig Test:</strong></p><pre>dig google.com @192.168.2.1 <br>dig doubleclick.net @192.168.2.1 <br>dig github.com @127.0.0.1 -p 5335</pre><p><strong>Dig Response:</strong></p><pre>; &lt;&lt;&gt;&gt; DiG 9.20.21-1~deb13u1-Debian &lt;&lt;&gt;&gt; google.com @192.168.2.1<br>;; global options: +cmd<br>;; Got answer:<br>;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 27770<br>;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1<br><br>;; OPT PSEUDOSECTION:<br>; EDNS: version: 0, flags:; udp: 1232<br>;; QUESTION SECTION:<br>;google.com.                    IN      A<br><br>;; ANSWER SECTION:<br>google.com.             89      IN      A       142.250.139.113<br>google.com.             89      IN      A       142.250.139.139<br>google.com.             89      IN      A       142.250.139.101<br>google.com.             89      IN      A       142.250.139.102<br>google.com.             89      IN      A       142.250.139.138<br>google.com.             89      IN      A       142.250.139.100<br><br>;; Query time: 0 msec<br>;; SERVER: 192.168.2.1#53(192.168.2.1) (UDP)<br>;; WHEN: Sat Apr 04 06:40:27 EDT 2026<br>;; MSG SIZE  rcvd: 135<br><br>; &lt;&lt;&gt;&gt; DiG 9.20.21-1~deb13u1-Debian &lt;&lt;&gt;&gt; doubleclick.net @192.168.2.1<br>;; global options: +cmd<br>;; Got answer:<br>;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 44149<br>;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1<br><br>;; OPT PSEUDOSECTION:<br>; EDNS: version: 0, flags:; udp: 1232<br>;; QUESTION SECTION:<br>;doubleclick.net.               IN      A<br><br>;; ANSWER SECTION:<br>doubleclick.net.        2       IN      A       0.0.0.0<br><br>;; Query time: 0 msec<br>;; SERVER: 192.168.2.1#53(192.168.2.1) (UDP)<br>;; WHEN: Sat Apr 04 06:40:27 EDT 2026<br>;; MSG SIZE  rcvd: 60<br><br>; &lt;&lt;&gt;&gt; DiG 9.20.21-1~deb13u1-Debian &lt;&lt;&gt;&gt; github.com @127.0.0.1 -p 5335<br>;; global options: +cmd<br>;; Got answer:<br>;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 18055<br>;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1<br><br>;; OPT PSEUDOSECTION:<br>; EDNS: version: 0, flags:; udp: 1472<br>;; QUESTION SECTION:<br>;github.com.                    IN      A<br><br>;; ANSWER SECTION:<br>github.com.             60      IN      A       140.82.114.3<br><br>;; Query time: 43 msec<br>;; SERVER: 127.0.0.1#5335(127.0.0.1) (UDP)<br>;; WHEN: Sat Apr 04 06:40:27 EDT 2026<br>;; MSG SIZE  rcvd: 55</pre><p><strong>DNS resolution</strong> <br>google.com <strong>@192.168.2.1</strong> returns real IPs in 0ms (cached).</p><p><strong>doubleclick.net</strong> returns <strong>0.0.0.0</strong> in 0ms. <br>The pihole.log confirms why? <br><strong>gravity blocked doubleclick.net is 0.0.0.0</strong>.</p><p><strong>github.com @127.0.0.1 -p 5335</strong> resolves in 43ms direct to root DNS.</p><p><strong>Services Test:</strong></p><pre>sudo ss -tulnp | grep -E &#39;53|5335&#39;<br>pihole status<br>sudo systemctl status unbound --no-pager<br>sudo systemctl status pihole-FTL --no-pager</pre><p><strong>Services Response:</strong></p><pre>udp   UNCONN 0      0          127.0.0.1:5335       0.0.0.0:*    users:((&quot;unbound&quot;,pid=5057,fd=3))<br>udp   UNCONN 0      0            0.0.0.0:5353       0.0.0.0:*    users:((&quot;avahi-daemon&quot;,pid=668,fd=12))<br>udp   UNCONN 0      0            0.0.0.0:53         0.0.0.0:*    users:((&quot;pihole-FTL&quot;,pid=22499,fd=20))<br>udp   UNCONN 0      0                  *:5353             *:*    users:((&quot;avahi-daemon&quot;,pid=668,fd=13))<br>udp   UNCONN 0      0                  *:53               *:*    users:((&quot;pihole-FTL&quot;,pid=22499,fd=22))<br>tcp   LISTEN 0      256        127.0.0.1:5335       0.0.0.0:*    users:((&quot;unbound&quot;,pid=5057,fd=4))<br>tcp   LISTEN 0      32           0.0.0.0:53         0.0.0.0:*    users:((&quot;pihole-FTL&quot;,pid=22499,fd=21))<br>tcp   LISTEN 0      32              [::]:53            [::]:*    users:((&quot;pihole-FTL&quot;,pid=22499,fd=23))<br>/opt/pihole/utils.sh: line 55: /etc/pihole/versions: Permission denied<br>  [✓] FTL is listening on port 53<br>     [✓] UDP (IPv4)<br>     [✓] TCP (IPv4)<br>     [✓] UDP (IPv6)<br>     [✓] TCP (IPv6)<br><br>  [✓] Pi-hole blocking is enabled<br>● unbound.service - Unbound DNS server<br>     Loaded: loaded (/usr/lib/systemd/system/unbound.service; enabled; preset: enabled)<br>     Active: active (running) since Sat 2026-03-28 04:16:55 EDT; 1 week 0 days ago<br> Invocation: 21c806a36a724c3fa7667ef76ed7448d<br>       Docs: man:unbound(8)<br>   Main PID: 5057 (unbound)<br>      Tasks: 1 (limit: 9578)<br>        CPU: 3.407s<br>     CGroup: /system.slice/unbound.service<br>             └─5057 /usr/sbin/unbound -d -p<br><br>Notice: journal has been rotated since unit was started, output may be incomplete.<br>● pihole-FTL.service - Pi-hole FTL<br>     Loaded: loaded (/etc/systemd/system/pihole-FTL.service; enabled; preset: enabled)<br>     Active: active (running) since Sat 2026-04-04 06:39:36 EDT; 51s ago<br> Invocation: c99d2a224bb844b98c8c890bcc8e513d<br>    Process: 22473 ExecStartPre=/opt/pihole/pihole-FTL-prestart.sh (code=exited, status=0/SUCCESS)<br>   Main PID: 22499 (pihole-FTL)<br>      Tasks: 11 (limit: 9578)<br>        CPU: 300ms<br>     CGroup: /system.slice/pihole-FTL.service<br>             └─22499 /usr/bin/pihole-FTL -f</pre><p><em>Real quick</em>:<br>/opt/pihole/utils.sh: line 55: /etc/pihole/versions: Permission denied<br>Caused by running <strong>pihole status</strong> as a non-root user in Pi-hole v6.<br><strong>sudo pihole status</strong> clears it.</p><p><strong>Port layout</strong> — only <strong>pihole-FTL</strong> on port 53, only <strong>unbound </strong>on port 5335. <br>No conflicts.</p><p><strong>Both services enabled</strong> — survive reboot automatically.</p><p><strong>Confirm Logs Test</strong>:</p><pre>sudo tail -5 /var/log/pihole/pihole.log<br>sudo tail -5 /var/log/unbound/unbound.log</pre><p><strong>Confirm Logs Response</strong>:</p><pre>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.585 EDT [22499M] INFO: FTL user: pihole<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.585 EDT [22499M] INFO: Compiled for l…15.2.0<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.587 EDT [22499M] INFO: Wrote config file:<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.587 EDT [22499M] INFO:  - 167 total entries<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.587 EDT [22499M] INFO:  - 164 entries…efault<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.587 EDT [22499M] INFO:  - 3 entries a…dified<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.587 EDT [22499M] INFO:  - 0 entries a…onment<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.588 EDT [22499M] INFO: Parsed config …sfully<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.588 EDT [22499M] INFO: PID file does …adable<br>Apr 04 06:39:36 TheGateWatcher pihole-FTL[22499]: 2026-04-04 06:39:36.588 EDT [22499M] INFO: No other runni…found.<br>Hint: Some lines were ellipsized, use -l to show in full.<br>Apr  4 06:40:27 dnsmasq[22499]: reply google.com is 142.250.139.102<br>Apr  4 06:40:27 dnsmasq[22499]: reply google.com is 142.250.139.138<br>Apr  4 06:40:27 dnsmasq[22499]: reply google.com is 142.250.139.100<br>Apr  4 06:40:27 dnsmasq[22499]: query[A] doubleclick.net from 192.168.2.1<br>Apr  4 06:40:27 dnsmasq[22499]: gravity blocked doubleclick.net is 0.0.0.0<br>[1775299210] unbound[5057:0] info: 127.0.0.1 sync-19.obsidian.md. A IN NOERROR 0.004976 0 96<br>[1775299227] unbound[5057:0] info: 127.0.0.1 google.com. A IN<br>[1775299227] unbound[5057:0] info: 127.0.0.1 google.com. A IN NOERROR 0.000000 1 135<br>[1775299227] unbound[5057:0] info: 127.0.0.1 github.com. A IN<br>[1775299227] unbound[5057:0] info: 127.0.0.1 github.com. A IN NOERROR 0.043907 0 55</pre><p><strong>Logs flowing</strong> — <strong>pihole.log</strong> showing live query activity, <strong>unbound.log</strong> showing recursive lookups.</p><p>The detection philosophy driving all of this: <strong>Pi-hole blocks the obvious stuff at the perimeter. TheBrainStorage catches the subtle stuff through correlation.</strong> Pi-hole’s blocklists stop known bad domains before a connection is ever made. But malware using a new domain, a device making unusual query patterns, or a domain that just appeared in a threat intelligence feed, those require looking across time and multiple data sources. That analysis happens in Elasticsearch on TheBrainStorage, once the Wazuh agent is configured to ship these logs there.</p><h3>Up next</h3><p>Part 05: Suricata IDS on TheGateWatcher. We’ll put passive network monitoring on both eth1 and eth2, capture raw packet-level events to eve.json, and set up the log pipeline for SIEM ingestion. TheGateWatcher starts watching traffic, not just routing it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87babc859ea4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 03 — Building a Security Operations Center Homelab (Setting up the Initial Firewall)]]></title>
            <link>https://medium.com/@seancnelsonis/part-03-building-a-security-options-center-homelab-setting-up-the-initial-firewall-305610e3d228?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/305610e3d228</guid>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 04:35:08 GMT</pubDate>
            <atom:updated>2026-04-19T22:10:55.011Z</atom:updated>
            <content:encoded><![CDATA[<p>The physical device with the hostname “TheGateWatcher” has been Assembled. We will not be setting up the security system just yet. We want to make sure everything can talk to each other. by setting up the infrastructure first.</p><p>One thing I want to point out is during this stage, I switch between two different users. One of from my desktop SSH into over WiFi and SSH over cable from my laptop. User is my Desktop. Chipm is my laptop. This part took multiple days to learn and configure properly. So you will see different timestamps and IPs when I connect to “TheGateWatcher”.</p><p>I debated with myself on when to add my own comments through out the walkthrough / technical write-up, or if the code itself was descriptive enough, So I added comment where I think they were needed. Please read through the entire page before replicating this setup. Enjoy :).</p><p>Let’s begin.</p><p>Here are the steps we need to take:</p><p>1. Power on the TheGateWatcher and connect over SSH<br>2. Setup and install the Radxa drivers to enable the hat<br>3. Enable IP forwarding through the Radxa Hat<br>4. Install nftables (Netfilters Tables)<br>5. Writing the Firewall Ruleset<br>6. Apply rules and test<br>7. Hand out IPs dnsmasq</p><h3>1. Power on the “TheGateWatcher” and connect over SSH</h3><p>We have a method of doing this. I want to start with this protocol:<strong><br>mDNS (Multicast DNS)/ Hostname resolution</strong></p><p><a href="https://en.wikipedia.org/wiki/Multicast_DNS">Multicast DNS - Wikipedia</a></p><p>Multicast DNS (mDNS) is a computer networking protocol that resolves hostnames to IP addresses within small networks that do not include a local name server. It is a zero-configuration service, using essentially the same programming interfaces, packet formats and operating semantics as unicast Domain Name System (DNS).</p><p>What that means is we can ping the hostname without knowing the IP address (Praise DNS!). We ping the hostname to see if the host is live. From there, we can SSH with the username and password from our initial setup, and find the IP address.</p><p>We setup the Hostname of the Hosts in <strong><em>Part 02 — Building a Security Options Center Homelab</em></strong>.</p><p>Right now, my laptop is connected to my home WiFi in order to ping the host. The remote IP address will change as we connect and disconnect from our network through out this process.</p><p>From my laptop (Management Console) My local account is Chipm. I will ping TheGateWatcher.local.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*lU4LJQr_Gi_-6m69YYPa3Q.png" /></figure><p>Success! The host is responding, and we have found the IP address: 192.168.1.95. As I’m building this, the IP will likely change due to accidental disconnects. However, I will just SSH to the hostname, as it will always resolve due to <strong>mDNS</strong>. For now at least. This will change later.</p><p>Let’s SSH into the device to confirm our settings from the initial configuration worked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9hg6OCua00ok2HE-ELKN_g.png" /></figure><p>Everything is working correctly, Excellent! We can also see our Management console IP address, 192.168.1.87. fun.</p><h3>2. Setup and install the Radxa drivers to enable the hat</h3><p>Lets start setting up the Raspberri Pi as a firewall.</p><p>Because we are using a Radxa Dual 2.5G Router Hat, I need to download the drivers to us it properly. I learned this from Claude.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*SQEF7c8MkzlIx2CQ0G6uqw.png" /></figure><p>Lets install the <strong>realtek-r8125-dkms</strong> driver. Here is the code. I will be running on TheGateWatcher.</p><p>This installs the dependencies and checks if it’s available for download.</p><pre># Install dependencies needed to build the driver<br>sudo apt install -y dkms git build-essential<br><br># Download the latest release from GitHub<br># First check what&#39;s available<br>curl -s https://api.github.com/repos/awesometic/realtek-r8125-dkms/releases/latest \<br>| grep &quot;browser_download_url.*deb&quot; \<br>| cut -d &#39;&quot;&#39; -f 4</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZkeMoVvYAEB23GMTRlT19Q.png" /></figure><p>The lines in the red rectangle show us the 4 dependencies were needed to install the driver. The last line shows us it is indeed available for download.</p><p>Here is the next block of code we will be using to install the drivers</p><pre># Download and install it (replace URL with what the command above returned)<br>wget https://github.com/awesometic/realtek-r8125-dkms/releases/download/9.013.02-2/r8125-dkms_9.013.02-2_amd64.deb<br><br>sudo dpkg -i r8125-dkms_*.deb<br><br># Verify it installed<br>dkms status<br>```<br><br>You should see `r8125` listed. This driver persists across kernel updates automatically because it&#39;s DKMS — it rebuilds itself whenever your kernel updates.<br><br>---<br><br>## Step 1 — What Your `ip link show` Output Means<br><br>Let&#39;s decode each line:<br><br>### Interface 1: `lo` — Loopback<br>```<br>1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536<br>```<br>This is a **virtual interface** that only talks to itself. Every Linux system has it. `127.0.0.1` lives here. You never touch this for networking — it&#39;s used internally by the OS so processes can talk to each other. Ignore it.<br><br>### Interface 2: `eth0` — Onboard Ethernet<br>```<br>2: eth0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 state DOWN<br>    link/ether 2c:cf:67:aa:ac:46<br>```<br>This is the **Pi&#39;s built-in ethernet port**. The critical flag here is `NO-CARRIER` and `state DOWN` — it&#39;s enabled in software but **nothing is physically plugged into it**. No cable connected. This port isn&#39;t being used right now.<br><br>### Interface 3: `wlan0` — WiFi<br>```<br>3: wlan0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 state UP mode DORMANT<br>    link/ether 2c:cf:67:aa:ac:47</pre><blockquote><strong>WAIT. READ THE CODE CLOSELY. YOU MUST CHECK WHAT AI SPITS OUT.</strong></blockquote><p><strong><em>#(replace URL with what the command above returned)<br></em></strong>We must replace:<br><strong><em>9.013.02–2/r8125-dkms_9.013.02–2_amd64.deb<br></em></strong>with:<br><strong><em>9.016.01–1/realtek-r8125-dkms_9.016.01–1_amd64.deb<br></em></strong>With out this we would be installing an older version with potential bug that shouldn’t exist with the newer version. <br>There’s also a lot of comments that we <strong><em>simply don’t need to add</em></strong>.</p><p>Here is the final code snippets I will use:</p><pre># Download and install it (replace URL with what the command above returned)<br>wget https://github.com/awesometic/realtek-r8125-dkms/releases/download/9.016.01-1/realtek-r8125-dkms_9.016.01-1_amd64.deb<br><br># Install the package<br>sudo dpkg -i r8125-dkms_9.016.01–1_amd64.deb<br><br># Verify it installed<br>dkms status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KKhNDO2c6c1opPbcSl1aAw.png" /><figcaption>Look closely. Downloaded the correct package?</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*IjOmK6tnU0lSf8Cmgm7Lkw.png" /><figcaption>Wrong architecture</figcaption></figure><p>I have missed a critical error. We are not using and amd64. we are using arm64. I wanted to show my mistake here <strong><em>so others can also learn from it</em></strong>.</p><p>Every processor speaks a different “language” at the hardware level called an <strong>instruction set</strong>. Raspberry Pi uses an <strong>ARM</strong> processor. A regular desktop or server uses an <strong>x86/AMD64</strong> processor. They are incompatible. Code compiled for one cannot run on the other.</p><p>A .deb file is already precompiled for me. IF we were using the amd64 processor this wouldn’t be an issue.</p><p>Instead of downloading a pre-compiled binary, I will download the <strong>raw source code</strong> and compile it myself. The compiler on your Pi knows it’s running on ARM64 and produces an ARM64 binary automatically.</p><p>We will use the gcc compiler that comes with Raspberri Pi. Lets run commands that solves this issue.</p><pre>sudo apt install -y dkms git build-essential bc<br>git clone https://github.com/awesometic/realtek-r8125-dkms.git<br>cd realtek-r8125-dkms<br>sudo ./dkms-install.sh</pre><p>Real quick. The “bc” you see in the first line stands for <strong>Basic Calculator.<br></strong>The “sudo ./dkms-install.sh” command needs to do version comparisons during the build process.</p><p>Example: <br>echo “5 + 3” | bc<br>8</p><p>Is the kernel version greater than X?<br>Is this module version compatible?</p><p>I didn’t know this. So now I’m sharing it with you. :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*O6Mmk_EdbZ8EeEECU3iZxA.png" /><figcaption>Install the dependencies</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*RKk9Jo8Y7UVJEeljpS9nwQ.png" /><figcaption>Download realtek-r8125-dkms</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*2I6Zz0w0R_4XN6nZp4CHLQ.png" /><figcaption>Checking for directory, entering the directory, compiling code and installing.</figcaption></figure><p>Look at us. Downloading raw code, compiling it, and installing it like a professional. <br>Can I get a hell yeah? :^)</p><p>Quick note. aarch64 vs arm64. I said we need arm64. They are exactly the same thing. Two different names for the same architecture.</p><p><strong>arm64 </strong>Apple, Debian/Ubuntu package naming, Docker<br><strong>aarch64 </strong>Linux kernel, GCC compiler, DKMS, most low-level tools</p><p>When you see <strong>aarch64: installed</strong> in DKMS output, that is my arm64 Pi confirming the driver built correctly for its architecture.</p><p>Now we have to Enable PCIe and reboot.</p><p>Quick explanation about PCIe.</p><p><strong>PCIe stands for Peripheral Component Interconnect Express.</strong> It is a high speed communication lane essentially a highway that connects expansion hardware directly to a processor.</p><p>Think of our Pi like a city. The processor is the city centre. PCIe is the highway that lets external hardware (my router hat) talk to that city centre at very high speed. The communication happens over a FPC (Flexible Printed Circuit cable) This is the highway the ethernet ports use to transfer data.</p><p>The ethernet ports need two things to work. Power to run, and a data path to send traffic through. The 40-pin header provides the power. The FPC cable provides the data path.</p><p>The Router Hat is not a standalone device. It has no brain of its own. It is purely ethernet hardware — physical ports and controllers. The Pi’s processor IS the brain that reads packets from <strong>eth1</strong>, makes routing decisions, and sends them out <strong>eth2</strong>. You cannot remove the Pi from that equation because the Pi IS the router.</p><p>Router Hat ports = the doors of a building<br>Raspberry Pi CPU = the security desk inside deciding who goes where.</p><p>The doors are useless without the desk. The desk is useless without the doors.</p><p>So lets take a look at the commands</p><pre># Enable the external PCIe connector for the Router Hat<br>echo &quot;dtparam=pciex1&quot; | sudo tee -a /boot/firmware/config.txt<br><br># Confirm it was written correctly<br>tail /boot/firmware/config.txt</pre><p>Why “dtparam=pciex1” is needed</p><p>Because the Pi 5 ships with that FPC PCIe connector <strong>disabled by default</strong>. The 40-pin header connection works immediately, the Hat gets power. But, without enabling the PCIe lane, the data side of the connection is dead. The ethernet ports exist physically but the Pi has no data path to them.</p><p>Nothing connected to it will be detected. This line switches it on permanently so the Router Hat is recognized every time the Pi boots.</p><p><strong>/boot/firmware/config.txt</strong> is <strong>only read once at boot time.</strong> The Pi reads it before the operating system even starts, to know what hardware to initialize.</p><p>This is the file after running the command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*XMG5nnYLQ6_mLmcQHgZChw.png" /><figcaption>We run the commands</figcaption></figure><p>It appears it got written twice. I must have misclicked at some point without realizing. This won’t break anything. I will use nano to clean up the second “dtparam-pciex1” for a cleaner config file.</p><pre>sudo nano /boot/firmware/config.txt</pre><p>Scroll to the bottom and see this:</p><pre>[all]<br>dtparam=pciex1<br>dtparam=pciex1</pre><p>I deleted one of them, saved, then verified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*lncvhuFnpwp27_ji_ajw1Q.png" /></figure><p>Lets reboot and see our change in effect.</p><p>Kinda hard to take a screenshot of the machine rebooting…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*rAMS_ukRjOmViyrwRf2Ovw.png" /><figcaption>Here is the command</figcaption></figure><p>After this reboot my SSH connection says “connection refused” or “time out” while the Pi restarts. That is completely normal. Just wait the full 30 seconds before trying to reconnect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*5AMzrIc0ydB-G5eEYWh0Jg.png" /><figcaption>Showed up when I rebooted.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xonjwwv4TpCM9MJJoge_Ew.png" /><figcaption>Here is the “ip link show” command before</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*diqeehl477ArrKYeSg_uew.png" /><figcaption>Here is the “ip link show” command after reboot</figcaption></figure><p>eth0 is the default Raspberri Pi ethernet port<br>eth1 and eth2 are the Radxa ethernet ports</p><p>Fun fact.</p><p>I was SSHed over WiFi instead of the wired cable this whole time.</p><p>I had the ethernet cable plugged into the Radxa hat the whole time, but the Raspberri Pi couldn’t see it. Now that the physical ports can be seen we can start using them.</p><p>I would’ve gotten the same results if I was connecting over hardwire.</p><p>but again, fun facts. :)</p><h3>3. Enable IP forwarding through the Radxa Hat</h3><p>Here is our layout<br>eth2 = WAN (modem side)<br>eth1 = LAN (switch side)</p><p>This will eventually turn into:<br>WAN side (eth2): 192.168.1.x ← My existing router’s network<br>LAN side (eth1): 192.168.2.x ← TheGateWatcher’s own network</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*Tc-IgTs7KJT70mmWNrh03w.png" /><figcaption>Checking ports for which port is going to be going to the modem and network devices.</figcaption></figure><p>By default, Linux ignores packets that are not addressed to itself. If a packet arrives on <strong>eth1</strong> destined for my Xbox, Linux sees it, notices it is not for the Pi, and throws it away.</p><p>IP forwarding tells Linux “If a packet arrives that is not for me, <strong>don’t drop it, route it to the right place</strong>.” Without this, my Pi receives everything and forwards nothing. It is the single most important setting that turns a regular Linux machine into a router.</p><p>Here is my Xbox with no internet connection. We have not enabled IP forwarding yet. We will compare this photo after we are done.</p><p>You can also see me in the reflection. Hello! :D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2wONKnhgE_T24eFB_i-xdA.png" /></figure><p>Let’s enable IP forwarding.</p><p><em>Real quick. </em>Sysctl is a command-line utility used in Unix-like operating systems to read and modify kernel parameters at runtime. It allows users to configure various system settings without needing to recompile the kernel.</p><pre>sudo sysctl -w net.ipv4.ip_forward=1</pre><p>Setting this value to 1, sets this value to true. We want to make sure it survives reboot.</p><pre>sudo nano /etc/sysctl.conf</pre><p>This will create a new blank file.<br>type this line:</p><pre>net.ipv4.ip_forward=1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*gIlR8jLjCg1Y2EsnpXaVPQ.png" /><figcaption>Typing in the single line.</figcaption></figure><p>Save and exit — <strong>Ctrl+X</strong>, <strong>Y</strong>, <strong>Enter</strong>.</p><p>Use this command to to read that file and apply the setting</p><pre>sudo sysctl -p</pre><p>The “-p” flag mean “persistent”.</p><p>Check one more time with:</p><pre>sysctl net.ipv4.ip_forward</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*HQY7FPc8uH5JFZ-p-9qDrw.png" /></figure><p>The port forwarding is now enabled and we can start configuring the nftables.</p><h3>4. Install nftables (Netfilters Tables)</h3><p>Here is the list of commands we want to run in order:</p><pre>sudo apt update<br>sudo apt install nftables -y<br>sudo systemctl enable nftables<br>sudo systemctl start nftables</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*xoqJj6mjWn2SKOwBkOQtCg.png" /><figcaption>Installing nftables</figcaption></figure><p>We make sure if there is anything needed to be updated. We can update later, the important thing is it connected successfully.</p><p>nftables was <strong>already installed</strong> on my system, Nice! Raspberry Pi OS ships with it by default. Nothing needed to be downloaded. Version 1.1.3–1 works fine.</p><p>Let’s now verify that it’s running, and check rule set.</p><pre>sudo systemctl status nftables<br>sudo nft list ruleset</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*TxkKE0RdaWK66RNXdnxiZw.png" /><figcaption>Verify nftables is running. It is. :)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*evhk_Q8u2Q1GFRI80jLf1Q.png" /><figcaption>View rule set</figcaption></figure><p>nftables is a one shot service. It runs once at boot, loads the rules from <br><strong>/etc/nftables.conf</strong> into the kernel, then exits. It does not need to keep running in the background because the rules live inside the kernel itself.</p><h3>4. Writing the Firewall Ruleset</h3><p>Here’s where is starts to get hard. The syntax of nftables is not user friendly what-so-ever.</p><p>Lets start configuring the ruleset.</p><pre>sudo nano /etc/nftables.conf</pre><p>This is what we see by default.</p><pre>#!/usr/sbin/nft -f<br><br>flush ruleset<br><br>table inet filter {<br>        chain input {<br>                type filter hook input priority filter;<br>        }<br>        chain forward {<br>                type filter hook forward priority filter;<br>        }<br>        chain output {<br>                type filter hook output priority filter;<br>        }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*YXNFaOsg3HWuVqWWBpXZIw.png" /><figcaption>Default nftables</figcaption></figure><p>Here is what we are replacing it with:</p><pre>#!/usr/sbin/nft -f<br><br>flush ruleset<br><br># Define interfaces based on confirmed layout<br>define WAN = eth2<br>define LAN = eth1<br><br>table inet firewall {<br><br>    # Traffic destined FOR the Pi itself<br>    chain input {<br>        type filter hook input priority 0; policy drop;<br><br>        # Allow established/related connections<br>        ct state established,related accept<br><br>        # Allow loopback<br>        iif lo accept<br><br>        # Allow ping from LAN only<br>        ip protocol icmp iif $LAN accept<br><br>        # Allow SSH from LAN only<br>        iif $LAN tcp dport 22 accept<br><br>        # Allow DNS queries from LAN<br>        iif $LAN udp dport 53 accept<br>        iif $LAN tcp dport 53 accept<br><br>        # Allow DHCP from LAN<br>        iif $LAN udp dport 67 accept<br><br>        # Log and drop everything else<br>        log prefix &quot;nft-input-drop: &quot; drop<br>    }<br><br>    # Traffic passing THROUGH the Pi<br>    chain forward {<br>        type filter hook forward priority 0; policy drop;<br><br>        # Allow established/related through<br>        ct state established,related accept<br><br>        # Allow LAN devices to reach internet<br>        iif $LAN oif $WAN accept<br><br>        # Block WAN initiating into LAN<br>        iif $WAN oif $LAN drop<br>    }<br><br>    # Traffic FROM the Pi going out<br>    chain output {<br>        type filter hook output priority 0; policy accept;<br>    }<br>}<br><br># NAT — lets all LAN devices share the single WAN IP<br>table ip nat {<br>    chain postrouting {<br>        type nat hook postrouting priority 100;<br>        oif $WAN masquerade<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*n_U7PMkXq8nz4VaxVF0ogw.png" /><figcaption>Full nftable in my config file</figcaption></figure><p>Let’s look at one of the important lines</p><pre>log prefix &quot;nft-input-drop: &quot; drop</pre><p>This logs every dropped packet to my system journal before dropping it. As a SOC build this is important. I want to see what is being blocked. I can read those logs later with:</p><pre>sudo journalctl -k | grep &quot;nft-input-drop&quot;</pre><h3>6. Apply Rules and Test</h3><p>Run these rules one at a time</p><pre># Apply the ruleset<br>sudo nft -f /etc/nftables.conf</pre><pre># Verify rules loaded correctly<br>sudo nft list ruleset</pre><pre># Check for no errors<br>echo $?</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*9vd9-jrPjCMT95Ijn3TSrA.png" /></figure><p>No errors. Your God Damn Right.</p><h3>7. Hand out IPs dnsmasq</h3><p>TheGateWatcher is the DHCP server that hands out IP addresses to my Xbox, laptop, and TheBrainStorage when they connect to the switch. Without this, devices on our LAN get no IP address and cannot communicate.</p><p>Let’s install dnsmasq</p><pre>sudo apt install dnsmasq -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*AHmOsYhD-o9USH5OBGTcNQ.png" /><figcaption>Clean install no error. starts up on boot.</figcaption></figure><p>Time to start configuring dnsmasq.</p><p>The default config file is large and full of comments. We are going to back it up and replace it with a clean focused config in case we make any mistakes.</p><pre># Back up the original config first<br>sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup<br><br># Create our clean config<br>sudo nano /etc/dnsmasq.conf</pre><p>This is inside the file:</p><pre># Listen on LAN interface only — never on WAN<br>interface=eth1<br>bind-interfaces<br><br># DHCP range — hands out IPs to your devices<br># Format: start IP, end IP, lease time<br>dhcp-range=192.168.1.10,192.168.1.200,24h<br><br># Tell devices to use TheGateWatcher as their gateway<br>dhcp-option=3,192.168.1.1<br><br># Tell devices to use TheGateWatcher as their DNS<br>dhcp-option=6,192.168.1.1<br><br># Static reservations — devices that always get the same IP<br># Uncomment and fill in MAC addresses once you know them<br># dhcp-host=xx:xx:xx:xx:xx:xx,TheBrainStorage,192.168.1.3<br># dhcp-host=xx:xx:xx:xx:xx:xx,Laptop,192.168.1.4<br><br># Log DHCP activity — important for SOC visibility<br>log-dhcp<br><br># Do not use /etc/resolv.conf for upstream DNS<br># We will point this to Pi-hole or Unbound later<br>no-resolv<br><br># Upstream DNS server for now — Cloudflare<br># We replace this when Pi-hole is installed<br>server=1.1.1.1<br>server=8.8.8.8</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*uDinhJFkMOYinf5Ly6i_ow.png" /></figure><p>For reference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*7jBwk66ynh6Poa_J38Ofag.png" /></figure><p>Now lets restart and check dnsmasq.</p><pre>sudo systemctl restart dnsmasq<br>sudo systemctl status dnsmasq</pre><p>It appears I’ve run into an error! D:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*iivwxbZDnOklEECuGyRJXA.png" /></figure><p>I’ve missed a critical step.</p><p>dnsmasq tried to bind to <strong>eth1, </strong>but <strong>eth1 </strong>has no IP address assigned to it yet. <strong>eth2 </strong>has an IP address, it got it from the modem. dnsmasq cannot listen on an interface that has no IP.</p><p>We must assign static IP to eth1 (LAN Interface)</p><p>Raspberry Pi OS uses <strong>dhcpd</strong> for network configuration. We need to tell it that <strong>eth1</strong> always gets the static IP <strong>192.168.1.1</strong>.</p><pre>sudo nano /etc/dhcpcd.conf</pre><p>Scroll all the way to the bottom of the file and add these lines:</p><pre># TheGateWatcher LAN interface — static IP<br>interface eth1<br>static ip_address=192.168.1.1/24<br>static domain_name_servers=127.0.0.1<br><br># TheGateWatcher WAN interface — gets IP from modem via DHCP<br>interface eth2</pre><p>Here is my full dhcpcd.conf file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*3NQix7xHV9Q-uwb2_9HyzQ.png" /><figcaption>dhcpcd.conf</figcaption></figure><p>Let’s restart the service.<br>Another error has appeared!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*_0F-lbZ5cIO6d17ZHpTx7A.png" /></figure><p><strong>dhcpcd</strong> is not installed on my system. Raspberry Pi OS Lite on the Pi 5 uses a different network management tool. <strong>dhcpcd </strong>was replaced by <strong>NetworkManager </strong>on newer versions.</p><p>We will have have to use <strong>NetworkManager </strong>instead.</p><p>Since we are on Raspberry Pi OS based on Debian Trixie (which we saw earlier in our <strong>apt update</strong> output), <strong>NetworkManager </strong>is what manages your interfaces. We use <strong>nmcli </strong>as the command line tool.</p><p>Run these commands one at a time:</p><p>Assign Static IP to eth1(LAN):</p><pre>sudo nmcli con add type ethernet ifname eth1 con-name lan \<br>  ip4 192.168.1.1/24 gw4 192.168.1.1<br><br>sudo nmcli con mod lan ipv4.dns 127.0.0.1<br>sudo nmcli con mod lan ipv4.method manual<br>sudo nmcli con up lan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*E8DwGH-OuMGckvZwjHLpsg.png" /></figure><p><strong>First </strong>command creates a new connection profile called “<strong>lan</strong>” on the <strong>eth1</strong> interface, assigning it the static IP <strong>192.168.1.1/24</strong> with a gateway of <strong>192.168.1.1</strong></p><p><strong>Second </strong>command sets the DNS resolver to 127.0.0.1, meaning the machine will query itself for DNS. We are running a local DNS server (like Pi-hole, dnsmasq, Unbound, etc.) on this Pi.</p><p><strong>Third </strong>command locks the connection to manual addressing so NetworkManager <strong>won’t try to obtain an IP via DHCP</strong> everything stays at the static values you set.</p><p><strong>Fourth </strong>command activates the “<strong>lan</strong>” profile, bringing <strong>eth1 </strong>up with all those settings applied.</p><p>Let <strong>eth2 </strong>(WAN) keep using DHCP from modem.</p><pre>sudo nmcli con add type ethernet ifname eth2 con-name wan \<br>  ipv4.method auto<br><br>sudo nmcli con up wan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*MoE7iF3EtxT-MXEbRju71w.png" /><figcaption>hahahaha panic time…?</figcaption></figure><p>We are not locked out.</p><p>When NetworkManager brought up <strong>eth1 </strong>with <strong>192.168.1.1</strong> and <strong>wan</strong> connection on <strong>eth2</strong>, it renegotiated the network interface. Our existing SSH session was riding on <strong>wlan0</strong> over WiFi.</p><h3>Debug Time!</h3><p>I will show you what I tried and didn’t work. Setting up the network correctly was <strong>BY FAR </strong>the biggest headache and challenge of my project. I will save you <em>the profanity </em>I used during this process as well. :P</p><p>Here are the commands I tried from my Laptop (Chipm) in my flurry of panic.</p><pre>ssh gatewatcher@TheGateWatcher.local<br>ssh gatewatcher@192.168.1.1 </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*67u1uG8kKdG-kje3llAwwg.png" /><figcaption>Panic commands :)</figcaption></figure><p>We have a catch 22 problem here.</p><p>Need SSH to fix dnsmasq.<br>But need dnsmasq working to get an IP to SSH over ethernet.</p><p>Rebooting the Pi did not solve this problem.</p><p>Another downside is my lack of screenshots. I do however have my conversation with Claude. which I will summarize.</p><p>I pull out the SD card, put it in my laptop, mount as a drive, and try to disable the nftables temporarily.</p><p>The SD card has two partitions. Windows can only see one of them <strong>bootfs</strong>. The <strong>.dtb</strong> and <strong>.dtbo </strong>files are hardware device tree files.</p><p>I need to edit ONE file on this partition . This tells the Pi kernel what to do at boot. We are going to add a parameter that disables nftables from loading automatically on this boot.</p><p>Open <strong>cmdline.txt </strong>with <strong>Notepad</strong>). DO NOT any other editor.</p><p>The is a long line that looks something like this:</p><pre>console=serial0,115200 console=tty1 root=PARTUUID=xxxx-xx rootfstype=ext4 fsck.repair=yes rootwait quiet</pre><p>Add a single space at the end of the line and add this:</p><pre>systemd.unit=rescue.target</pre><p>This boots the Pi into rescue mode with minimal services, no nftables, no firewall.</p><p>Despite all this, I abandon this route and decide to just hook up the Pi to my TV over a Micro HDMI cable. Say hello to the less happy me. :/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*mGgw1ZNp9F_2AvDevpuSbQ.png" /></figure><p>After being able to login and reset the nftables. I was able to SSH from my laptop again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*va3hY-RKb0SEjwMapmLm6w.png" /></figure><p>Again, due to this being late at night, there is a lake of screenshots. I wish I had more.</p><p><strong>Here is likely one of the causes of the problem:</strong></p><p>eth2 (WAN) has IP: 192.168.1.99<br>My existing router is: 192.168.1.254<br>My laptop got: 192.168.1.178</p><p>Both my LAN and WAN are on a xxx.xxx.1.xxx subnet.</p><p>We need TheGateWatcher’s LAN to use a <strong>different subnet</strong> than the WAN side. The standard approach is:</p><p>WAN side (eth2): 192.168.1.x ← My existing router’s network<br>LAN side (eth1): 192.168.2.x ← TheGateWatcher’s own network</p><p>From the commands we saw from NetworkManager before, I will have to run new commands:</p><pre>sudo nmcli con mod lan ipv4.addresses 192.168.2.1/24<br>sudo nmcli con mod lan ipv4.gateway 192.168.2.1<br>sudo nmcli con mod lan ipv4.dns 192.168.2.1<br>sudo nmcli con up lan</pre><pre># Old<br>dhcp-range=192.168.1.10,192.168.1.200,24h<br>dhcp-option=3,192.168.1.1<br>dhcp-option=6,192.168.1.1<br><br># New<br>dhcp-range=192.168.2.10,192.168.2.200,24h<br>dhcp-option=3,192.168.2.1<br>dhcp-option=6,192.168.2.1</pre><pre>sudo systemctl restart dnsmasq</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*GBa9xPEXuD7Zxk46mmKAXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*coe5TQxfv8mAR4n6_Qd5bg.png" /><figcaption>New network layouts</figcaption></figure><p>For reference this is what my Xbox dashboard looks like. It’s still the same as before. Hello again :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2wONKnhgE_T24eFB_i-xdA.png" /></figure><p>It’s clear I still have no internet connection to my Xbox.</p><p>I can still SSH into “TheGateWatcher” through my laptop as intended, and run commands.<br>Despite this, my laptop is still having issue connecting to the outbound internet. There appears to be another issue at play here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*KaLGePiENmk4h0fWeXTKSQ.png" /><figcaption>Issue likely is due to double NAT</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*v4dHYxXeH6tWUiNCB878fg.png" /><figcaption>ipconfig from laptop</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*oyygbMrUobQu4VZCX0g6tQ.png" /><figcaption>Ping from laptop</figcaption></figure><p>I removed the extra WiFi subnet, that was creating a double NAT.</p><pre># Disable wlan0 now<br>sudo ip link set wlan0 down<br><br># Disable WiFi permanently via NetworkManager<br>sudo nmcli radio wifi off</pre><p>Block it from loading on boot:</p><pre>sudo nano /boot/firmware/config.txt<br><br>#Add this line at the bottom<br>dtoverlay=disable-wifi</pre><p>Save with: <strong>Ctrl+X</strong>, <strong>Y</strong>, <strong>Enter</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*YXC66R9tDiBzde0awjdQjw.png" /></figure><p>At this point I run a full analysis:</p><pre># 1 - Is ip_forward actually on?<br>sudo sysctl net.ipv4.ip_forward<br><br># 2 - What does the routing table look like?<br>ip route show<br><br># 3 - What IPs are on each interface?<br>ip addr show eth1<br>ip addr show eth2<br><br># 4 - Is dnsmasq running?<br>sudo systemctl status dnsmasq --no-pager<br><br># 5 - Is nftables loaded correctly?<br>sudo nft list ruleset<br><br># 6 - Can TheGateWatcher itself reach internet?<br>ping -c 4 8.8.8.8</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wncSSNk6ISVjObTBZGTrog.png" /><figcaption>Forgive the low res. click to zoom.</figcaption></figure><p>The firewall ruleset is completely empty. No NAT. No forwarding rules. Nothing.</p><p>Without NAT masquerade, My laptop’s packets reach TheGateWatcher but cannot be forwarded to the internet because there is no NAT rule to rewrite the source IP.</p><p>For reference:</p><h3>Network Address Translation</h3><p><a href="https://en.wikipedia.org/wiki/Network_address_translation">Network address translation - Wikipedia</a></p><p><strong>Network address translation</strong> (<strong>NAT</strong>) is a method of mapping an IP <a href="https://en.wikipedia.org/wiki/Address_space">address space</a> into another by modifying <a href="https://en.wikipedia.org/wiki/Network_address">network address</a> information in the <a href="https://en.wikipedia.org/wiki/IP_header">IP header</a> of packets while they are in transit across a traffic <a href="https://en.wikipedia.org/wiki/Router_(computing)">routing device</a>.</p><p>Its clear I didn’t set up NAT correctly. Also, after removing the WiFi Route it cause my nftables to break.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*sGCEFjQB1yGzovIALmJTrw.png" /></figure><p>At one point during troubleshooting, I added <strong>wlan0</strong> to the nftables.conf. I wanted to be able to SSH over WiFi. However, it is no longer needed.</p><p>I removed the <strong>wlan0</strong> References From nftables.conf</p><p>Here is the final nftable config.</p><pre>#!/usr/sbin/nft -f<br><br>flush ruleset<br><br>define WAN = eth2<br>define LAN = eth1<br><br>table inet firewall {<br><br>    chain input {<br>        type filter hook input priority 0; policy drop;<br>        ct state established,related accept<br>        iif lo accept<br>        ip protocol icmp iif $LAN accept<br>        iif $LAN tcp dport 22 accept<br>        iif $LAN udp dport 53 accept<br>        iif $LAN tcp dport 53 accept<br>        iif $LAN udp dport 67 accept<br>        log prefix &quot;nft-input-drop: &quot; drop<br>    }<br><br>    chain forward {<br>        type filter hook forward priority 0; policy drop;<br>        ct state established,related accept<br>        ip protocol icmp accept<br>        iif $LAN oif $WAN accept<br>        iif $WAN oif $LAN drop<br>    }<br><br>    chain output {<br>        type filter hook output priority 0; policy accept;<br>    }<br>}<br><br>table ip nat {<br>    chain postrouting {<br>        type nat hook postrouting priority 100;<br>        oif $WAN masquerade<br>    }<br>}</pre><p>FINALLY! My Xbox is now working! Say hello to the happier me! :D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*m-yzOnb0jzMYdNbUUAJJ6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JKlR9PDTGEKfiYXX7Usnbg.png" /><figcaption>Xbox Dashboard</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rBNUZvG7AC5GngT_TmX33g.png" /><figcaption>This is from using edge browser on Xbox</figcaption></figure><p>Here is my laptop speedtest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kb7hgDZkYeibsHjlHscLjg.png" /></figure><p>Here is what happened and the solution.</p><pre>1. Attempted to use /etc/dhcpcd.conf → failed, dhcpcd not installed<br>2. Switched to nmcli → assigned 192.168.2.1/24 to eth1<br>3. Discovered both sides were on 192.168.1.x subnet → conflict<br>4. Changed LAN subnet to 192.168.2.x to separate WAN and LAN<br>5. Updated dnsmasq DHCP range to 192.168.2.x to match<br>6. Make sure net.ipv4.ip_forward=1<br>7. Added and removed wlan0 during troubleshooting</pre><p>TheGateWatcher — Final Config.txt</p><pre>gatewatcher@TheGateWatcher:~ $ cat gatewatcher-config-snapshot.txt<br>=== NETWORK ===<br>1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000<br>    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br>    inet 127.0.0.1/8 scope host lo<br>       valid_lft forever preferred_lft forever<br>    inet6 ::1/128 scope host noprefixroute<br>       valid_lft forever preferred_lft forever<br>2: eth0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc fq_codel state DOWN group default qlen 1000<br>    link/ether 2c:cf:67:aa:ac:46 brd ff:ff:ff:ff:ff:ff<br>3: eth1: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc fq_codel state UP group default qlen 1000<br>    link/ether 00:48:54:20:36:ea brd ff:ff:ff:ff:ff:ff<br>    inet 192.168.2.1/24 brd 192.168.2.255 scope global noprefixroute eth1<br>       valid_lft forever preferred_lft forever<br>    inet6 fe80::3aed:6e3a:794e:f250/64 scope link noprefixroute<br>       valid_lft forever preferred_lft forever<br>4: eth2: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc fq_codel state UP group default qlen 1000<br>    link/ether 00:48:54:20:36:eb brd ff:ff:ff:ff:ff:ff<br>    inet 192.168.1.99/24 brd 192.168.1.255 scope global dynamic noprefixroute eth2<br>       valid_lft 62509sec preferred_lft 62509sec<br>    inet6 fe80::b273:acd7:5780:5eba/64 scope link noprefixroute<br>       valid_lft forever preferred_lft forever<br><br>=== ROUTES ===<br>default via 192.168.1.254 dev eth2 proto dhcp src 192.168.1.99 metric 101<br>192.168.1.0/24 dev eth2 proto kernel scope link src 192.168.1.99 metric 101<br>192.168.2.0/24 dev eth1 proto kernel scope link src 192.168.2.1 metric 100<br><br>=== NFTABLES ===<br>table inet firewall {<br>        chain input {<br>                type filter hook input priority filter; policy drop;<br>                ct state established,related accept<br>                iif &quot;lo&quot; accept<br>                ip protocol icmp iif &quot;eth1&quot; accept<br>                iif &quot;eth1&quot; tcp dport 22 accept<br>                iif &quot;eth1&quot; udp dport 53 accept<br>                iif &quot;eth1&quot; tcp dport 53 accept<br>                iif &quot;eth1&quot; udp dport 67 accept<br>                log prefix &quot;nft-input-drop: &quot; drop<br>        }<br><br>        chain forward {<br>                type filter hook forward priority filter; policy drop;<br>                ct state established,related accept<br>                ip protocol icmp accept<br>                iif &quot;eth1&quot; oif &quot;eth2&quot; accept<br>                iif &quot;eth2&quot; oif &quot;eth1&quot; drop<br>        }<br><br>        chain output {<br>                type filter hook output priority filter; policy accept;<br>        }<br>}<br>table ip nat {<br>        chain postrouting {<br>                type nat hook postrouting priority srcnat; policy accept;<br>                oif &quot;eth2&quot; masquerade<br>        }<br>}<br><br>=== DNSMASQ ===<br># Listen on LAN interface only — never on WAN<br>interface=eth1<br>bind-interfaces<br><br># DHCP range — hands out IPs to your devices<br># Format: start IP, end IP, lease time<br>dhcp-range=192.168.2.10,192.168.2.200,24h<br><br># Tell devices to use TheGateWatcher as their gateway<br>dhcp-option=3,192.168.2.1<br><br># Tell devices to use TheGateWatcher as their DNS<br>dhcp-option=6,192.168.2.1<br><br># Static reservations — devices that always get the same IP<br># Uncomment and fill in MAC addresses once you know them<br># dhcp-host=xx:xx:xx:xx:xx:xx,TheBrainStorage,192.168.1.3<br># dhcp-host=xx:xx:xx:xx:xx:xx,Laptop,192.168.1.4<br><br># Log DHCP activity — important for SOC visibility<br>log-dhcp<br><br># Do not use /etc/resolv.conf for upstream DNS<br># We will point this to Pi-hole or Unbound later<br>no-resolv<br><br># Upstream DNS server for now — Cloudflare<br># We replace this when Pi-hole is installed<br>server=1.1.1.1<br>server=8.8.8.8<br><br>=== SYSCTL ===<br>net.ipv4.ip_forward = 1</pre><p>Everything is now working correctly. :D</p><p>Thank you for joining me in <strong>Part 03</strong> of <strong>Building a SOC series</strong>. I hope to see you in the next section where we install <a href="https://medium.com/@seancnelsonis/part-04-building-a-security-operations-center-homelab-setting-up-pi-hole-and-unbound-87babc859ea4?postPublishedType=repub"><strong>Pi Hole and Unbound</strong></a>.</p><p>I hope to see you there. :) ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=305610e3d228" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 02 — Building a Security Operations Center Homelab (Installing Raspberri Pi OS Lite)]]></title>
            <link>https://medium.com/@seancnelsonis/part-02-building-a-security-options-center-homelab-installing-raspberri-pi-os-lite-199d34d0fab2?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/199d34d0fab2</guid>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Mon, 16 Mar 2026 04:00:00 GMT</pubDate>
            <atom:updated>2026-03-17T04:42:47.735Z</atom:updated>
            <content:encoded><![CDATA[<p>At this point I am installing Raspberri Pi OS Lite on both The Gate+Watcher and The Brain+Storage.</p><p>Starting with “TheGateWatcher”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*_CEGnObpWVYmuTOmKkz2vw.png" /><figcaption>Selecting the OS /1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*_CEGnObpWVYmuTOmKkz2vw.png" /><figcaption>Selecting the OS /2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*B3vSyxmaID82H9vbW3jSOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*YZfNS2WWxH9SMi8jr53hlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*JG80hXYYMBuxkQzwNYqi3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*3LisjI4mgUraZgVH-z_Y0g.png" /><figcaption>Setting up User / Pass</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*C96uoUxBI2eeZ-bbxrlj9Q.png" /><figcaption>Configuring Wifi</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*DFY-ORFERcwTDALWiq8Uuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*yCA1kO-eG2_IrxZw-cROKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*IZYmZJx4k086LKkTgE7wjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*p_GVIW5vI89YCpLxaMd1OA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*bn2FIpU3M1Y2usSzqZi4UA.png" /></figure><p>Next with “TheBrainStorage”. Everything will be the same expect the hostname, username, and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*D1F7S1fEfkqi5KDwy1i0dQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*Tk_PmllQN1IQjoMDsjg2EA.png" /></figure><p>Everything else is exactly the same. No need for extra screenshots.</p><p>Next up we move to settings up the firewall to allow all traffic to flow through this Inline IDS/IPS.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=199d34d0fab2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 01 — Building a Security Operations Center Homelab (The Plan)]]></title>
            <link>https://medium.com/@seancnelsonis/part-01-building-a-security-options-center-homelab-the-plan-4bb770226492?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bb770226492</guid>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Mon, 16 Mar 2026 03:59:53 GMT</pubDate>
            <atom:updated>2026-04-19T21:41:05.917Z</atom:updated>
            <content:encoded><![CDATA[<p>This project for me is to learn how to create my own SOC in a homelab. I will be using:</p><ul><li>Raspberri Pi + Radxa Dual 2.5G Router Hat + 1x 500GB SSD</li><li>Raspberri Pi + Radxa Penta SATA Hat + 2x 250GB SSD</li><li>TP-Link TL-SG105</li><li>1x 1TB HDD</li><li>MSI Raider Laptop (Management Console)</li></ul><p>I will also be using ClaudeAI during this project for assistance.</p><p><strong>Pi 1 — “The Gate + Watcher” </strong>With Radxa Dual 2.5G Router Hat + USB 3.0 enclosure for the SSD.</p><p>Pi 1 handles everything network-facing. The Router Hat gives it the ability to be an inline IDS/IPS.</p><ul><li>nftables — firewall, routing (uses both 2.5G ports natively)</li><li>Pi-hole + Unbound — DNS filtering</li><li>Suricata — IDS/IPS (inline, benefits from the 2.5G throughput)</li><li>Zeek — passive traffic analysis</li><li>OpenCanary — honeypot</li></ul><h4><strong>TP-Link TL-SG105</strong></h4><p>A 5-port <strong>unmanaged</strong> <strong>switch</strong>, which means it does not support port mirroring. This was left over from our house getting a new SOHO switch.</p><h4><strong>Pi 2 — “The Brain + Storage”</strong></h4><p>With Radxa Penta SATA Hat + 2x 250GB SSD + 1x 1TB HDD</p><p>Pi 2 handles everything computational. The SATA hat allows me to save all the logs from the the first and second Pis for analysis. This will also act as my HIDs/HIPs. The SSDs will make it easier for logs being seached in a SIEM/SOAR.</p><ul><li>Wazuh Server + Elasticsearch + Kibana</li><li>Grafana — dashboards</li><li>TheHive + Cortex — incident management and analysis</li><li>OpenVAS — vulnerability scanning / MISP — threat intelligence</li><li>Shuffle — SOAR automation</li></ul><h4><strong>Cold Storage</strong></h4><p>1TB HDD — long-term log archival, pcap storage from Zeek, cold storage.</p><h4><strong>Management Console</strong></h4><p>I will be configuring all of this from my laptop.</p><p>All of these Raspberri Pi hosts will be headless. I will manage all the configuration over SSH and Web UIs. This will save on extra hardware.</p><p>I will also have an Xbox Series X on the network for my own recreation. :)</p><p>Here is the network topology I made in Draw.io. (<a href="https://app.diagrams.net/">https://app.diagrams.net/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*dwdxYcPK8Ng3AOIoYP89NQ.png" /></figure><p>I’ve saved the map here on my Github repo.<br><a href="https://github.com/SeanCNelson/Building-a-Security-Options-Center-Homelab">https://github.com/SeanCNelson/Building-a-Security-Options-Center-Homelab</a></p><p>I will be using this repo to store scripts, files, etc.</p><h4><strong>Future Fixes</strong></h4><ul><li>Expanding the Pi2’s storage with more SSDs. I am currently using RAID_01. I will be able to move to RAID_10. This will increase my storage memory and storage resistance.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*61rwa2_G7gIK3gDrchTIcQ.png" /><figcaption>Different Raid Setups</figcaption></figure><ul><li>Swap the <strong>TL-SG105</strong> to a <strong>TL-SG108E</strong>. This will give me a manager switch which can be used for port mirroring. I will be able to see the traffic between hosts behind the firewall (East/West), not just inbound and outbound traffic. (North/South).</li><li><strong>UPS </strong>(Uninterruptible power supply). This simply prevents hard blackouts and log loss from rebooting / power outages.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bb770226492" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Test Title]]></title>
            <link>https://medium.com/@seancnelsonis/test-title-180d49ab66a2?source=rss-e45cd545228d------2</link>
            <guid isPermaLink="false">https://medium.com/p/180d49ab66a2</guid>
            <category><![CDATA[test]]></category>
            <dc:creator><![CDATA[Sean Nelson]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 02:26:42 GMT</pubDate>
            <atom:updated>2026-03-12T02:26:42.295Z</atom:updated>
            <content:encoded><![CDATA[<p>Test story</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=180d49ab66a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>