this post was submitted on 25 Dec 2023
96 points (98.0% liked)

Linux

48330 readers
634 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'm curious about the possible uses of the hardware Trusted Protection Module for automatic login or transfer encryption. I'm not really looking to solve anything or pry. I'm just curious about the use cases as I'm exploring network attached storage and to a lesser extent self hosting. I see a lot of places where public private keys are generated and wonder why I don't see people mention generating the public key from TPM where the private key is never accessible at all.

all 34 comments
sorted by: hot top controversial new old
[–] [email protected] 38 points 11 months ago (3 children)

Personally, I don't see how a TPM module is more useful than full disk encryption with a password you enter on boot.

I struggle to see how it makes automatic login safer given it does nothing to protect against the really common threat of someone physically stealing your laptop or desktop.

I don't trust any encryption or authentication system that I don't have access to the keys for. Microsoft has also kinda made me feel it's more for vendor lock in, like they did with secure boot.

Still, I'm probably being unreasonably pessimistic about it though - be interested to see any practical use cases of it.

[–] wildbus8979 16 points 11 months ago (1 children)

In theory, the TPM can be used to verify that the bootloader, kernel and injtamfs haven't been tampered with, which is very very useful as FDE (in the running machine) is only good if that remains true.

[–] [email protected] 9 points 11 months ago (4 children)

I've heard that before, but there are two main problems that stick out to me:

  • A lot of the marketing for TPM (at least when I was setting up bitlocker on Windows) suggests that it's used to support decrypting drives without a password on boot. But that doesn't seem to offer any protection from the devices being stolen. The bootloader may be safe but it's not actually verifying that I'm the one booting the device.
  • I can't think of a situation where someone would be able to actually modify the bootloader without also having full access to the files and secrets. Especially in a single-boot environment where every time the system is running, the device is decrypted.

I'm not saying that it's all just a scam or anything like that, but it really feels like I'm missing something important and obvious.

[–] metiulekm 10 points 11 months ago (2 children)

The bootloader is stored unencrypted on your disk. Therefore it is trivial to modify, the other person just needs to power down your PC, take the hard drive out, mount it on their own PC and modify stuff. This is the Evil Maid attack the other person talked about.

[–] [email protected] 3 points 11 months ago

Otherwise you simply have a USB boot partition.

Pretty easy to set up, can be taken out to not be modified at run time unless you want plus not being stolen with the computer itself.

I see only drawbacks with a TPM for a computer system like that. In embedded credentials, mobile applications, cold credential storage, etc... it works very well, but it doesn't solve any problem that someone tech savvy doesn't have a better solution for, in my opinion.

If you are a big enough target for an evil maid attack, you are either good enough to circumvent it better than an embedded TPM, or you are rich enough to hire someone who is.

[–] [email protected] 1 points 11 months ago (1 children)

I can't see that being a reasonable approach for them to take, tbh. One option with TPM is that your system logs in automatically to the desktop, in which case they can just turn it on and use it normally. The other is that it requires a password at some point during startup, to which they could just use a (hardware) keylogger.

[–] [email protected] 4 points 11 months ago

It only at most auto logs you into the display manager or more generally into login. Then you still need to get root access to modify anything from there. Login would still be based on user password/key/whatever.

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

If the device is stolen, your disk is still encrypted at all time. If you believe your OS's login system is reasonably secure, then the attacker should have no way to access your data: they cannot access the data from software because it is blocked by login screen, they cannot access the data from hardware because it is protected by FDE.

One of the misconceptions I had before is that I assumed that the disk will be decrypted when you enter the LUKS password. This is not true, the password is loaded into the ram, and only decrypts necessary parts to RAM. All the data on the disk is never decrypted, even when you are working in your OS.

[–] [email protected] 6 points 11 months ago* (last edited 11 months ago)

they cannot access the data from software because it is blocked by login screen

The system may still be vulnerable to over the network exploits. So for example, if the system is running sshd, and a couple of months from now a root exploit is found (à la heartbleed), the attacker may get inside.

It's somewhat of a long shot, but it's still a much larger attack surface than butting your head against a LUKS encrypted drive that's at rest.

they cannot access the data from hardware because it is protected by FDE.

RAM is not protected by FDE. There are (obviously non-trivial) ways to dump the RAM of a running system (Cold Boot attacks, and other forensic tools exist). So if the attacker is dedicated enough, there are ways.

One of the misconceptions I had before is that I assumed that the disk will be decrypted when you enter the LUKS password. This is not true, the password is loaded into the ram, and only decrypts necessary parts to RAM. All the data on the disk is never decrypted, even when you are working in your OS.

Hah! That would be impractical :) Imagine having to decrypt your entire 32TB drive array everytime you booted your computer.

[–] [email protected] 2 points 11 months ago

While I don't use TPM myself (I dislike being tied to a specific hardware) the way it protects you is:

Disk is protected through encryption, so you can't remove and inject anything/hack the password.

If boot is protected/signed/authorized only, a random person can't load an external OS and modify the disk either.

All this together would say, even if someone acquires your computer, they can't do anything to it without an account with access, or an exploit that works before a user logs.

In a way, the attack surface can be bigger than if you simply encrypted your disk with a key and password protect that key.

[–] [email protected] 2 points 11 months ago* (last edited 11 months ago)

The key is only released into ram, so unless the thief can read content from ram they cannot easily decrypt your disk. And most common thief probably do not have that ability.

That being said, you do need a login password to prevent the thief straight up booting into your OS and copy everything using the file manager...

One of the advantage of using TPM with FDE, is that you can use a much longer random password. If I dont use TPM I am forced to use a password I can remember, which is likely the same password I use somewhere else. This means if someone close to me stole my laptop, they will have reasonable chance of guessing my password.

[–] [email protected] -2 points 11 months ago* (last edited 11 months ago) (1 children)

You can use insecure boot and not enter the password. It can't make stuff meaningfully more secure though, it just plain doesn't add any protection against evil maid.

[–] [email protected] 12 points 11 months ago

I use it for Data-at-rest Encryption. Not much else though.

[–] [email protected] 8 points 11 months ago

Usually because its not portable. A USB security key costs more than the TPM you already have, but you can make a backup and store it in a safe

[–] [email protected] 8 points 11 months ago

100% Yes

  • Currently using systemd-creds to displace any secrets in env

  • Spending time getting to grips with Keylime

[–] [email protected] 8 points 11 months ago (1 children)

The problem with this is that the key would be “machine based” and not “person”

So it’s better for “service accounts”

[–] [email protected] 4 points 11 months ago* (last edited 11 months ago)

Having read poetterings blog posts a bit and he explains that the TPM2 based encryption is entirely just for system resources (basically everything under / with exception of /home). For home he still "envisions" (its already possible and not really hard with sd-homed) that the encryption is based on the users passphrase/key/whatever and not unlockable by anyone else than the users passphrase/...

So user specific stuff is tied to user keys while system stuff is tied to the system & OS.
If you wanna read the post: https://0pointer.net/blog/fitting-everything-together.html

[–] [email protected] 7 points 11 months ago (2 children)

I use it for storing luks credentials, so every time I boot I get dropped at my login manager. It leaves my system vunerable to attacks to it, but its quite convenient.

Besides, if anyone tries to boot any other OS which is not mine, the keys are erased.

[–] [email protected] 1 points 11 months ago (1 children)

Can you explain a bit on how the key erasure works? AFAIK TPM only refuse to release the key when certain PCR dont match, is there a setting to let it erase key?

[–] [email protected] 1 points 11 months ago (1 children)

https://fedoramagazine.org/automatically-decrypt-your-disk-using-tpm2/

I've read this article to make my setup, but its very informative about the function of TPM too

[–] [email protected] 1 points 11 months ago (1 children)

I have read that article, it doesn't seem to mention that TPM will erase key if a different OS is loaded, maybe I missed something?

[–] [email protected] 1 points 11 months ago

It talsk about pcr, every time another OS is booted some pcsrs are changed, and if the keys are installed on the correct ones, this will lead to it being erased

[–] [email protected] 0 points 11 months ago

Besides, if anyone tries to boot any other OS which is not mine, the keys are erased.

There are forensic tools that can capture the contents of RAM, and so access your decrypted LUKS encryption key.

I guess it depends on who you are protecting against, but if for example law enforcement wants evidence against you for what they think is a serious enough crime, they just may go through the trouble to do it.

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

It scares me. What if the chip dies? How am I gonna be able to get my stuff? I don't fully understand how it works, but where is the encryption saved? On the chip itself or somewhere else?

[–] [email protected] 1 points 11 months ago (1 children)

What if the chip dies? How am I gonna be able to get my stuff?

You can have backup keys, but if you don't have that then your data is gone.

I don’t fully understand how it works, but where is the encryption saved? On the chip itself or somewhere else?

Encryption key is stored in the TPM chip.

[–] [email protected] 1 points 11 months ago

Ok this is scary. Lol Unless you have those backup keys then it's a bit better.

[–] [email protected] 2 points 10 months ago

A security module or a key fob/smart card processes the key internally using its own dedicated ram and cpu without any debugging support. This way, even something will full ram and cpu access or a compromise of your machine, there is no way to export or access the key. Data is passed to the module and it returns the scrambled or unscrambled result based on the key which no body knows or has ever seen. A key locked with no way to access can’t be hacked without physically stealing the module, which is where your pin comes in to save you. The TPM is a very important part of a secure boot chain. If you want to secure other things I wouldn’t blame you for using a separate module or fob that isn’t always connected util it’s actually needed and it should only be activated with a physical button or something so you have to be present to engage with it. This adds even more security. So you could use the TPM for boot chain security and a separate fob or data privacy for example.

[–] [email protected] 0 points 11 months ago

i use it to auto unlock luks. if someone messed with the hardware/ bios, it will ask for the password next boot.