Add optional Kali attacker VM and DHCP for the lab bridge
lab.sh kali install|up|down|reset|status extracts the official Kali QEMU image once, keeps it as a read-only base with a throwaway overlay, and boots two NICs: the lab bridge (for the exercise) and user networking (so apt works without opening the isolation policy). DC01 now serves DHCP on 10.10.10.100-200 with DNS and domain options but no router: devices on the bridge configure themselves while the lab stays isolated. A reservation pins 10.10.10.101 to the Kali MAC. Also fixed backend_stop, which still called the pre-refactor WinRM helper and fell back to killing the VMs.
This commit is contained in:
@@ -135,6 +135,27 @@ try {
|
||||
Set-ADDefaultDomainPasswordPolicy -Identity '@@DOMAIN@@' -MinPasswordAge '00:00:00'
|
||||
Write-LabLog 'dc01: minimum password age set to zero'
|
||||
|
||||
# ------------------------------------------------------------ dhcp
|
||||
# Lets anything plugged into the lab bridge configure itself: the Kali
|
||||
# attacker VM, an instructor laptop. No router option on purpose — the lab
|
||||
# is isolated, so clients must not think they have a way out.
|
||||
if (-not (Get-WindowsFeature -Name DHCP).Installed) {
|
||||
$null = Install-WindowsFeature -Name DHCP -IncludeManagementTools
|
||||
Write-LabLog 'dc01: DHCP role installed'
|
||||
}
|
||||
try { Add-DhcpServerInDC -DnsName "dc01.@@DOMAIN@@" -IPAddress '@@LAB_DC_IP@@' -ErrorAction Stop }
|
||||
catch { Write-LabLog 'dc01: DHCP already authorized' }
|
||||
|
||||
if (-not (Get-DhcpServerv4Scope -ScopeId '10.10.10.0' -ErrorAction SilentlyContinue)) {
|
||||
Add-DhcpServerv4Scope -Name 'Norbourg lab' -StartRange '10.10.10.100' `
|
||||
-EndRange '10.10.10.200' -SubnetMask '255.255.255.0' -State Active
|
||||
Write-LabLog 'dc01: DHCP scope 10.10.10.100-200 created'
|
||||
}
|
||||
Set-DhcpServerv4OptionValue -ScopeId '10.10.10.0' `
|
||||
-DnsServer '@@LAB_DC_IP@@' -DnsDomain '@@DOMAIN@@'
|
||||
Set-Service -Name DHCPServer -StartupType Automatic -ErrorAction SilentlyContinue
|
||||
Start-Service -Name DHCPServer -ErrorAction SilentlyContinue
|
||||
|
||||
# ------------------------------------------------------------ auditing
|
||||
# Legacy policy off, advanced subcategories on: this is what the blue-team
|
||||
# debrief reads back from the event log.
|
||||
|
||||
Reference in New Issue
Block a user