fix(reseed): unique machine-id per clone + entropy hygiene#8
Merged
Conversation
systemd-machine-id-setup derives the machine-id from the SMBIOS product_uuid in a VM, which a snapshot clone inherits verbatim — so every clone regenerated the SAME id, silently defeating the reseed verb's whole purpose (cocoon assigns no per-clone SMBIOS UUID). Always write a fresh random id instead and drop the DMI-derived path. Writing the new id first also removes the empty-machine-id window a failing drop-dbus step used to leave. Zero the single-use host entropy after the mix, and note the agent's 512-byte cap on the client.
A surviving /var/lib/dbus/machine-id keeps serving the old id to dbus consumers after a clone; a drop failure is a real uniqueness gap, so surface it at Warn instead of Debug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The reseed verb exists so byte-identical snapshot clones don't share CRNG state — but the machine-id half was self-defeating.
systemd-machine-id-setupin a VM derives the id from the SMBIOSproduct_uuid, which a snapshot clone inherits verbatim, and cocoon assigns no per-clone SMBIOS UUID. So every clone regenerated the same machine-id. The random path only fired when the tool failed, not when it succeeded with a shared DMI id.Fix
systemd-machine-id-setuppath entirely.randomMachineIDextracted as a pure, tested function (uniqueness is the whole point)./etc/machine-idwindow a failing drop step used to leave (found by review).req.Data+ the ioctl buffer) after the mix.client.Reseed.Verification
GOWORK=off build/test/
-race(agent+client) green; lint 0 issues on linux/darwin/windows; fmt-check clean. NewTestRandomMachineIDasserts canonical format + uniqueness.Reviewed by an adversarial Opus pass (two should-fix + two nits, all addressed). No backward-compat kept per owner direction.