Skip to content

Auto-generated gateway TLS cert lacks subjectAltName, breaks strict-TLS CLI clients #96910

Closed

Description

@RealFlyingToaster

Summary

The gateway's auto-generated self-signed TLS certificate has only a CN (/CN=openclaw-gateway) and no subjectAltName extension. Modern TLS clients (Node ≥17) ignore CN for hostname/IP verification per RFC 6125, so any client probing the gateway by IP or hostname fails with:

Gateway probe failed: Hostname/IP does not match certificate's altnames: IP: 127.0.0.1 is not in the cert's list:

Affected version

OpenClaw 2026.6.10 (also reproduces with any prior cert generated by this code path).

Source

dist/gateway-DJBMYd11.js lines 20–35 invoke openssl req -x509 ... -subj /CN=openclaw-gateway with no -addext "subjectAltName=..." flag.

Reproduction

  1. Fresh install with gateway.tls.enabled=true and gateway.tls.autoGenerate=true (the default).
  2. Run openclaw gateway status — the CLI probes wss://127.0.0.1:18789 and hits the altnames error.
  3. Inspect the generated cert: openssl x509 -in ~/.openclaw/gateway/tls/gateway-cert.pem -noout -ext subjectAltName prints no SAN.

Suggested fix

When generating the cert, add SANs for the bind address(es) plus loopback. Minimum useful set: DNS:localhost,DNS:<hostname>,IP:127.0.0.1,IP:::1 plus any non-loopback bind IPs. Equivalent openssl flag: -addext "subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1,...".

Related issue

The CLI also lacks any built-in trust mechanism for the gateway's own self-signed cert — users must manually set NODE_EXTRA_CA_CERTS to the cert path. Worth considering whether the CLI should auto-trust ~/.openclaw/gateway/tls/gateway-cert.pem for local probes. Happy to file separately if preferred.

Workaround

Regenerate the cert manually:

openssl req -x509 -newkey rsa:2048 -sha256 -days 3650 -nodes \
  -keyout gateway-key.pem -out gateway-cert.pem \
  -subj /CN=openclaw-gateway \
  -addext "subjectAltName=DNS:localhost,DNS:<hostname>,IP:127.0.0.1,IP:::1,IP:<lan-ip>"

…then restart the gateway.

Activity

  1. clawsweeper commented on Jun 26, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 1, 2026, 10:47 PM ET / August 2, 2026, 02:47 UTC.

    Summary
    Keep open for a maintainer security decision: current main still generates a CN-only certificate, although OpenClaw’s local status and supervised probes now pin the known certificate fingerprint instead of depending on hostname verification. The remaining question is whether auto-generated local/dev certificates should also support arbitrary strict hostname-verifying clients, and which identities they may safely assert.

    Reproducibility: yes. source-reproducible: fresh auto-generation invokes OpenSSL with only a CN and no SAN in src/infra/tls/gateway.ts:126. The reported gateway status failure is not established on current main because local loopback WSS probes now use certificate-fingerprint pinning.

    Root-cause cluster
    Relationship: canonical
    Canonical: #96910
    Summary: This issue is the canonical open report for the remaining certificate-identity policy. The related TLS pull requests proposed the same general repair but are all closed unmerged.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Maintainer decision needed

    Question Recommendation
    Should an auto-generated local/dev gateway certificate promise strict hostname verification beyond OpenClaw’s fingerprint-pinned loopback probes, and if so which SAN identities and legacy-certificate rotation policy are acceptable? Add loopback SANs with Doctor migration: Generate only localhost and loopback IP SANs for new pairs, and offer an explicit Doctor repair for recognizable legacy OpenClaw-generated pairs.

    Why: The current OpenClaw local probe is already secured through certificate fingerprint pinning, while adding SANs or replacing existing certificates changes the identity and upgrade trust boundary for external clients.

    Next step
    A focused implementation is feasible only after a maintainer chooses the SAN identity scope and whether legacy generated certificates rotate automatically or through Doctor.

    Security
    Needs attention: The issue concerns a certificate identity boundary: current auto-generated pairs lack SANs, while any broader identity set or legacy rotation must be explicitly bounded.

    Review details

    Best possible solution:

    Keep the fingerprint-pinned loopback probes as the canonical OpenClaw local-client path, then decide whether generated local/dev certificates should additionally carry a narrowly documented loopback SAN set; if yes, rotate only unmistakably OpenClaw-generated legacy pairs through an explicit Doctor repair flow and add real certificate-identity regression coverage.

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

    Yes, source-reproducible: fresh auto-generation invokes OpenSSL with only a CN and no SAN in src/infra/tls/gateway.ts:126. The reported gateway status failure is not established on current main because local loopback WSS probes now use certificate-fingerprint pinning.

    Is this the best way to solve the issue?

    Unclear: SAN generation alone is not necessarily the best solution because the named OpenClaw local-probe path already authenticates by pinned fingerprint; the remaining external-client behavior needs an explicit identity and upgrade policy.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • Adding LAN hostnames or addresses to an automatically generated private certificate broadens the identities that certificate can authenticate and needs an explicit security boundary.
    • Automatically rotating existing CN-only certificates would change the fingerprint used by local pinning and may interrupt clients that persist the old fingerprint.
    • The checkout is a partial clone and its promisor remote could not resolve, preventing a complete older-history provenance pass.

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

    Label changes

    Label justifications:

    • P2: The remaining behavior affects TLS-enabled gateway users and external strict clients, but current local OpenClaw probes have a fingerprint-pinned path.
    • impact:security: The request changes the identity assertions and trust boundary of automatically generated gateway certificates.
    • maturity:stable: The primary owner is the M4 Gateway runtime security-control surface identified by the maturity helper.
    Evidence reviewed

    Security concerns:

    • [medium] Define the generated certificate identity boundary — src/infra/tls/gateway.ts:141
      src/infra/tls/gateway.ts generates a certificate with only CN=openclaw-gateway; adding SANs or rotating existing certificates changes the identities authenticated by an OpenClaw-controlled private key and must preserve operator-provided certificate paths.
      Confidence: 0.96

    What I checked:

    • Current certificate generation: Current main invokes OpenSSL with only /CN=openclaw-gateway and no subjectAltName argument. It generates only when both certificate and key are absent, so existing generated pairs are not rotated by this loader. (src/infra/tls/gateway.ts:126, 5cb0c9df5344)
    • Current local status behavior: Gateway status supplies the local TLS fingerprint only for local loopback WSS targets, avoiding dependence on hostname validation for that built-in probe. (src/commands/gateway-status/probe-run.ts:138, 5cb0c9df5344)
    • Current supervised-probe verification: The supervised health probe disables CA validation only when it has the configured fingerprint, then rejects the response unless the peer fingerprint exactly matches; this is a deliberate local self-signed-certificate trust path. (src/cli/gateway-cli/run.ts:522, 5cb0c9df5344)
    • Tests cover publication, not SAN identities: The TLS tests validate generation staging, atomic publication, private modes, and load behavior, but the inspected generation tests do not assert certificate SAN contents or legacy CN-only rotation. (src/infra/tls/gateway.test.ts:218, 5cb0c9df5344)
    • Feature-history signal: Blame attributes the present TLS generator and local fingerprint-pinning code to the current infrastructure refactor commit; repository history also shows earlier TLS fingerprint hardening. The partial clone could not retrieve older promisor objects after network DNS failure, so origin-level provenance remains incomplete. (src/cli/gateway-cli/run.ts:530, 9f3b44a1417a)
    • Release comparison: Current main is not contained in the latest provided release tag v2026.7.1; the checked-out main is newer, so this review does not claim the current local-probe behavior shipped in that release. (5cb0c9df5344)

    Likely related people:

    • Peter Steinberger: Current blame assigns the TLS generator and the local fingerprint-pinning probe path to the recent infrastructure refactor, and the module’s local history shows repeated contributions from this author. (role: recent area contributor; confidence: medium; commits: 9f3b44a1417a, 759068304ee0; files: src/infra/tls/gateway.ts, src/cli/gateway-cli/run.ts, src/commands/gateway-status/probe-run.ts)
    • miorbnli: Recent history includes the gateway TLS configuration-path repair, which touches the same runtime loader and its regression tests. (role: recent TLS configuration contributor; confidence: medium; commits: 90fb2ee4e184; files: src/infra/tls/gateway.ts, src/infra/tls/gateway.test.ts)
    • Loganaden Velvindron: History identifies this contributor on the TLS minimum-version hardening in the same certificate-loading module. (role: adjacent TLS contributor; confidence: low; commits: a2b00495cdce; files: src/infra/tls/gateway.ts)
    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.
  2. added
    P2Normal backlog priority with limited blast radius.
    impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    and removed
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.
    on Jun 26, 2026
  3. added 6 commits that reference this issue on Jun 26, 2026
    665e8b5
    ae273e4
  4. added
    maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.
    on Jun 28, 2026
  5. added a commit that references this issue on Jul 2, 2026
    36bee13
  6. steipete commented on Oct 24, 2026

    @steipete
    Contributor

    Thanks for filing this. We're closing older issues that no longer look actionable on current main.

    OpenClaw's own status and supervised probes now pin the gateway certificate fingerprint, so the reported gateway probe failure no longer depends on hostname verification. For strict third-party clients, please supply your own certificate with the SANs you need.

    OpenClaw has changed a lot since this was filed. If this still affects you on the latest release, please open a fresh issue with your version and repro steps (feel free to link back here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions