mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 03:27:05 +00:00
[Windows] Ensure MDE is not setup (#12544)
This commit is contained in:
26
images/windows/scripts/build/Post-Build-Validation.ps1
Normal file
26
images/windows/scripts/build/Post-Build-Validation.ps1
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
################################################################################
|
||||||
|
## File: post-build-validation.sh
|
||||||
|
## Desc: Validate different aspects of the image after build
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
Write-Host "Test Microsoft Defender not set up using 'sc query sense'"
|
||||||
|
$response = sc query sense
|
||||||
|
foreach ($item in $response) {
|
||||||
|
if ($item -match "STATE") {
|
||||||
|
$state = $item.Split(":")[1].Trim()
|
||||||
|
if ($state -notmatch "RUNNING") {
|
||||||
|
Write-Host "MDE is not running"
|
||||||
|
} else {
|
||||||
|
Write-Host "MDE is running"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Test Microsoft Defender not set up by checking for the MDE extension"
|
||||||
|
if (Test-Path -Path "C:\Packages\Plugins\Microsoft.Azure.AzureDefenderForServers.MDE.Windows") {
|
||||||
|
Write-Error "MDE extension detected, MDE is more likely installed on the system"
|
||||||
|
exit 1
|
||||||
|
} else {
|
||||||
|
Write-Host "MDE is not setup on the system"
|
||||||
|
}
|
||||||
@@ -263,7 +263,8 @@ build {
|
|||||||
scripts = [
|
scripts = [
|
||||||
"${path.root}/../scripts/build/Install-NativeImages.ps1",
|
"${path.root}/../scripts/build/Install-NativeImages.ps1",
|
||||||
"${path.root}/../scripts/build/Configure-System.ps1",
|
"${path.root}/../scripts/build/Configure-System.ps1",
|
||||||
"${path.root}/../scripts/build/Configure-User.ps1"
|
"${path.root}/../scripts/build/Configure-User.ps1",
|
||||||
|
"${path.root}/../scripts/build/Post-Build-Validation.ps1"
|
||||||
]
|
]
|
||||||
skip_clean = true
|
skip_clean = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,7 +258,8 @@ build {
|
|||||||
scripts = [
|
scripts = [
|
||||||
"${path.root}/../scripts/build/Install-NativeImages.ps1",
|
"${path.root}/../scripts/build/Install-NativeImages.ps1",
|
||||||
"${path.root}/../scripts/build/Configure-System.ps1",
|
"${path.root}/../scripts/build/Configure-System.ps1",
|
||||||
"${path.root}/../scripts/build/Configure-User.ps1"
|
"${path.root}/../scripts/build/Configure-User.ps1",
|
||||||
|
"${path.root}/../scripts/build/Post-Build-Validation.ps1"
|
||||||
]
|
]
|
||||||
skip_clean = true
|
skip_clean = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,7 +250,8 @@ provisioner "powershell" {
|
|||||||
scripts = [
|
scripts = [
|
||||||
"${path.root}/../scripts/build/Install-NativeImages.ps1",
|
"${path.root}/../scripts/build/Install-NativeImages.ps1",
|
||||||
"${path.root}/../scripts/build/Configure-System.ps1",
|
"${path.root}/../scripts/build/Configure-System.ps1",
|
||||||
"${path.root}/../scripts/build/Configure-User.ps1"
|
"${path.root}/../scripts/build/Configure-User.ps1",
|
||||||
|
"${path.root}/../scripts/build/Post-Build-Validation.ps1"
|
||||||
]
|
]
|
||||||
skip_clean = true
|
skip_clean = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user