Skip to content

fix(setup): sync Windows CA certificates to WSL before CLI install - #819

Merged
steipete merged 2 commits into
openclaw:mainfrom
jkf87:fix/sync-windows-ca-certs-to-wsl
Jul 5, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
jkf87:fix/sync-windows-ca-certs-to-wsl

Conversation

@jkf87

@jkf87 jkf87 commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On corporate/enterprise networks, a TLS-intercepting proxy can inject a certificate chain trusted by Windows but not by the fresh WSL Ubuntu instance. The gateway install then fails while downloading the OpenClaw CLI:

curl: (60) SSL certificate problem: self-signed certificate in certificate chain

Fix

Add SyncWindowsCaCertsStep immediately before InstallCliStep:

  1. Read the Windows LocalMachine\Root and CurrentUser\Root trust stores and deduplicate certificates by SHA-256.
  2. Send a fingerprinted certificate manifest to wsl.exe over stdin; no privileged \\wsl$ filesystem write.
  3. As WSL root, validate every X.509 certificate and fingerprint, write one PEM certificate per .crt file with system-readable permissions, then rebuild the Debian trust store.
  4. Replace the app-managed certificate directory transactionally. Crash recovery lives outside the CA scan tree, failed updates restore the previous trust state, and rollback removes the managed roots and rebuilds trust.

The sync step remains non-fatal so machines that cannot read or update the Windows-derived roots still proceed to the normal installer diagnostics. Command stdin writes now share the existing timeout/cancellation policy, preventing a wedged WSL launch from hanging setup indefinitely.

Test plan

  • Windows 11 ARM64 VM: OpenClaw.SetupEngine.Tests — 375 passed
  • Windows 11 ARM64 VM: build.ps1 — Shared, CLI, WinNodeCLI, SetupEngine, and WinUI green
  • AutoReview — clean after CRLF, permissions, timeout, stale-trust, and rollback-accounting fixes
  • GitHub Windows CI — setup/connect, network recovery, revocation recovery, x64, and ARM64 green on exact head

The local Apple ARM VM cannot start nested WSL2 (HCS_E_HYPERV_NOT_INSTALLED), so the repository's native Windows runner supplies the real WSL execution proof.

Co-authored-by: conanssam [email protected]

@clawsweeper

clawsweeper Bot commented Jun 25, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 7:24 PM ET / 23:24 UTC.

Summary
Adds a SetupEngine step before CLI installation that exports Windows LocalMachine and CurrentUser root CAs into the managed WSL trust store via stdin, plus stdin timeout handling and focused SetupEngine tests.

Reproducibility: no. high-confidence live reproduction was run in this read-only review. Source inspection shows current main downloads the installer with WSL curl before any CA import, matching the reported corporate TLS-inspection failure mode.

Review metrics: 3 noteworthy metrics.

  • Changed files: 7 files affected. The diff is bounded to SetupEngine code and tests, which keeps review focused on setup behavior and trust policy.
  • Setup step insertion: 1 step added before install-cli. The new step runs on every default fresh setup before the installer download and changes TLS trust for that path.
  • After-fix setup proof: 0 current-head runs posted. The PR body has validation checkboxes but no real managed gateway setup transcript showing the changed behavior.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add a redacted current-head setup log from a fresh managed WSL gateway behind the TLS-inspection proxy showing sync-ca-certs runs and install-cli succeeds.
  • [P1] Add a normal-network setup log showing the new step is harmless or non-fatal when no corporate proxy is present.
  • Get maintainer/security acceptance of default LocalMachine and CurrentUser root import, or update the PR to the chosen opt-in or warning path.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists unit/build validation, but no after-fix real setup run from this head behind TLS inspection or on a normal network; redacted logs or terminal output are still needed before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging this changes the managed WSL distro system trust store before downloading and running the CLI installer, including roots from both Windows LocalMachine and CurrentUser stores.
  • [P1] The PR still lacks redacted current-head setup proof from a fresh managed gateway behind corporate TLS inspection and from a normal-network path.
  • [P2] Unit tests cover manifest, rollback, and stdin timeout mechanics, but they do not prove the live WSL/root/update-ca-certificates path on the affected network.

Maintainer options:

  1. Require proof and policy signoff (recommended)
    Keep the PR open until maintainers explicitly accept the trust-store policy and the contributor adds redacted setup logs for both affected and unaffected networks.
  2. Narrow the trust import path
    If default host-root mirroring is too broad, revise the PR to add the chosen opt-in, opt-out, or warning behavior before merge.
  3. Accept default mirroring risk
    Maintainers may intentionally accept default Windows-root mirroring for the managed distro, but should document the decision and still require current-head real setup proof.

Next step before merge

  • [P1] Needs maintainer/security trust-policy judgment and contributor-supplied real setup proof; there is no narrow automated code repair to queue now.

Maintainer decision needed

  • Question: Should fresh managed WSL gateway setup import Windows LocalMachine and CurrentUser root CAs into the WSL system trust store by default before downloading the CLI installer?
  • Rationale: This is a useful enterprise setup repair, but it intentionally changes installer TLS trust inside the app-managed distro and cannot be settled by unit tests alone.
  • Likely owner: steipete — They authored the current safety rewrite and recently touched setup/onboarding flow ownership on current main.
  • Options:
    • Default-on after proof (recommended): Accept the current default-on trust mirroring policy, but require redacted current-head setup proof for the affected corporate proxy and normal-network paths before merge.
    • Opt-in or warned import: Require an explicit config/UI choice or visible warning before importing Windows roots, trading setup automation for a narrower trust boundary.
    • Reject core trust import: Keep corporate TLS-interception recovery as manual documentation until a different trust design is approved.

Security
Needs attention: The diff intentionally broadens installer TLS trust in the managed WSL distro and needs explicit maintainer acceptance plus real setup proof.

Review details

Best possible solution:

Land only after maintainers choose the default or opt-in trust policy and the PR body includes redacted current-head setup logs for both enterprise TLS-inspection and normal-network paths.

Do we have a high-confidence way to reproduce the issue?

No high-confidence live reproduction was run in this read-only review. Source inspection shows current main downloads the installer with WSL curl before any CA import, matching the reported corporate TLS-inspection failure mode.

Is this the best way to solve the issue?

Unclear. The stdin/root transactional implementation is a stronger direction than the earlier UNC bundle, but the default trust policy and direct setup proof still need maintainer approval before it is the best merge path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b37b1bef0a0c.

Label changes

Label justifications:

  • P2: This is a normal-priority enterprise setup reliability fix with limited blast radius but real proof and trust-policy blockers.
  • merge-risk: 🚨 security-boundary: The PR changes the managed WSL distro TLS trust store before downloading and executing the CLI installer.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists unit/build validation, but no after-fix real setup run from this head behind TLS inspection or on a normal network; redacted logs or terminal output are still needed before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

Security concerns:

  • [medium] Default Windows root mirroring changes installer TLS trust — src/OpenClaw.SetupEngine/SetupSteps.cs:1391
    The PR imports Windows LocalMachine and CurrentUser root stores into WSL before curl | bash; that may be the right enterprise repair, but it is a security-boundary policy decision rather than a CI-only correctness question.
    Confidence: 0.84

What I checked:

Likely related people:

  • steipete: Authored the current safety rewrite on this PR and recently landed the Windows gateway onboarding wizard that touches setup flow ownership. (role: recent area contributor; confidence: high; commits: f53b48c84bab, adcb4c378f90; files: src/OpenClaw.SetupEngine/SetupSteps.cs, src/OpenClaw.SetupEngine/SetupPipeline.cs)
  • ranjeshj: Git history shows the out-of-process SetupEngine introduction and multiple WSL setup determinism/reliability commits in the central setup files. (role: setup engine feature owner; confidence: high; commits: cefce3952ab1, 98d0760cb5b6, ff3a7cc53736; files: src/OpenClaw.SetupEngine/SetupSteps.cs, src/OpenClaw.SetupEngine/SetupPipeline.cs, src/OpenClaw.SetupEngine/CommandRunner.cs)
  • shanselman: Git history shows several WSL setup reliability commits committed through this person, and current-main blame points to their recent setup/test history in the reviewed checkout. (role: setup history committer; confidence: medium; commits: 4166e0fd63f8, ff3a7cc53736, 98d0760cb5b6; files: src/OpenClaw.SetupEngine/SetupSteps.cs, src/OpenClaw.SetupEngine/SetupPipeline.cs, src/OpenClaw.SetupEngine/CommandRunner.cs)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed June 24, 2026, 10:50 PM ET / 02:50 UTC sha d2fbe02 :: needs real behavior proof before merge. :: [P1] Regenerate the WSL CA store on rollback
  • reviewed 2026-07-05T23:19:48.830Z sha f53b48c :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Jun 25, 2026
jkf87 and others added 2 commits July 5, 2026 23:32
On corporate/enterprise networks a TLS-intercepting proxy injects a
self-signed certificate that WSL Ubuntu's curl does not trust, causing
`install-cli` to fail with exit 60:

  curl: (60) SSL certificate problem: self-signed certificate in
  certificate chain

Fix: add `SyncWindowsCaCertsStep` between `ValidateWslLockdownStep` and
`InstallCliStep` that:

1. Reads the Windows LocalMachine\Root and \CA certificate stores using
   X509Store and serialises them to PEM format.
2. Writes the bundle directly to the WSL distro filesystem via the
   `\wsl$\<distro>\usr\local\share\ca-certificates\` UNC share that
   WSL2 exposes on Windows (no stdin piping required).
3. Runs `update-ca-certificates` as root inside WSL so curl picks up the
   new trust anchors for the install-script download.

The step is intentionally non-fatal: if the Windows cert store cannot be
read, the UNC path is unreachable, or update-ca-certificates warns, the
step logs and continues so non-proxied setups are not affected.
RollbackAsync removes the written bundle file on uninstall.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@steipete
steipete force-pushed the fix/sync-windows-ca-certs-to-wsl branch from d2fbe02 to f53b48c Compare July 5, 2026 23:15
@steipete
steipete merged commit 919a8ce into openclaw:main Jul 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants