Supported formats
Both Linux Unified Key Setup (LUKS) 1 and 2 are supported. The data layout is fully
compliant with the LUKS specification. External LUKS compatible tools such as
dm-crypt or QEMU can safely perform encrypted Input/Output (I/O)
on encrypted RBD images. Additionally, you can import existing LUKS images created by external
tools, by copying the raw LUKS data into the RBD image.
Currently, only Advanced Encryption Standards (AES) 128 and 256 encryption algorithms are supported. xts-plain64 is currently the only supported encryption mode.
Syntax
rbd encryption format POOL_NAME/LUKS_IMAGE luks1|luks2 passphrase.txt
Example
[ceph: root@host01 /]# rbd encryption format pool1/luksimage1 luks1 passphrase.txt
luks1 or luks encryption
format.The encryption format operation generates a LUKS header and writes it at the start of the RBD
image. A single keyslot is appended to the header. The keyslot holds a randomly generated encryption
key, and is protected by the passphrase read from the passphrase file. By default, AES-256 in
xts-plain64 mode, which is the current recommended mode and the default for other LUKS tools, is
used. Adding or removing additional passphrases is currently not supported natively, but can be
achieved using LUKS tools such as cryptsetup. The LUKS header size can vary that is
up to 136MiB in LUKS, but it is usually upto 16MiB, dependent on the version of
libcryptsetup installed. For optimal performance, the encryption format will set
the data offset to be aligned with the image object size. For example, expect a minimum overhead of
8MiB if using an image configured with an 8MiB object size.
In LUKS1, sectors, which are the minimal encryption units, are fixed at 512 bytes. LUKS2 supports
larger sectors, and for better performance, the default sector size is set to the maximum of 4KiB.
Writes which are either smaller than a sector, or are not aligned to a sector start, will trigger a
guarded read-modify-write chain on the client, with a considerable latency penalty.
A batch of such unaligned writes can lead to I/O races which will further deteriorate performance.
IBM recommends to avoid using RBD encryption in cases where incoming writes cannot be guaranteed to
be LUKS sector aligned.
To map a LUKS encrypted image, run the following command:
Syntax
rbd device map -t nbd -o encryption-format=luks1|luks2,encryption-passphrase-file=passphrase.txt POOL_NAME/LUKS_IMAGE
Example
[ceph: root@host01 /]# rbd device map -t nbd -o encryption-format=luks1,encryption-passphrase-file=passphrase.txt pool1/luksimage1
- You can select either
luks1orluks2encryption format. - For security reasons, both the encryption format and encryption load operations are CPU-intensive, and may take a few seconds to complete. For encrypted I/O, assuming AES-NI is enabled, a relative small microseconds latency might be added, as well as a small increase in CPU utilization.