Skip to content

Add LUKS Encryption Support in Ceph NVMe-oF Gateway #1710

@Greenpepper15

Description

@Greenpepper15

Add LUKS Encryption Support in Ceph NVMe-oF Gateway

1. Summary

This proposal aims to add support for Data-At-Rest Encryption to the Ceph NVMe-oF Gateway by exposing the native encryption capabilities of librbd. This will allow the Gateway to serve LUKS-encrypted RBD images to NVMe initiators transparently.

2. Motivation

Currently, the Ceph NVMe-oF Gateway serves RBD images as plain block devices. If a user requires Data-At-Rest encryption due to compliance or security concerns, they must handle encryption within the client (Initiator). Should this not be possible due to capacity constrains outsourcing it in the gateway would be ideal.

The Solution:
Offload the encryption/decryption task to the NVMe-oF Gateway. The Gateway unlocks the RBD image using librbd and presents a standard, unencrypted NVMe namespace to the client. libRBD itself already natively supports LUKS encryption using AES-XTS.

3. Proposed Design

Preferred Approach: librbd Native Encryption (LUKS)

We propose extending the SPDK bdev_rbd module to support the built-in encryption API provided by librbd.

  • Why this path? librbd supports the LUKS standard. An image encrypted via the Gateway remains compatible with other Ceph RBD clients (QEMU with libRBD, krbd+DmCrypt, rbd-nbd).
  • Why not SPDK Virtual Crypto Bdev? While SPDK has a bdev_crypto module, it creates a layering of encryption that is not natively understood by standard Ceph tools. Using librbd ensures the image is "just a LUKS image" to the rest of the Ceph ecosystem.

Proposed Workflow

  1. Gateway receives NamespaceAdd() RPC with all the nessary information to bind an encrypted RBD image to gateway
  2. Gateway leverages SPDK via bdev_rbd_create() to use libRBD to bind RBD image to gateway and configure encryption

4. Implementation Details

We need to modify the interaction between the Gateway's control plane and the underlying SPDK bdev_rbd module.

A. SPDK Extension

The bdev_rbd_create method in SPDK needs to accept encryption context. To mitigate any breaking changes we
should maybe create a new function bdev_encrypted_rbd_create in SPDK.

Current Signature:

bdev_rbd_create(name, pool_name, rbd_name, ...)

Proposed Signature Extension:

bdev_encrypted_rbd_create(
    name, 
    pool_name, 
    rbd_name, 
    ...
    encryption_format="luks",    # Type of LUKS: luks1, luks2
    encryption_passphrase="...", # The key/passphrase
    encryption_algorithm = 1 # implies AES-256 in XTS mode see rbd_encryption_algorithm_t enum in librbd.h
    # maybe other parameters
)

An implementation of using the libRBD encryption feature would be similar to the
QEMU integration of the libRBD encryption feature.

To simplify the logic we could impose that the Ceph NVMe-oF Gateway can only use valid LUKS formatted RBD images. Then we only need to integrate the libRBD load encryption key operation and not worry about formatting the RBD image to be LUKS conform. This would work fairly well in the context of ceph-csi. When the rbd image is created the ceph-csi driver could also LUKS format the image (if specified) and then attach it to the Ceph NVMe-oF Gateway.

B. Gateway API Extension

The Ceph NVMe-oF Gateway (ceph-nvmeof) needs to expose these parameters in the namespace_add:

def namespace_add(self, request, context=None):
    """Adds a namespace to a subsystem."""
    # ...

    # Pass passphrase and other parameter from 'request' down to SPDK
    bdev_name = self.spdk_rpc_client.bdev_encrypted_rbd_create(
        ...,
        encryption_format=request.luks,
        encryption_passphrase=request.passphrase,
        encryption_algorithm = request.algorithm
        # maybe other parameters
    )
    
    # ...

I.e. this only covers the LUKS formatted RBD image attach case.

6. Conclusion

Implementing this feature aligns the NVMe-oF Gateway with the rest of the Ceph ecosystem, allowing for a seamless encrypted storage experience that is interoperable and standards-compliant.

Related Issues:

#1402

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions