Problem/Justification
Any pool, including where the system dataset is, should be allowed to be encrypted, using a passphrase. Right now the only way to encrypt the pool where the system dataset is stored is by using key files.
I tried poking around a bit but couldn’t determine if the key files are encrypted and protected by a users password or not. Based on the way auto mounting is described it seems like its not and the keys are just in plain text on the drive.
Right now if you encrypt your pool with key files, its like you have a safe with the keys just laying on the top. It doesn’t really offer you much security. As currently, it looks like key files for encryption are stored in plain text on the disk(s).
Using a passphrase solves this issue as its not stored anywhere but memory, once the computer is turned off, loses power the key is gone. Now you could store key files in memory as well which would allow you to have the same or greater security as a passphrase depending on how the key in the file is generated.
So, this begs the questions why are key files stored on the disk in the first place? The answer to that is auto unlocking. With the keys only being stored in memory any time the computer restarts the key needs to be reentered. Auto unlocking will always be more insecure then entering a key on boot. However, with that being said the current way of storing key files is not the correct way of doing it. The proper way of implementing auto unlock is by storing the keys in a secure element. Pretty much all modern computers have this, on most PCs its referred to as the TPM.
Why is storing the keys in the TPM ok but not on the disk ? TPMs are specifically designed to store keys, hard drives are not. While it is possible to extract the keys from either it is harder to extract keys from a TPM. If you want to be as secure as possible a key entered at boot is the way to go.
Wouldn’t that mean, I cant move to a new pool or I can no longer mount my drives outside the system containing the TPM? No, when setting up encryption you would be given a key to keep safe. This key will allow you to move / mount your drives out side the system where it was initially setup. Lose the key though and your out of luck.
Why is a passphrase still needed?
Despite pretty much all modern computers coming with a TPM. Some older computers don’t have one but more importantly is that storing the key on a TPM is a lot less secure then the passphrase entered on boot. [1][2]
What about self encrypting drives? These work a lot like the TPM does so its better then key files but in the end you need to trust the vender to implement stuff properly. Additionally like TPM depending on the implementation you can extract the keys from SEDs. [3][4][5]
One reason Opensource is more secure is anyone can audit the implementation. You don’t get that choice with TPMs or SEDs so your completely depending on the people making them knowing what their doing. Even then mistakes happen. See footnotes.
Impact
Implementing these changes would result in better security with minimal downsides to the user.
User Story
My thought on implementing, would be to implement this in a way that you can still unlock the drives using the TrueNas WebUI.
If the user enables passphrase encryption on the root dataset, here is how I envision this working.
The boot drive should only contain the OS and no other information, with some exceptions see below. the ix-apps, system, etc… datasets should be stored in a dataset that is encrypted.
This way the OS and the TrueNas web UI can start and prompt the user for the password to unlock the drives. For user accounts passwords should be stored using a strong hashing algorithm like Argon2ID. These can be placed on the boot drive since they’re hashed. Ideally you would store them encrypted not on the boot drive but this complicates implementation if you want the user to be logged in before entering the password to decrypt the drives. You could also, on top of strongly hashing the passwords, encrypt them with the TPM.
If you don’t care about having the user be logged in first then just make unlocking the drives a prompt before any users sign in.
As for TPM replacing the current implementation of key files, this wouldn’t really wouldn’t be a visible change as it would work pretty much the same as key files just more secure. You could / should also tie in user passwords with the TPM for better security then the TPM alone.
Forensic method for decrypting TPM-protected BitLocker volumes using Intel DCI - ScienceDirect ↩︎
Flaws in self-encrypting SSDs let attackers bypass disk encryption | ZDNET ↩︎
VU#395981 - Self-encrypting hard drives do not adequately protect data ↩︎
Self-Encrypting Deception: Weaknesses in the Encryption of Solid State Drives | IEEE Conference Publication | IEEE Xplore ↩︎