this post was submitted on 27 Oct 2023
26 points (100.0% liked)

Linux

48144 readers
717 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I have setup my fedora to use LUKS encryoted partitions. But entering two passwords gets quite tiring, as I shutdown my laptop quite often to get the benefit of LUKS (I am assuming nothing is encrypted when in suspend, please correctme if I am wrong)

I am thinking about setting up TPM autodecrypt. However, I was wondering does the decryption happen on boot or after I login?

If it happens on boot, then it seems like the benefit is pretty limited compare to a unencrypted drive. Since the attacker can simply boot my laptop and get the unecrypted drive.

Am I missing something here? I was wondering is there a way for me to enter my password once and unlock everything, from disk to gnome keyring?

top 19 comments
sorted by: hot top controversial new old
[–] [email protected] 9 points 1 year ago

The idea behind TPM-locked boot is that you can boot into your system unattended, but it stops booting into any other system. Typically no password is needed, but you can also assign an additional (non-user) password if you want.

This is nice if you trust your system to be basically secure. Nothing else can access its filesystems, so no external tool can be used to break into it. Rescue disks can not access any data without knowing a special rescue key -- so make sure to set one up! A nice side effiect is that the key is only available while setting up disks in the initrd and totally inaccessible at any other time. That makes it very hard to extract the password once the system is running.

You can encrypt the home directories of users using other services like systemd-homed. That will prevent anyone from accessing any data in the user's directory while that user is logged out. Homed will basically use your password to unlock your disk and if that works, then the password is accepted. So you do not need that user to be listed in the traditional /etc/passwd file, which is useful as you can just copy the users homedir image file onto another system to move a user account over.

[–] [email protected] 5 points 1 year ago (1 children)

The data on disk doesn't get decrypted at any time. Even if they boot it, they would still need to log in somehow.

There are attacks through DMA or extracting the decryption key from RAM, but those are not going to happen by a casual laptop thief.

[–] [email protected] 3 points 1 year ago (1 children)

...or extracting the decryption key from RAM.

Moral of the story:

Always shutdown the computer when you are not using it, kids.

[–] [email protected] 7 points 1 year ago (1 children)

I see your decryption key extraction and offer you a 5 dollar wrench.

The wrench also comes with DMA (direct mechanical assault), RDMA (remote direct mechanical assault via throwing), and DDIO (deals damage if opposing) capabilities. It's a real NSA bargain!

[–] [email protected] 1 points 1 year ago (2 children)

But if the key is fully wrench-safe inside the TPM. You do not know it, you can not get convinced to give it up -- even after repeated wrench use.

Of course the recovery key that typically goes with it and you logging password is not wrench safe, so that does not protect the system fully, while getting you a matching set of broken kneecaps.

[–] [email protected] 3 points 1 year ago

Pretty sure the NSA doesn't want the recovery key, they want the information the recovery key is protecting.

[–] [email protected] 2 points 1 year ago

you don't know it, you can not get convinced to give it up

It's ok that you don't know it, just log into your computer please and we'll take care of setting a new key. Or you can have a conversation with Mr Wrench again.

[–] [email protected] 5 points 1 year ago

The TPM releases the key to the OS at boot time. Without that, there would be no way for the OS to load (assuming the root FS is encrypted).

The key is bound to PCRs in the TPM, which control under what conditions the key can be released. For example, it can be tied to secure boot, bios settings, etc.

[–] [email protected] 4 points 1 year ago (2 children)

on my laptop I have tpm to decrypt my drive and I've also enabled secure boot and set a bios password, so if someone steals my laptop it's basically bricked,

secure boots there to prevent any potential tampering if someone were to take the drive out then put it back in

I feel this setup is secure enough for me, if you've got some nation state after you, or some guy with a wrench theres probably nothing you can do

[–] [email protected] 2 points 1 year ago

My laptop has an option to demand a bios password if a storage unit is removed and if the bottom of the laptop is removed.

Very useful.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

I was wondering what security does the TPM password provides. If I understand correctly, it will prevent attacker from getting the data on the disk.

However, theoretically, attacker can boot the laptop and disconnect the disk to get a decrypted disk. Realistically, I think my laptop will shutdown when the chasis is opened (unless configured otherwise in the bios). So it should be safe?

[–] [email protected] 6 points 1 year ago (1 children)

However, theoretically, attacker can boot the laptop and disconnect the disk to get a decrypted disk.

This is not how this works. The bits are never decrypted on your disk / partition. If that was the case, a power loss would leave your device decrypted as well, and that is something a potential attacker might have control over.

What actually happens is that encrypted data is read from disk by the CPU, decrypted by the CPU and then written to RAM unencrypted. Unencrypted data should NEVER be written to non-volatile memory (the necessary exceptions, like the boot image, apply).

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

Oh! That makes much more sense! Thanks!

Then I guess there is not much point in encrypting both the full disk and the home dir together then (if I trust gnome login screen cannot be by-passed), since the data is always encrypted when they are on the disk.

[–] [email protected] 3 points 1 year ago

In a single user context where the only user is also the administrator, full disk encryption has no disadvantages to home directory encryption AFAIK.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

I have MX Linux setup with LUKS/btrfs and it was asking password on boot, so I put my key in TPM and modified /etc/crypttab to retrieve it, at least I don't have to enter it at any boot, but yeah it decrypts automatically, like Windows Bitlocker in fact, it still asks my user password login (my choice, no auto login here), but at boot you can break grub and have a root shell it you know how.

Other way is to put the luks key on a USB drive, when you leave home with your computer shutdown, take the USB key with you and that's it.

[–] [email protected] 2 points 1 year ago

The point of using the TPM is that it does not unlock the drive unless it has a certain set of software is loaded in a certain sequence on the machine with that specific TPM chip.

So if somebody breaks grub and makes it load a shell, then that results in different software loaded (or at least loaded in a different sequence) and will prevent the TPM to unlock the system. The same is true if somebody boots from a rescue disk (different software loaded) or when you try to unlock the disk in an unexpected phase of the boot process (same software but different sequence of things loaded, e.g. after boot up to send the key to some server on thr network. The key is locked to one TPM, so removing the drive and booting it in a different machine also does not work.

The TPM-locked disk is pretty secure, even more so than that USB idea of yours -- if the system you boot into is secure. It basically stops any attacker from bringing extra tools to help them in their attack. All they have available is what your system has installed. Do not use auto-login or run some root shell in some console somewhere...

[–] [email protected] 2 points 1 year ago (1 children)

I'm assuming the two passwords are the LUKS one and then your login, which you can remove by just configuring your login manager to do auto-login (no attacker will be able to access your data anyway if it's encrypted, logged in or not).

[–] [email protected] 2 points 1 year ago

Unfortunately, the gnome keyring will not be able to be unlocked in this way.

[–] [email protected] 0 points 1 year ago

BTW, it depends if you have FDE (Full disk Ecryption) or only your /home partition. Having FDE you have no choice to enter a password at boot (initramfs) to decrypt / and putting it in TPM2 may have unsecure problem.

If you only have your /home partition encrypted, then you can use one password to decrypt it and autologin.