Creación del blob binario de AWS para el arranque seguro de UEFI - Amazon Elastic Compute Cloud

Creación del blob binario de AWS para el arranque seguro de UEFI

Puede seguir los siguientes pasos para personalizar las variables de UEFI Secure Boot durante la creación de AMI. El KEK que se utiliza en estos pasos está actualizado a partir de septiembre de 2021. Si Microsoft actualiza la KEK, debe utilizar la KEK más reciente.

Para crear el blob binario de AWS
  1. Cree una lista de firmas de PK vacía.

    touch empty_key.crt cert-to-efi-sig-list empty_key.crt PK.esl
  2. Descargue el certificado KEK.

    https://go.microsoft.com/fwlink/?LinkId=321185
  3. Empaque los certificados KEK en una lista de firmas UEFI (siglist).

    sbsiglist --owner 77fa9abd-0359-4d32-bd60-28f4e78f784b --type x509 --output MS_Win_KEK.esl MicCorKEKCA2011_2011-06-24.crt
  4. Descargue los certificados de la db de Microsoft.

    https://www.microsoft.com/pkiops/certs/MicWinProPCA2011_2011-10-19.crt https://www.microsoft.com/pkiops/certs/MicCorUEFCA2011_2011-06-27.crt
  5. Genere la lista de firmas de la db.

    sbsiglist --owner 77fa9abd-0359-4d32-bd60-28f4e78f784b --type x509 --output MS_Win_db.esl MicWinProPCA2011_2011-10-19.crt sbsiglist --owner 77fa9abd-0359-4d32-bd60-28f4e78f784b --type x509 --output MS_UEFI_db.esl MicCorUEFCA2011_2011-06-27.crt cat MS_Win_db.esl MS_UEFI_db.esl > MS_db.esl
  6. Unified Extensible Firmware Interface Forum ya no proporciona los archivos DBX. Ahora los proporciona Microsoft en GitHub. Descargue la actualización más reciente de DBX del repositorio de actualizaciones de Arranque seguro de Microsoft en https://github.com/microsoft/secureboot_objects.

  7. Desempaquete el archivo update-binary firmado.

    Cree SplitDbxContent.ps1 con el contenido del script que aparece a continuación. Como alternativa, puede instalar el script desde la Galería de PowerShell con Install-Script -Name SplitDbxContent.

    <#PSScriptInfo .VERSION 1.0 .GUID ec45a3fc-5e87-4d90-b55e-bdea083f732d .AUTHOR Microsoft Secure Boot Team .COMPANYNAME Microsoft .COPYRIGHT Microsoft .TAGS Windows Security .LICENSEURI .PROJECTURI .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES Version 1.0: Original published version. #> <# .DESCRIPTION Splits a DBX update package into the new DBX variable contents and the signature authorizing the change. To apply an update using the output files of this script, try: Set-SecureBootUefi -Name dbx -ContentFilePath .\content.bin -SignedFilePath .\signature.p7 -Time 2010-03-06T19:17:21Z -AppendWrite' .EXAMPLE .\SplitDbxAuthInfo.ps1 DbxUpdate_x64.bin #> # Get file from script input $file = Get-Content -Encoding Byte $args[0] # Identify file signature $chop = $file[40..($file.Length - 1)] if (($chop[0] -ne 0x30) -or ($chop[1] -ne 0x82 )) { Write-Error "Cannot find signature" exit 1 } # Signature is known to be ASN size plus header of 4 bytes $sig_length = ($chop[2] * 256) + $chop[3] + 4 $sig = $chop[0..($sig_length - 1)] if ($sig_length -gt ($file.Length + 40)) { Write-Error "Signature longer than file size!" exit 1 } # Content is everything else $content = $file[0..39] + $chop[$sig_length..($chop.Length - 1)] # Write signature and content to files Set-Content -Encoding Byte signature.p7 $sig Set-Content -Encoding Byte content.bin $content

    Utilice el script para desempaquetar los archivos DBX firmados.

    PS C:\Windows\system32> SplitDbxContent.ps1 .\dbx.bin

    Esto produce dos archivos: signature.p7 y content.bin. Use content.bin en el paso siguiente.

  8. Cree un almacén de variables UEFI utilizando el script uefivars.py.

    ./uefivars.py -i none -o aws -O uefiblob-microsoft-keys-empty-pk.bin -P ~/PK.esl -K ~/MS_Win_KEK.esl --db ~/MS_db.esl --dbx ~/content.bin
  9. Compruebe el blob binario y el almacén de variables UEFI.

    ./uefivars.py -i aws -I uefiblob-microsoft-keys-empty-pk.bin -o json | less
  10. Puede actualizar el blob cargándolo nuevamente en la misma herramienta.

    ./uefivars.py -i aws -I uefiblob-microsoft-keys-empty-pk.bin -o aws -O uefiblob-microsoft-keys-empty-pk.bin -P ~/PK.esl -K ~/MS_Win_KEK.esl --db ~/MS_db.esl --dbx ~/content.bin

    Resultado previsto

    Replacing PK Replacing KEK Replacing db Replacing dbx