Container runner: wildcard-bound host services reachable from containers via host.containers.internal #216
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#216
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Found while validating PR #214 (containerized runner, ADR-0052). ADR-0052 states pasta gives "full egress with no route back to the host's loopback services ... never a host port." That is true only for services bound to the host loopback (
127.0.0.1). A host service bound to a wildcard/LAN address (0.0.0.0) remains reachable from inside a container viahost.containers.internal, which podman's--network=pastamaps by default.This is not a break of the loopback isolation the ADR relies on, and not a merge blocker — filing so we investigate and decide on hardening later.
Why it matters here
lab's own HTTP server runs with
--addr :8080(a wildcard bind — confirmed on the dev host). So a containerized run can reach lab's operator HTTP port athost.containers.internal:8080, and likewise any other0.0.0.0-bound service on the host (a database, metrics endpoint, another daemon).Mitigating factors (why it's not urgent):
/agent/v1) is served on the unix socket only, never on:8080.:8080requires a session cookie; a container has no cookie and the run token (LAB_TOKEN) only authenticates the agent socket. So reaching:8080is low-value.But the surface is wider than the ADR claims, and it depends on what else the operator runs on
0.0.0.0.Evidence (reproduced with podman's faithful default pasta args)
Faithful arg set:
--config-net --dns-forward 169.254.1.1 -t none -u none -T none -U none --no-map-gw --map-guest-addr 169.254.1.2. From inside the netns, against host services:127.0.0.1:PORT(guest loopback)127.0.0.1<gateway>:PORT127.0.0.1--no-map-gw)host.containers.internal:PORT127.0.0.1host.containers.internal:PORT0.0.0.0Mechanism: podman always appends
--map-guest-addr 169.254.1.2forhost.containers.internal; per the pasta(1) man page it maps to the host's global address (not loopback).--no-map-gw(podman default) is what blocks the loopback path.Possible mitigations to evaluate
--map-guest-addr noneto the pane argv (internal/podmanx/podmanx.goRunArgv) to drop thehost.containers.internalmapping entirely — the container has no need for it (it reaches lab via the mounted unix socket).127.0.0.1on hosts where the container runner is enabled (and document that co-located services should too), relying on the reverse proxy for external access.Notes
main/v5.8.x vendoredlibnetwork/pastaand the pasta(1) man page; reproduced with nixpkgspasston the dev host (rootless podman is not yet installed there).