AD Test Lab
On this page
This Guide helps you to setup a basic lab to play around with a active directory, windows event logs and so on.
Inspiration / Tutorials
The following guide is based on a variety of sources:
- Lab Building Guide: Virtual Active Directory
- Building an Effective Active Directory Lab Environment for Testing
- Creating Active Directory Labs for Blue and Red Teams
- Github Infose Link Collection
- Threat Hunting Lab (Part II) : Sending PfSense Netflow data to Elastic Stack
- Intercepting HTTPS Traffic Using the Squid Proxy Service in pfSense
- WEF-Subscriptions
Future Ideas / Resources
- Managing Windows Server with Puppet Part 7: Installing Active Directory
- BadBlood Script
- Active Directory Kill Chain Attack & Defense
- ADSecurity Blog
- Azure AD - Attack and Defense Playbook
Eval images
If you don’t have a msdn subscription, you can use eval images from Microsoft1. They are valid for 180 days and the period can be extended for 30 or 90 days.
Windows 7: It looks like Windows 7 is not available as Eval version any more, however I found the following working link in the technet forum2:
IE/Edge Testing images Beside of the eval images, there are also the IE/Edge Virtual Machines available3.
Lab Overview
The Lab guide covers the following setup:
- Root Domain: umbrella.corp
- Child Domain: racoon.umbrella.corp
- 1 domain controller (root DC — umbrella.corp): DC01,
- 1 domain controller (child DC — racoon.umbrella.corp): DC02
- 1 server (parent — umbrella.corp): APP01
- 1 workstation (parent — umbrella.corp):
- 1 workstation (child — racoon.umbrella.corp)
DC01
Functions as Primary DC in Forest umbrella.corp
Details
- CPU: 2 Cores
- RAM: 4 gb
- Storage: 40 GB Thin
- OS: Windows Server 2019
- IP: 10.2.1.101, Gateway: 10.2.1.1
- Domain name: umbrella.corp
- NETBIOS: UMBRELLA
DC02
Functions as Child DC in Forest umbrella.corp
Details
- CPU: 2 Cores
- RAM: 4 gb
- Storage: 40 GB Thin
- OS: Windows Server 2016
- IP: 10.2.1.101, Gateway: 10.2.1.1, DNS: 10.2.1.101
- Domain name: raccoon.umbrella.corp
- NETBIOS: RACCOON
APP01
Windows Server 2012 - Application Server
Details
- CPU: 2 Cores
- RAM: 4 gb
- Storage: 40 GB Thin
- OS: Windows Server 12
- Domain: umbrella.corp
- IP: 10.2.1.150, Gateway: 10.2.1.1, DNS: 10.2.1.101
WIN10-01
Windows 10 Client in Forrest umbrella.corp
- CPU: 2 Cores
- RAM: 4 gb
- Storage: 40 GB Thin
- OS: Windows 10
- Domain: umbrella.corp
- IP: DHCP, DNS: 10.2.1.101
Win7-01
Windows 7 Client
(Currently on Datastore 1)
- CPU: 2 Cores
- RAM: 4 gb
- Storage: 40 GB Thin
- OS: Windows 7
- Hostname: WIN7-01
- Domain: raccoon.umbrella.corp
Topology
The routing is done with a pfsense.
WIN Client Network
- 10.1.90.x
- DHCP: 10.1.90.1.2-10.90.1.100
WIN Server Network
- 10.2.1.x
- DHCP: 10.2.1.1-10.2.1.100
DMZ / linux server network
- 10.5.2.x
- DHCP: 10.5.2.2-10.5.2.100
WAN Network
- 10.22.22.22
Setup DC01
- Language: en
- Operating System: Windows Server 2019 Standard Evaluation (Desktop Experience)
- Custom: Install Windows only (advanced)
- Select Drive 0
- Set Administrator Password
- Install VMTools and updates
- Change Computer Name to DC01
- Configure Network Adapter
- Set IP, Subnetmask, Gateway and DNS
- Server Manager -> 1 Configure this local server -> Add roles and features
- Role based installation
- DC01
- Active Directory Domain Services
- Restart the destination server automatically if required
- Server Manager -> Wait for yellow warning sign next to flag in top bar
- Promote this server to a domain controller
- Add a new forest: umbrella.corp
- Set a DSRM password
- Install
- Validate in Powershell
- Get-ADDomain
- Setup dns reverse lookup zone:
- DNS Manager -> Reverse Lookup Zone -> right click “New Zone”
- Check Primary Zone and Store the zone in Active Directory
- Type Network ID: 10.2.1, Select Reverse lookup zone name
- Right click new zone -> New Pointer (PTR) -> Host IP: 10.2.1.101, Host name: dc01.umbrella.corp
- repeat zone for 10.90.1
Add Accounts
Domain Admin:
- Server Manager -> Active Directory Users and Computers
- umbrella.corp -> Users -> Right Click -> New User
- User logon name: redqueen
- Set Password, Uncheck User must change password at next logon, Check Password never expires
- Select User redqueen -> Right Click -> Properties -> Member Of add to Administrators, Domain Admins, Enterprise Admins and Schema Admins
Domain User:
- Server Manager -> Active Directory Users and Computers
- umbrella.corp -> Users -> Right Click -> New User
- User logon name: charles
Setup Child DC02
- Language: en
- Operating System: Windows Server 2016 Standard Evaluation (Desktop Experience)
- Custom: Install Windows only (advanced)
- Select Drive 0
- Set Administrator Password
- Install VMTools and updates
- Change Computer Name to DC01
- Configure Network Adapter
- Set IP, Subnetmask, Gateway and DNS
- Server Manager -> 1 Configure this local server -> Add roles and features
- Role based installation
- DC01
- Active Directory Domain Services
- Restart the destination server automatically if required
- Server Manager -> Wait for yellow warning sign next to flag in top bar
- Promote this server to a domain controller
- Add a new domain to an existing forest:
- Select domain type: Child Domain
- Parent domain name: umbrella.corp -> Select
- Use Umbrella\Administrator account
- New Domain name: raccoon
- Set a DSRM password
- Install
- Validate in Powershell
- Get-ADDomain
- Get-ADTrust -Filter *
Add Accounts
- Domain Admin:
- Server Manager -> Active Directory Users and Computers
- umbrella.corp -> Users -> Right Click -> New User
- User logon name: timothy
- Set Password, Uncheck User must change password at next logon, Check Password never expires
- Select User timothy -> Right Click -> Properties -> Member Of add to Administrators, Domain Admins
Setup Application Server APP01
- Language: en
- Operating System: Windows Server 2012 Standard Evaluation (Desktop Experience)
- Custom: Install Windows only (advanced)
- Select Drive 0
- Set Administrator Password
- Install VMTools and updates
- Change Computer Name to APP01
- Configure Network Adapter
- Set IP, Subnetmask, Gateway and DNS
Client Setup
We are currently using default windows settings.
WIN7-01
After fresh install, the following steps are required:
- Install .NET 4
- Install SP1/SP2/Update, because it’s not available anymore on the Windows website, you can try use the version from Chip
JOIN Clients to Domain
- Set DNS server to DC IP: 10.2.1.101
- Computer name, domain, and workgroup -> Member of Domain: umbrella.corp
PFSense Settings
AD Domain Resoving
- Services -> DNS Resolver -> General Settings -> Domain Overrides -> Add
- Domain: umbrella.corp
- IP Address: 10.2.1.101
- Repeat for other domains
- Domain: raccoon.umbrella.corp
- IP Address: 10.2.1.102
Squid Proxy Setup
- System -> Package Manager -> Available Packages -> squid and lightsquid
- Services -> Squid Proxy Server -> Local Cache
- Hard Disk Cache Size: 3000
- Memory Cache Size: 2048
- Maximum Object Size in RAM: 40000
- System -> Certificate Manager -> CAs -> add
- Descriptive Name: pfsense CA
- Country Code: US
- State: Arklay County
- City: Raccoon City
- Organization: Umbrella Corporation
- Export CA
- ON DC01
- Group Policy Management -> Forest umbrella.corp -> Domains -> umbrella.corp -> Group Policy Objects -> Right click -> New
- Name: pfSense Certificate
- Right click on pfSense Certificate -> Edit
- Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Public Key Policies -> Trusted Root Certification Authorities -> Right Click -> Import
- Select pfsense CA File Right Click on Domains -> umbrella.corp -> Link an Existing GPO
- select pfSense Certificate Right Click on Domains -> umbrella.corp -> Domain Controller -> Link an Existing GPO
- select pfSense Certificate
- to immediately apply issue gpupdate /force on a client
- Copy policy to raccoon.umbrella.corp and repeat linking steps
- Services -> Squid Proxy Server -> General
- Enable Squid Proxy: On
- Proxy Interface(s): WINCLIENT, DMZ, WINSERVER,loopback
- Outgoing Network Interface: WAN
- Transparent HTTP Proxy: on
- Transparent Proxy Interface(s): WINCLIENT, DMZ, WINSERVER
- Bypass Proxy for these Source IPs: 10.22.22.22
- Bypass Proxy for these Destination IPs: 10.22.22.22
- Enable Access Login: on
- HTTPS/SSL Interception: on
- SSL Intercept Interfaces: WINCLIENT,DMZ,WINSERVER
- CA: pfsense CA
Windows Event Logs
Setup Event Event Collecting
Warning: This setup is incomplete
On DC1:
- In Powershell: Enable-PSRemoting
-> On Client check
Invoke-Command -ComputerName <COLLECTORHOSTNAME> -ScriptBlock {1}
-> if returns 1 = success - Open Event Viewer -> Click Subscriptions -> Yes
- In CMD:
wevtutil gl security-> copy value of channelAccess
- Open Group Policy Management -> umbrella.corp -> Domains -> umbrella.corp -> right click -> Create a GPO in this domain, and Link it here: EventForwarding
- Edit GPO -> Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Event Forwarding -> Configure target subscription manager
- Set SubscriptionManagers to: Server=http://dc01.umbrella.corp:5985/wsman/SubscriptionManager/WEC,Refresh=60
- Click on -> Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Event Log Service -> Security -> Configure log access insert channelAccess value from previous step
- Click on -> Computer Configuration -> Policies -> Windows Settings -> System Services -> Windows Remote Management -> Automatic
- Not sure what fixed the problem but on server 2019 try out
netsh http add urlacl url=https://+:5986/wsman/ sddl=D:(A;;GX;;;S-1-5-80-569256582-2953403351-2909559716-1301513147-412116970)(A;;GX;;;S-1-5-80-4059739203-877974739-1245631912-527174227-2996563517) - Event Viewer -> Subscription -> Create Subscription
- Subscription name: Security
- Source computer initiated -> Add Domain Computers: WIN10-01, APP01
- Select Events: Security
- Advanced -> Minimize Latency
- ON DC1 run:
wecutil ss Security /l:en-US