271
submitted 8 months ago by communism@lemmy.ml to c/linux@lemmy.ml

[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
[-] Qkall@lemmy.ml 81 points 8 months ago

we really ain't making any jokes on the name of the drives? okay...

[-] maniacal_gaff@lemmy.world 48 points 8 months ago

Actually the bottomLuks generates most of the power.

[-] SatyrSack@lemmy.one 25 points 8 months ago

Speed has everything to do with it.

[-] unexposedhazard@discuss.tchncs.de 17 points 8 months ago

Well considdering it was posted by a user with the username "communism" i will assume bottomLuks

[-] delirious_owl@discuss.online 12 points 8 months ago

Communism doesn't have hierarchy tho

[-] JustEnoughDucks@feddit.nl 8 points 8 months ago

That's very true.

But Marxist-Leninism (Lemmy.ml), the attempt to make communism practical and achievable and bumbling into fascism, does have a hierarchy.

load more comments (2 replies)
[-] communism@lemmy.ml 11 points 8 months ago

Yes, perhaps I should have named them outerLuks and innerLuks... oh well lol

[-] Max_P@lemmy.max-p.me 60 points 8 months ago

Yeah, LUKS and most block level overlays just don't care. That's what good abstraction layers do for you!

You can LUKS on a disk image mounted over SSHFS that itself resides on a Ceph cluster and mounted over iSCSI for all it cares. Is it a block device? Yes? Good to go.

You can even LUKS a floppy if you want. Or a CD.

[-] hperrin@lemmy.world 34 points 8 months ago

You wouldn’t LUKS a floppy?

[-] MigratingtoLemmy@lemmy.world 11 points 8 months ago

I absolutely will, if I can find one

[-] tgxn@lemmy.tgxn.net 5 points 8 months ago

And a suitable reader that my computer knows how to talk to.

[-] MigratingtoLemmy@lemmy.world 6 points 8 months ago

Connections to the reader need to be encrypted or I don't want it

[-] Bitrot@lemmy.sdf.org 6 points 8 months ago

I remember years ago investigating alternatives to VMware vSAN and doing hyperconverged storage clusters in Red Hat with glusterFS in top of a couple of other layers. Feels rickety as heck putting it all together but it works well. Hard sell for “normal” people who expect to hit a Next button and get some pretty graphical chart though.

[-] hperrin@lemmy.world 50 points 8 months ago

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.

[-] Jawa@lemmy.world 36 points 8 months ago

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

[-] hperrin@lemmy.world 9 points 8 months ago

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

load more comments (2 replies)
[-] communism@lemmy.ml 17 points 8 months ago

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.

[-] TimeSquirrel@kbin.social 13 points 8 months ago* (last edited 8 months ago)

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

[-] communism@lemmy.ml 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 :)

[-] Sabata11792@kbin.social 5 points 8 months ago

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

load more comments (3 replies)
load more comments (1 replies)
[-] jjlinux@lemmy.ml 43 points 8 months ago

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

[-] LostXOR@fedia.io 40 points 8 months ago

Now recursively create more layers until you have barely any free space left on the disk, then do some performance benchmarks. ;)

[-] crispy_kilt@feddit.de 26 points 8 months ago

top / bottom

( ͡° ͜ʖ ͡°)

load more comments (1 replies)
[-] theit8514@lemmy.world 25 points 8 months ago

You can, sure, but you probably shouldn't. Encrypting and decrypting consume additional cpu time, and you won't gain much in terms of security.

[-] authed@lemmy.ml 7 points 8 months ago

not really if you have a hardware chip that does the encrypt/decrypting

[-] cbarrick@lemmy.world 27 points 8 months ago* (last edited 8 months ago)

AES has been accelerated on all Intel CPUs since Broadwell, was common as far back as Sandy Bridge, and has been available since Westmere.

AMD has had AES acceleration since Bulldozer.

But the commenter is right that adding a second layer of encryption is useless in everything except very specific circumstances.

[-] theit8514@lemmy.world 6 points 8 months ago

Yes, but as I've found recently AES-NI is only as good as your software support for it. Had a team using an ancient version of winscp and they kept complaining about download speeds on our 10Gb circuit. Couldn't replicate it on any other machine with the newest version of winscp so I installed their exact version. AES-NI support wasn't added until like 2020 and it gave them 5x better download speed after upgrading.

[-] authed@lemmy.ml 4 points 8 months ago

agreed that it is useless for most cases but I could see it being useful if you need multiple people to agree on decrypting a file.

[-] cbarrick@lemmy.world 11 points 8 months ago

multiple people to agree on decrypting a file

For that, you would use Shamir's Secret Sharing algorithm rather than multiple encryption.

https://en.wikipedia.org/wiki/Shamir%27s_secret_sharing

load more comments (2 replies)
load more comments (2 replies)
[-] taaz@biglemmowski.win 4 points 8 months ago

I've also found about this recently when moving my root from drive to drive which was after I upgraded to 13th gen intel (from various older i5s) and the best cipher changed (cryptsetup benchmark).

load more comments (2 replies)
load more comments (3 replies)
[-] bjoern_tantau@swg-empire.de 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.

[-] wildbus8979@sh.itjust.works 20 points 8 months ago* (last edited 8 months ago)

Of course, and you can also add on as many layers of LVM and MDADM as you'd like.

You can also do the same with disk images (including sparse images)

[-] avidamoeba@lemmy.ca 10 points 8 months ago* (last edited 8 months ago)

Above and/or below LUKS!

So these days I use LVMRAID instead of mdraid. Underneath it uses mdraid but it's a bit easier to use since it's self-contained in LVM.

[-] Evilsandwichman@hexbear.net 13 points 8 months ago* (last edited 8 months ago)

I guess your...Luks not running out.

[-] CaptKoala@lemmy.ml 6 points 8 months ago

Take my angry upvote, you heathen.

[-] fruitycoder@sh.itjust.works 10 points 8 months ago

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

[-] EpicFailGuy@lemmy.world 4 points 8 months ago

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

load more comments (2 replies)
[-] TankieTanuki@hexbear.net 9 points 8 months ago
load more comments (1 replies)
[-] radiofreeval@hexbear.net 9 points 8 months ago

That's cool and I hope I never see that in the wild

load more comments (3 replies)
[-] Goun@lemmy.ml 5 points 8 months ago

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?

[-] communism@lemmy.ml 6 points 8 months ago

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

load more comments (5 replies)
[-] CarbonScored@hexbear.net 4 points 8 months ago

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

load more comments (2 replies)
[-] fmstrat@lemmy.nowsci.com 3 points 8 months ago

Where's the ZFS love...

load more comments
view more: next ›
this post was submitted on 19 Mar 2024
271 points (97.9% liked)

Linux

48236 readers
630 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