You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
With mkosi it is possible to generate encrypted disk images, which can easily deployed to machines, especially virtual machines. The downside with deploying the same image multiple times is that they will all use the same drive encryption key unless the image is generated again between deployments. It would be nice if systemd-repart could do a reencryption of a drive on the first boot.
Describe the solution you'd like
A new option for systemd-repart which starts a reencryption of a drive, allowing to deploy the same encrypted image multiple times.
I'm not sure that systemd-repart has any way to identify the first boot where this should happen, so maybe this can be stored as a GPT attribute and whenever that is set, it will begin/continue a reencryption. After the reencryption is done, the flag is set to 0.
The benefit of putting this into repart would be that this could (with a kernel command line option / config option in repart.d to toggle the behaviour) be run before the partition and luks mapper is grown, so the reencrypt doesn't run for possibly hundreds of GB, but just the size of the original image (probably a few GB or les only).
Describe alternatives you've considered
A naive solution to mitigate this would be to put a service in the image that starts on firstboot and starts cryptsetup reencrypt as well as cryptsetup reencrypt --resume-only on the next boots. This is a process that can be interrupted.
The systemd version you checked that didn't have the feature you are asking for
Mainly to have the ability to ship secrets inside the image so the machines can be deployed without manual intervention and can call back into a central service to get config management options. An encrypted image could also be sent to manufacturers who support pre-imaging a computer with an image the company provides, so devices can be sent directly to people instead of going through an IT department for imaging.
Activity
Cornelicorn commentedon Nov 1, 2023
Maybe this should also rather go into
systemd-gpt-auto-generatorthan repart?Growing the LUKS mapper would be done there as far as I understand.
bluca commentedon Nov 1, 2023
Why not just encrypt on first boot, instead of shipping it already encrypted?
Cornelicorn commentedon Nov 1, 2023
Mainly to have the ability to ship secrets inside the image so the machines can be deployed without manual intervention and can call back into a central service to get config management options. An encrypted image could also be sent to manufacturers who support pre-imaging a computer with an image the company provides, so devices can be sent directly to people instead of going through an IT department for imaging.
poettering commentedon Nov 1, 2023
See #29731