Chapter 6. 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.
6.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.
6.2. Configuring a RHEL instance on Amazon Web Services with AMD SEV SNP Copy linkLink copied to clipboard!
To create a trusted boot environment, configure AMD Secure Encrypted Virtualization with Secure Nested Paging (SEV-SNP) for a Red Hat Enterprise Linux (RHEL) instance on Amazon Web Services (AWS). SEV-SNP isolates VM data from the hypervisor and AWS, supported on AMD EPYC processor-based hosts only.
Prerequisites
-
You have installed the
awscli2,openssh, andopenssh-clientspackages. - You have created an AWS EC2 instance using an AMD EPYC processor-based machine type from the supported list. For details, see supported instance types.
You have checked if SEV-SNP is enabled for the RHEL instance:
$ aws ec2 describe-instances --instance-ids <example_instance_id> \ --region <example_region>... "CpuOptions": { "CoreCount": 2, "ThreadsPerCore": 2, "AmdSevSnp": "enabled" }, ...NoteBefore configuring a RHEL instance on AWS with AMD SEV-SNP, check with your cloud service provider. Verify the support status and certification of your particular RHEL instance type.
Procedure
Get ID of a RHEL AMI if SEV-SNP is not enabled:
$ aws ec2 describe-images \ --owners 309956199498 \ --query 'sort_by(Images, &Name)[*].[CreationDate,Name,ImageId]' \ --filters "Name=name,Values=RHEL-10*" \ --region us-east-1... "RHEL-10.0_HVM-amd64-..", "ami-0a1b2c3d4e5f67890" ...WarningDo not modify the command option
--owners 309956199498. This is the account ID for displaying Red Hat images. If you need to list images for AWS GovCloud, use--region us-gov-west-1and--owners 219670896067.Launch a RHEL instance with AMD SEV-SNP enabled:
$ aws ec2 run-instances \ --image-id <example-rhel-10-ami-id> \ --instance-type m6a.4xlarge \ --key-name <example_key_pair_name> \ --subnet-id <example_subnet_id> \ --cpu-options AmdSevSnp=enabled
Verification
Check kernel logs to verify status of SEV-SNP:
$ dmesg | grep -i sev... [ 7.509546] Memory Encryption Features active: AMD SEV SEV-ES SEV-SNP [ 8.469487] SEV: Using SNP CPUID table, 64 entries present. [ 9.433348] SEV: SNP guest platform device initialized. [ 33.314380] sev-guest sev-guest: Initialized SEV guest driver (using vmpck_id 0) ...