Skip to content

[NBS] NRD/Mirrored disk default encryption #176

@qkrorlqr

Description

@qkrorlqr

We can implement default encryption for STORAGE_MEDIA_SSD_{NONREPLICATED,MIRROR2,MIRROR3} both at rest and in transit by encrypting data at the endpoint level - just like user key-based encryption. The default key can be generated upon CreateVolume and stored in NProto::TVolumeConfig and then propagated to the endpoint upon MountVolume. The only remaining problem is the performance hit which is currently mostly caused by the need to update UsedBlockMap in the volume database. But actually we don't need this bitmap. A good encryption algorithm should produce data that's indistinguishable from the data generated by a uniform random generator. Therefore we don't need this bitmap - we can simply check that the block that we have just read from the storage node contains only zeroes - if so, we should not decrypt this block, otherwise - decrypt. We don't even have to check the whole block - checking the first 128 bytes should be more than enough. And just in case (which should be literally impossible - P=1/2^1024) an encrypted block contains zeroes in the first 128 bytes, we can check it upon write and report a E_IO or a E_ARGUMENT error to the client and raise a CriticalEvent. This endpoint-level encryption is also great because it won't impact the vhost-server-based fast rdma datapath - we will just disable it at the fastpath endpoint level.

Metadata

Metadata

Assignees

Labels

2025Q2blockstoreAdd this label to run only cloud/blockstore build and tests on PR

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions