From 302352573785d1fd3f3456986c059e85cdc79ae5 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Mon, 26 Oct 2026 22:43:51 -0400 Subject: [PATCH] dc01: serve the site on http://norbourg.lab too The domain name must keep resolving to the DC for AD, so redirect at the HTTP layer: a netsh portproxy on the DC forwards port 80 to FS01, and a firewall rule opens it. Both URLs now serve the archived site. doctor checks the short URL and warns (not fails) when the forward is absent. --- session1/content/lib/cmd_doctor.sh | 7 +++++++ session1/content/windows/roles/dc01-post.ps1 | 16 ++++++++++++++++ session1/docs/etudiant.md | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/session1/content/lib/cmd_doctor.sh b/session1/content/lib/cmd_doctor.sh index dca28da..ef6e793 100644 --- a/session1/content/lib/cmd_doctor.sh +++ b/session1/content/lib/cmd_doctor.sh @@ -74,6 +74,13 @@ cmd_doctor() { _d_fail "site not answering (${code:-timeout}) — ./lab.sh web --sync" fi + code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 "http://10.10.10.10/" 2>/dev/null || true) + if [[ $code == 200 ]]; then + _d_ok "site answers on the domain name (http://norbourg.lab)" + else + _d_warn "http://norbourg.lab does not answer (${code:-timeout}) — re-run provision --role dc01" + fi + code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 "http://10.10.10.20/public/IT-inventaire.txt" 2>/dev/null || true) if [[ $code == 200 ]]; then _d_ok "entry point reachable: /public/IT-inventaire.txt" diff --git a/session1/content/windows/roles/dc01-post.ps1 b/session1/content/windows/roles/dc01-post.ps1 index 0437405..1f11570 100644 --- a/session1/content/windows/roles/dc01-post.ps1 +++ b/session1/content/windows/roles/dc01-post.ps1 @@ -165,6 +165,22 @@ try { Write-LabLog 'dc01: www A record already present' } + # The domain name resolves to the DC. Forward HTTP to FS01 so the archived + # site also answers on http://norbourg.lab, not only http://www.norbourg.lab. + try { + $null = netsh.exe interface portproxy delete v4tov4 listenport=80 listenaddress='@@LAB_DC_IP@@' 2>$null + $null = netsh.exe interface portproxy add v4tov4 listenport=80 listenaddress='@@LAB_DC_IP@@' connectport=80 connectaddress='10.10.10.20' + Set-Service iphlpsvc -StartupType Automatic -ErrorAction SilentlyContinue + Start-Service iphlpsvc -ErrorAction SilentlyContinue + if (-not (Get-NetFirewallRule -DisplayName 'Norbourg HTTP forward' -ErrorAction SilentlyContinue)) { + New-NetFirewallRule -DisplayName 'Norbourg HTTP forward' -Direction Inbound ` + -Protocol TCP -LocalPort 80 -Action Allow | Out-Null + } + Write-LabLog 'dc01: http://@@DOMAIN@@ forwarded to FS01' + } catch { + Write-LabLog "dc01: HTTP forward skipped ($($_.Exception.Message))" + } + # Easter egg: discoverable with nslookup -type=TXT yourlove.norbourg.lab try { Add-DnsServerResourceRecord -ZoneName '@@DOMAIN@@' -Name 'yourlove' -Txt ` diff --git a/session1/docs/etudiant.md b/session1/docs/etudiant.md index 6a6491f..38dc4d6 100644 --- a/session1/docs/etudiant.md +++ b/session1/docs/etudiant.md @@ -63,7 +63,7 @@ les deux marchent. Toutes les commandes ci-dessous se lancent depuis Kali. nmap -sn 10.10.10.0/24 nmap -sV -p- 10.10.10.10 nxc smb 10.10.10.0/24 -curl -s http://10.10.10.20/ | head -20 +curl -s http://norbourg.lab/ | head -20 curl -s http://10.10.10.20/public/ ```