<?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 The InfoSec Guy on Medium]]></title>
        <description><![CDATA[Stories by The InfoSec Guy on Medium]]></description>
        <link>https://medium.com/@jibingeorge.mg?source=rss-babf3dcbce37------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FaD9ucZJ4JeW2BJRWYzdXw.png</url>
            <title>Stories by The InfoSec Guy on Medium</title>
            <link>https://medium.com/@jibingeorge.mg?source=rss-babf3dcbce37------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 04:06:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jibingeorge.mg/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[Build Your Own Cybersecurity Lab Using Infrastructure as Code (IaC) with Terraform and Ansible]]></title>
            <link>https://medium.com/@jibingeorge.mg/build-your-own-cybersecurity-lab-using-infrastructure-as-code-iac-with-terraform-and-ansible-e33adb83bdf0?source=rss-babf3dcbce37------2</link>
            <guid isPermaLink="false">https://medium.com/p/e33adb83bdf0</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[security-operation-center]]></category>
            <dc:creator><![CDATA[The InfoSec Guy]]></dc:creator>
            <pubDate>Sun, 28 Dec 2025 16:14:32 GMT</pubDate>
            <atom:updated>2025-12-28T17:14:37.982Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lne6myQO7byXYiJtSZLMPw.jpeg" /></figure><p>Building a cybersecurity lab is one of the most effective ways to gain real-world security engineering skills. This article walks through how to build a <strong>corporate-grade cybersecurity lab from scratch</strong> using <strong>Infrastructure as Code (IaC)</strong> with <strong>Terraform and Ansible</strong>, focusing on automation, reproducibility, and SOC realism.</p><p>Before adopting IaC, I built a full-fledged cybersecurity research lab using Proxmox, pfSense, Active Directory, and SIEM/XDR tooling. It worked — but it was fragile. One wrong configuration change could take down the entire environment, and rebuilding meant hours of manual effort.</p><p>This article documents the <strong>second iteration</strong> of that lab — redesigned with <strong>Infrastructure as Code (IaC)</strong> principles using <strong>Terraform and Ansible</strong>. The goal was simple:</p><blockquote>Move fast and break things. Unless you are breaking stuff, you are not moving fast enough. ― Mark Zuckerberg</blockquote><h4>Network Design — Separation Before Everything Else</h4><p>When building a cybersecurity lab, <strong>breaking things is expected — and encouraged</strong>. Misconfigurations, vulnerable services, and noisy testing are all part of the learning process. However, without proper isolation, those experiments can spill into places they don’t belong, such as your home network. Separating the lab environment ensures you can test freely, deploy intentionally vulnerable systems, and learn safely, while keeping personal devices and everyday connectivity unaffected. Isolation creates a safe boundary where experimentation leads to insight, not incidents.</p><h4>Network Diagram</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyOIwnaUlBLHZ5jboT0jiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yUftMAA3GhhX3gLFIXlkg.png" /></figure><h4>Hardware Used in This Lab</h4><p>I used a <strong>TP-Link TL-SG105E</strong> managed switch. It’s inexpensive, widely available, and supports basic VLAN functionality — more than enough for a home lab.</p><p>Rather than documenting switch configuration line by line, I followed an excellent existing guide that explains VLAN concepts clearly and practically:</p><p>➡️ <strong>Steve’s Smart Home Guide — VLANs in Home Networks</strong><br> <a href="https://stevessmarthomeguide.com/vlans-home-networks/">https://stevessmarthomeguide.com/vlans-home-networks/</a></p><p>If VLANs are new to you, I strongly recommend reading it before proceeding.</p><h3>Proxmox — Laying the Virtualization Foundation</h3><p>With the network design in place, the next step is setting up the hypervisor that will host the entire lab. For this environment, I chose <strong>Proxmox VE</strong> — an open-source enterprise virtualization platform built on KVM and LXC. It offers an excellent balance of performance, flexibility, and visibility, which makes it ideal for learning and security research.</p><p>You can check out this helpful YouTube video by NetworkChuck that provides a step-by-step tutorial on installing Proxmox: <a href="https://youtu.be/_u8qTN3cCnQ">NetworkChuck — Proxmox Installation Tutorial</a></p><p>Use separate storage devices — one dedicated to installing Proxmox VE and another reserved for hosting lab virtual machines.</p><p><strong>Recommended (Generic) Hardware Requirement</strong></p><ul><li><strong>CPU:</strong> 8-core CPU (AMD or Intel with virtualization support)</li><li><strong>Memory:</strong> 32 GB RAM</li><li><strong>250 GB SSD</strong> for Proxmox VE installation</li><li><strong>1 TB SSD</strong> for lab virtual machines</li></ul><p>Before deploying any virtual machines, two things must be done correctly in Proxmox: <strong>networking</strong> and <strong>storage</strong>. Everything else in the lab — templates, automation, rebuilds — depends on these foundations.</p><h4>Proxmox Networking — Designing Before Deploying</h4><p>Proxmox uses <strong>Linux bridges</strong> to connect virtual machines to networks. A bridge behaves like a virtual switch inside the hypervisor: VMs attach their network interfaces to a bridge, and traffic flows just as it would through a physical switch.</p><p>By default, Proxmox creates a single bridge called vmbr0. Instead of using one flat network, this lab follows a segmented design that mirrors enterprise environments:</p><p>The lab uses <strong>three Proxmox bridges</strong>, each with a distinct purpose:</p><ul><li><strong>vmbr0 – WAN</strong><br> Connects to the physical network and provides <strong>internet access</strong> for the lab (e.g., pfSense updates and external connectivity).</li><li><strong>vmbr1 – Internal Lab Network (LAN)</strong><br> Hosts all internal lab machines — domain controllers, workstations, servers, and SIEM/XDR systems. Traffic here is isolated from WAN and management unless routed intentionally.</li><li><strong>vmbr2 – Management Network</strong><br> Dedicated to <strong>administrative access</strong>, allowing secure control of lab machines without mixing with WAN or internal lab traffic.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILMVoyG3wJs9ExwjDmReWg.png" /></figure><p>This separation ensures <strong>safe isolation, clear boundaries, and enterprise-style networking</strong>, letting you experiment without impacting your home network.</p><h4>Proxmox Storage — ZFS as the Backbone</h4><p>With networking in place, the next critical decision is storage. For this lab, <strong>ZFS</strong> is used as the primary storage backend.</p><p>ZFS brings several features that are especially valuable in a cybersecurity lab:</p><ul><li><strong>Snapshots</strong> for quick rollback after experiments</li><li><strong>Clones</strong> for rapidly creating VM templates</li><li><strong>Data integrity checks</strong> to protect against silent corruption</li><li><strong>High performance</strong> for VM disks and cloud-init templates</li></ul><p>ZFS becomes the backbone that enables everything that follows — golden images, Terraform-driven VM creation, and fast, repeatable rebuilds. Once ZFS is configured, creating and destroying environments becomes a routine operation instead of a risky event.</p><p>Configure a 1TB drive (eg: /dev/nvme0n1) as a ZFS pool named Internal for hosting lab VMs. This setup prioritizes speed (LZ4 compression) and stability (RAM limiting) while ensuring space efficiency (Thin Provisioning).</p><h4>Preparation &amp; Disk Wipe</h4><ul><li><strong>Remove Old Storage Config: </strong>Navigate to Datacenter &gt; Storage and remove entry name for the storage you want to remove to make the ZFS.</li><li><strong>Unmount and Wipe (Proxmox Shell):</strong></li></ul><pre># Unmount the path if it was previously mounted<br>umount /mnt/&lt;old storage name&gt;<br><br># Remove old partition headers/signatures<br>wipefs -a &lt;old storage path eg:/dev/nvme0n1&gt;</pre><ul><li><strong>Clean fstab: </strong>Check /etc/fstab to ensure no old mount points for /mnt/&lt;old storage name&gt; exist. If its exits, remove it.</li><li><strong>Limit ZFS RAM Usage (via Proxmox Shell):</strong> By default, ZFS uses 50% of Host RAM. For a lab environment, limit this to 1GB to save RAM for VMs.</li></ul><pre>echo &quot;options zfs zfs_arc_max=1073741824&quot; &gt; /etc/modprobe.d/zfs.conf<br>update-initramfs -u</pre><ul><li><strong>Create ZFS Pool (GUI): </strong>Navigate to Datacenter &gt; Node (proxmox) &gt; Disks &gt;ZFS. Click <strong>Create: ZFS </strong>and configure.</li></ul><pre>Name: Internal<br>Disk: Select your storage disk for VMs eg: /dev/nvme0n1<br>RAID Level: Single Disk<br>Compression: on (LZ4) — Provides &quot;free&quot; performance and space savings.<br>ashift: 12 — Optimized for modern SSDs</pre><ul><li><strong>Enable Thin Provisioning: </strong>Thin provisioning is required because it prevents Proxmox from reserving the full virtual disk size upfront. Space is allocated only when data is written, which avoids wasted storage, allows more VMs on the same ZFS pool, and prevents premature “out of space” issues.</li></ul><pre>Navigate to Datacenter &gt; Storage.<br>Select the new Internal (ZFS) storage and click Edit.<br>Ensure Thin provision is Checked.Click OK.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*k1-IgUotzd6TsUXIfDgC8A.png" /></figure><h4>Configuring Proxmox API User &amp; Token</h4><ul><li><strong>Create the Service User</strong>: Navigate to Datacenter &gt; Permissions &gt; Users. Create user terraform.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*wUP7Ik6SoYjRmYI9W2gy6A.png" /></figure><ul><li><strong>Generate API Token: </strong>Navigate to Datacenter &gt; Permissions &gt; API Tokens. Select terraform user, give a Token ID, uncheck Privilege Separation and click Add. Save the secret.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*1OKGl5CYBuo8zmvMrWBwfQ.png" /></figure><ul><li><strong>Assign Permissions: </strong>Navigate to Datacenter &gt; Permissions. Click Add &gt; User Permission.</li></ul><pre>Path: / (Root access)<br>User: terraform@pam<br>Role: Administrator</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*hLai4DR-v08ki1NWDTidNg.png" /></figure><h4>Creating Golden VM Templates</h4><p>To support fully automated VM provisioning using Terraform in Proxmox, we must create golden VM templates with <strong>Cloud-Init enabled for Linux</strong> and <strong>Cloudbase-Init enabled for Windows</strong>. These templates act as immutable base images that Terraform can clone, customize, and deploy repeatedly without manual intervention.</p><h4>What Is Cloud-Init?</h4><p><strong>Cloud-Init</strong> is a first-boot initialization service for Linux VMs.<br> It configures a VM during its initial startup using metadata provided by Proxmox.</p><p>It is used to:</p><ul><li>Set hostname and FQDN</li><li>Configure networking (DHCP or static)</li><li>Inject SSH keys</li><li>Create users and passwords</li><li>Run startup scripts</li></ul><p>Cloud-Init runs <strong>once per cloned VM</strong>, making it ideal for template-based automation.</p><p><strong>Supported on:</strong> Ubuntu, Debian, RHEL-based distributions, and most modern Linux OSes.</p><h4>What Is Cloudbase-Init?</h4><p><strong>Cloudbase-Init</strong> is the Windows equivalent of Cloud-Init.</p><p>It enables Windows VMs to:</p><ul><li>Rename the system</li><li>Configure network settings</li><li>Set Administrator credentials</li><li>Enable WinRM</li><li>Run PowerShell bootstrap scripts</li></ul><p><strong>Supported on:</strong> Windows Server 2019/2022 and Windows 10/11.</p><h4>Required ISO Images:</h4><ul><li>pfSense CE ISO Image: <a href="https://www.pfsense.org/download/">https://www.pfsense.org/download/</a></li><li>Windows Server 2022 ISO Image: <a href="https://www.microsoft.com/en-us/evalcenter/download-windows-server-2022">https://www.microsoft.com/en-us/evalcenter/download-windows-server-2022</a></li><li>Windows 11 ISO Image: <a href="https://www.microsoft.com/en-us/software-download/windows11">https://www.microsoft.com/en-us/software-download/windows11</a></li><li>Windows VirtIO Drivers: <a href="https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers">https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers</a></li><li>Ubuntu Server Cloud Image: <a href="https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img">noble-server-cloudimg-amd64.img</a></li></ul><p>Upload the ISOs to a storage location of your choice. In this setup, they are uploaded to the same drive where Proxmox is installed.</p><blockquote>Note: Use the minimum hardware requirements recommended for each OS when creating templates. Since these are base templates, allocating excess CPU, RAM, or disk only wastes space and provides no benefit.</blockquote><blockquote>Ensure the <strong>QEMU Guest Agent</strong> is installed and enabled on all VMs. It allows Proxmox to retrieve accurate VM status, IP addresses, and perform clean shutdowns, which is essential for automation and reliable management.</blockquote><blockquote>Ensure Cache is set to ‘Write back’, Discard and IO thread check if SSD for better performance while VM/VM Template creation.</blockquote><blockquote>Cloud-Init drive needs to be added for all VM templates except pfSense.</blockquote><h4>pfSense Template</h4><ul><li>Create a VM named <strong>pfsense-template </strong>using the downloade pfSense Installer image<strong> </strong>with <strong>vmbr0</strong> assigned as the WAN interface and <strong>vmbr1</strong> as the LAN interface. During installation, configure the WAN interface with a static IP from your home network (for example, 10.10.10.220/24), set the gateway to your home network’s gateway (for example, 10.10.10.100), and define a DNS resolver such as 8.8.8.8 or any resolver suitable for your environment. For the LAN interface, disable DHCP and assign the IP address 172.16.10.1/24.</li><li><strong>Install QEMU Guest Agent and Enable the service to start at boot:</strong></li></ul><pre>pkg update<br>pkg install qemu-guest-agent<br><br>echo &#39;qemu_guest_agent_enable=&quot;YES&quot;&#39; &gt;&gt; /etc/rc.conf.local<br>echo &#39;qemu_guest_agent_flags=&quot;-d -v -l /var/log/qemu-ga.log&quot;&#39; &gt;&gt; /etc/rc.conf.local<br><br>service qemu-guest-agent start</pre><ul><li>Shutdown the machine and convert to template.</li></ul><h4>Ubuntu Server Template</h4><p>Run the following commands in the Proxmox shell to create the ubuntu-server-template. Use a unique VMID for the template (for example, 103) and specify the path to the Ubuntu Server cloud image downloaded earlier and uploaded to Proxmox.</p><pre>apt update<br>apt install libguestfs-tools -y<br><br># 1. Define Variables<br>VMID=&lt;Define a unique VM ID here&gt;<br>VMNAME=&quot;ubuntu-server-template&quot;<br># Check if you have the image, or download a new one<br>SOURCE_IMG=&quot;/var/lib/vz/template/iso/&lt;ubuntu server cloud image file&gt;&quot;<br>TEMP_IMG=&quot;/tmp/ubuntu-zfs.img&quot;<br><br># 2. Prepare the clean image<br>rm -f $TEMP_IMG<br>cp $SOURCE_IMG $TEMP_IMG<br><br># 3. Inject &quot;Passwordless Sudo&quot; (The Magic Step)<br># This modifies the disk directly without booting the VM<br>virt-customize -a $TEMP_IMG --run-command &#39;echo &quot;%sudo ALL=(ALL) NOPASSWD:ALL&quot; &gt; /etc/sudoers.d/nopasswd&#39;<br><br># 4. Create the VM Shell<br># Note: Using vmbr1 (LAN) as per your script, but vmbr0 is also common for templates.<br>qm create $VMID --name $VMNAME --memory 2048 --net0 virtio,bridge=vmbr1<br><br># 5. Import and Attach Disk to ZFS<br># importdisk copies the file to ZFS. &#39;qm set&#39; attaches it as a SCSI drive.<br>qm importdisk $VMID $TEMP_IMG Internal<br>qm set $VMID --scsihw virtio-scsi-pci --scsi0 Internal:vm-$VMID-disk-0<br><br># 6. Configure Hardware &amp; Cloud-Init<br>qm resize $VMID scsi0 32G           # Expand to 32GB<br>qm set $VMID --ide2 Internal:cloudinit # Store cloud-init data on ZFS (Internal)<br>qm set $VMID --boot c --bootdisk scsi0 # Set boot order<br>qm set $VMID --serial0 socket --vga serial0 # Enable Console for Terraform logs<br><br># 7. Convert to Template<br>qm template $VMID<br><br># 8. Cleanup<br>rm $TEMP_IMG</pre><h4>Ubuntu Desktop Template</h4><ul><li>Create a VM named <strong>ubuntu-desktop-template</strong> using ubuntu desktop ISO.</li><li>In the VM’s Hardware section, before the first boot, configure vmbr0 as the only network interface so the system can download and install required packages. Once the setup is complete and before converting the VM into a template, remove vmbr0 and attach vmbr1 as the network interface.</li><li>Complete a standard installation. Once the system has booted, proceed with the steps below.</li><li><strong>Install Required Packages: </strong>This installs the QEMU Guest Agent, automation agent (Cloud-Init) and the remote access server (SSH).</li></ul><pre>sudo apt update<br>sudo apt install qemu-guest-agent cloud-init openssh-server -y</pre><ul><li><strong>Configure Passwordless Sudo: </strong>By default, Cloud-Init adds new users to the sudo group. We need to tell the system that “anyone in the sudo group can run commands without a password.”</li></ul><pre>echo &quot;%sudo ALL=(ALL:ALL) NOPASSWD:ALL&quot; | sudo tee /etc/sudoers.d/90-cloud-init-users<br>sudo chmod 440 /etc/sudoers.d/90-cloud-init-users</pre><ul><li><strong>Enable SSH and Qemu Guest Agent Service:</strong> Ensure Qemu Guest Agent and SSH starts automatically so you can log in remotely immediately after the clone boots.</li></ul><pre>sudo systemctl enable ssh<br>sudo systemctl start ssh<br><br>sudo systemctl start qemu-guest-agent<br>sudo systemctl enable qemu-guest-agent</pre><ul><li>Reboot the machine</li><li>Run the below commands in terminal.</li></ul><pre># Remove temporary data<br>sudo apt autoremove -y<br>sudo apt clean<br>sudo rm -rf /var/cache/apt/archives/*<br><br># Reset Machine ID<br>sudo truncate -s 0 /etc/machine-id<br>sudo rm /var/lib/dbus/machine-id<br>sudo ln -s /etc/machine-id /var/lib/dbus/machine-id</pre><ul><li>Remove the vmbr0 network interface and attach vmbr1 as the NIC.</li><li>Shutdown down the machine and convert to template.</li></ul><h4>Windows Server 2022 Template</h4><ul><li>Create a VM with name win-dc-2022-template using the downloaded Windows Server 2022 ISO Image.</li><li>In the VM’s Hardware section, before the first boot, configure vmbr0 as the only network interface so the system can download and install required packages. Once the setup is complete and before converting the VM into a template, remove vmbr0 and attach vmbr1 as the network interface. Also add a serial port (serial0) for logging.</li><li>Complete a standard installation. Once the system has booted, proceed with the steps below.</li><li>Enable <strong>WinRM</strong> to allow Ansible to connect later by running the following commands in <strong>PowerShell</strong>.</li></ul><pre>Set-Service WinRM -StartupType Automatic<br>Enable-PSRemoting -Force<br>New-NetFirewallRule -DisplayName &quot;WinRM&quot; -Direction Inbound -LocalPort 5985 -Protocol TCP -Action Allow</pre><ul><li>Download the latest <strong>Cloudbase-Init</strong> installer from <a href="https://github.com/cloudbase/cloudbase-init/releases">https://github.com/cloudbase/cloudbase-init/releases</a> and run it.</li><li>Set the username to Administrator, select the serial port for logging, and enable Use metadata password and Run Cloudbase-Init service as LocalSystem. Continue and complete the installation. At the final step, do not enable Sysprep, as additional configuration is required before generalizing the system.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*TmI91aAGCOfYyMuH4IsvNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*jO5kVeazR8kMFlLqyBJbvA.png" /></figure><ul><li>Edit the <strong>Cloudbase-Init.conf</strong> file located at<br> C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\Cloudbase-Init.conf.</li><li>Set the username to <strong>Administrator</strong>, then add the required lines under inject_user_password=true and save the file.</li></ul><pre>first_logon_behaviour=no<br>metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService</pre><ul><li>In powershell, run the below command to generalize the system</li></ul><pre>C:\Windows\System32\Sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:&quot;C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\Unattend.xml&quot;</pre><ul><li>Remove the vmbr0 network interface and attach vmbr1 as the NIC.</li><li>Shutdown down the machine and convert to template.</li></ul><h4>Windows 11 Template</h4><ul><li>Create a VM with name win11-template using the downloaded Windows 11 ISO Image.</li><li>In the VM’s Hardware section, before the first boot, configure vmbr0 as the only network interface so the system can download and install required packages. Once the setup is complete and before converting the VM into a template, remove vmbr0 and attach vmbr1 as the network interface. Also add a serial port (serial0) for logging.</li><li>Follow this <a href="https://www.youtube.com/watch?v=SiDLgdbFdtM">tutorial</a> during the Windows installation to bypass the Microsoft account setup.</li><li>After booting and signing in to the created user account, Enable WinRM to allow Ansible to connect later by running the following commands in PowerShell.</li></ul><pre>Set-NetConnectionProfile -NetworkCategory Private<br><br>Set-Service WinRM -StartupType Automatic<br>Enable-PSRemoting -Force<br>New-NetFirewallRule -DisplayName &quot;WinRM&quot; -Direction Inbound -LocalPort 5985 -Protocol TCP -Action Allow</pre><ul><li>BitLocker encryption must be disabled, and the system should be allowed to fully complete the decryption process before proceeding.</li></ul><pre>manage-bde -off C:<br>IMPORTANT: You must WAIT. Run the status command below. You cannot proceed until it says Percentage Encrypted: 0.0%.<br><br>manage-bde -status<br>(If it says &quot;Decryption in Progress,&quot; wait a few minutes and check again.)</pre><ul><li>Next, enable the Administrator account, sign in to it, and delete the user account created in the previous step.</li></ul><pre>net user Administrator /active:yes<br>net user Administrator TempPasswd</pre><ul><li>After signing in to the Administrator account, perform the following steps:</li></ul><pre>Get-AppxPackage -AllUsers Microsoft.OneDriveSync | Remove-AppxPackage -AllUsers</pre><ul><li>Download the latest <strong>Cloudbase-Init</strong> installer from <a href="https://github.com/cloudbase/cloudbase-init/releases">https://github.com/cloudbase/cloudbase-init/releases</a> and run it.</li><li>Set the username to Administrator, select the serial port for logging, and enable Use metadata password and Run Cloudbase-Init service as LocalSystem. Continue and complete the installation. At the final step, do not enable Sysprep, as additional configuration is required before generalizing the system.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*TmI91aAGCOfYyMuH4IsvNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*jO5kVeazR8kMFlLqyBJbvA.png" /></figure><ul><li>Edit the <strong>Cloudbase-Init.conf</strong> file located at C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\Cloudbase-Init.conf.</li><li>Set the username to <strong>Administrator</strong>, then add the required lines under inject_user_password=true and save the file.</li></ul><pre>first_logon_behaviour=no<br>metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService</pre><ul><li>Edit the <strong>Unattend.xml</strong> file to insert the block below inside <strong>RunSynchronous</strong>. Place it just above the existing <strong>RunSynchronousCommand</strong> block to enable the <strong>Administrator</strong> account on first boot after Sysprep, and update the existing block to have <strong>Order 2</strong>.</li></ul><pre>&lt;RunSynchronousCommand wcm:action=&quot;add&quot;&gt;<br>  &lt;Path&gt;net user administrator /active:yes&lt;/Path&gt;<br>  &lt;Order&gt;1&lt;/Order&gt;<br>  &lt;Description&gt;Enable Administrator User&lt;/Description&gt;<br>&lt;/RunSynchronousCommand&gt;<br>&lt;RunSynchronousCommand wcm:action=&quot;add&quot;&gt;<br>&lt;!-- Add above to RunSynchronous block before the below one--&gt;<br>&lt;/RunSynchronousCommand&gt;<br>&lt;RunSynchronousCommand wcm:action=&quot;add&quot;&gt;<br>    &lt;Order&gt;2&lt;/Order&gt;<br>    &lt;Path&gt;cmd.exe /c &quot;&quot;C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init.exe&quot; --config-file &quot;C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init-unattend.conf&quot; &amp;amp;&amp;amp; exit 1 || exit 2&quot;&lt;/Path&gt;<br>    &lt;Description&gt;Run Cloudbase-Init to set the hostname&lt;/Description&gt;<br>    &lt;WillReboot&gt;OnRequest&lt;/WillReboot&gt;<br>&lt;/RunSynchronousCommand&gt;</pre><ul><li>In powershell, run the below command to generalize the system</li></ul><pre>C:\Windows\System32\Sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:&quot;C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\Unattend.xml&quot;</pre><ul><li>Remove the vmbr0 network interface and attach vmbr1 as the NIC.</li><li>Shutdown down the machine and convert to template.</li></ul><h3>Getting Started with the Code</h3><p>The hard part is now done. The architecture is designed, the network is in place, and Proxmox is ready. From this point forward, <strong>everything is code</strong>.</p><p>Clone the GitHub repository that contains all the required <strong>Terraform and Ansible</strong> configurations:</p><pre>git clone git@github.com:J4ckFr05t/cyberlab-iac.git<br>cd cyberlab-iac</pre><p>This repository is the single source of truth for the lab. It includes:</p><ul><li>Terraform code to provision infrastructure on Proxmox</li><li>Ansible playbooks and roles to configure systems</li><li>Inventory and variable files</li><li>A helper script (cyberlab.py) to simplify setup</li></ul><p>Use cyberlab.py using option 1 to generate vms.json, which defines the virtual machines to be cloned along with their hardware requirements, and to create the secret files and configs required by Terraform and Ansible.</p><pre>❯ python cyberlab.py<br><br>=== CyberLab Infrastructure Manager ===<br>1. Run Prerequisites Checks<br>2. Deploy Infrastructure (Terraform)<br>3. Configure Software (Ansible)<br>4. Exit<br><br>Select an option (1-4): 1<br><br>=== Checking Prerequisites ===<br><br>Checking System Tools:<br>[OK] Found terraform at /opt/homebrew/bin/terraform<br>[OK] Found ansible at /opt/homebrew/bin/ansible<br>[OK] Found ansible-playbook at /opt/homebrew/bin/ansible-playbook<br><br>Checking Terraform VM Configuration (vms.json):<br>[WARN] Missing vms.json<br>Create vms.json from example? (y/n): y<br>To configure cloud-init, please provide the following (applied to all VMs):<br>Enter Search Domain (e.g. yourdomain.com): yourdomain.com<br><br>Select SSH Public Key source:<br>1. Manual input<br>2. Read from /Users/jibingeorge/.ssh/id_rsa.pub<br>3. Read from /Users/jibingeorge/.ssh/id_ed25519.pub<br>Select option (1-3): 2<br>Read key: ssh-rsa AAAAB3NzaC1y...ns-MacBook-Pro.local<br>[OK] Created and configured /Users/jibingeorge/Documents/cyberlab-iac/terraform/vms.json<br><br>Checking Ansible Group Variables:<br>[WARN] Missing all.yml<br>Create all.yml now? (y/n): y<br><br>Configuring Domain Settings for all.yml:<br>Enter Domain Name (e.g., example.com or domain1.parent.com): yourdomain.com<br>Enter Domain NetBIOS Name (e.g., EXAMPLE): YOURDOMAIN<br>Enter DNS Forwarders (press Enter after each, empty line to finish):<br>  DNS Forwarder (or Enter to finish): 8.8.8.8<br>  DNS Forwarder (or Enter to finish): 1.1.1.1<br>  DNS Forwarder (or Enter to finish): <br>[OK] Created all.yml<br>[WARN] Missing dc.yml<br>[INFO] Creating dc.yml automatically...<br>[OK] Created dc.yml<br><br>Checking Terraform Configuration:<br>[WARN] Missing /Users/jibingeorge/Documents/cyberlab-iac/terraform/terraform.tfvars<br>Create Terraform secrets now? (y/n): y<br><br>Configuring Terraform secrets:<br>Enter Proxmox API URL (e.g., https://your-proxmox-server:8006/api2/json): https://10.10.10.200:8006/api2/json<br>Enter Proxmox API Token ID (e.g., your-token-id@pam!your-token-name): terraform@pam!terraform<br>Enter Proxmox API Token Secret: your-proxmox-secret-token                 <br><br>Configure passwords for VM templates:<br>Use the same password for all templates? (y/n): y<br>Enter password for all templates: Password@123<br>[OK] Created terraform.tfvars<br><br>Checking Ansible Configuration:<br>[WARN] Missing Vault Password File: /Users/jibingeorge/Documents/cyberlab-iac/ansible/.vault_pass<br>Create Vault Password file now? (y/n): y<br><br>Creating Ansible Vault password file:<br>Enter Ansible Vault password: vaultpass@123<br>[OK] Created .vault_pass<br>[WARN] Missing Ansible Vault: /Users/jibingeorge/Documents/cyberlab-iac/ansible/inventory/group_vars/secret_vault.yml<br>Create Ansible Vault now? (y/n): y<br><br>Configuring Ansible Vault secrets:<br><br>Enter the following credentials:<br>Windows/AD Administrator Username (default: Administrator): Administrator<br>Windows/AD Administrator Password: Password@123<br>Domain Recovery (DSRM) Password: Password@123<br>Dave User Password: Password@123<br>Sophia User Password: Password@123<br>Elastic Custom Password: Password@123<br>Wazuh API Password: Password@123<br>Wazuh Admin Password: Password@123<br>[OK] Created encrypted secret_vault.yml<br><br>Initializing Terraform:<br>[OK] Terraform is already initialized (.terraform directory exists).<br><br>Installing Ansible Requirements:<br>[INFO] Running: Ansible Galaxy Install...<br>----------------------------------------<br>Starting galaxy collection install process<br>Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.<br>----------------------------------------<br>[OK] Ansible Galaxy Install completed successfully.<br><br>All prerequisites checks passed!</pre><p>With everything in place, run cyberlab.py using option 2 to provision the virtual machines as shown below and wait until the process finishes.</p><pre>jackfrost@mgmt-01-srv:~/cyberlab-iac$ python3 cyberlab.py<br><br>=== CyberLab Infrastructure Manager ===<br>1. Run Prerequisites Checks<br>2. Deploy Infrastructure (Terraform)<br>3. Configure Software (Ansible)<br>4. Exit<br><br>Select an option (1-4): 2<br><br>=== Deploy Infrastructure (Terraform) ===<br><br>Running Terraform Plan...<br>[INFO] Running: Terraform Plan...<br>.<br>.<br>.<br>.<br>Plan: 7 to add, 0 to change, 0 to destroy.<br><br>─────────────────────────────────────────────────────────────────────────────<br><br>Saved the plan to: lab.tfplan<br><br>To perform exactly these actions, run the following command to apply:<br>    terraform apply &quot;lab.tfplan&quot;<br>----------------------------------------<br>[OK] Terraform Plan completed successfully.<br><br>Please review the plan above.<br>Do you want to apply this plan? (y/n): y</pre><p>Log in to the Windows 11 VM (win-01-ws) using the credentials provided via Cloud-Init. This completes the Windows OOBE process and prevents issues during subsequent Ansible configuration.</p><p>Log in to the pfSense VM (PF-01-RTR), reset the default password, and perform the initial configuration, including enabling DHCP as required.</p><p>Now run cyberlab.py and select <strong>option 3</strong> to execute the Ansible playbooks. This will set up the domain controller, join workstations to the domain, configure Elastic Fleet, enroll Elastic agents on endpoints, and deploy Wazuh along with its agents.</p><pre>jackfrost@mgmt-01-srv:~/cyberlab-iac$ python3 cyberlab.py<br><br>=== CyberLab Infrastructure Manager ===<br>1. Run Prerequisites Checks<br>2. Deploy Infrastructure (Terraform)<br>3. Configure Software (Ansible)<br>4. Exit<br><br>Select an option (1-4): 3<br><br>=== Configure Software (Ansible) ===<br><br>The following playbooks will be executed in order:<br>1. Check Connectivity<br>2. Domain Controller Setup<br>3. Join to Domain<br>4. SIEM Stack (ELK &amp; Fleet)<br>5. Enroll Elastic Agents<br>6. Wazuh Manager Setup<br>7. Enroll Wazuh Agents<br><br>Proceed with configuration? (y/n): y</pre><p>If any playbook fails on a specific host, rerun it manually as shown below:</p><pre>ansible-playbook playbooks/&lt;playbook name yaml&gt; --vault-password-file .vault_pass --limit &lt;hostname&gt;<br>eg: ansible-playbook playbooks/enroll_wazuh_agents.yml --vault-password-file .vault_pass --limit win-01-ws</pre><p>At this point, you should have a fully functional lab environment with Active Directory in place, hosts joined to the domain, and both SIEM (Elasticsearch) and XDR (Wazuh) operational.</p><p>This foundation opens the door to building and experimenting with a wide range of security scenarios. I hope you enjoyed following along and were able to reproduce the setup successfully. I’ll continue improving the scripts to add more automation and make the workflow even simpler over time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e33adb83bdf0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Secure Cybersecurity Research Lab: A Journey of Isolation and Exploration]]></title>
            <link>https://medium.com/@jibingeorge.mg/cybersecurity-research-lab-setup-5beb54d8dd59?source=rss-babf3dcbce37------2</link>
            <guid isPermaLink="false">https://medium.com/p/5beb54d8dd59</guid>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cyber-security-analyst]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[security-engineer]]></category>
            <dc:creator><![CDATA[The InfoSec Guy]]></dc:creator>
            <pubDate>Sat, 03 Jun 2023 15:37:13 GMT</pubDate>
            <atom:updated>2025-12-31T12:18:08.361Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Secure Cybersecurity Lab: A Journey of Isolation and Exploration</h3><h3><em>Introduction</em></h3><p>In an increasingly interconnected world, cybersecurity has become a paramount concern. As an avid learner and passionate about understanding the intricacies of cyber threats, I embarked on a journey to create my own cybersecurity research lab. In this blog post, I will share my experiences and insights on how I built a secure and isolated research lab separate from my home network. Join me as we dive into the world of cybersecurity exploration and innovation.</p><blockquote><strong>Automated Lab Setup now available at:</strong> <a href="https://medium.com/@jibingeorge.mg/build-your-own-cybersecurity-lab-using-infrastructure-as-code-iac-with-terraform-and-ansible-e33adb83bdf0">https://medium.com/@jibingeorge.mg/build-your-own-cybersecurity-lab-using-infrastructure-as-code-iac-with-terraform-and-ansible-e33adb83bdf0</a></blockquote><h3>Securing Boundaries: VLAN Segmentation for Home-Lab Network Isolation</h3><p>In the realm of cybersecurity research, isolation is a fundamental principle that ensures the integrity and security of your lab environment. By separating your lab from your home network, you minimize the risk of potential threats spreading beyond their intended boundaries. In this section, I will delve into the importance of isolation and explain how I achieved it in my cybersecurity research lab.</p><p>To create a clear separation between my lab and home network, I utilized various networking components and concepts, including a switch, two wireless access points (WAP), and an ISP router. One of the key concepts I employed was the use of Virtual Local Area Networks (VLANs).</p><h4>VLANs: Virtual Local Area Networks</h4><p>VLANs allow you to logically divide a physical network into multiple virtual networks. Each VLAN operates as an independent broadcast domain, effectively isolating the devices within it. By using VLANs, I created two separate networks: one for my home devices and another for my lab devices.</p><h4>Access Ports, Trunk Ports, PVID, Tagged, and Untagged Ports</h4><p>To implement VLANs effectively, it’s important to understand certain port configurations:</p><ol><li><strong>Access Ports:</strong> These ports are assigned to a specific VLAN and connect to devices that belong to that VLAN. Devices connected to access ports are unaware of VLAN tagging and communicate within their designated VLAN only.</li><li><strong>Trunk Ports:</strong> Trunk ports are responsible for carrying traffic for multiple VLANs. They are typically connected between networking devices, such as switches and routers. Trunk ports use VLAN tagging to differentiate between VLANs, allowing traffic to flow between them.</li><li><strong>PVID (Port VLAN ID):</strong> PVID is the VLAN assigned to an access port. Incoming untagged frames on an access port are associated with the VLAN specified by its PVID.</li><li><strong>Tagged and Untagged Ports:</strong> In a VLAN configuration, ports can be either tagged or untagged. Tagged ports transmit frames with VLAN tags, indicating which VLAN the frames belong to. Untagged ports, on the other hand, do not include VLAN tags in their transmitted frames.</li></ol><blockquote>The purpose of a tagged or “trunked” port is to pass traffic for multiple VLAN’s, whereas an untagged or “access” port accepts traffic for only a single VLAN. Generally speaking, trunk ports will link switches, and access ports will link to end devices.</blockquote><p>To better understand VLAN setup, including access ports, trunk ports, PVID, tagged and untagged ports, I recommend reading this comprehensive guide by Steve on their blog: <a href="https://stevessmarthomeguide.com/vlans-home-networks/#:~:text=VLANS%20or%20Virtual%20LANS%20is,communicate%20with%20any%20other%20device">https://stevessmarthomeguide.com/vlans-home-networks/#:~:text=VLANS%20or%20Virtual%20LANS%20is,communicate%20with%20any%20other%20device</a>.</p><p>This blog post provides a detailed explanation of VLAN concepts and their implementation, making it a valuable resource for anyone looking to set up VLANs in their network.</p><h4>Network Diagram</h4><p>To give you a visual representation of how I implemented VLANs and designed the network for my cybersecurity research lab, here is a simplified network diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*yfuetNFTRRQ5rZHO5f4CeA.png" /></figure><p>By implementing VLANs based on the principles outlined in Steve smart home guide blog post and leveraging the appropriate network equipment, I successfully achieved the necessary isolation for my cybersecurity research lab. This separation ensured that my lab remained protected from potential threats and allowed me to conduct experiments, analyze threats, and explore cybersecurity innovations in a controlled and secure environment.</p><blockquote>I have utilized two routers for my home and lab networks, deactivating DHCP in both devices to function as wireless access points (WAPs). One router is designated for the home network, while the other serves the lab network. To prevent accidental wireless connections, I disabled SSID broadcast on the ISP modem, as both VLANs have access to it. To enhance the security of this network configuration, incorporating a dedicated firewall would be advantageous.</blockquote><h3>Building the Foundation: Setting up the Lab for Cybersecurity Research</h3><p>When it comes to setting up a robust and secure cybersecurity lab, it’s essential to have the right hardware and software in place.</p><h4>Hardware Requirements</h4><p>To ensure optimal performance and a smooth experience while setting up your cybersecurity lab, it is important to meet certain hardware requirements. Here are the recommended specifications based on your given setup:</p><p>CPU: Intel/AMD Processor 8 Cores (Atleast 4 core CPU)</p><p>RAM: 24 GB (32 GB Recommended)</p><p>Storage: 512 GB SSD/HDD (SSD Recommended)</p><p>Meeting these hardware requirements ensures that your cybersecurity lab operates efficiently, minimizing I/O delays, and delivering a responsive user experience. It is important to note that upgrading to 24 GB of RAM and utilizing at least one SSD for storage will significantly enhance the performance and usability of your lab.</p><h4>Installing Proxmox: Unlocking the Power of Virtualization</h4><p>To harness the full potential of your cybersecurity lab, it is essential to install a virtualization platform like Proxmox.</p><p>You can check out this helpful YouTube video by NetworkChuck that provides a step-by-step tutorial on installing Proxmox: <a href="https://youtu.be/_u8qTN3cCnQ">NetworkChuck — Proxmox Installation Tutorial</a></p><blockquote>By configuring a static IP, such as 192.168.1.100, you ensure stable connectivity and easy access for remote management. Customize the IP address, subnet mask, default gateway, and DNS settings according to your specific network requirements.</blockquote><h4>Configuring Storage for VMs and Backup: Utilizing Different Storage Resources</h4><p>So, let me walk you through how I configured the storage components for my cybersecurity lab. I wanted to ensure optimal performance and data protection, so I allocated specific resources for virtual machines (VMs) and backups. Here’s what I did:</p><p>First, I dedicated a high-performance 1TB M.2 SSD (Internal) specifically for hosting the virtual machine disks. This SSD offers fast read and write operations, allowing me to run multiple VMs simultaneously without any performance issues.</p><p>Next, I set aside a separate 1TB HDD (External) for storing backups. Having a dedicated backup storage ensures data redundancy and backup integrity. This way, I can easily restore critical data in case of unexpected incidents or system failures.</p><p>In terms of ISO images used for VM installations, I opted to store them on the drive (local) where proxmox is installed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y26wfCz7Ne9VYtCKS9Lj9g.png" /></figure><h4>Setting up the Network for VMs: Creating LAN and WAN Interfaces</h4><p>To enable connectivity and networking capabilities for the virtual machines (VMs) in your cybersecurity lab, you have to establish a network configuration that includes a LAN interface and a WAN interface. Let’s dive into how you set up the network for your VMs:</p><ol><li>LAN Interface: In order to create a local area network (LAN) specifically for your lab, you created a new linux bridge called vmbr1. This interface acts as the LAN interface, allowing communication and data transfer among the VMs within your lab environment. By designating a separate LAN interface, you can isolate your lab network from the external network and ensure the security and integrity of your research and experimentation.</li><li>WAN Interface: To provide connectivity to the outside world and access resources beyond your lab environment, you utilized the default Linux bridge interface, vmbr0, as the wide area network (WAN) interface. This interface serves as the gateway to the external network, enabling VMs to connect to the internet, access external services, and communicate with resources outside your lab. By separating the LAN and WAN interfaces, you maintain control over network traffic and effectively manage communication between your lab and the external network.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Or-nPeES-L_HtkCJ8rexZw.png" /></figure><p>By configuring the LAN and WAN interfaces in this manner, you create a network environment that supports both local communication among the lab VMs and connectivity to the wider network. The LAN interface, vmbr1, facilitates secure and isolated communication within the lab, while the WAN interface, vmbr0, ensures connectivity to the external network and the internet.</p><h4>Setting up VMs for Lab</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*d54d7rWzvd1s9z6miN5-TA.png" /></figure><p>To establish Active Directory (AD) integration in your lab environment, several machines need to connect to the AD domain controller. Follow the steps below to configure AD and join the respective machines:</p><ol><li>Configure pfSense Router:</li></ol><ul><li>To serve as the central router and firewall for your lab, you set up a Pfsense VM</li><li>Set the IP address of the domain controller (172.16.16.100) as the primary DNS server on the pfSense router.</li><li>Use 8.8.8.8 as the secondary DNS server to ensure external DNS resolution.</li><li>Refer to this YouTube video by divgital for a <a href="https://www.youtube.com/watch?v=yTMvrPAwbPE&amp;t=299s&amp;ab_channel=Divgital">detailed guide on setting up pfSense on proxmox</a>.</li></ul><p>2. Configure Active Directory and DNS Server:</p><ul><li>Set up the Windows Server VM as a Domain Controller and configure it as a DNS server.</li><li>Refer to this YouTube video by MSFT WebCast for a <a href="https://youtu.be/h3sxduUt5a8">detailed guide on configuring Active Directory</a>.</li></ul><p>3. Join Windows and Linux Machines to the AD Domain:</p><ul><li>You’ve set up Windows and Linux VMs to act as user workstations within your lab.</li><li>Follow the instructions provided in these YouTube video by <a href="https://youtu.be/SsN8pwIE1_Y">Proffessor Andrew</a> and <a href="https://youtu.be/BvqdU6FZblw">Nerd on the Street</a> to join Windows and Linux machines to the AD domain.</li></ul><p>4. Install and Set Up ELK Stack and Fleet Server:</p><ul><li>Install the ELK stack on one Ubuntu server, and install Fleet Server on another Ubuntu server.</li><li>Follow the installation and setup instructions provided in this <a href="https://youtu.be/Ts-ofIVRMo4">YouTube video by IppSec</a>.</li></ul><p>5. Set Up ELK and Fleet Server:</p><ul><li>Two Ubuntu servers have been provisioned in your lab. The first Ubuntu server is dedicated to hosting Fleet Server, which manages and orchestrates Elastic agents. Fleet Server enables centralized management, monitoring, and control of Elastic agents across the lab network. The second Ubuntu server hosts the ELK stack, which stands for Elasticsearch, Logstash, and Kibana. ELK stack is utilized for Security Information and Event Management (SIEM) purposes, providing advanced log analysis, threat detection, and visualization capabilities.</li><li>Configure Elastic agents on each host (Windows and Linux machines) to communicate with Fleet Server.</li><li>Create seperate agent policies for windows and linux machines. I have added windows integration to windows agent policy and auditd integration to linux agent policy.</li><li>Refer to the steps demonstrated in this <a href="https://youtu.be/V3C_AOlNtvI">YouTube video by Offensive Kernal for installing and setting up elastic agents</a>.</li></ul><p>It is important to configure the network interfaces correctly for each VM. Ensure that all the VMs, except for Pfsense, are connected to the vmbr1 interface, which serves as the LAN interface for your lab network. This enables seamless communication and data transfer among the VMs within the lab environment.</p><p>For Pfsense, it should be configured to have both vmbr0 and vmbr1 interfaces. The vmbr0 interface acts as the WAN interface, connecting Pfsense to the external network and providing internet access to the lab network. The vmbr1 interface, on the other hand, connects Pfsense to the LAN, allowing it to manage the internal lab network and enforce firewall rules and security policies.</p><h4>Fixing Fleet Server Offline Issue and Automating Elastic Agent Restart (The fix should be in 8.9.0)</h4><p>If you’ve encountered the issue of Fleet Server going offline after a reboot, there is a solution that can help ensure its smooth operation. By following the steps below, you can resolve this issue and automate the restart of Elastic Agent after a reboot:</p><ol><li>Identify the Issue:</li></ol><ul><li>While troubleshooting the Fleet Server offline problem, you came across a helpful GitHub discussion. You can find the discussion here: <a href="https://github.com/elastic/fleet-server/issues/2431">GitHub Discussion: Fleet-server Agent gets into offline state on machine reboot.</a></li><li>Through this discussion, you discovered that restarting the Elastic Agent in the Fleet Server resolves the offline issue. However, you need to perform this step manually after each reboot.</li></ul><p>2. Automate Elastic Agent Restart:</p><ul><li>To automate the process of restarting the Elastic Agent service after a reboot, you can create a cronjob.</li><li>Cron is a time-based job scheduler in Unix-like operating systems. It allows you to schedule commands or scripts to run automatically at predefined intervals.</li><li>Create a cronjob that executes the command to restart the Elastic Agent service 1 minute after the system reboots.</li></ul><p>3. Configure the Cronjob:</p><ul><li>Open the crontab file using the command: <strong>sudo crontab -e</strong></li><li>Add the following line to the file:</li></ul><pre>@reboot sleep 60 &amp;&amp; systemctl restart elastic-agent.service</pre><ul><li>Save and exit the file.</li></ul><p>By setting up this cronjob, the Elastic Agent service will automatically restart 1 minute after each system reboot, ensuring that Fleet Server remains online without manual intervention.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQLn6AlSeto4HdCKsOnBxw.png" /></figure><p>Please note that the above solution is based on the information and discussions found in the GitHub thread you mentioned. It’s always recommended to refer to the latest documentation and community discussions for any updates or alternative solutions related to this issue.</p><p>By implementing this automated solution, you can address the Fleet Server offline problem and ensure the seamless functioning of your Elastic Agents within the Fleet Server environment.</p><h4>Setting up XDR for lab using Wazuh</h4><p>XDR, or Extended Detection and Response, is a game-changer in cybersecurity. Unlike traditional tools, XDR integrates data from across an organization’s IT infrastructure to provide a unified and proactive threat detection system. Using advanced analytics and automation, XDR not only detects known threats but adapts to emerging risks, offering a comprehensive defense strategy against the evolving cyber threat landscape.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWgT9Ku1SmqwPR_dTFE3CA.png" /><figcaption>Wazuh</figcaption></figure><p><a href="https://github.com/wazuh/wazuh">Wazuh</a> is a free and open source platform used for threat prevention, detection, and response. It is capable of protecting workloads across on-premises, virtualized, containerized, and cloud-based environments.</p><p>Wazuh solution consists of an endpoint security agent, deployed to the monitored systems, and a management server, which collects and analyzes data gathered by the agents. Besides, Wazuh has been fully integrated with the Elastic Stack, providing a search engine and data visualization tool that allows users to navigate through their security alerts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*kkxHGS2PMJnR_LpWvpjkFw.png" /></figure><p>Steps:</p><ul><li>Provision a new ubuntu VM in your lab with 4 vCPU and 8GB RAM.</li><li>Install and configure wazuh as demonstrated in this <a href="https://www.youtube.com/watch?v=i68atPbB8uQ&amp;t=1880s&amp;ab_channel=JohnHammond">YouTube video by John Hammond</a>.</li><li>Configure Wazuh agents on each host to communicate with XDR server.</li><li>Configure Elastic agents on XDR Server to communicate with fleet server.</li></ul><blockquote>Remember, the journey doesn’t end here. It is just the beginning of a lifelong pursuit of cybersecurity excellence. So, keep exploring, keep pushing boundaries, and keep making a positive impact in the realm of cybersecurity.</blockquote><blockquote>Thank you for joining me on this journey of building a secure cybersecurity research lab. Together, let’s continue to strengthen our knowledge, skills, and defenses to make the digital world a safer place.</blockquote><blockquote>Feel free to connect with me on <a href="https://www.linkedin.com/in/jibin-george-mg/">LinkedIn</a> or visit my <a href="http://jibingeorge.org/">website</a>.</blockquote><blockquote>Happy researching and stay secure!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5beb54d8dd59" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>