Jump to content
IamSpartacus

Where does disk encryption stand?

108 posts in this topic Last Reply

Recommended Posts

I've read through the notes in the RC threads and I see it mentioned that disk encryption should only be used on test servers as future refinements will be made.  How soon are those refinements from being implemented/completed?  I ask because I'm ready to setup a new configuration and format eight 10TB disks and copy about 40TB of data to the array.  I'm trying to avoid having to re-format my disks and copy all my data again if I can avoid it.

 

What would the recommended approach here?

Share this post


Link to post

Well, I think the underlying functionality is done in the latest release candidate; those refinements are all about entering the passphrase to unlock and mount it.

Share this post


Link to post
3 hours ago, IamSpartacus said:

I'm trying to avoid having to re-format my disks and copy all my data again if I can avoid it.

 

LUKS system is used for encryption, this won't change. Latest RC versions (including upcoming) is all about refinements to make using encryption as easy as possible.

 

Share this post


Link to post
3 hours ago, gfjardim said:

Well, I think the underlying functionality is done in the latest release candidate; those refinements are all about entering the passphrase to unlock and mount it.

 

12 minutes ago, bonienl said:

 

LUKS system is used for encryption, this won't change. Latest RC versions (including upcoming) is all about refinements to make using encryption as easy as possible.

 

 

Thank you.

 

Do you know if the data can be read on another system provided you have the encryption key/passphrase or can the data only be read from within the UnRAID server where the encryption was setup? 

 

Is there any information on this forum about the different encryption ciphers and which are recommended for security, speed, etc or is everyone just going off the benchmarks?

 

Can the encryption keyfile/keyphrase be manually changed without having to reformat the drives each time?

Edited by IamSpartacus

Share this post


Link to post

Encrypted disks are transferable, provided the other system uses LUKS as well.

 

The current implementation allows for a single passphrase / keyfile only, which means the passphrase or keyfile needs to be transferred too. Future versions of unRAID may include multiple passphrases/keyfiles, which would allow transfers of disks without revealing your own passphrase/keyfile.

 

Encryption settings are fixed at the moment, defaults to AES and SHA2, which are the most applicable choices.

  • Like 1

Share this post


Link to post

To add on what bonienl said...

 

In current 6.4.0-rc series unRAID uses the default settings for LUKS as defined by current version of cryptsetup.  These have been chosen by the developers to be very good security (and the defaults have changed over the years).  I highly recommend reading the cryptsetup FAQ:

https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions

 

We do plan to add capability to let you change the cipher and various other crypto-specific settings in a future release.

 

If you want to open your LUKS volume as created by unRAID on another linux system, you can provide your passphrase/keyfile, or, you can use the 'cryptsetup' command to define another passphrase to open your volume.  For example, suppose your unRAID passphrase is "ffj3i2948423.a84" but you want to attach one of the devices to an unbuntu system (for example), and you don't want to reveal that passphrase.  With array Started you could type this at the unRAID command line:

cryptsetup luksAddKey /dev/md1   [e.g., for disk1]

This command will prompt for your existing passphrase, and then it will prompt for another, new passphrase (and confirmation).  Now you can Stop array, yank device out and give to someone and tell them your "new" passphrase to use to open the device.

 

Edit: by "keyfile" above, I mean the file that contains your passphrase (created when you enter a passphrase), or a file you have uploaded to serve as the encryption key.   That is, not to be confused with your Registration Key.

Edited by limetech
clarify term "keyfile"
  • Like 2

Share this post


Link to post
13 hours ago, limetech said:

To add on what bonienl said...

 

In current 6.4.0-rc series unRAID uses the default settings for LUKS as defined by current version of cryptsetup.  These have been chosen by the developers to be very good security (and the defaults have changed over the years).  I highly recommend reading the cryptsetup FAQ:

https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions

 

We do plan to add capability to let you change the cipher and various other crypto-specific settings in a future release.

 

If you want to open your LUKS volume as created by unRAID on another linux system, you can provide your passphrase/keyfile, or, you can use the 'cryptsetup' command to define another passphrase to open your volume.  For example, suppose your unRAID passphrase is "ffj3i2948423.a84" but you want to attach one of the devices to an unbuntu system (for example), and you don't want to reveal that passphrase.  With array Started you could type this at the unRAID command line:


cryptsetup luksAddKey /dev/md1   [e.g., for disk1]

This command will prompt for your existing passphrase, and then it will prompt for another, new passphrase (and confirmation).  Now you can Stop array, yank device out and give to someone and tell them your "new" passphrase to use to open the device.

 

Edit: by "keyfile" above, I mean the file that contains your passphrase (created when you enter a passphrase), or a file you have uploaded to serve as the encryption key.   That is, not to be confused with your Registration Key.

 

Thanks @limetech for this response.  It's very helpful.  I feel much better about setting my disks up with encryption now.

Share this post


Link to post

If I formatted new disks already, how can I convert them to being encrypted?  I have no data on them.  Tell me I don't have to clear them again?

Edited by IamSpartacus

Share this post


Link to post
2 minutes ago, IamSpartacus said:

If if formatted new disks already, how can I convert them to being encrypted?  I have no data on them.

 

You need to select a new file-system (see Main -> Disk "name" -> Disk settings) and choose one of the encrypted versions, e.g. xfs - encrypted.

 

Selecting a new FS will always require to format the disk and in the process all data on it is erased (to preserve it, copy the disk content to somewhere else).

 

Once the disk is formatted, it will have encryption protection.

 

Do not forget your passphrase or loose your selected keyfile!

Share this post


Link to post
2 minutes ago, bonienl said:

 

You need to select a new file-system (see Main -> Disk "name" -> Disk settings) and choose one of the encrypted versions, e.g. xfs - encrypted.

 

Selecting a new FS will always require to format the disk and in the process all data on it is erased (to preserve it, copy the disk content to somewhere else).

 

Once the disk is formatted, it will have encryption protection.

 

Do not forget your passphrase or loose your selected keyfile!

 

Got it thanks.  Where do I actually setup my passphrase now that the Encryption Settings have been removed from the latest RC?

Share this post


Link to post
2 minutes ago, IamSpartacus said:

 

Got it thanks.  Where do I actually setup my passphrase now that the Encryption Settings have been removed from the latest RC?

 

Everything is done from the Main page under Array Operation.

Edited by bonienl

Share this post


Link to post
2 minutes ago, bonienl said:

 

Everything is done from the Main page under Array Operations

 

Ahhh I see now.  It wasn't there until I configured the disks for xfs-encrypted.  Thanks again!

Share this post


Link to post

One last question.  If I setup an encrypted volume with a keyphrase and want to change that keyphrase, what is that process?  I realize all the data will be destroyed but just wondering what the process is.  I originally was thinking of using a very long keyphrase but if I have to enter this everytime I want to start my array (I know some automation on this front is in the works) I need something more manageable yet still complex.

Share this post


Link to post
8 minutes ago, IamSpartacus said:

One last question.  If I setup an encrypted volume with a keyphrase and want to change that keyphrase, what is that process?  I realize all the data will be destroyed but just wondering what the process is.  I originally was thinking of using a very long keyphrase but if I have to enter this everytime I want to start my array (I know some automation on this front is in the works) I need something more manageable yet still complex.

 

The steps are:

1. Stop the array

2. Delete the stored encryption keyfile (see Delete button at bottom of Array operation)

3. Enter a new passphrase or keyfile

4. Start the array

5. It will now tell a "wrong key" has been entered

6. Select the option "permit format"

7. In case of a passphrase it will ask you to retype (confirm) the new  passphrase

8. Start the array again

9. Format the disks with the new passphrase/keyfile. Remember this erases all content!

 

Edited by bonienl
  • Like 1

Share this post


Link to post
10 minutes ago, IamSpartacus said:

I originally was thinking of using a very long keyphrase but if I have to enter this everytime I want to start my array (I

 

You can create a long passphrase and store this in a file, then instead of choosing a passphrase select the file with your stored passphrase.

 

Share this post


Link to post
5 minutes ago, bonienl said:

 

The steps are:

1. Stop the array

2. Delete the stored encryption keyfile (see Delete button at bottom of Array operation)

3. Enter a new passphrase or keyfile

4. Start the array

5. It will now tell a "wrong key" has been entered

6. Select the option "permit format"

7. In case of a passphrase it will ask you to retype (confirm) the new  passphrase

8. Start the array again

9. Format the disks with the new passphrase/keyfile. Remember this erases all content!

 

 

Thanks so much @bonienl.

Share this post


Link to post
2 minutes ago, bonienl said:

 

You can create a long passphrase and store this in a file, then instead of choosing a passphrase select the file with your stored passphrase.

 

 

I see.  Might just do that then.

Share this post


Link to post
38 minutes ago, IamSpartacus said:

If I setup an encrypted volume with a keyphrase and want to change that keyphrase, what is that process?  I realize all the data will be destroyed but just wondering what the process is.

 

You can change the passphrase/keyfile without reformatting but you have to use the 'cryptsetup' command to do it.

First you have to add your new passphrase:

cryptsetup luksAddKey /dev/md1  # for disk1; for disk2 use 'md2', disk3 use 'md3', ...

This will ask you for existing passphrase and then prompt for another passphrase.  Note at this point you now have two passphrases that will unlock the volume.  You can leave like that or you can remove the original passphrase:

cryptsetup luksRemoveKey /dev/md1

This will ask you for the passphrase to remove.

 

Careful with this procedure.  unRAID will only normally let you enter one passphrase to be used to unlock all volumes.  If one of the devices uses a different passphrase, unRAID will not be able to open it and the array will not Start.

 

LUKS lets you create up to 8 passphrases that all will unlock the volume.  This does not change any data content on the device.  Instead, when device is formatted with LUKS header, it also creates a "master key" which is what's actually used to encrypt/decrypt data.  The master key itself is encrypted with your entered passphrase.  Meaning, if you have say 4 passphrases defined, there will be 4 copies of the encrypted master key corresponding to the 4 passphrases.  When an encrypted LUKS volume is "opened" with a specified passphrase, it tries to decrypt each master key with that passphrase.  If the entered passphrase can't decrypt any of the master keys, then the volume cannot be opened.

 

Depending on user requirements in the future, we may add this capability to manage these "key slots" within the unRAID webGui, but of course that would be in a future release.

  • Like 1

Share this post


Link to post
On 11/16/2017 at 6:54 AM, bonienl said:

 

You can create a long passphrase and store this in a file, then instead of choosing a passphrase select the file with your stored passphrase.

 

Doesn't that undo the protection of FDE in the first place, since the key is sitting unencrypted on the box?  It seems to me that if your threat model includes physical theft of the server, this might not be a good idea.

 

Honest question; apologies if I am missing something obvious.

Share this post


Link to post
1 minute ago, mattyx said:

Honest question; apologies if I am missing something obvious.

 

Once array is Started there is a button on the bottom of Main that lets you delete the keyfile.

Share this post


Link to post
17 minutes ago, limetech said:

 

Once array is Started there is a button on the bottom of Main that lets you delete the keyfile.

 

So if I am understanding the flow here (I don't think the lightbulb is on just yet):

  1. Create passphrase key doc, add it to LUKS
  2. Reboot, using passphrase doc.
  3. Start Array
  4. <Optional, good for security> Delete old keyfile
  5. <Mandatory if you did #4> Regenerate and re-add keyfile to LUKS before next reboot/power failure, or...?  I assume you'd fall back to a password that you'd manually enter...?
Edited by mattyx

Share this post


Link to post

5. When the keyfile is deleted in step 4 (which is stored on unRAID itself), then next time the array is started it will ask to enter the previous passphrase or previous file (don't forget your pasphrase or don't loose the file).

 

  • Like 1

Share this post


Link to post

Got it, that makes sense.  Thanks!

 

Summarizing (for myself):  Using a keyfile would be good for a threat model involving array disks being stolen (and for ease of use), but probably not the best if you're concerned with the entire server being stolen.


EDIT:  This assumes the key stays on the Unraid USB stick, which it does not.  It is uploaded each time, in place of manually entering a password.  limetech clears this up on page 2, but I thought it was worth an edit here to call out my mistake.

Edited by mattyx

Share this post


Link to post
1 hour ago, mattyx said:

Got it, that makes sense.  Thanks!

 

Summarizing (for myself):  Using a keyfile would be good for a threat model involving array disks being stolen (and for ease of use), but probably not the best if you're concerned with the entire server being stolen.

 

Not exactly.  When you initially decide to use encryption you have to decide, "Am I going to use a passphrase or a file as my encryption/decryption method?".

 

If you use passphrase, this is a string you have to type correctly each time you reboot your server.  The longer the string, the harder it will be for someone to crack.  Make it long enough and it's supposedly impossible to crack, but then you have to type it exactly - no fat fingers.

 

Alternately you can use a file, that is, you can pick a file and upload instead of using a passphrase.  The advantage of this approach is that you can use a relatively large file that is filled with random text or even binary data.  The file content is what's used as the encryption/decryption key.  For example, you can use maybe a random image file, or create one with random data.  Of course now you have the problem of keeping a safe copy of that file somewhere.

 

Regardless of which method you use, unRAID will store the encryption key in a file called "/root/keyfile".  (If you use passphrase, we just store the passphrase in this file in plain text just as you entered it.  If you upload key file, we save its content in this file.)

 

Saving the passphrase in /root/keyfile may seem insecure (and it can be), but realize this is RAM and when server powers off, the file is gone.  Also, as stated earlier, you can explicitly delete the file once the array has been Started - actually you can delete any time.  Perhaps in future we may change code so that every time the array is Started we auto-delete the /root/keyfile - we'll see.

  • Like 2

Share this post


Link to post
15 minutes ago, limetech said:

When you initially decide to use encryption you have to decide, "Am I going to use a passphrase or a file as my encryption/decryption method?".

As far as i know, with cryptsetup you can use keyfile and passphrase at the same time.. am i not true? or this is just an unRAID limitation? 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now