feat(agent): reseed verb — host-fed entropy, CRNG reseed, machine-id regen#4
Merged
Conversation
…regen Cloned/restored VMs resume from byte-identical snapshot memory, so their CRNG state (and /etc/machine-id) is identical across all clones unless something perturbs it post-boot. Adds a second wire-protocol verb, reseed, so the host can push fresh entropy and order a CRNG reseed (+ optional machine-id regen) over the same vsock connection used for exec.
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.
What
New wire verb
reseed— the second verb afterexec. After a VM clone/restore, N guests share byte-identical snapshot memory, hence byte-identical CRNG state (colliding TLS keys/UUIDs). The host sends areseedframe carrying fresh entropy; the agent:RNDADDENTROPY(hand-builtrand_pool_info: entropy bits + buf size + payload, native-endian),RNDRESEEDCRNG,/var/lib/systemd/random-seed,/etc/machine-id(regen_machine_id— clone sets it, same-VM restore doesn't; skipped silently where the file doesn't exist, e.g. Android).Response reuses the existing terminal frames (
MsgExit/MsgError). Non-Linux GOOSes answer with a sentinel error (build-tag stub, same pattern astransport_other.go). Old agents reject the unknown frame type via the existing first-frame check — graceful degradation for free.Client side:
client.Reseed(ctx, conn, entropy, regenMachineID); the connection prologue shared withRunis extracted intoopenSession.Validation
make lint: 0 issues × {linux, darwin, windows}make test: agent 84.9% / client 21.2% coverage, race-enabled; new tests: dispatch (reseed first-frame, unknown-type rejection), protocol round-trip, client success/error/non-zero-exitrand_pool_infolayout (bits vs bytes), single-fd ioctl sequence, one-terminal-frame invariant, ctx-cancel conn teardown