Split into qemu and proxmox platforms over a shared content tree
platforms/qemu and platforms/proxmox each have their own lab.sh and lab.conf; content/ holds everything shared (roles, seed, site, helpers). The dispatcher, preflight and command implementations are common and take platform differences from the backend. Proxmox backend: qm create with q35/SATA/e1000, ISOs and seed ISOs in an ISO storage, provisioning over qm guest exec (no Python packages needed on the host), template + clone for reset, and peers/ to emit WireGuard configs. The role scripts now ride on the seed ISO, so provisioning transfers nothing. build-bundle.sh produces a self-contained tarball per platform, for hosts that cannot reach the git server. Both configs are generic: no absolute path from this machine remains.
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Norbourg lab — unattended install for Windows Server 2022 (eval).
|
||||
Rendered by scripts/build_seed.sh; @@TOKENS@@ are substituted per VM.
|
||||
|
||||
Deliberately minimal: disk, locale, image, account, autologon and one
|
||||
first-logon command. Static IP configuration happens in bootstrap.ps1
|
||||
because the unattend TCPIP <Identifier> must match the adapter's connection
|
||||
name exactly and fails silently when it does not.
|
||||
-->
|
||||
<unattend xmlns="urn:schemas-microsoft-com:unattend"
|
||||
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
|
||||
|
||||
<settings pass="windowsPE">
|
||||
<component name="Microsoft-Windows-International-Core-WinPE"
|
||||
processorArchitecture="amd64"
|
||||
publicKeyToken="31bf3856ad364e35"
|
||||
language="neutral" versionScope="nonSxS">
|
||||
<SetupUILanguage>
|
||||
<UILanguage>en-US</UILanguage>
|
||||
</SetupUILanguage>
|
||||
<InputLocale>en-US</InputLocale>
|
||||
<SystemLocale>en-US</SystemLocale>
|
||||
<UILanguage>en-US</UILanguage>
|
||||
<UserLocale>en-US</UserLocale>
|
||||
</component>
|
||||
|
||||
<component name="Microsoft-Windows-Setup"
|
||||
processorArchitecture="amd64"
|
||||
publicKeyToken="31bf3856ad364e35"
|
||||
language="neutral" versionScope="nonSxS">
|
||||
<DiskConfiguration>
|
||||
<Disk wcm:action="add">
|
||||
<DiskID>0</DiskID>
|
||||
<WillWipeDisk>true</WillWipeDisk>
|
||||
<CreatePartitions>
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>1</Order>
|
||||
<Type>Primary</Type>
|
||||
<Size>500</Size>
|
||||
</CreatePartition>
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>2</Order>
|
||||
<Type>Primary</Type>
|
||||
<Extend>true</Extend>
|
||||
</CreatePartition>
|
||||
</CreatePartitions>
|
||||
<ModifyPartitions>
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>1</Order>
|
||||
<PartitionID>1</PartitionID>
|
||||
<Active>true</Active>
|
||||
<Format>NTFS</Format>
|
||||
<Label>System</Label>
|
||||
</ModifyPartition>
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>2</Order>
|
||||
<PartitionID>2</PartitionID>
|
||||
<Format>NTFS</Format>
|
||||
<Label>Windows</Label>
|
||||
<Letter>C</Letter>
|
||||
</ModifyPartition>
|
||||
</ModifyPartitions>
|
||||
</Disk>
|
||||
<WillShowUI>OnError</WillShowUI>
|
||||
</DiskConfiguration>
|
||||
|
||||
<ImageInstall>
|
||||
<OSImage>
|
||||
<InstallFrom>
|
||||
<MetaData wcm:action="add">
|
||||
<Key>/IMAGE/INDEX</Key>
|
||||
<Value>@@IMAGE_INDEX@@</Value>
|
||||
</MetaData>
|
||||
</InstallFrom>
|
||||
<InstallTo>
|
||||
<DiskID>0</DiskID>
|
||||
<PartitionID>2</PartitionID>
|
||||
</InstallTo>
|
||||
</OSImage>
|
||||
</ImageInstall>
|
||||
|
||||
<UserData>
|
||||
<AcceptEula>true</AcceptEula>
|
||||
<FullName>Norbourg</FullName>
|
||||
<Organization>Norbourg Services Financiers</Organization>
|
||||
</UserData>
|
||||
</component>
|
||||
</settings>
|
||||
|
||||
<settings pass="specialize">
|
||||
<component name="Microsoft-Windows-Shell-Setup"
|
||||
processorArchitecture="amd64"
|
||||
publicKeyToken="31bf3856ad364e35"
|
||||
language="neutral" versionScope="nonSxS">
|
||||
<ComputerName>@@HOSTNAME@@</ComputerName>
|
||||
<TimeZone>Eastern Standard Time</TimeZone>
|
||||
<RegisteredOwner>Norbourg</RegisteredOwner>
|
||||
<RegisteredOrganization>Norbourg Services Financiers</RegisteredOrganization>
|
||||
</component>
|
||||
|
||||
<component name="Microsoft-Windows-ServerManager-SvrMgrNc"
|
||||
processorArchitecture="amd64"
|
||||
publicKeyToken="31bf3856ad364e35"
|
||||
language="neutral" versionScope="nonSxS">
|
||||
<DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
|
||||
</component>
|
||||
|
||||
<component name="Microsoft-Windows-IE-ESC"
|
||||
processorArchitecture="amd64"
|
||||
publicKeyToken="31bf3856ad364e35"
|
||||
language="neutral" versionScope="nonSxS">
|
||||
<IEHardenAdmin>false</IEHardenAdmin>
|
||||
<IEHardenUser>false</IEHardenUser>
|
||||
</component>
|
||||
</settings>
|
||||
|
||||
<settings pass="oobeSystem">
|
||||
<component name="Microsoft-Windows-International-Core"
|
||||
processorArchitecture="amd64"
|
||||
publicKeyToken="31bf3856ad364e35"
|
||||
language="neutral" versionScope="nonSxS">
|
||||
<InputLocale>en-US</InputLocale>
|
||||
<SystemLocale>en-US</SystemLocale>
|
||||
<UILanguage>en-US</UILanguage>
|
||||
<UserLocale>en-US</UserLocale>
|
||||
</component>
|
||||
|
||||
<component name="Microsoft-Windows-Shell-Setup"
|
||||
processorArchitecture="amd64"
|
||||
publicKeyToken="31bf3856ad364e35"
|
||||
language="neutral" versionScope="nonSxS">
|
||||
<OOBE>
|
||||
<HideEULAPage>true</HideEULAPage>
|
||||
<HideLocalAccountScreen>true</HideLocalAccountScreen>
|
||||
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
|
||||
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
|
||||
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
|
||||
<NetworkLocation>Work</NetworkLocation>
|
||||
<ProtectYourPC>3</ProtectYourPC>
|
||||
<SkipMachineOOBE>true</SkipMachineOOBE>
|
||||
<SkipUserOOBE>true</SkipUserOOBE>
|
||||
</OOBE>
|
||||
|
||||
<UserAccounts>
|
||||
<AdministratorPassword>
|
||||
<Value>@@ADMIN_PASSWORD@@</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</AdministratorPassword>
|
||||
</UserAccounts>
|
||||
|
||||
<AutoLogon>
|
||||
<Enabled>true</Enabled>
|
||||
<LogonCount>3</LogonCount>
|
||||
<Username>Administrator</Username>
|
||||
<Password>
|
||||
<Value>@@ADMIN_PASSWORD@@</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</Password>
|
||||
</AutoLogon>
|
||||
|
||||
<FirstLogonCommands>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<Order>1</Order>
|
||||
<Description>Norbourg bootstrap</Description>
|
||||
<CommandLine>cmd /c for %d in (D E F G H I J K) do if exist %d:\norbourg\bootstrap.cmd call %d:\norbourg\bootstrap.cmd</CommandLine>
|
||||
<RequiresUserInput>false</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
</FirstLogonCommands>
|
||||
</component>
|
||||
</settings>
|
||||
|
||||
</unattend>
|
||||
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
rem Norbourg lab — first-logon entry point (runs from the seed ISO).
|
||||
rem The ISO carries the whole payload, so copy it locally first: from then on
|
||||
rem the guest never needs another file transfer.
|
||||
if not exist C:\norbourg mkdir C:\norbourg
|
||||
xcopy "%~dp0*.*" C:\norbourg\ /E /I /Y >nul 2>&1
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "C:\norbourg\bootstrap.ps1" >> C:\norbourg\bootstrap.log 2>&1
|
||||
@@ -0,0 +1,70 @@
|
||||
# Norbourg lab — first-boot bootstrap, runs once from the seed ISO.
|
||||
# The unattend file creates the account and triggers this; everything that
|
||||
# touches the network happens here because unattend TCPIP settings fail
|
||||
# silently when the adapter name does not match.
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$base = 'C:\norbourg'
|
||||
New-Item -ItemType Directory -Force -Path $base | Out-Null
|
||||
Start-Transcript -Path "$base\bootstrap.log" -Append | Out-Null
|
||||
|
||||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
. (Join-Path $here 'config.ps1')
|
||||
|
||||
Write-Host "bootstrap: host=$($Config.Hostname) role=$($Config.Role) ip=$($Config.IP)"
|
||||
|
||||
# ------------------------------------------------------------------ network
|
||||
$nic = Get-NetAdapter |
|
||||
Where-Object { $_.Status -eq 'Up' -and $_.InterfaceDescription -notmatch 'Loopback' } |
|
||||
Select-Object -First 1
|
||||
|
||||
if (-not $nic) {
|
||||
Write-Host 'bootstrap: no up adapter, network step skipped'
|
||||
} else {
|
||||
Remove-NetIPAddress -InterfaceIndex $nic.ifIndex -Confirm:$false -ErrorAction SilentlyContinue
|
||||
Remove-NetRoute -InterfaceIndex $nic.ifIndex -Confirm:$false -ErrorAction SilentlyContinue
|
||||
|
||||
New-NetIPAddress -InterfaceIndex $nic.ifIndex `
|
||||
-IPAddress $Config.IP -PrefixLength $Config.Prefix `
|
||||
-DefaultGateway $Config.Gateway | Out-Null
|
||||
|
||||
Set-DnsClientServerAddress -InterfaceIndex $nic.ifIndex -ServerAddresses $Config.DNS
|
||||
Set-NetConnectionProfile -InterfaceIndex $nic.ifIndex -NetworkCategory Private -ErrorAction SilentlyContinue
|
||||
|
||||
# The IP change re-triggers the "make this PC discoverable" flyout.
|
||||
New-Item -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Network' -Force | Out-Null
|
||||
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Network' `
|
||||
-Name NewNetworkWindowOff -Value 1 -Type DWord
|
||||
|
||||
Write-Host "bootstrap: $($nic.Name) -> $($Config.IP)/$($Config.Prefix)"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------ WinRM
|
||||
# The host provisions over WinRM; no guest agent needed for that.
|
||||
Enable-PSRemoting -SkipNetworkProfileCheck -Force | Out-Null
|
||||
Set-NetFirewallRule -DisplayGroup 'Windows Remote Management' -Enabled True -Profile Any -ErrorAction SilentlyContinue
|
||||
|
||||
# SMB: the eval image leaves File and Printer Sharing disabled, which makes the
|
||||
# workstation invisible to a normal SMB scan.
|
||||
Enable-NetFirewallRule -DisplayGroup 'File and Printer Sharing' -ErrorAction SilentlyContinue
|
||||
|
||||
# RDP: useful for the instructor when a step misbehaves.
|
||||
Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\Terminal Server' `
|
||||
-Name fDenyTSConnections -Value 0
|
||||
Enable-NetFirewallRule -DisplayGroup 'Remote Desktop' -ErrorAction SilentlyContinue
|
||||
|
||||
# ------------------------------------------------------------------ marker
|
||||
"$env:COMPUTERNAME|$($Config.Role)|$($Config.IP)|$((Get-Date).ToString('s'))" |
|
||||
Set-Content -Path "$base\stamp.txt" -Encoding ascii
|
||||
|
||||
# ------------------------------------------------------------------ role
|
||||
$role = Join-Path $here "roles\$($Config.Role).ps1"
|
||||
if (Test-Path $role) {
|
||||
Write-Host "bootstrap: running role $($Config.Role)"
|
||||
& $role
|
||||
} else {
|
||||
Write-Host "bootstrap: no role script for '$($Config.Role)' yet (phase 5)"
|
||||
}
|
||||
|
||||
Write-Host 'bootstrap: done'
|
||||
Stop-Transcript | Out-Null
|
||||
Reference in New Issue
Block a user