Skip to main content
RunBook Academy

CephCXIX · Disaster Recovery ArchitectureDisaster Recovery Architecture

Encrypting backups and keeping the keys usable

Advanced⏱ ~18 mincephrbdgpg

What you'll learn

  • Place encryption at the right layer for backups
  • Describe what OSD-level encryption protects against
  • Escrow keys outside the cluster they protect
  • Rotate keys without orphaning archives

Prerequisites

None — start here.

Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18

Not yet marked complete on this device.

Why this matters in production

A backup holds exactly the data the cluster holds, with none of the cluster’s access control in front of it. It is the copy an attacker would rather have.

Where encryption can live

LayerProtects againstCovers the backup
OSD dmcrypttheft or RMA of a driveno
RBD image LUKSreading the image outside the clientonly if the backup copies ciphertext
RGW server-side encryptionreading objects from the poolno, unless preserved by the copy
client-side, before writingeverything below the clientyes
applied at or before the backup targetdisclosure of the archiveyes
ceph config-key ls | grep dm-crypt
service_type: osd
service_id: default
placement:
  host_pattern: '*'
spec:
  data_devices:
    all: true
  encrypted: true

OSD encryption is transparent to every authenticated client and to the OSD process itself. It answers a drive leaving the building and nothing else, which is why the backup needs its own.

Encrypting the archive

rbd encryption format rbd/vm-104 luks2 /secure/keys/vm-104.key
rbd export rbd/vm-104 - \
  | gpg --batch --encrypt --recipient backup@example.net \
        --output /backup/vm-104-2026-08-18.img.gpg
gpg --list-keys backup@example.net
sha256sum /backup/vm-104-2026-08-18.img.gpg > /backup/vm-104-2026-08-18.sha256

Key custody

QuestionAcceptable answer
where does the key liveoutside this cluster, at the DR location
who can retrieve ita role distinct from cluster administrators
what if the cluster is goneretrieval is unaffected
how is it proven retrievableit is used in the quarterly drill
A key stored in the config-key store, in a vault backed by this cluster,
or on a host that only exists here, is not custody. It is a second copy of
the same failure.

Rotation without orphaning archives

GenerationActiveEncryptsRetire after
k-2026-01Jan–Jun 2026archives Jan–Junlast archive expires Jun 2033
k-2026-07Jul–Dec 2026archives Jul–Declast archive expires Dec 2033
# which generation encrypted which archive, recorded outside the archive
printf '%s\t%s\n' vm-104-2026-08-18.img.gpg k-2026-07 \
  >> /secure/offsite/key-generation-index.tsv

Quiz

Knowledge check · 4 questions

  1. Q1. What does OSD-level dmcrypt encryption protect a backup against?

  2. Q2. Rotating a backup encryption key means the previous key can be destroyed.

  3. Q3. Fix a backup encryption design.

    Archives are encrypted with a key held in HashiCorp Vault. Vault's storage backend is an S3 bucket served by this cluster's RGW. The key rotation policy destroys the previous key after twelve months; archives are retained for seven years.

  4. Q4. Where must backup encryption keys be held, and why?

Passing score: 75%. Answers are checked in this browser.

Production discipline

Apply backup encryption at or before the backup target; OSD dmcrypt covers a drive leaving the building and travels with nothing you copy out. Never destroy a retired key generation while archives it encrypted are still retained, and keep the archive-to-generation index outside the archives.

Cross-course references

  • Kubernetes: a sealed-secret key stored only in the cluster it seals is lost with that cluster
  • Linux: encryption at rest at one layer says nothing about copies made above it