Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Full disk encryption--an explanation of exactly how does it work from the user's end?

  1. #1
    Join Date
    Aug 2007
    Location
    Kingsport TN
    Beans
    148
    Distro
    Ubuntu 12.04 Precise Pangolin

    Full disk encryption--an explanation of exactly how does it work from the user's end?

    All,

    I'm posting this because I've not been able to read how the full-disk encryption option actually works. I don't want an explanation of how AES works, not an explanation of how to install it; there oodles of those. I want to know how it works in practice and how secure it is (and what I meant by that is not "how AES is implemented" but what it does and does not do in practice). I've been a Linux user for 13 years, I've been using Ecryptfs for most of that period, and I've used Scramdisk/TrueCrypt/Veracrypt, for my background. Plus I've actually done an installation with the full-disk encryption option for someone else. I just don't know how it "works".

    And what do I mean by "how it works??

    Is the same key used system-wide? This is my biggest question. That means:

    1) If I log in as User1 on a full-disk encrypted system, and I have sudo privileges, can I "spy" into the contents of User2's and User3's account if I choose? With Encryptfs, you can't--because those are encrypted with different keys. Or do I have a separate key that can only decrypt my own /home folder + the filesystem and /boot folders?

    2) If all user accounts are encrypted with separate keys, are these linked to the filesystem decryption key? (Ergo, at the boot screen you can enter your /home user key, then again at the user login screen, as your home user key is linked to the filesystem key---it decrypts only the filesystem plus your own /home user directory, nothing else. That would escape the need for multiple users having to share the master filesystem key for the whole system).

    3) Is /swap encrypted with the same key as the filesystem? If it is a separate key, is it a permanent key? In Encryptfs the swap key is temporary, once the system is shut down the key is destroyed and another key is generated upon boot, which makes whatever was written to swap the previous session irretrievable.

    If /swap is encrypted with its own temporary, separate, key, is this true irregardless whether or not /swap is on a partition or is a swap file? (I've heard of people recommending using swapfiles as a workaround on Ubuntu's policies on auto-creating swap space on installs using full-disk encryption, which don't give you any partitioning options out of the box, and which generate ridiculously small swap spaces (on an install of Bodhi Linux, an Ubuntu derivative, i was doing on a friend's laptop that had only 2 GB of RAM, it only auto-created 1 GB of swap--and I'd think you'd need at least 2, better 4 for such a limited machine. Ubuntu used to create 2:1 swap:RAM spaces by default, but not anymore).

    Thanks for any responses.

    StewartM

  2. #2
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    Quote Originally Posted by StewartM View Post
    Is the same key used system-wide? This is my biggest question. That means:

    1) If I log in as User1 on a full-disk encrypted system, and I have sudo privileges, can I "spy" into the contents of User2's and User3's account if I choose? With Encryptfs, you can't--because those are encrypted with different keys. Or do I have a separate key that can only decrypt my own /home folder + the filesystem and /boot folders?
    It depends on the type of encryption used. I usually use LUKS to do full disk encryption and once the drive is unencrypted and mounted, any user with access can view whatever files they want to. This may be different from encrypfs or the other methods though. I speak of Full Disk Encryption from a server standpoint rather than a desktop or workstation standpoint, though.

    Quote Originally Posted by StewartM View Post
    2) If all user accounts are encrypted with separate keys, are these linked to the filesystem decryption key? (Ergo, at the boot screen you can enter your /home user key, then again at the user login screen, as your home user key is linked to the filesystem key---it decrypts only the filesystem plus your own /home user directory, nothing else. That would escape the need for multiple users having to share the master filesystem key for the whole system).
    I do not know the answer to the question at least in regards to LUKS, since it doesn't really have a "user" mode - it's all or nothing.

    Quote Originally Posted by StewartM View Post
    3) Is /swap encrypted with the same key as the filesystem? If it is a separate key, is it a permanent key? In Encryptfs the swap key is temporary, once the system is shut down the key is destroyed and another key is generated upon boot, which makes whatever was written to swap the previous session irretrievable.

    If /swap is encrypted with its own temporary, separate, key, is this true irregardless whether or not /swap is on a partition or is a swap file? (I've heard of people recommending using swapfiles as a workaround on Ubuntu's policies on auto-creating swap space on installs using full-disk encryption, which don't give you any partitioning options out of the box, and which generate ridiculously small swap spaces (on an install of Bodhi Linux, an Ubuntu derivative, i was doing on a friend's laptop that had only 2 GB of RAM, it only auto-created 1 GB of swap--and I'd think you'd need at least 2, better 4 for such a limited machine. Ubuntu used to create 2:1 swap:RAM spaces by default, but not anymore).

    Thanks for any responses.

    StewartM
    In my case with LUKS, The root device is encrypted with LUKS and then I've got LVM on top of it, so I'm technically using "encrypted swap" but my partition lives on the root device. It's using the same keys as the root device. Other implementations might be different as I've had this install running for quite a few years and I haven't felt like redoing everything.

    Hopefully that helps, somehow.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  3. #3
    Join Date
    Aug 2007
    Location
    Kingsport TN
    Beans
    148
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    I do not know the answer to the question at least in regards to LUKS, since it doesn't really have a "user" mode - it's all or nothing.
    Why then is there a limitation on the number of user accounts with the default Ubuntu-based full-disk encryption? (You can have up to 8).

    https://superuser.com/questions/1593...d-i-e-not-luks

    If you say is true (and this is the default installation) then this limitation makes no sense other than avoid having to implement a system of password sharing. For if any sudo user can view/modfiy the other accounts just using sudo privileges, if a intruder can access just one of the user passwords combinations (the LUKS and the user account password) and if that user has sudo privileges then that intrusion compromises every user on the system, not just the hacked user. Maybe I'm overlooking something or I'm misreading something, but that doesn't seem good.

    In my case with LUKS, The root device is encrypted with LUKS and then I've got LVM on top of it, so I'm technically using "encrypted swap" but my partition lives on the root device. It's using the same keys as the root device
    So with your system (is it the default installation?) the swap area is simply encrypted with the filesystem password, and thus access to the filesystem gives one the rights to examine swap. If that's the default, it's not optimal; there is no reason to keep anything written in swap around, period, after a reboot.

    I think I recall looking at some of the installation options where it was possible to have the swap key regenerated anew on boot, which is the most desirable option, but I do not know if that is the default installation or not.

    Thanks for the reply!

  4. #4
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    Quote Originally Posted by StewartM View Post
    Why then is there a limitation on the number of user accounts with the default Ubuntu-based full-disk encryption? (You can have up to 8).

    https://superuser.com/questions/1593...d-i-e-not-luks

    If you say is true (and this is the default installation) then this limitation makes no sense other than avoid having to implement a system of password sharing. For if any sudo user can view/modfiy the other accounts just using sudo privileges, if a intruder can access just one of the user passwords combinations (the LUKS and the user account password) and if that user has sudo privileges then that intrusion compromises every user on the system, not just the hacked user. Maybe I'm overlooking something or I'm misreading something, but that doesn't seem good.
    What you call "users" here is not actual users - LUKS has a limit of 8 "key slots", which can contain anything from a key file, to a passphrase. This is the limitation the link you posted is referring to. It isn't a limit in the actual number of users on the system, but a limit on the number of passwords or keys you can use to unlock the encrypted drive. You can also remove and add other keys in the event one of the keys is compromised or needs to be rotated for whatever reason.

    This might give you some more info on how that works: https://www.thegeekstuff.com/2016/03...setup-lukskey/


    Quote Originally Posted by StewartM View Post
    So with your system (is it the default installation?) the swap area is simply encrypted with the filesystem password, and thus access to the filesystem gives one the rights to examine swap. If that's the default, it's not optimal; there is no reason to keep anything written in swap around, period, after a reboot.

    I think I recall looking at some of the installation options where it was possible to have the swap key regenerated anew on boot, which is the most desirable option, but I do not know if that is the default installation or not.

    Thanks for the reply!
    I'm not really sure tbh. I checked and it looks like my root file system was created back in 2019 and I'm assuming that was when I reinstalled after my OS got hosed up.

    I seem to remember setting this up manually because the default install set only 1GB for /boot and that only let me have one or two kernels installed before it ran out of space.

    I also wanted the root LVM device and swap device to have better names than sda_whatever. My /boot/ partition is living on a USB flash drive, if that matters.

    Have a read here:
    https://help.ubuntu.com/community/Ma...stemEncryption
    https://help.ubuntu.com/community/Fu...ion_Howto_2019
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    I'll take a stab at this ... again. Had a system lock up just before submitting my prior post and I don't have the desire to re-write it all, but I drew a diagram to show partitions --> LUKS Containers --> LVM objects. Hope this helps.

    LVM-Diag.png

    Often, an LV can be thought about as a smart partition, but that's an understatement. LVs can be modified while the system is being used and while the file system is active. That's huge.

  6. #6
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    Quote Originally Posted by TheFu View Post
    I'll take a stab at this ... again. Had a system lock up just before submitting my prior post and I don't have the desire to re-write it all, but I drew a diagram to show partitions --> LUKS Containers --> LVM objects. Hope this helps.
    I just wanted to say that that is a great example image of how everything is nested.

    As an aside, the forum software does so an auto saved in different intervals and if you've got text that was saved, there should be a "Restore Auto-Saved Content" button above the post icons section in the full editor.

    Don't know if it helps or if you already knew about it, but I figured I would throw it out there any way.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  7. #7
    Join Date
    Aug 2007
    Location
    Kingsport TN
    Beans
    148
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    Charles A and The Fu,

    What's I'm seeing and reading is:

    1) Yes, you can have up to eight encryption keys (I knew already these were not necessarily tied to users; that's a feature I'd like, but it not provided). It seems you can use these multiple keys to:

    a) give users (to avoid passphrase sharing);
    b) encrypt different partions (including swap, I suppose?)
    c) you can add, reovke, and replace encryption keys

    2) However, I don't see anyway that you can have each user have their own separate keys that *only* encrypt/decrypt their user directories. You can have the entire /home directory on its own partition, but (unlike Encryptfs) all users who have accounts will use either one keys or separate keys that encrypt/decrypt all of /home, which would include not only the contents of their own user directories, but those of other users. This is something I regard as intrinsically inferior to the Encryptfs system, which does give users separate keys that only encrypt/decrypt their own /home user folders and not the accounts of others.

    I say this as although my computers are mostly single-user (me) systems, at times I have created accounts for others. These people typically use weaker passphrases and even if I require them to use a strong, one, they will end up writing it down to remember it. To my mind, this creates a security weakness that need not exist.

    3) I recall there was one install where the swap key was generated on boot but I can't find it. I suppose from what you gave me is that you could manually revoke and replace the swap partition key periodically to mimic this.

    What generated my asking these questions is that have received a new computer from a Linux vendor that has the full-disk encryption (with /home on a different physical drive). I did this because Ubuntu deprecated Encryptfs and no longer offered it on installation (though one can always install it post-install). However, other Linux distros, such as Linux Mint, still offer Encryptfs as an option on install (plus full-disk encryption).

    But I forgot to tell the vendor I wanted ext3 file system instead of ext4 because file wipers still largely work with the default mode of ext3. So I got ext4 which I want to get rid of (except for the boot drive; which is a SSD, where no file wiping works insofar as I understand it, so ext 4 is ok). So I was thinking of reformatting the disk with my /home directory to get ext3. Now I'm thinking about just going back to Ecryptfs, as it's still offered on Mint installs and I see it's a superior solution superior for /home and /swap to the full-disk encryption. Thanks for both of your replies.

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    b) encrypt different partions (including swap, I suppose?)
    Each LUKS container will have different slots and methods used by those slots for decryption. LUKS has a 2-phase encryption method.
    There's the data part which is always encrypted and there's the LUKS header part which is what holds the decryption keys for the data. By limiting access to the header to 8-slots, LUKS makes it so
    1) excellent, random, encryption keys and salt us used for all the data, regardless of user input.
    2) modifying a slot in the header access doesn't mandate re-re-re-encryption for all the data.
    Smart, right?

    As for 2) each user have their own separate keys, just setup different LUKS containers for each user. Want to keep 5000 users with 5000 separate containers? Go for it. Always remember that with Unix systems, everything is just a file. That includes whole HDDs, partitions, or files. We could make a 10G "file", then treat it like a partition, make it into a LUKS container and put a file system inside it or ZFS or LVM, if we prefer.

    Trading a "feature" for poor security is something I prefer to avoid. Encfs and EncryptFS have well documented security problems.

    LUKS can use 2FA. I do it that way with a yubikey in challenge-response mode.

    If you want to wipe empty space on a disk, just fill it up daily with random data. That's a 3-4 line script. The pros for ext4 are so many, IMHO, ext3 doesn't have much use anymore. Heck, I use ext2 for /boot sometimes for small partitions and mostly read-only data (anywhere performance and journaling isn't needed).

    Swap should be encrypted all the time. I suspect something was lost in my attempt to convey LVM's power.

  9. #9
    Join Date
    Aug 2007
    Location
    Kingsport TN
    Beans
    148
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    Encfs and EncryptFS have well documented security problems.
    Like what? The only one I'm aware of is that Encryptfs doesn't always unmount the encrypted /home user directory after logout--it's best to do a reboot after logging out. You could also point out that Encryptfs files will differ in size, that an adversary can differentiate encrypted files by size, something is probably a small text file vs a large media file, though the file names are ecrypted. That part of the data will "leak".

    As for 2) each user have their own separate keys, just setup different LUKS containers for each user.
    And using LUKS I have to what? Re-partition the LVMS to accommodate a new user? Or resize a LVM if one user runs out of space while another user has plenty of space? And how exactly do you give different users different LVMs when everything is supposed to be under /home? I have looked at a good many tutorials and 'how-tos' to do full-disk encryption, and none of them I recall showing this.

    If you want to wipe empty space on a disk, just fill it up daily with random data. That's a 3-4 line script. The pros for ext4 are so many, IMHO, ext3 doesn't have much use anymore.
    I've used ext3 on all my systems for the past 14 years, since migrating to Linux from Windows, and I've never lost data, despite doing file wipes routinely. The only hard drives I've had fail was a new one from Dell that was so new that it couldn't have possibly been to disk wear (it was replaced under warranty a few months after I bought the computer) and a backup external one where the firmware, not the disk itself, failed. Wiping files on ext3 should mostly work, and plus I do it routinely for mostly everything, not just for sensitive files. I believe that no security system is perfect, but I also think that putting all your eggs into one basket (say, full-disk encryption with no ability to wipe individual files) is also a mistake.

    Since I've never lost data to file corruption using ext3, plus I can wipe files, I don't see the advantage of ext4.

  10. #10
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Full disk encryption--an explanation of exactly how does it work from the user's

    I've provided leads for more research. It is up to others to research those leads and decide for themselves if there is any merit. Sorry that I've failed.

    Creating a new LV is 5 seconds and ZERO downtime. A VG can have hundreds of physical disks and thousands of LVs. Or use the "everything is a file method."
    Last edited by TheFu; June 29th, 2021 at 12:47 AM. Reason: added 2nd line.

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •