-
Notifications
You must be signed in to change notification settings - Fork 171
Seed filesystem UUIDs with SOURCE_DATE_EPOCH + offset #2847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
waiting for integration tests to complete |
49ec47c to
266fc95
Compare
|
I'm confused? I think the idea was the control the PRNG, not use the label itself as a seed. This creates some weird effects, particularly when images aren't intentionally doing this. For example, Fedora Asahi Remix systems all have the partition label "fedora" (as do Fedora Cloud images). Having a fixed UUID automatically derived from the label means that it's now impossible to produce disk images on those systems since the UUIDs and labels match, creating mount confusion. |
Hmm, I can't follow you on this. label and uuids are not the same. For the calculation of the UUID the "randomness" is disabled by providing a seed, such that a rebuild of the image comes with the same UUID. The systemd provided standard UUID definitions for partitions are the same UUIDs for the same type of partition. This code now "standardize" the filesystem UUID according to its label. Example: kiwi applies the label name 'ROOT' for the rootfs. This will then result in the following UUID for the rootfs import random
import uuid
from functools import reduce
label='ROOT'
label_seed = reduce(lambda x, y: x + y, map(ord, label))
rd = random.Random()
rd.seed(label_seed)
print(uuid.UUID(int=rd.getrandbits(128)))
And it will be the same as long as the label is the same. For the custom partitions (those you specify yourself) you can specify a custom label which is used as the seed for the UUID. That way you create a connection between your label and your UUID but I don't see any conflict If no label exists, we stay random ? |
|
All tests passing, but we need to clarify what we really want to achieve. Maybe also a topic for tomorrows community meeting |
|
I can imagine a device conflict for the following condition:
How likely is this ? systemd is aware of this conflict when systems are setup to boot using the standard IDs I believe we should at least add an opportunity to configure the seed for those filesystems where it is currently not possible (root, boot, swap) |
|
I think it's likely enough that I'd be concerned. The idea that @davide125 and @supakeen had was to allow setting a time-value seed for UUIDs (e.g. |
|
So then let's update the code to make use of |
|
The problem here is that you can't use SOURCE_DATE_EPOCH + 1 and so on ? |
|
I would use |
|
Yeah, I agree with @Conan-Kudo, it's not at all uncommon to deploy multiple images on the same system. Using SOURCE_DATE_EPOCH - offset seems reasonable to me. |
|
all right, so let's take SOURCE_DATE_EPOCH into account |
da2ba5a to
12b0a5a
Compare
d2e47ca to
b62d7b2
Compare
|
We currently cannot set the fliesystem label for the ESP (or even mount options), which is why we have this in Fedora's kiwi descriptions: https://pagure.io/fedora-kiwi-descriptions/blob/rawhide/f/root/etc/fstab.script |
Hmm, I don't get that part. So with this change here, the EFI filesystem will be created like this So you are saying we have a problem here ? |
|
We need a way to set the shortname behavior and mount settings for the ESP because they affect the reproducibility of image. This should be a separate pull request, though. |
Add some scope information such that we know from where this log information originates from.
Allow to specify a filesystem label as part of a <partition> definition. So far the label was set by the name of the partition. With the new label attribute, a filesystem label different from the partition name can be set. This commit also updates/fixes the documentation in this regard.
For reproducible builds the calculation of the filesystem UUID should be persistent with each rebuild of the image. To achieve this the UUID is calculated using the SOURCE_DATE_EPOCH from the environment plus a char-number representation of the filesystem label name as random seed. In kiwi every filesystem is created with a label, thus only in case there is no SOURCE_DATE_EPOCH available we continue to create the UUID as random data. This Fixes #2761
Allow to set environment variables in the caller environment via the commandline, e.g --setenv SOURCE_DATE_EPOCH=42
ab89796 to
f9fb77e
Compare
For reproducible builds the calculation of the filesystem UUID should be persistent with each rebuild of the image. To achieve this the UUID is calculated using the label name as seed. Only in case the filesystem has no label assigned the UUID stays random and changes with each rebuild. In addition to this change a new label attribute has been added to the
<partition>section. This Fixes #2761