fix(guest): sync system clock from RTC at boot to avoid 'certificate not yet valid'#127
Open
arlishansenn wants to merge 2 commits into
Open
fix(guest): sync system clock from RTC at boot to avoid 'certificate not yet valid'#127arlishansenn wants to merge 2 commits into
arlishansenn wants to merge 2 commits into
Conversation
The host signs short-lived MITM TLS certificates with notBefore set to the host wall-clock time. When the guest system clock lags behind the host, those freshly minted certificates are rejected as "certificate is not yet valid", breaking every HTTPS egress (curl, apk, Node/Python runtimes, ...). Seed the system clock from the QEMU-exposed hardware RTC early in guest init (before networking/CA setup) so the guest stays inside the certificate validity window. Falls back gracefully when hwclock is unavailable.
Alpine splits resize2fs into the e2fsprogs-extra package; e2fsprogs alone does not ship it. Without resize2fs in the guest image, setting rootfs.size makes the VM fail to boot with "requires resize2fs in the guest image (install e2fsprogs)". Also gitignore the top-level image-out/ build output directory.
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
Inside the guest, every HTTPS egress (curl,
apk, Node/Python runtimes) can fail with:against the
gondolin-mitm-caproxy certificates.Root cause
The host signs short-lived MITM TLS certificates with
notBeforeset to the host wall-clock time. When the guest system clock lags behind the host, those freshly minted certificates are seen as not yet valid, so the TLS handshake through the egress proxy is rejected.Observed in an aarch64 QEMU guest:
rtc-pl031set the system clock to e.g.06:57:39notBeforewas minutes ahead of guest time ->not yet valid/dev/rtc0) actually tracked host time correctlyConfirmed fix in-guest:
hwclock -simmediately restored strict TLS (curl https://api.github.com-> 200,apk updateover HTTPS -> OK), with no CA or repo changes.There is currently no guest-side time sync and no host option to control this (no
clock/rtc/timeknobs in the SDK/CLI, no-rtcexposure), and guestinitdoes not seed the clock.Change
Seed the system clock from the hardware RTC early in
guest/image/init(after/devis mounted, before networking/CA setup). Trieshwclock --hctosys --utc, falls back tohwclock -s, and degrades gracefully (logs and continues) whenhwclockis unavailable.Notes
busybox(present in the Alpine base image) provides anhwclockapplet, so this is available by default.-rtc base=utc,clock=host; this guest-side change is the minimal self-contained fix.