Chapter 7. Configuring RHEL on Public Cloud Platforms with AMD SEV SNP
To prevent VM integrity-based attacks and reduce memory integrity violations, configure AMD Secure Encrypted Virtualization with Secure Nested Paging (SEV-SNP) on Red Hat Enterprise Linux (RHEL) instances on public cloud. AMD SEV-SNP isolates VM data from the hypervisor and cloud service provider.
7.1. Overview of AMD SEV SNP Copy linkLink copied to clipboard!
AMD Secure Encrypted Virtualization with Secure Nested Paging (SEV-SNP) aims at improving security of virtual machines (VMs) and data stored in them on public cloud platforms.
AMD processors offer three hardware-based security mechanisms: SEV, SEV-ES, and SEV-SNP.
- SEV: The SEV mechanism encrypts virtual machine (VM) memory to prevent the hypervisor from accessing VM data.
- SEV-ES: SEV with Encrypted State (SEV-ES) extends SEV by encrypting CPU register states. This mechanism prevents the hypervisor from accessing or modifying VM CPU registers. Despite providing isolation between hypervisor and VM, it is still vulnerable to memory integrity attacks.
- SEV-SNP: SEV-SNP is an enhancement to SEV-ES that adds memory integrity protection along with VM encryption. This mechanism prevents the hypervisor from modifying page tables to redirect VM memory access. It protects against replay attacks and memory tampering.
- SEV SNP components
-
Secure Processor: The AMD
EPYCprocessor integrates a Secure Processor (SP) subsystem. The AMD SP is a dedicated hardware component to manage keys and encryption operations. Memory Integrity: The memory management unit (MMU) utilizes page tables to translate virtual addresses to guest-physical addresses.
- SEV-SNP uses nested page tables for translating guest-physical addresses to host-physical addresses.
- Once defined, nested page tables cannot be altered by the hypervisor or the host. This prevents VM access to different pages, protecting memory integrity.
- SEV-SNP uses this method to offer protection against replay attacks, memory integrity violations, and malicious modifications to VM memory.
-
Memory Encryption: The AMD
EPYCprocessor hides the memory encryption key, which remains hidden from both host and VM. Attestation report for verification: A CPU-generated report contains RHEL instance information in an authorized cryptographic format. This report confirms the authenticity and reliability of the initial CPU and memory state of the RHEL instance and AMD processor.
NoteEven if a hypervisor creates the primary memory and CPU register state of the VM, they remain hidden and inaccessible to the hypervisor after initialization of that VM.
- The AMD SEV SNP Secure Boot process
Initialization and measurement: A SEV-SNP enabled hypervisor sets the initial state of a VM.
- This hypervisor loads firmware binary into the VM memory and sets the initial register state.
- AMD Secure Processor (SP) measures the initial state of the VM and provides details to verify the initial state of the VM.
Firmware: The VM initiates the UEFI firmware. The firmware might include either stateful or stateless Virtual Trusted Platform Module (vTPM) implementation.
- Stateful vTPM maintains persistent cryptographic state across VM reboots and migrations.
- Stateless vTPM generates a new cryptographic state for each VM session without persistence.
- Virtual Machine Privilege Levels (VMPL) technology isolates vTPM from the guest.
- VMPL offers hardware-enforced privilege isolation between different VM components and the hypervisor.
vTPM: For stateful vTPM implementation, the UEFI firmware might perform remote attestation.
- This depends on your cloud service provider. The attestation decrypts the persistent state of vTPM.
vTPM also measures facts about the boot process
- Secure Boot state
- Certificates used for signing boot artifacts
- UEFI binary hashes
Shim: When the UEFI firmware finishes the initialization process, it searches for the extended firmware interface (EFI) system partition.
- The UEFI firmware verifies and executes the first stage boot loader from there.
-
For RHEL, this is
shim. Theshimprogram allows non-Microsoft operating systems to load the second stage boot loader from the EFI system partition. -
shimuses a Red Hat certificate to verify the second stage boot loader (grub) or Red Hat Unified Kernel Image (UKI). -
gruborUKIunpacks, verifies, and executes Linux kernel and initial RAM filesystem (initramfs), and the kernel command line. - This process ensures that the Linux kernel loads in a trusted and secured environment.
Initramfs: In
initramfs, vTPM information automatically unlocks the encrypted root partition in case of full disk encryption technology.-
When the root volume becomes available,
initramfstransfers the execution flow to the root volume.
-
When the root volume becomes available,
Attestation: The VM tenant gets access to the system. They can perform remote attestation to ensure the VM is an untampered Confidential Virtual Machine (CVM).
- Attestation is performed based on information from the AMD SP and vTPM.
- This process confirms the authenticity and reliability of the initial CPU and memory state of the RHEL instance and the AMD processor.
- TEE: This process creates a Trusted Execution Environment (TEE) to ensure that booting of the VM is in a trusted and secured environment.
7.2. Configuring a RHEL VM on Azure with AMD SEV SNP Copy linkLink copied to clipboard!
You can configure AMD Secure Encrypted Virtualization with Secure Nested Paging (SEV-SNP) on RHEL VMs on Azure to create a trusted boot environment. SEV-SNP protects your data from access by the hypervisor and cloud service provider, and is available only for AMD EPYC processor family.
Prerequisites
-
You have installed the
opensshandopenssh-clientspackages. - You have installed the Azure CLI utility. For details, see installing the Azure CLI.
- You have created an Azure virtual machine (VM) that uses a supported AMD EPYC processor-based machine type.
Procedure
Log in to Azure by using the Azure CLI utility:
$ az loginCreate an azure resource group for the selected availability zone:
$ az group create --name <example_resource_group> --location eastusDeploy a RHEL instance with SEV-SNP, for example, the
Standard_DC4as_V5instance type:$ az vm create --resource-group <example_resource_group> \ --name <example-rhel-10-sev-snp-instance> \ --image <RedHat:rhel:10_x64_Gen2:latest> \ --size <Standard_DC4as_V5> \ --admin-username <example_azure_user> \ --generate-ssh-keys \ --security-type ConfidentialVM \ --os-disk-security-encryption-type DiskWithVMGuestStateConnect to the RHEL instance:
$ ssh <example_azure_user>@<example_ip_address_of_VM>
Verification
Check kernel logs to verify status of SEV-SNP:
$ sudo dmesg | grep -i sev... [ 0.547223] Memory Encryption Features active: AMD SEV [ 4.843171] kvm-guest: setup_efi_kvm_sev_migration : EFI live migration variable not found ...