Repository navigation
c0mpute edge: https for Moshpit names pointed at c0mpute sites - #31
Merged
Merged
Conversation
bin/moshpit-c0mpute-edge.ts terminates TLS for names whose holders ran `moshcode name c0mpute <name> <site_id>`, with a leaf the Moshpit CA signs for the edge account on first use (key + CSR by openssl, kept on disk, renewed inside the last ten days), and maps https://<name>/path to /s/<site_id>/path on the fastest healthy c0mpute gateway, failing over on refused connections, timeouts and 5xx. Gateways come from C0MPUTE_GATEWAYS seeds and the public node list (`gateway` field), health-checked every minute; the last good list survives a failed discovery. An SNI that is not a c0mpute name never reaches the CA, and a Host that disagrees with the SNI gets 421. Plain http serves the same sites. Tests run real sockets: a fake registry signing with an openssl CA, a broken and a working gateway, and an https client trusting only that CA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This was referenced Nov 9, 2026
ralyodio
added a commit
to profullstack/c0mpute
that referenced
this pull request
Nov 9, 2026
#151) A gateway whose operator set gateway.announce now puts its public origin in its capability ad (`gateway`), and the node board publishes it as `gateway` on /nodes and /api/nodes. Opt-in (nothing without the setting, never in private mode, only with the gateway role), re-validated by the aggregator to a bare http(s) origin with no credentials. This is how a client that is not a libp2p peer (the Moshpit c0mpute edge, profullstack/moshpit-proxy#31) finds gateways to fetch /s/<site>/ from, without a central list. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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
bin/moshpit-c0mpute-edge.ts(+lib/c0mpute-edge.ts,systemd/moshpit-c0mpute-edge.service): the TLS terminator for Moshpit names whose holders ranmoshcode name c0mpute <name> <site_id>(registry side: moshcoder/moshcode#600).Why an edge and not DNS straight at gateways: gateways serve plain HTTP on :7777 with no Moshpit certificate, so
https://<name>cannot work against them in a real browser. The edge is the only hop that needs a cert; nothing on the c0mpute side changes and no c0mpute server is on the path (any gateway serves any site)./api/moshpit/tlds/:tld/certswith its own API key. The registry signs for the edge account only while the holder has the name on c0mpute. One issuance in flight per name; leaves cached on disk (key 0600, written by rename) and renewed in the background inside their last 10 days. An SNI that is not a c0mpute name never reaches the CA.C0MPUTE_GATEWAYSseeds + discovery fromC0MPUTE_NODES_URL(default c0mpute.com/api/nodes,gatewayfield: profullstack/c0mpute PR adds it)./healthzevery minute; fastest first, rotating among equals; a failing gateway backs off 10 s doubling to 5 min; last good list kept when discovery fails.https://<name>/path->/s/<site_id>/path, failover on refused/timeout/5xx, GET/HEAD only, only static-site headers passed back (no Set-Cookie), 421 when Host != SNI, 502 when no gateway answers. Plain http serves the same sites (no redirect, like moshpit-origin.conf).Tests
tests/c0mpute-edge.test.ts, real sockets: fake registry that signs CSRs with an openssl CA, a broken (503) and a working gateway, https client trusting only that CA. Covers serving + path mapping, header filtering, issue-once then disk/memory, no cert (and no CA call) for non-c0mpute names, 421, http GET/HEAD/405/404/400/502, pool discovery/ordering/rotation/back-off, site lookup caching and outage behaviour.Full suite:
node --test tests/*.test.ts107/107.tsc --noEmit: no errors in new files (2 pre-existing errors in tests/reconcile-ca-trigger.test.ts and tests/trust.test.ts, unchanged).Not deployed; it needs its own box/address with 80/443 free (see README).
🤖 Generated with Claude Code