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:
2026-10-22 19:55:15 -04:00
parent b077d2c7d5
commit 77d123a9cf
10 changed files with 221 additions and 2 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ backend_stop() {
# ACPI powerdown is best-effort; Server 2022 often ignores it. Asking the
# guest to shut itself down over WinRM is what actually works.
if _winrm "$ip" ps "shutdown.exe /s /t 3 /f" >/dev/null 2>&1; then
if backend_ps "$name" "shutdown.exe /s /t 3 /f" >/dev/null 2>&1; then
detail "shutdown requested over WinRM"
elif [[ -S $sock ]]; then
printf 'system_powerdown\n' | socat - "UNIX-CONNECT:$sock" >/dev/null 2>&1 || true
+10
View File
@@ -51,6 +51,16 @@ LAB_ADMIN_PASSWORD="${LAB_ADMIN_PASSWORD:-Norbourg!2026}"
LAB_SAFE_MODE_PASSWORD="${LAB_SAFE_MODE_PASSWORD:-NorbourgDsrm!2026}"
WINDOWS_IMAGE_INDEX=2 # 2 = Standard, Desktop Experience
# ---------------------------------------------------------------- kali
# Optional attacker VM (official Kali QEMU image, full toolset).
KALI_ARCHIVE_URL="https://cdimage.kali.org/kali-2026.3/kali-linux-2026.3-qemu-amd64.7z"
KALI_IP="10.10.10.101"
KALI_RAM=4096
KALI_VCPU=2
KALI_DISK_GB=40
KALI_SSH_PORT=2222
KALI_VNC_DISPLAY=9
# ---------------------------------------------------------------- tuning
DISK_FILL_RATIO=30 # percent of the nominal disk actually used (measured ~26%)
ISO_BUDGET_GB=8
+1 -1
View File
@@ -10,7 +10,7 @@ export LAB_DIR ROOT_DIR CONTENT_DIR PLATFORM
source "$CONTENT_DIR/lib/common.sh"
for _lib in check cmd_init cmd_isos cmd_seeds cmd_build cmd_provision cmd_web \
cmd_snapshot cmd_doctor cmd_misc; do
cmd_snapshot cmd_doctor cmd_misc cmd_kali; do
# shellcheck disable=SC1090
source "$CONTENT_DIR/lib/${_lib}.sh"
done