Skip to content

Instantly share code, notes, and snippets.

@fbeauchamp
Last active June 14, 2022 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbeauchamp/618dc684edc21e16a35395c0c74cb6f3 to your computer and use it in GitHub Desktop.
Save fbeauchamp/618dc684edc21e16a35395c0c74cb6f3 to your computer and use it in GitHub Desktop.

Backup encryption

definition

protecting data at rest : encrypt data before writing them to disk.

e2e encryption : block should be encrypted by the sender ( in our case : the host) . Not applicable for now.

key rotation : use a new key to encrypt new data without losing the ability to decrypt old data. Should be used periodically, or at least after an attacker got the keys.

state of the art

Veeam : https://helpcenter.veeam.com/archive/backup/95/vsphere/encryption_standards.html

key exchange https://signal.org/docs/specifications/doubleratchet/#symmetric-key-ratchet

Key storage

file / env var

easy to develop, quite easy to manage , but weak : an attacker with access to the host files will be able to obtain the key

per remote

easy to develop, easier to manage, but even weaker : an attacker will only need a xo account to decrypt data. Since the data are store unencrypted in redis, an attacker with access to the host will also be able to read this without an xo account.

encrypted file / env var

will need a user intervention when restarting xo-server

external key store

need a manual intervention on service restart (to enter the master key/connection key). This step should be done after asking for our communtiy which provider to support ( hashicorp vault, amazon , google, keycloack for example)

Key change

if the key is compromised we should be able to update the key

download / decrypt / encrypt / upload

slow, costly but easy and ensure that the attacker won't be able to recover any fragment of data after

per block key (with index)

store in the block metdata the hash / reference of the key used. When encrypting : use the most recent key. When decrypting : use the key referenced in the block metadata. That way an attacker with the knowledge of a key won't be able to get the new data, making the disk image unreadable.

Implementation proposition

  • a file on the host with the keys algorithm + hash + value . File may be store on an encrypted partition
  • a parameter on the remote to activate encryption only for vhd directory
  • saving the key hash in the filters fie during backup
  • add an option to export the key files during a XO configuration export
  • changing a key will means that the merge will fall back to download/decrypt/crypt/upload until the next full backup
  • deleting the keys file on the xo host will means all data are irrecoverable

Step 2:

  • encryption of the key file, maybe linked with the TPM feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment