|
| 1 | +--- |
| 2 | +layout: blog |
| 3 | +title: "Building a Cyber Range with Ludus" |
| 4 | +seo_title: "Setting up and Active Directory (AD) Cyber Range Lab with Proxmox VE and Ludus" |
| 5 | +date: 2025-11-22T15:38 |
| 6 | +categories: ['Active-Directory', 'Homelab'] |
| 7 | +--- |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +Ever since I built my first homelab, I’ve been obsessed with having my own dedicated cyber range — my little digital fight club where I can break things, fix things, automate things, and then do it all again. True definition of insanity right here. But I didn’t want to risk nuking my daily-driver machine. |
| 12 | + |
| 13 | +Then one day I looked over at my ancient desktop — the one that wheezes when you open more than three Chrome tabs (I actually needed to replace a few faulty fans) — and thought: |
| 14 | + |
| 15 | +> “Bestie, you’re getting a glow-up.” |
| 16 | +
|
| 17 | +A quick dive into the documentation rabbit hole later, I found [Ludus](https://docs.ludus.cloud/), an open-source framework that basically said, “I heard you hate clicking through installers manually, let me cook.” |
| 18 | + |
| 19 | +## Why Ludus? |
| 20 | +I chose Ludus for a few reasons: |
| 21 | +- It automates the heavy lifting of cyber range creation, because I am allergic to unnecessary clicking. |
| 22 | +- It supports modular “plugins,” including prebuilt Active Directory environments. |
| 23 | +- Everything is infrastructure-as-code, which means I can tear down and rebuild environments cleanly. |
| 24 | +- It's built for learning, research, and “I wonder what happens if—” moments, not production use. |
| 25 | + |
| 26 | +Besides, I was already making use of [Proxmox](https://www.proxmox.com/) in my previous series and Ludus builds on top of it. So Ludus fits perfectly into my tech ecosystem. |
| 27 | + |
| 28 | +## Setting up my Range |
| 29 | +Ludus' [documentation](https://docs.ludus.cloud/docs/quick-start/install-ludus) walks through the installation process, and following it is very straightforward so I won't be covering it in this blogpost. |
| 30 | + |
| 31 | +After you have installed Ludus and created a user, you should be able to list the available templates. |
| 32 | + |
| 33 | +```console |
| 34 | +$ ludus templates list |
| 35 | ++------------------------------------+-------+ |
| 36 | +| TEMPLATE | BUILT | |
| 37 | ++------------------------------------+-------+ |
| 38 | +| debian-11-x64-server-template | FALSE | |
| 39 | +| debian-12-x64-server-template | FALSE | |
| 40 | +| kali-x64-desktop-template | FALSE | |
| 41 | +| win11-22h2-x64-enterprise-template | FALSE | |
| 42 | +| win2022-server-x64-template | FALSE | |
| 43 | ++------------------------------------+-------+ |
| 44 | +``` |
| 45 | + |
| 46 | +On a fresh install, a few default templates are provided but haven't been build yet. As I like to keep things up to date I added a `win2025` template, but you can add as many as you like (if the storage lets you). |
| 47 | + |
| 48 | +```console |
| 49 | +$ git clone https://gitlab.com/badsectorlabs/ludus |
| 50 | +$ cd ludus/templates |
| 51 | +$ ludus templates add -d win2025-server-x64-tpm |
| 52 | +[INFO] Successfully added template |
| 53 | +$ ludus templates build -n win-2025-server-x64-tpm-template |
| 54 | +[INFO] Template building started |
| 55 | +$ ludus templates build -n debian-12-x64-server-template |
| 56 | +[INFO] Template building started |
| 57 | +``` |
| 58 | + |
| 59 | +While browsing the “Environment Guides,” I stumbled upon the **Game Of Active Directory – Ninja Hacking Academy (GOAD-NHA)** setup. This thing is basically an escape room for sysadmins — you drop in, and everything dares you to figure it out by yourself. But I wanted my cyber range to be on the latest Windows Server version, which at the time of writing is 2025. |
| 60 | + |
| 61 | +That meant modifying the original Ansible scripts. Thankfully, it wasn’t as dramatic as it sounds, but it did feel like giving the templates a well-deserved modern update. My current ludus range configuration looks as follows: |
| 62 | + |
| 63 | +```yml |
| 64 | +ludus: |
| 65 | + - vm_name: "{{ range_id }}-NHA-DC01" |
| 66 | + hostname: "{{ range_id }}-DC01" |
| 67 | + template: win2025-server-x64-tpm-template |
| 68 | + vlan: 10 |
| 69 | + ip_last_octet: 30 |
| 70 | + ram_gb: 8 |
| 71 | + cpus: 2 |
| 72 | + windows: |
| 73 | + sysprep: true |
| 74 | + - vm_name: "{{ range_id }}-NHA-DC02" |
| 75 | + hostname: "{{ range_id }}-DC02" |
| 76 | + template: win2025-server-x64-tpm-template |
| 77 | + vlan: 10 |
| 78 | + ip_last_octet: 31 |
| 79 | + ram_gb: 8 |
| 80 | + cpus: 2 |
| 81 | + windows: |
| 82 | + sysprep: true |
| 83 | + - vm_name: "{{ range_id }}-NHA-SRV01" |
| 84 | + hostname: "{{ range_id }}-SRV01" |
| 85 | + template: win2025-server-x64-tpm-template |
| 86 | + vlan: 10 |
| 87 | + ip_last_octet: 32 |
| 88 | + ram_gb: 6 |
| 89 | + cpus: 2 |
| 90 | + windows: |
| 91 | + sysprep: true |
| 92 | + - vm_name: "{{ range_id }}-NHA-SRV02" |
| 93 | + hostname: "{{ range_id }}-SRV02" |
| 94 | + template: win2025-server-x64-tpm-template |
| 95 | + vlan: 10 |
| 96 | + ip_last_octet: 33 |
| 97 | + ram_gb: 6 |
| 98 | + cpus: 2 |
| 99 | + windows: |
| 100 | + sysprep: true |
| 101 | + - vm_name: "{{ range_id }}-NHA-SRV03" |
| 102 | + hostname: "{{ range_id }}-SRV03" |
| 103 | + template: win2025-server-x64-tpm-template |
| 104 | + vlan: 10 |
| 105 | + ip_last_octet: 34 |
| 106 | + ram_gb: 6 |
| 107 | + cpus: 2 |
| 108 | + windows: |
| 109 | + sysprep: true |
| 110 | + |
| 111 | +router: |
| 112 | + vm_name: "{{ range_id }}-router-debian12-x64" |
| 113 | + hostname: "{{ range_id }}-router" |
| 114 | + template: debian-12-x64-server-template |
| 115 | + ram_gb: 2 |
| 116 | + ram_min_gb: 1 |
| 117 | + cpus: 2 |
| 118 | + |
| 119 | +defaults: |
| 120 | + ad_domain_functional_level: Win2025 |
| 121 | + ad_forest_functional_level: Win2025 |
| 122 | + snapshot_with_RAM: true |
| 123 | + stale_hours: 0 |
| 124 | + ad_domain_admin: domainadmin |
| 125 | + ad_domain_admin_password: password |
| 126 | + ad_domain_user: domainuser |
| 127 | + ad_domain_user_password: password |
| 128 | + ad_domain_safe_mode_password: password |
| 129 | + timezone: America/New_York |
| 130 | + enable_dynamic_wallpaper: true |
| 131 | +``` |
| 132 | +
|
| 133 | +I also made a few tweaks to the available RAM of the VMs and updated the domain/forest functional level to 2025 as well. With this file we can start building our hacker lab. |
| 134 | +
|
| 135 | +## Ninja Hacker Academy Setup |
| 136 | +
|
| 137 | +!!!info |
| 138 | +NHA is designed as an educational challenge where users normally work toward gaining domain admin on two domains (`academy.ninja.lan` and `ninja.hack`) |
| 139 | +!!! |
| 140 | + |
| 141 | +The scenario includes: |
| 142 | +- A starting point on `srv01` at `10.5.10.32` |
| 143 | +- Flags hidden on each machine |
| 144 | +- Up-to-date systems with Defender enabled |
| 145 | + |
| 146 | +Let's create a new user for our range and start the deployment with the Ludus CLI. |
| 147 | + |
| 148 | +```console |
| 149 | +$ ludus user add --name Ninja --userid NHA --url https://127.0.0.1:8081 |
| 150 | ++--------+------------------+-------+---------------------------------------------+ |
| 151 | +| USERID | PROXMOX USERNAME | ADMIN | API KEY | |
| 152 | ++--------+------------------+-------+---------------------------------------------+ |
| 153 | +| NHA | Ninja | true | <YOUR_API_KEY> | |
| 154 | ++--------+------------------+-------+---------------------------------------------+ |
| 155 | +
|
| 156 | +$ ludus range config set -f ad/NHA/providers/ludus/config.yml --user NHA |
| 157 | +[INFO] Your range config has been successfully updated. |
| 158 | +
|
| 159 | +$ ludus range deploy --user NHA |
| 160 | +[INFO] range deploy started |
| 161 | +``` |
| 162 | + |
| 163 | +At the end you should see something like this: |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | +At this point the old desktop is usually running enough VMs to sound mildly annoyed, but it manages. |
| 168 | + |
| 169 | +### Ansible Provisioning |
| 170 | + |
| 171 | +With our range deployed, we can start setting up the actual environment. With [Ansible](https://docs.ansible.com/) we can provision our whole infrastructure using custom playbooks. Using the available playbooks from [Orange-Cyberdefense](https://github.com/Orange-Cyberdefense/GOAD), I changed most of them to be compatible with the latest version of Ansible. |
| 172 | + |
| 173 | +!!!info |
| 174 | +In the future I was thinking of publishing them on my [GitHub](https://github.com/bytebl33d), but they might already be there ;) |
| 175 | +!!! |
| 176 | + |
| 177 | +We proceed with the provisioning and install the required collections: |
| 178 | + |
| 179 | +```console |
| 180 | +$ ansible-galaxy collection install ansible.windows |
| 181 | +$ ansible-galaxy collection install community.general |
| 182 | +$ ansible-galaxy collection install community.windows |
| 183 | +``` |
| 184 | + |
| 185 | +Hop into the `ansible` directory where all the playbooks are located and run them all. |
| 186 | + |
| 187 | +!!!info |
| 188 | +If you get the error `Ansible could not initialize the preferred locale: unsupported locale setting`, check your locales with `locale -a` and set it with `export LC_ALL=<YOUR_LOCALE>.utf8` |
| 189 | +!!! |
| 190 | + |
| 191 | +```console |
| 192 | +$ cd ansible |
| 193 | +$ ansible-playbook -i ../ad/NHA/data/inventory -i ../globalsettings.ini main.yml |
| 194 | +``` |
| 195 | + |
| 196 | +## Connecting to the Lab |
| 197 | + |
| 198 | +```console |
| 199 | +$ ludus user wireguard --user NHAc531df | tee ludus-wg.conf |
| 200 | +[Interface] |
| 201 | +PrivateKey = <PRIVATE_KEY> |
| 202 | +Address = 198.51.100.5/32 |
| 203 | +
|
| 204 | +[Peer] |
| 205 | +PublicKey = <PUBLIC_KEY> |
| 206 | +Endpoint = 192.168.128.10:51820 |
| 207 | +AllowedIPs = 10.5.0.0/16, 198.51.100.1/32 |
| 208 | +PersistentKeepalive = 25 |
| 209 | +``` |
| 210 | + |
| 211 | +Copy this file to your client and run WireGuard: |
| 212 | + |
| 213 | +```console |
| 214 | +$ wg-quick up ./ludus-wg.conf |
| 215 | +``` |
| 216 | +You can optionally narrow `AllowedIPs` down to only the `srv01` host for better isolation. And just like that, you’re securely connected to your newly deployed cyber range. |
0 commit comments