mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
Validate MS Defender is not installed (#12529)
This commit is contained in:
19
images/ubuntu/scripts/build/post-build-validation.sh
Normal file
19
images/ubuntu/scripts/build/post-build-validation.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
################################################################################
|
||||||
|
## File: post-build-validation.sh
|
||||||
|
## Desc: Validate different aspects of the image after build
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
echo "Test microsoft defender not installed using '-d /opt/microsoft/mdatp'"
|
||||||
|
# Validate Defender not installed test 1
|
||||||
|
if [ -d /opt/microsoft/mdatp ]; then
|
||||||
|
echo "Microsoft Defender for Endpoint is installed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Test microsoft defender not installed using 'systemctl list-units --type=service --all | grep mdatp'"
|
||||||
|
# Validate Defender not installed test 2
|
||||||
|
if systemctl list-units --type=service --all | grep -w mdatp &>/dev/null; then
|
||||||
|
echo "Microsoft Defender for Endpoint is installed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -238,6 +238,12 @@ build {
|
|||||||
inline = ["mkdir -p /etc/vsts", "cp /tmp/ubuntu2204.conf /etc/vsts/machine_instance.conf"]
|
inline = ["mkdir -p /etc/vsts", "cp /tmp/ubuntu2204.conf /etc/vsts/machine_instance.conf"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "shell" {
|
||||||
|
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}"]
|
||||||
|
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
scripts = ["${path.root}/../scripts/build/post-build-validation.sh"]
|
||||||
|
}
|
||||||
|
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
inline = ["sleep 30", "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"]
|
inline = ["sleep 30", "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"]
|
||||||
|
|||||||
@@ -217,6 +217,12 @@ provisioner "shell" {
|
|||||||
scripts = ["${path.root}/../scripts/build/configure-system.sh"]
|
scripts = ["${path.root}/../scripts/build/configure-system.sh"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "shell" {
|
||||||
|
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}"]
|
||||||
|
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
scripts = ["${path.root}/../scripts/build/post-build-validation.sh"]
|
||||||
|
}
|
||||||
|
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
inline = ["sleep 30", "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"]
|
inline = ["sleep 30", "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"]
|
||||||
|
|||||||
Reference in New Issue
Block a user