Skip to content

Commit 83bcff1

Browse files
authored
feat: disable kernel lockdown mode for azurelinux 3.0 aks image by default (#7990)
Signed-off-by: Mitch Zhu <mitchzhu@microsoft.com>
1 parent 12e23eb commit 83bcff1

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

vhdbuilder/packer/pre-install-dependencies.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ if [[ ${OS} == ${MARINER_OS_NAME} ]] && [[ "${ENABLE_CGROUPV2,,}" == "true" ]];
123123
fi
124124
capture_benchmark "${SCRIPT_NAME}_enable_cgroupv2_for_azurelinux"
125125

126+
# Remove lockdown=integrity from kernel cmdline for Azure Linux 3.0
127+
# The kernel has an OOT patch that auto-enables lockdown when secure boot is detected
128+
if isMarinerOrAzureLinux "$OS" && [ "$OS_VERSION" = "3.0" ]; then
129+
disableKernelLockdownCmdline
130+
fi
131+
capture_benchmark "${SCRIPT_NAME}_disable_kernel_lockdown_cmdline"
132+
126133
# shellcheck disable=SC3010
127134
if [[ ${UBUNTU_RELEASE//./} -ge 2204 && "${ENABLE_FIPS,,}" != "true" ]]; then
128135

vhdbuilder/scripts/linux/mariner/tool_installs_mariner.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,19 @@ activateNfConntrack() {
172172
echo nf_conntrack >> /etc/modules-load.d/contrack.conf
173173
}
174174

175+
# Remove lockdown=integrity from kernel cmdline for Azure Linux 3.0.
176+
# The AzureLinux 3.0 kernel has an OOT patch that automatically enables
177+
# lockdown when secure boot is detected.
178+
disableKernelLockdownCmdline() {
179+
echo "Removing lockdown=integrity from kernel cmdline..."
180+
if [ -f /etc/default/grub ]; then
181+
sed -i 's/lockdown=integrity//g' /etc/default/grub
182+
grub2-mkconfig -o /boot/grub2/grub.cfg || exit 1
183+
else
184+
echo "Warning: /etc/default/grub not found, skipping lockdown removal"
185+
fi
186+
}
187+
175188
installFIPS() {
176189

177190
echo "Installing FIPS..."

0 commit comments

Comments
 (0)