Configuring AMD SEV on Proxmox: Protecting VM Data Even If the Host is Compromised

Virtualization tutorial - IT technology blog
Virtualization tutorial - IT technology blog

Why Firewalls and Passwords Aren’t Enough to Protect Your VMs

Imagine a worst-case scenario: A hacker gains root access to your physical host. At this point, every security mechanism inside the virtual machine (VM), such as firewalls or disk encryption, becomes useless. With full administrative privileges, an attacker can easily dump the entire VM RAM to extract passwords, SSH keys, or transaction data being processed.

AMD SEV (Secure Encrypted Virtualization) was created to stop this scenario. Instead of trusting the software layer (Hypervisor), we place our trust in the hardware. The AMD CPU encrypts the memory of each VM using unique keys. Even if a system administrator has malicious intent, all they see in the RAM is a pile of meaningless junk data.

I run a small Proxmox cluster at home with about 12 VMs. I used to be quite complacent, but after reading about VM Escape vulnerabilities, I realized that memory-level security is mandatory if you are running crypto nodes or databases containing customer information.

System Requirements: Not All CPUs Are Compatible

To deploy SEV, you need synchronization between hardware and software. This is not a feature that can be enabled via emulation.

1. Compatible Hardware

  • CPU: Must be AMD EPYC (7001 or later) or the Ryzen Pro series. Note that consumer Ryzen lines (like the 5600X, 5900X) usually have this feature locked at the hardware level by AMD.
  • Mainboard: The chipset must support it, and the BIOS must have an option to enable SEV. Server motherboards like Tyan or Supermicro usually offer better support than gaming motherboards.
  • RAM: You need some headroom. When SEV is enabled, memory ballooning (RAM sharing) is completely disabled.

2. Supported Software

  • Hypervisor: Proxmox VE 7.2 or later is currently the most stable choice.
  • Guest OS: The VM should use Kernel 4.15+. Distributions like Ubuntu 20.04/22.04 or Debian 11/12 are well-supported.

Steps to Enable AMD SEV on the Proxmox Host

First, enter the BIOS/UEFI, navigate to Advanced > CPU Configuration, and enable both SME and SEV. Then, perform the configuration on Proxmox via SSH.

Step 1: Configure the Linux Kernel

By default, Proxmox does not automatically enable SEV to save resources. You need to modify the grub file:

nano /etc/default/grub

Find the line GRUB_CMDLINE_LINUX_DEFAULT and add the parameter kvm_amd.sev=1. The line should look like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet rw kvm_amd.sev=1"

Save it, update the configuration, and reboot the server:

update-grub
reboot

Step 2: Verify SEV Status

Once the system is up, check if the module loaded successfully using the command:

cat /sys/module/kvm_amd/parameters/sev

If you see the number 1, it means the door is open. To find out how many secure VMs you can run simultaneously, use the command:

dmesg | grep -i sev

For example, the message sev: 15 ASIDs available means your CPU supports up to 15 encrypted VMs at the same time. Newer EPYC lines can support hundreds of ASIDs.

Configuring the Virtual Machine (Guest) to Enable Encryption

Currently, Proxmox does not have an SEV toggle in the web interface. You must edit the configuration file manually.

Step 1: Locate the VM Configuration File

Open the VM configuration file (e.g., ID 101):

nano /etc/pve/qemu-server/101.conf

Step 2: Add Security Parameters

For SEV to work, the VM must use the q35 chipset and OVMF BIOS. Add the following lines to the file:

machine: q35
bios: ovmf
balloon: 0
args: -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1 -machine memory-encryption=sev0

Technical Explanation:

  • cbitpos: The position of the encryption bit in the RAM address. For EPYC CPUs, it’s usually 47. You can verify this using the cpuid -1 | grep -i sev command on the host.
  • reduced-phys-bits: Usually set to 1 to make room for the encryption bit.

Verifying the Results Inside the VM

Start the VM and log into the console. Run the following command to confirm the security layer is active:

dmesg | grep -i sev

If you see the line AMD Secure Encrypted Virtualization (SEV) active, you have succeeded. Now, the data in the VM’s RAM is completely isolated from the rest of the world.

Performance Assessment

In my real-world tests, enabling SEV increases RAM latency by about 2-4%. The CPU will spend a few more cycles continuously encrypting/decrypting data. However, for tasks like web servers or databases, this difference is almost imperceptible.

Important Considerations

Deploying SEV isn’t always smooth sailing. Here are a few things to keep in mind:

  1. Snapshot & Live Migration: Moving a running VM (Live Migration) between hosts becomes more complex and requires consistent SEV configuration across the entire cluster.
  2. Memory Errors: If the VM fails to start, 90% of the time it’s because you forgot to disable ballooning. SEV requires RAM to be fully pinned.
  3. Backup: Data on disk is not affected by SEV (that’s the job of LUKS or VeraCrypt); SEV only protects data “live” in the RAM.

Configuring AMD SEV helps you build a Zero Trust environment starting from the infrastructure level. Even if an attacker gains access to the physical server, your data remains in a secure zone that they cannot touch.

Share: