Skip to content

Post-hoc port publish on msb via ssh serve + ssh -L (gap K) #238

Closed

Description

@mogul

Post-hoc port publishing on msb — expose a port on an already-running sandbox without a re-create — via msb ssh serve + OpenSSH -L local forwarding, wired behind acq ports <sandbox> --publish H:G. This closes the last port-capability gap vs. sbx (sbx ports … --publish) and lets acq ports do something on msb instead of printing "re-create the sandbox." Design: ADR-0015.

Why

msb --tree (msb 0.6.7) confirms msb has no post-hoc NAT publish (only create/run-time -p), but does have msb ssh serve <sandbox> — a host-side SSH listener against a running sandbox — over which OpenSSH -L/-D forwarding tunnels a guest port to the host with no restart. ADR-0014 deliberately left this out of scope (create-time -p only); this is the incremental follow-on.

Scope

  • Wire acq_backend_ports (msb) to: authorize an acq-managed key once (msb ssh authorize), start msb ssh serve --host 127.0.0.1 --port <ephemeral>, open a backgrounded ssh -L 127.0.0.1:H:127.0.0.1:G.
  • Flip ACQ_BACKEND_SUPPORTS_PORT_FORWARD=1 on msb and correct its rationale comment.
  • Track and tear down the serve/ssh process pair on acq rm/stop.
  • Validate H/G (1..65535, integer) before argv (reuse ADR-0014's validation).

Caveats (from the tree)

  • Forwarded connections originate inside the guest, so 127.0.0.1 in the -L destination is the sandbox's loopback, not the host's.
  • Sandbox network policy still applies; reverse (-R) and stream-local forwarding are unsupported.
  • Listener binds loopback by default; binding beyond 127.0.0.1 is opt-in and out of scope here.
  • Uses a dedicated acq-managed key (not the user's personal key).

Verification

Live end-to-end (acq ports against a running msb sandbox, then curl the host port) requires a KVM host and runs via scripts/verify-backends, per ADR-0011 (no nested sandboxes).

Related

AI-assisted (OpenCode); requires human review.

Activity

  1. added
    epicParent tracking issue coordinating multiple child issues
    and removed
    epicParent tracking issue coordinating multiple child issues
    on Jul 29, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions