LINBIT / linstor-server

High Performance Software-Defined Block Storage for container, cloud and virtualisation. Fully integrated with Docker, Kubernetes, Openstack, Proxmox etc.
https://docs.linbit.com/docs/linstor-guide/
GNU General Public License v3.0
943 stars 75 forks source link

Feature-request: native encryption with ZFS #177

Open kvaps opened 4 years ago

kvaps commented 4 years ago

OpenZFS does support native encryption since 0.8.0.

Encryption can be enabled for whole pool, dataset or per ZVOL (our case). It would be nice to add its support in roadmap for LINSTOR.

Here is examples: https://blog.heckel.io/2017/01/08/zfs-encryption-openzfs-zfs-on-linux/

ghernadi commented 4 years ago

For me this sounds like a feature request for the linstor physical-storage create-device-pool command.

As for an encryption of the whole zpool, the user would have to enable encryption before linstor sp c zfs ...
and for per ZVOL, you should be able to use the new StorDriver/ZfscreateOptions #128

kvaps commented 4 years ago

Yes looks like StorDriver/ZfscreateOptions #128 is exactly what we need, but the questions is how to input encryption password :)

ghernadi commented 4 years ago

So you also want to have a password?

Well.. in that case, I have to agree, that makes it a bit more difficult.

I am not a zfs expert, but if I understand this zfs-encryption correctly (for some reasons I could test it myself for now, I'll have to look into my test-setup) and you need to re-enter the password when you are mounting / start using the device, that will cause some problems in Linstor which would require quite a lot of changes...

First, right now, basically every layer in Linstor might be "on top" of the StorageLayer with a ZFS provider (except the StorageLayer itself).
That means, all of those layers have to be ready to enter that password before they start using the device. This is something we highly tried to avoid, as basically every layer would have to access layer-specific data from the storage layer. Right now, (with only several small exceptions) every layer can "do its own thing" with its own layer specific data without having to rely on any other layer apart from "I need a device 'this' large" or "delete this device" or similar highly generic commands.

Second, storing / managing the password itself is a problem. The LuksLayer requires the user to remember only one passphrase (the master-passphrase), which Linstor never remembers and keeps in memory as short as possible. The actual Luks-passwords are generated, salted and encrypted (with the master-passphrase) before stored in the database.
With zfs-encryption, Linstor has to either let the user enter the password (upon resource create ..?) and has to provider an API showing the password in plaintext. Yes, Linstor could somehow "securely" store that password, similar to the way LuksLayer's passwords are stored, but also that would require quite some rework.

All in all, although I do understand that one might want to use the feature especially "if it is already there". But on the other hand, Linstor already has a dedicated LuksLayer for encryption, which also works fine with ZFS. Unless someone explains me what other differences there are than "it is not the ZFS built in encryption", I guess this issue will get such a low priority, that it most likely will never get implemented.

gmelikov commented 4 years ago

Some small notes on topic:

ghernadi commented 4 years ago

Thanks for the info.

The load-key sounds interesting, especially if it can be used without the Linstor-changes I mentioned above.

Regarding the benefits: Linstor does not call / use scrub, but Linstor does use send/recv for snapshot shipping. But as you mentioned, if that also works without keys, load-key could be the answer to kvaps request :)

ggzengel commented 4 years ago

@kvaps What do you expect with encryption?

I use encryption to send disks to repair or throw away broken disks or protect data on stolen hardware. For this the root filesystem is installed on a encrypted LUKS LV and asks for keys on boot. The keys for ZFS are stored on root filesystem and inherited to sub volumes.

kvaps commented 4 years ago

Well, right now I don't need an encryption for the LINSTOR. But possible it will be needed in the future, I would prefer to choose native ZFS encryption instead of addition layer of LUKS

ggzengel commented 4 years ago

Only my root filesystem is LVM LUKS EXT4, because I don't trust to boot with ZFS and it's easier to repair grub and initramfs with debian's netinst.iso thru an IPMI session. Everything else is native ZFS encryption.

If you encouraged you can boot from an encrypted ZFS.

zrav commented 1 month ago

Another vote for ZFS encryption handling. We need encryption at rest, so my suggestion as to how this would work is based on that: The password should only have to be entered once on cluster start, then Linstor keeps the key in RAM and automatically handles any load-key operations. That would mean the same key is used for all storage pools/volumes, but that would be fine in our case.