encryption options for ZFS plug-in

  • Hi!


    I have just moved to OMV. I used two old DNS-32x devices and clearly it was time for them to go. So I have built a simple NAS with ASrock J3455M, 8Gb of RAM, modest PSU, 6-port PCIe x4 SATA card (with the name I cannot pronounce) and 5 drives + 1 small SSD for the OS. All in ATX mid-tower case, seems to be working fine. So far I love OMV, it may not look as fancy as FreeNAS but I prefer Linux to BSD and it seems it does just enough for me. Except one thing I have not yet decided how to do.

    I have a few Gb of important documents (bills, statements etc) that I like to keep on my NAS to access from several computers at home + doing periodic backups to other locations. Before


    I used to store an encrypted disk image (I use OS X) on my Samba share. It was not efficient but it worked and I had end-to-end encryption this way. Although, obviously, it was OS X - specific and mounting this sparse image from a Linux box would be probably not trivial. But I felt safe enough with it because if the physical drive was stolen, the bad guys would only see the non-confidential stuff stored on the drives.


    Now I am wondering if I can do something more elegant with OMV. I do not need to encrypt the entire device, I actually need a relatively small encrypted filesystem on my ZFS mirror. And I would love to have it as simple as possible. It seems to me that I have the following options:


    1. use command-line ZFS tools to create an encrypted dataset

    2. use command-line ZFS tools to create a volume (device) and then probably use LUKS on top of it (there seems to be a plugin available for OMV for LUKS)

    3. use something user-space, FUSE-based, with FUSE running on the OMV NAS itself, exposing this filesystem via Samba

    4. use something user-space, FUSE-based, with FUSE running on the client machines - not sure how well it will work on Macs


    I am wondering if someone here could recommend the best approach. I only want to encrypt a small amount of data and I would like to have this "share" to be accessible via Samba.


    Thanks!

  • native encrytion is only available on ZFS 0.8.0 or newer, please revise version on OMV , I suspect that do not meet reqeriments.


    https://wiki.archlinux.org/index.php/ZFS#Native_encryption


    Well, on my OMV box:


    # zfs --version

    zfs-0.8.6-1~bpo10+1

    zfs-kmod-0.8.6-1~bpo10+1


    In the properties of the pools created via OMV UI I see that encryption support is available. So, I guess, the question is really about configuring it and seeing how OMV will behave if it cannot mount the filesystem until the key is provided...

  • In short, I think I have found a solution that seems to be working transparently for OMV. The point is mainly to prevent one threat: reading my confidential documents stored on the NAS in case the physical drive is stolen (with the NAS ;) ). Other security aspects: my network, external access, WiFi security and shared folder access control are, obviously, taken care of by using other measures.


    1. Created AWS KMS encryption key (CMK). It is free under free tier.

    2. Generated a random encryption key. Encrypted it with KMS. Stored the encrypted key on OMV box.

    3. Created an encrypted dataset as follows (key was previously loaded in RAM)


    Code
    zfs create -o encryption=on -o keyformat=raw -o keylocation=file:///dev/shm/my-key pool/dataset

    4. Created a systemd unit as follows:



    5. The script does this



    Seems to be working. Tested, rebooted several times. OMV has noticed the new ZFS "filesystem" (AKA dataset), asked to apply the configuration. Applied, it survived.


    Obviosly, I have a copy of the encryption key in a safe place so should something happen, I can mount it manually.


    The point of using AWS (you can do the same with other cloud providers) is to control the encryption key access. First, I can severely restrict access to the KEK and decrypt functionality to make sure it can be called only from my network. Next, should something happen, I can disable access to this KMS and this leaves the (stolen) system without any way to access the key (since it stored only the encrypted DEK).

    • Official Post

    I do not find the number of NAS boxes relevant :)

    Other than an indication that I'm a long time ZFS user, it's not relevant. However, I was exposed to drive encryption at work, in times past, and it proved to be a huge PITA. If the slightest thing goes wrong with the filesystem, encryption might mean wiping the drive and rebuilding.

    I want encryption to encrypt the data worth encrypting


    Here's to hoping you don't experience the down side of drive encryption and that you have 100% backup. (You may need it.)

  • Other than an indication that I'm a long time ZFS user, it's not relevant. However, I was exposed to drive encryption at work, in times past, and it proved to be a huge PITA. If the slightest thing goes wrong with the filesystem, encryption might mean wiping the drive and rebuilding.


    Here's to hoping you don't experience the down side of drive encryption and that you have 100% backup. (You may need it.)


    That's not even a question. I have seen everything failing :) I believe in multiple backups on _different_ media/servers for the data that is worth it. BTW, I also have that encrypted dataset on a ZFS mirror. The main driver for having the encrypted dataset is to be able to access it from several machines, so a local encrypted storage was not an option.

  • I am also interested into zfs native encryption. Till now I am working with mdadm, luks, lvm and ext4/btrfs. I want to reduce complexity, but there are no GUI options for encryption in openmediavault-zfs plugin. Also my luks automount is organized with non-file based key read from usb stick.

    Till now I have seen only passkey or binary file encryption with zfs. I would have to implement a script that reads from usb stick to write temporally to tmp device just to let zfs read from it. As I had issues with systemd service files to get them working properly timed during boot, I am scared to go down this path.


    Is it planned to get zfs native encryption into the plugin? And will the use of USB sticks (non file based keys) be part of the solution like it is for luks?


    Otherwise I think I have to use luks beneath zfs and encrypt every drive separatly.

    cpu Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
    omv 6.9.13-1 (Shaitan)

    kernel 6.1.0-0.deb11.11-amd64

    • Official Post

    Is it planned to get zfs native encryption into the plugin?

    Only if someone else writes the code. There is nothing stopping you from adding encryption from the command line.

    And will the use of USB sticks (non file based keys) be part of the solution like it is for luks?

    Since you are doing it from the command line, you can probably use whatever you want.

    Otherwise I think I have to use luks beneath zfs and encrypt every drive separatly.

    That is just begging to have problems especially timing on startup. I would not do that.

    omv 7.7.10-1 sandworm | 64 bit | 6.11 proxmox kernel

    plugins :: omvextrasorg 7.0.2 | kvm 7.1.8 | compose 7.6.10 | cterm 7.8.7 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.3.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Only if someone else writes the code. There is nothing stopping you from adding encryption from the command line.

    Since you are doing it from the command line, you can probably use whatever you want.

    That is just begging to have problems especially timing on startup. I would not do that.

    Can something like this be used with zfs? Because till now I see only possibility with files...

    dev-crypt /dev/disk/by-uuid/dev-crypt-uuid /dev/disk/by-id/usb-myStick luks,tries=3,keyfile-size=4096,keyfile-offset=512

    If this would work, how to plan auto mount with zfs? Is systemd service file the only way as the thread owner published?

    cpu Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
    omv 6.9.13-1 (Shaitan)

    kernel 6.1.0-0.deb11.11-amd64

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!