(Rewrite of original post).
As I said here, I am trying to create a certain specific solution for a cryptsetup partitioning scheme.
My goal is to have 2 different OSes, both Linux, one of which is what they euphemistically call a penetration testing distribution -- common slang for "hackers" ;-).
The idea is to have a main system that is visible in GRUB, and ideally a different system that becomes available after entering a first password -- or alternative means of supply e.g. a keyfile.
Especially for the idea of having a headless server, such a separate (e.g. USB supplied) keyfile or passphrase becomes mandatory for booting.
And in the absence of that, it needs to be some kind of SSH or similar authentication mechanism with a BusyBox / Dropbear thing.
But for now:
- two volume groups, each volume group containing a root fs and a swap. Then a 3rd ideally also hidden (within one of the volume groups) data partition.
Complete security is not a necessity and it is also a testing thing to see what is possible and how it is done.
The idea then becomes to have a /boot partition that is not encrypted. But I'm not even sure, because of how GRUB operates and how it can perhaps also unlock encrypted root filesystems by itself.
You would think then: the boot information gives access to a single 'root unlock' but it should or could chainload into a different GRUB residing on one of the encrypted partitions. Perhaps it is not more difficult than to have a MBR grub unlocking the primary root, and a different grub on the primary root giving access to something else. However, the most ideal situation is to have different passwords unlocking different systems.
Currently when I install a default Kubuntu (15.04, 14.10, it makes no difference) it puts two volumes in the /etc/crypttab, one for sda5_crypt, and one for an encrypted swap. Then in fstab, the devices that are mapped from those get mounted as / and used as swap.
I do not yet know how this mapping is configured, have to look into dmsetup I guess.
The main idea currently in any case is to have two volume groups based on an encrypted logical partition, or perhaps two volume groups containing one encrypted partition (with password) and the other (swap) as /dev/urandom.
When using the Server installer manual setup, it doesn't really do that thing with the swap, but you can set it to not need a password (random key). I also found that you can prevent (in crypttab) volumes from being auto-mounted, or from failing or blocking the boot process should they not get mounted straight away.
It should also be possible to let it remember the passwords you enter for other volumes, but when I tried this (with a Server install) the system became ..rather unstable. Even the rescue option / screen (where you get a little menu with about 6 options) would just freeze. That was about using keyscript=decrypt_keyctl in /etc/crypttab. Rather unreliable?
So right now I am wondering whether I can do resizings in the current volume group to resize the root volume, and I also wonder whether I can change the names of the mapper devices. Make it more to my liking. But I don't know how and when they are added, and where they are configured. I know I can manually remove them and probably also renew them. But currently they don't show up in the (currently mounted) root filesystem (from this live session still).
In any case, that is my progress thus far. If I can resize the volumes later on, I can easily add new encrypted partitions to my own liking. The only ....annoyance I have is with the UUIDs, because I don't know how they work yet.
At least I learned a few commands:
It seems easy enough now to change the names of the volume group, their paths, and the name of the volumes themselves.
Then what is left is to resize an encrypted ext4 partition, but that might be hard. In any case it seems like the /sda5 is encrypted as a whole. Which is kinda weird considering that... there are two swaps defined. One comes from sda5 -> sda5_crypt. Within sda5_crypt there is a swap partition. Since this is by itself an unencrypted volume, there is nothing defined for it in terms of LUKS. But there is also an additional swap defined in the crypttab called cryptswap1 with a UUID that I cannot find anywhere yet. And this has its own, auto-generated 'password' (or key). And both are mentioned in /etc/fstab, but one is still not mapped in the current live session.
Anyway. Time to continue.
As I said here, I am trying to create a certain specific solution for a cryptsetup partitioning scheme.
My goal is to have 2 different OSes, both Linux, one of which is what they euphemistically call a penetration testing distribution -- common slang for "hackers" ;-).
The idea is to have a main system that is visible in GRUB, and ideally a different system that becomes available after entering a first password -- or alternative means of supply e.g. a keyfile.
Especially for the idea of having a headless server, such a separate (e.g. USB supplied) keyfile or passphrase becomes mandatory for booting.
And in the absence of that, it needs to be some kind of SSH or similar authentication mechanism with a BusyBox / Dropbear thing.
But for now:
- two volume groups, each volume group containing a root fs and a swap. Then a 3rd ideally also hidden (within one of the volume groups) data partition.
Complete security is not a necessity and it is also a testing thing to see what is possible and how it is done.
The idea then becomes to have a /boot partition that is not encrypted. But I'm not even sure, because of how GRUB operates and how it can perhaps also unlock encrypted root filesystems by itself.
You would think then: the boot information gives access to a single 'root unlock' but it should or could chainload into a different GRUB residing on one of the encrypted partitions. Perhaps it is not more difficult than to have a MBR grub unlocking the primary root, and a different grub on the primary root giving access to something else. However, the most ideal situation is to have different passwords unlocking different systems.
Currently when I install a default Kubuntu (15.04, 14.10, it makes no difference) it puts two volumes in the /etc/crypttab, one for sda5_crypt, and one for an encrypted swap. Then in fstab, the devices that are mapped from those get mounted as / and used as swap.
I do not yet know how this mapping is configured, have to look into dmsetup I guess.
The main idea currently in any case is to have two volume groups based on an encrypted logical partition, or perhaps two volume groups containing one encrypted partition (with password) and the other (swap) as /dev/urandom.
When using the Server installer manual setup, it doesn't really do that thing with the swap, but you can set it to not need a password (random key). I also found that you can prevent (in crypttab) volumes from being auto-mounted, or from failing or blocking the boot process should they not get mounted straight away.
It should also be possible to let it remember the passwords you enter for other volumes, but when I tried this (with a Server install) the system became ..rather unstable. Even the rescue option / screen (where you get a little menu with about 6 options) would just freeze. That was about using keyscript=decrypt_keyctl in /etc/crypttab. Rather unreliable?
So right now I am wondering whether I can do resizings in the current volume group to resize the root volume, and I also wonder whether I can change the names of the mapper devices. Make it more to my liking. But I don't know how and when they are added, and where they are configured. I know I can manually remove them and probably also renew them. But currently they don't show up in the (currently mounted) root filesystem (from this live session still).
In any case, that is my progress thus far. If I can resize the volumes later on, I can easily add new encrypted partitions to my own liking. The only ....annoyance I have is with the UUIDs, because I don't know how they work yet.
At least I learned a few commands:
Code:
blkid lvdisplay ls -l /dev/disk/by-uuid
Then what is left is to resize an encrypted ext4 partition, but that might be hard. In any case it seems like the /sda5 is encrypted as a whole. Which is kinda weird considering that... there are two swaps defined. One comes from sda5 -> sda5_crypt. Within sda5_crypt there is a swap partition. Since this is by itself an unencrypted volume, there is nothing defined for it in terms of LUKS. But there is also an additional swap defined in the crypttab called cryptswap1 with a UUID that I cannot find anywhere yet. And this has its own, auto-generated 'password' (or key). And both are mentioned in /etc/fstab, but one is still not mapped in the current live session.
Anyway. Time to continue.
Comment