Active Directory security lab: a Samba domain controller to audit and harden on one private Ubuntu VM
This lab gives each student a working Active Directory to run, audit and harden: one Ubuntu VM that is the domain controller for a made-up college, AD.COLLEGE.LAB, built with Samba. It is written for the person who runs a college’s directory, not for an attacker. Each weakness is an ordinary real-world misconfiguration, planted on the student’s own domain, and the module shows how to find it with the least intrusive check and then how to fix it and how the domain controller’s own logs would catch it.
Samba, the open-source implementation of Active Directory, is the real thing, installed from Ubuntu’s archive. Defensive only: the student reads and changes their own directory with samba-tool, ldbsearch and the Kerberos tools, never points anything at a directory that is not theirs, and reaches no network but the platform’s package mirrors. Every password in the lab is a planted practice fixture, said so in the README and the repository.
What students learn
How a directory works and how to keep it safe. They list accounts, groups and attributes; read how Kerberos issues tickets and why a service account’s ticket can come back in the old RC4 cipher; confirm a weak service-account password with a tiny wordlist of planted guesses only; find a host trusted for unconstrained delegation and an everyday account left in Domain Admins; and see that NTLM is still accepted. Most of each lesson is the fix, long random passwords and group managed service accounts, AES-only Kerberos, disabling NTLM and requiring signing, constrained delegation, and admin tiers, and the log events a defender alerts on.
The planted weaknesses
Four, each read back by a lesson. A service account svc-sql with a service principal name and a weak, never-expiring password, so its service ticket is kerberoastable. A computer account WEB01$ trusted for unconstrained delegation, which the audit filter finds beside the domain controller itself, legitimately trusted. An everyday account t0admin left in Domain Admins. And NTLM still accepted, Samba’s default. An ordinary staff account, jadams, is there for the first lesson. None is an attack on anybody: every check is the least intrusive read of the student’s own directory.
Run it in your browser
VM labs are set as a lab task in a module, and the sample is on the lab’s page. A domain controller needs more than a free VM’s gigabyte, so this lab is given two CPUs, 2 GB of memory and 10 GB of disk, the Kubernetes lab’s exception. The setup installs from Ubuntu’s archive, which every VM reaches, so a visitor without an account can run it too.
- Add the lab. In a module you teach, add a task and choose the Ubuntu VM lab card. The page shows a short description of the machine instead of a compose file.
- Start from the sample. The page offers ready-made labs to start from. Choose Active Directory security. Using a sample replaces the text, and Undo brings yours back.
- Publish and start your own copy. Publish, then Start. The lab’s setup script installs Samba from Ubuntu’s archive and provisions the domain AD.COLLEGE.LAB with its planted weaknesses, the first time the VM starts, in about a minute.
- Open the terminal. Open its terminal and read README.md in the home folder. Nothing opens in the browser: the lab is the terminal. The student is the person who runs this directory.
A basic lesson on this lab
Active Directory Basics is a small lesson worked in this lab, which is an Ubuntu VM. It has a hook, an I can outcome, key words, a starter, a check after each idea, a common mistake and an exit check, and each step has a Run button that types its command into the machine’s terminal. A student lists the accounts and groups, reads one account plainly and lists the service accounts.
The lesson only looks around; the module’s six lessons audit and then fix the four weaknesses. The undergraduate module Active Directory security is worked in this lab, six lessons and a teacher guide.
How it is marked
The lab has no check, deliberately: the VM terminal is the platform’s student account with passwordless sudo, so any check that read a file the student can write could be faked in one line, as the Linux privilege escalation lab explains. The graded work is a hardening write-up a teacher reads and the module’s three Python assignments, which are marked by hidden tests. A student whose write-up names, for each weakness, the audit check, the exact setting changed and the domain controller log event to alert on has understood the module.
- Hand it out. Assign the lab like any task, with a due date if you want one. Each student gets a VM of their own, kept between sessions, running a domain controller nobody else can reach.
- Ask for a hardening write-up. There is no automatic mark: a student with sudo on their own machine could fake any check. For each weakness the module shows, ask for the check that found it, the setting that fixed it and the log event a defender would alert on.
- Mark it, and the assignments. Read the write-up against the four weaknesses: the kerberoastable service account, unconstrained delegation, the everyday Domain Admin and NTLM still accepted. The module’s three Python assignments are marked by their own hidden tests.
The definition on GitHub
The file is the whole lab definition, the same text the platform runs: the machine’s size, the setup script that installs Samba and provisions the domain, the planted accounts and the README. Copy it and change the realm, the accounts or the weaknesses to make a lab of your own.
Try this lab, and what it costs
A free personal account can work through the basic lessons in this lab, with enough free credit each month to follow most lessons and no card. For a class, a school or college has its first 365 days free for up to 50 students, then pays per student a year, with every lab included and staff free.
Questions people ask
- Does the lab need a licence?
- No. Samba and the Kerberos and LDAP tools are GPL-3.0 and installed on the student’s VM from Ubuntu’s archive when it starts, so we distribute none of them. The lab definition itself is CC BY-NC-SA 4.0 in its repository.
- Is it real Active Directory?
- It is Samba’s Active Directory domain controller, the open-source implementation, which speaks the same LDAP, Kerberos and SMB and is audited and hardened the same way. A Windows domain adds Group Policy and tools Samba does not, which the lessons name where it matters.
- Can students harm anything?
- Only their own copy. The directory is inside the VM, which reaches only the platform’s list of allowed hosts, its package mirrors and nothing else, so there is no other machine to reach. Every attack technique is explained and then confirmed with the least intrusive read; the wordlist used is a handful of the lab’s own planted passwords.
- Was the lab tested in a real student VM?
- The setup, and every lesson’s audit, fix and detection command, were run by hand in an Ubuntu 26.04 container standing in for the VM, on an arm64 machine. A booted student VM and the amd64 install are worth one try before a class.