Repository navigation
feat(e2b): builds and built templates reach the network through their source pool's proxy - #78
Merged
Merged
Conversation
… source pool's proxy A claim now reports its net_route and can carry egress false. When a claim relays through the node's egress proxy, a build starts its steps with the proxy variables silkd's unit sets, so RUN steps download through the proxy and the template keeps them as defaults, and a pool-image create hands them to envd under the request's envVars: envd builds a child's environment only from its defaults and the request. allow_internet_access false now claims any create with egress off, and a built template no longer refuses true.
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
Builds and built templates reach the network through the guarded egress proxy of their source pool, and a pool-image create's processes use that proxy too. This needs sandboxd cocoonstack/sandbox@dcffdec or later: a promoted template's clone takes its source pool's policy, and the claim reports
net_routeand acceptsegress: false.General packages (no e2b concept):
pkg/sandboxd:ClaimSpec.Egress *boolandClaimResult.NetRoute, plusNetRouteRelay.pkg/scale:ClaimOptions.NoEgressandAssignment.NetRoute, so the route reaches the caller and the opt-out reaches the node.e2b
/initdefaults and the request. It never reads its unit's environment (e2b-dev/infrapackages/envd/internal/services/process/handler/handler.go). So when a claim reportsrelay, this surface hands envd the variables silkd's unit sets:http_proxyandhttps_proxyhttp://127.0.0.1:3128,no_proxylocalhost,127.0.0.1,::1,169.254.169.254. It hands them to envd at three points:RUNstep (root ones included) goes through the proxy. The final tokenless/initstores them as the template's defaults. AnENVstep can override them./initcarries them under the request's ownenvVars, so a caller's value wins.GET /envsmerge.directornoneroute sets nothing.allow_internet_access: falsenow claims any create withegress: false, a built template's or a pool image's.trueor unset claims as before (true still picks the egress lane for a pool image). A built template no longer answers400fortrue.e2b-rt/e2b-cipools;sudosteps drop the variables, so package installs run as root;Kit rows
Two-node kit, sandboxd dcffdec on both hosts. The
e2b-rtande2b-cinone pools were given the package-index allow-list from the docs. Curl runs inside the guest through envd'scommands.run.pypi.org/example.com,https_proxyin the process env000 403, set000 403, setTemplate.buildfrom e2b-ci withRUN /opt/python/bin/pip install pyjokes(not in the image)Successfully installed pyjokes-0.8.3, 4.0 simport pyjokes+requests.get(pypi), curl allowed / deniedpyjokes 200, 200 /000 403allow_internet_access=false000 000both (no proxy behind the relay)allow_internet_access=false000 000both, no proxy variablesUnchanged on this head:
Hot path
A pool-image create on a relay route adds one small map clone (three entries plus the request's) before the
/initit already makes. Any other route adds nothing.Create→201 A/B, a6a86a5 (
d3c) against this PR (a2), interleaved with the order swapped, p50 of 15 creates each:No shift.
Tests
TestStoreClaim_RoutesToAWarmNode: the route rides the assignment back, andNoEgresssendsegress: false.TestARelayedBuildSeedsItsStepsWithTheProxyEnvironment: relay seeds both the RUN env and the/initdefaults; none seeds neither.TestARelayedCreateHandsEnvdTheProxyUnderTheRequestEnvs: relay, none and direct; a request'sno_proxywins;allow_internet_access=falsesets the opt-out on a pool image.TestARelayedBuildLeavesTheProxyInTheTemplateDefaults.TestACreateNamingABuiltTemplateClaimsItsKey: true is a plain claim, false is the opt-out.Gates: lint 8× "0 issues.", fmt-check,
asl -forwarder=falseon both GOOS, tidy, tagged vet, race over all packages, helm lint.Size