[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 :)

  • @hperrin@lemmy.world
    link
    fedilink
    504 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
      link
      fedilink
      364 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

        • @Jawa@lemmy.world
          link
          fedilink
          13 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

    • @communism@lemmy.mlOP
      link
      fedilink
      174 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
        link
        fedilink
        13
        edit-2
        4 months ago

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

        • @communism@lemmy.mlOP
          link
          fedilink
          84 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
          link
          fedilink
          54 months ago

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

      • @Opisek@lemmy.world
        link
        fedilink
        34 months ago

        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.

        • @communism@lemmy.mlOP
          link
          fedilink
          24 months ago

          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

          • @Opisek@lemmy.world
            link
            fedilink
            2
            edit-2
            4 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.

    • Possibly linux
      link
      fedilink
      English
      14 months ago

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