this post was submitted on 19 Mar 2024
271 points (97.9% liked)

Linux

48220 readers
637 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
 

[Image description:
Screenshot of terminal output:

~ ❯ lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda              8:0    1  62.5M  0 disk  
└─topLuks      254:2    0  60.5M  0 crypt 
  └─bottomLuks 254:3    0  44.5M  0 crypt

/end image description]

I had no idea!

If anyone else is curious, it's pretty much what you would expect:

cryptsetup -y -v luksFormat /dev/sda
cryptsetup open /dev/sda topLuks
cryptsetup -y -v luksFormat /dev/mapper/topLuks
cryptsetup open /dev/mapper/topLuks bottomLuks
lsblk

Then you can make a filesystem and mount it:

mkfs.ext4 /dev/mapper/bottomLuks
mount /dev/mapper/bottomLuks ~/mnt/embeddedLuksTest

I've tested putting files on it and then unmounting & re-encrypting it, and the files are indeed still there upon decrypting and re-mounting.

Again, sorry if this is not news to anyone else, but I didn't realise this was possible before, and thought it was very cool when I found it out. Sharing in case other people didn't know and also find it cool :)

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 10 points 8 months ago (1 children)

Might be a way to enforce multiple algorithms or enforce two factor unlocking (say TPM AND password).

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

You guys are going to blow your top when you hear about DFC (Distributed Fragment Cryptography)

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

Any good reading the subject?!

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

Googling it takes you to the one company website that has managed to get a service out (a keyless) they haveA really good docs public repository.

I work with these folks thru my job and it's a pleasure to deal with them (even tho the product it's a bit complex)

It does my great good to see a company actually being run by engineers

https://www.akeyless.io/blog/how-akeyless-dfc-works/

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

Never apologize for enjoying the discovery of new things. That's awesome, enjoy it.

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

Where's the ZFS love...

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

Is it possible to.. boot into a LUKS in a LUKS?

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

Have fun with the initramfs.

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

I will thanks

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

Great! Although I think that security actually goes down that way. Something something about statistics. A crypto expert could probably explain that properly and we could pretend to understand it.

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

Yo dog I heard you like cryptography

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

top / bottom

( ͡° ͜ʖ ͡°)

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

This guy LUKS!!

[–] [email protected] 13 points 8 months ago* (last edited 8 months ago) (1 children)

I guess your...Luks not running out.

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

Take my angry upvote, you heathen.

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

If you think about, it makes sense, but I didn't know this! Really cool indeed - do you have any use case for that or you were just poking around?

[–] [email protected] 6 points 8 months ago (2 children)

I have an SSD and an HDD—I was considering on my next distro hop to put the root partition on the SSD and home partition on the HDD, decrypt the SSD and top level of the HDD upon boot, then decrypt the bottom level of the HDD upon user login. I'm sure many will think that's overkill or silly, but hey, if you have full disk encryption you'll have to enter two passwords to get into your computer anyway, just means your personal files get protected with two passwords. I would agree it's mostly gimmicky but I still want to try it out lol

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

Wouldn't it be easier to just use a longer password and or a longer hash

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

Yes, it would. But it's less fun lol

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

Amazing! How do you setup the decryption on login? systemd-home or something like that?

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

pam_mount. Arch wiki also suggests pam-exec although their explanation uses systemd (I'm using runit).

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

Fancy! TIL about pam_mount. Thanks, comrade!

[–] [email protected] 50 points 8 months ago (3 children)

It would be good if you wanted to have a system that two people need to be present to unlock. Like those nuke launch locks that need two keys.

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

I don't think that's how its done. I see where your going with this.

[–] [email protected] 17 points 8 months ago (2 children)

Tbf this would enforce the order in which the two people decrypt it, which may not be good if you expect these two people to "arrive" asyncrhonously and you don't want them to have to wait for the other before entering their password/key. But maybe that's too specific of a use case.

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

What about this: Top layer encrypted by Alice Middle layer encrypted by Bob Bottom layer encrypted by Alice

If Alice arrives first, she decrypts the top layer and has to wait for Bob to arrive. She cannot go because she has to decrypt the last layer. If Bob arrives first, he has to wait for Alice to arrive. He cannot go because he hasn't decrypted anything yet.

Not really a solution but kind of helps.

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

That would just mean they both have to wait for each other rather than one having to wait for the other but not vice versa. Worse if you want to reduce the total amount of waiting, I guess better if you want there to be equality in having to wait for the other person lol

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

Oh yeah, seems I hyper focused on your usage of "arrive". I personally saw it as a problem if one person unlocked the first layer and just left leaving only one layer for days.

[–] [email protected] 13 points 8 months ago* (last edited 8 months ago) (2 children)

You're a programmer, aren't you? Always thinking about those race conditions and edge cases.

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

Didn't account for the 2 sticky notes cleverly hidden under they keyboard.

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

Definitely not professionally lol. I think I'd only want a programming job if I could somehow develop FOSS for a living, which is hard to get a full-time job in. And only to a limited extent as a hobby, though I do enjoy programming and am trying to teach myself more whenever I have the time :)

[–] [email protected] 36 points 8 months ago (2 children)

You can also just split the password for a single LUKS into two parts and give one each to the two people :D

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

But then you know both parts of the password and so must be killed to keep the machine secure

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

Ideally you would never have to because you just have the two people come up with their part of the password and then initialise the LUKS partition together. Sorta like a key ceremony

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

Yeah, you’re right. That’s better.

load more comments
view more: next ›