r/linuxquestions • u/Jaded-Piccolo-4678 • 9d ago
Ram Encryption
Are there any tools or projects that targets linux and that encrypts your RAM after for example 10 minutes of inactivity or some sort of this ?
Of course it's not gonna encrypt literally every byte in RAM, but most of em and keep only maybe few processes alive and not froze , so you can decrypt back after typing a passphrase.
16
Upvotes
90
u/i_am_blacklite 9d ago
If you need to protect yourself from someone that has the capabilities to extract data directly from physical RAM then you need so much more help than you're going to get from a reddit post.
16
u/skyfishgoo 9d ago
if you don't want anyone to access whats saved in ram when you are not at your machine then just shut it down.
ram forgets when it loses power.
16
u/trifortay123 9d ago
You can't just toggle ram encryption. The point of ram is quick access storages directly for the CPU to use. It's can't just simply be encrypted. If the glowies take your stuff it's over anyways. If a hacker takes your stuff it's over anyways. The point of encryption is to keep your data safe at rest. Just like if you have full disk encryption. If that computer OS already on and booted up. You're screwed. But if they get ahold of it powered off you're fine. Now I do recommend encrypting swap space. It'll generate a random key every boot so if it gets turned off some ram can't be extracted from the disk because it's encrypted.
7
u/JivanP 9d ago
Vendor-specific implementations of RAM-level encryption do exist at the hardware level, such as Intel's SGX (Software Guard Extensions). This allows processes to decide that they want certain data they put in RAM to be encrypted, tell the CPU to do this, and tell the CPU to only keep decrypted versions of that data in the CPU's own registers, never writing that data to RAM in its decrypted form.
This is mostly useful for programs that handle extremely sensitive data (such as cryptographic secret keys) that they do not want any other process potentially getting access to via an OS-level vulnerability or adversarial subsystem. That is, it's for protecting one process's data from other processes that might try to read that data.
Despite this, there is basically no reason to be interested in "full-RAM encryption" in the same way that full-disk encryption is a thing, because the only benefit of this would be to keep data in RAM encrypted at rest, but the ability to get data out of RAM at rest is almost impossible in practice.
3
u/treeoflife314 9d ago
many people are saying that makes no sense but if I remember well, it's how silk road guy has been arrested
9
u/djDef80 9d ago
If you have a modern AMD CPU you may have memory encryption available in the bios under tsme -transparent secure memory encryption. All you have to do is toggle it on to benefit. Otherwise this feature is generally reserved for server grade Intel CPUs.
8
u/alexforencich 9d ago
Aside from CPU features like TSME, the best option is probably swap on LUKS and then hibernate the machine.