Close the gaps that a fresh redeploy would have shipped

- install the QEMU guest agent from virtio-win: Proxmox provisions over
  qm guest exec, so without it every provision would hang waiting for the
  agent. virtio-win is now attached as ide3 on the Proxmox platform.
- restore the .url MIME mapping in fs01.ps1: the earlier patch silently
  missed, so a rebuilt FS01 would answer 404.3 for the easter-egg shortcut.
- kali install now builds a small tool ISO carrying the wordlist, so a
  fresh Kali is usable without network access to the host.

Audited by extracting the bundle and re-rendering the seeds: no unrendered
tokens, and every live fix is present in the generated role scripts.
This commit is contained in:
2026-10-23 00:30:40 -04:00
parent b5981dbe08
commit 7787bd5f84
5 changed files with 89 additions and 0 deletions
+8
View File
@@ -98,6 +98,14 @@ Identifiants par défaut : `kali` / `kali`. La VM a deux cartes : le pont du lab
(adresse fournie par le DHCP de DC01) et un réseau utilisateur qui permet `apt` sans ouvrir de
passage vers le réseau du bureau.
Un petit ISO « outils » est monté dans la VM : il contient `norbourg.txt`, la liste de mots de
l'atelier. À récupérer une fois au premier démarrage :
```bash
sudo mkdir -p /opt/norbourg/wordlists
sudo mount /dev/sr0 /mnt && sudo cp /mnt/norbourg.txt /opt/norbourg/wordlists/
```
## Commandes
| Commande | Effet |
+41
View File
@@ -12,6 +12,38 @@ _kali_pid() { printf '%s/run/kali.pid' "$LAB_ROOT"; }
_kali_log() { printf '%s/run/kali.log' "$LAB_ROOT"; }
_kali_installed() { [[ -f $(_kali_base) ]]; }
_kali_tools_iso() { printf '%s/seeds/kali-tools.iso' "$LAB_ROOT"; }
# The stock Kali image ships without the lab wordlist. A small ISO carries it
# into the guest, so a fresh redeploy is reproducible without network access.
_kali_build_tools() {
local iso dir
iso=$(_kali_tools_iso)
dir=$(mktemp -d)
mkdir -p "$(dirname "$iso")"
cp "$CONTENT_DIR/scripts/wordlists/norbourg.txt" "$dir/"
cat > "$dir/README.txt" <<'EOF'
Outils de l'atelier Norbourg
============================
norbourg.txt : liste de mots ciblee (1716 entrees), dimensionnee pour que le
cassage prenne quelques secondes.
Installation dans Kali :
sudo mkdir -p /opt/norbourg/wordlists
sudo cp /media/cdrom/norbourg.txt /opt/norbourg/wordlists/
sudo chmod 644 /opt/norbourg/wordlists/norbourg.txt
EOF
if have_cmd genisoimage; then
genisoimage -quiet -volid NORBOURG_TOOLS -J -R -o "$iso" "$dir"
else
xorriso -as mkisofs -quiet -V NORBOURG_TOOLS -J -R -o "$iso" "$dir"
fi
rm -rf "$dir"
ok "tool ISO: $iso"
}
_kali_ensure_overlay() {
local base overlay
@@ -70,6 +102,7 @@ _kali_install() {
fi
ok "base image: $(du -h "$base" | cut -f1) (${KALI_DISK_GB:-40}G nominal)"
_kali_ensure_overlay
_kali_build_tools
printf '\n'
ok "Kali installed — ./lab.sh kali up"
@@ -91,9 +124,15 @@ _kali_up() {
vnc=${KALI_VNC_DISPLAY:-9}
mkdir -p "$LAB_ROOT/run"
[[ -f $(_kali_tools_iso) ]] || _kali_build_tools
# net0: the lab bridge (DHCP from DC01). net1: user networking so apt works
# without punching a hole through the lab isolation policy.
local cd_args=()
if [[ -f $(_kali_tools_iso) ]]; then
cd_args=( -drive "if=none,id=cd1,media=cdrom,file=$(_kali_tools_iso)" -device "ide-cd,drive=cd1,bus=ide.1" )
fi
nohup qemu-system-x86_64 \
-name norbourg-kali \
-machine q35,accel=kvm -cpu host \
@@ -107,6 +146,7 @@ _kali_up() {
-netdev "user,id=net1,hostfwd=tcp:127.0.0.1:${KALI_SSH_PORT:-2222}-:22" \
-device "e1000,netdev=net1" \
-monitor "unix:$LAB_ROOT/run/kali.monitor,server,nowait" \
"${cd_args[@]}" \
-display none -vnc "127.0.0.1:$vnc" \
>>"$(_kali_log)" 2>&1 &
printf '%s\n' "$!" > "$(_kali_pid)"
@@ -115,6 +155,7 @@ _kali_up() {
if kill -0 "$(<"$(_kali_pid)")" 2>/dev/null; then
ok "Kali started · vnc 127.0.0.1:$(( 5900 + vnc )) · ssh 127.0.0.1:${KALI_SSH_PORT:-2222}"
info " login kali/kali · bridge address via DHCP (${KALI_IP:-10.10.10.101} reserved)"
info " wordlist on the tool CD: mount /dev/sr0 /mnt && cp /mnt/norbourg.txt /opt/norbourg/wordlists/"
else
fail "Kali failed to start — see $(_kali_log)"
return 1
+20
View File
@@ -60,6 +60,26 @@ if (-not (Get-NetFirewallRule -DisplayName 'Norbourg ICMPv4' -ErrorAction Silent
-Direction Inbound -Action Allow -Profile Any | Out-Null
}
# QEMU guest agent. Proxmox provisions over `qm guest exec`, which needs it.
# virtio-win is attached as a CD on that platform; on qemu it is absent and
# this block does nothing.
try {
$virtio = Get-Volume -ErrorAction SilentlyContinue |
Where-Object { $_.FileSystemLabel -like 'virtio-win*' -and $_.DriveLetter } |
Select-Object -First 1
if ($virtio) {
$msi = "$($virtio.DriveLetter):\guest-agent\qemu-ga-x86_64.msi"
if (Test-Path $msi) {
Start-Process msiexec.exe -ArgumentList "/i `"$msi`" /qn /norestart" -Wait
Write-Host 'bootstrap: qemu guest agent installed'
} else {
Write-Host 'bootstrap: virtio-win mounted but qemu-ga msi not found'
}
}
} catch {
Write-Host "bootstrap: guest agent step skipped ($($_.Exception.Message))"
}
# RDP: useful for the instructor when a step misbehaves. This only opens the
# listener; who may log on is still governed by Remote Desktop Users.
try {
+13
View File
@@ -26,6 +26,19 @@ try {
}
}
# IIS ships no MIME mapping for .url; the archived "Your Love" shortcut
# needs one or IIS answers 404.3.
Import-Module WebAdministration
$urlMime = Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' `
-Filter 'system.webServer/staticContent' -Name '.' |
Where-Object { $_.fileExtension -eq '.url' }
if (-not $urlMime) {
Add-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' `
-Filter 'system.webServer/staticContent' -Name '.' `
-Value @{ fileExtension = '.url'; mimeType = 'application/internet-shortcut' }
Write-LabLog 'fs01: .url MIME mapping added'
}
$root = 'C:\inetpub\wwwroot'
$public = Join-Path $root 'public'
New-Item -ItemType Directory -Force -Path $public | Out-Null
+7
View File
@@ -130,6 +130,13 @@ backend_create_disk() {
)
(( PVE_AGENT )) && args+=( --agent enabled=1 )
# virtio-win carries the QEMU guest agent that provisioning talks to.
if [[ -f $VIRTIO_ISO ]]; then
args+=( --ide3 "${PVE_STORAGE_ISO}:iso/$(basename "$VIRTIO_ISO"),media=cdrom" )
else
warn "virtio-win.iso missing: the guest agent cannot be installed (run ./lab.sh isos)"
fi
if (( dry )); then
info " + qm create ${args[*]}"
return 0