Skip to content

Commit c85fb8c

Browse files
committed
docs(rfc): explain the relay boundary and observability tradeoffs
The feature list said SSH, exec, and file transfer were unavailable without saying why, which read as an implementation gap rather than a structural one. Record the mechanism: RelayOpen targets something 'inside the sandbox', the SSH server exists only in openshell-supervisor-process, and sessions need the workload's PID, mount, and network namespaces -- ssh.rs calls setns to enter the sandbox netns. The sidecar bridge to an abstract socket works only because both processes share a pod. Note that TCP relays are the exception and are recoverable for services bound to 0.0.0.0. Add the observability picture, measured on OpenShift. Network OCSF events, policy config events, and denial analysis all reach 'openshell logs' as usual, because log push is gated on sandbox ID and endpoint rather than topology. What is lost is workload stdout, which now reaches only the container log, and actor attribution on network events, which renders as -(0) because reading /proc across a pod boundary is impossible. Restructure the compatibility tables by concern and record the enforcement mechanism, pods per sandbox, and OpenShift SCC per topology. Signed-off-by: Russell Bryant <rbryant@redhat.com>
1 parent 587db71 commit c85fb8c

1 file changed

Lines changed: 122 additions & 8 deletions

File tree

‎rfc/proxy-pod-topology-DRAFT.md‎

Lines changed: 122 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,24 +439,138 @@ discoverable long-term answer, but it forces a semantic decision — the field i
439439
genuinely inapplicable to topologies where the supervisor is the entrypoint — and
440440
is deferred rather than resolved here.
441441

442+
### Why relays cannot cross the pod boundary
443+
444+
The relay protocol states the constraint directly: `RelayOpen`'s target is
445+
"the target the supervisor should dial **inside the sandbox**." Every
446+
relay-backed capability — SSH, `exec`, port forwarding, file transfer — is a
447+
request to reach into the sandbox and connect to something. Three properties
448+
make that impossible from a separate pod:
449+
450+
- **The SSH server exists only in the process supervisor.** `russh` is a
451+
dependency of `openshell-supervisor-process` and the gateway.
452+
`openshell-supervisor-network`, the only supervisor `proxy-pod` runs, has no
453+
SSH server at all.
454+
- **Sessions must land in the workload's namespaces.** `ssh.rs` spawns PTY
455+
shells and pipe-execs that need the workload's PID, mount, and user
456+
namespaces, and for networking it calls `setns(fd, CLONE_NEWNET)` on a
457+
dedicated thread to enter the sandbox network namespace — otherwise
458+
connections reach the host loopback rather than the sandbox loopback where
459+
services listen. A supervisor in another pod holds none of those namespaces.
460+
- **The `sidecar` bridge does not generalize.** In `sidecar` the network
461+
sidecar owns the gateway session but does not serve SSH itself; it bridges
462+
relays to a Linux abstract socket owned by the process supervisor in the
463+
agent container, verified by peer PID. That works only because both run in
464+
one pod.
465+
466+
SSHing into the supervisor pod would land a shell in the wrong container.
467+
468+
One nuance is worth recording, because it narrows the gap. `RelayOpen` also
469+
carries a `TcpRelayTarget`, used for port forwarding and service exposure, and
470+
that is *not* structurally impossible here: the supervisor pod can dial the
471+
agent pod's IP, since this design restricts agent **egress** and supervisor
472+
**ingress** but leaves agent ingress open. The obstacle is practical rather
473+
than architectural — `connect_in_netns` exists precisely because workloads
474+
usually bind `127.0.0.1`, which is unreachable across pods, so it would work
475+
for services bound to `0.0.0.0` and fail otherwise. The current implementation
476+
rejects all relays uniformly, which is correct and safe; restoring TCP relays
477+
alone is possible later and is the strongest argument for giving
478+
`SupervisorSessionModel` a capability list rather than treating relays as
479+
all-or-nothing.
480+
481+
### Observability
482+
483+
Network-layer observability survives intact; anything requiring visibility
484+
inside the workload's namespaces does not. Log push to the gateway is gated on
485+
the sandbox ID and gateway endpoint rather than on topology, and the proxy pod
486+
has both, so `openshell logs <sandbox>` carries `[sandbox]` lines as usual.
487+
Confirmed on OpenShift:
488+
489+
```text
490+
[sandbox] [OCSF] NET:OPEN [MED] DENIED -(0) -> github.com:443 [engine:opa] [reason:network connections not allowed by policy]
491+
[sandbox] [OCSF] CONFIG:LOADED [INFO] Acknowledged initial policy revision as loaded [version:1]
492+
[sandbox] Flushed denial analysis to gateway proposals=2 summaries=2
493+
```
494+
495+
| Signal | `proxy-pod` |
496+
|---|---|
497+
| `NET:*` allow/deny with policy engine and reason | full |
498+
| `CONFIG:*` policy and inference-route changes | full |
499+
| Activity summaries and denial analysis for the policy advisor | full |
500+
| Gateway-side logs | full |
501+
| Workload stdout/stderr | **container log only** (`kubectl logs`), never `openshell logs` |
502+
| Process and binary attribution on network events | **none** |
503+
| `PROCESS:*`, `SSH:*`, Landlock/filesystem events | **none** |
504+
505+
Two losses deserve emphasis. The workload's own output is no longer captured
506+
by OpenShell at all: the workload is the container's PID 1 and no OpenShell
507+
process shares that pod, so its output reaches only the container log. Anyone
508+
driving OpenShell through the API rather than with cluster access cannot see it.
509+
510+
And network events carry no actor: the denial above reads `-(0)`, an empty
511+
process name and PID 0. Binary-aware attribution requires reading
512+
`/proc/<pid>` across the workload's PID namespace, which a separate pod cannot
513+
do. Operators can therefore answer what was denied but not which process
514+
attempted it, which removes `policy.binaries` as both an enforcement and a
515+
forensic tool.
516+
442517
### Feature availability
443518

519+
#### Enforcement
520+
444521
| Capability | `combined` | `sidecar` | `cni-sidecar` | `proxy-pod` |
445522
|---|---|---|---|---|
446523
| Network endpoint + L7 policy | yes | yes | yes | yes |
524+
| Enforcement mechanism | in-pod nftables | in-pod nftables | node CNI rules | **`NetworkPolicy`** |
447525
| Filesystem policy | yes | partial (Landlock) | partial (Landlock) | **no** |
448526
| Process / binary identity | yes | yes | yes | **no** |
449-
| SSH / `connect` | yes | yes | yes | **no** |
450-
| `exec` | yes | yes | yes | **no** |
451-
| Upload / download / sync | yes | yes | yes | **no** |
527+
| `policy.binaries` matching | yes | yes | yes | **no** — no actor attribution |
452528
| Dynamic provider env injection | yes | yes | yes | **no** |
529+
530+
#### Session and file access
531+
532+
All relay-backed, and all requiring the workload's namespaces:
533+
534+
| Capability | `combined` | `sidecar` | `cni-sidecar` | `proxy-pod` |
535+
|---|---|---|---|---|
536+
| SSH / `connect` | yes | yes | yes | **no** — structurally impossible |
537+
| `exec` | yes | yes | yes | **no** — structurally impossible |
538+
| Upload / download / sync | yes | yes | yes | **no** — structurally impossible |
539+
| Port forwarding / service exposure | yes | yes | yes | **no today** — recoverable for `0.0.0.0` binds |
540+
| Initial command from `sandbox create -- <cmd>` | yes | yes | yes | **no** — use `containers.agent.command` |
541+
542+
#### Observability
543+
544+
| Signal | `combined` | `sidecar` | `cni-sidecar` | `proxy-pod` |
545+
|---|---|---|---|---|
546+
| `NET:*` allow/deny with reason | yes | yes | yes | yes |
547+
| `CONFIG:*` policy and route changes | yes | yes | yes | yes |
548+
| Denial analysis for the policy advisor | yes | yes | yes | yes |
549+
| Workload stdout/stderr in `openshell logs` | yes | yes | yes | **no** — container log only |
550+
| Actor process on network events | yes | yes | yes | **no** — renders as `-(0)` |
551+
| `PROCESS:*` lifecycle events | yes | yes | yes | **no** |
552+
| `SSH:*` events | yes | yes | yes | **no** |
553+
| Landlock / filesystem events | yes | partial | partial | **no** |
554+
555+
#### Operational posture
556+
557+
| Property | `combined` | `sidecar` | `cni-sidecar` | `proxy-pod` |
558+
|---|---|---|---|---|
453559
| Privileged init container | no | **yes** | no | no |
454560
| Added capabilities in sandbox pod | **yes** | no | no | no |
455-
| Requires NetworkPolicy enforcement | no | no | no | **yes** |
456-
457-
The sandbox image's own entrypoint and command determine what runs. This
458-
topology suits batch and autonomous agent workloads that need policy-enforced
459-
egress and never need an interactive session.
561+
| Node-level privileged DaemonSet | no | no | **yes** | no |
562+
| Requires `NetworkPolicy` enforcement | no | no | no | **yes** |
563+
| Pods per sandbox | 1 | 1 | 1 | **2** |
564+
| OpenShift SCC required | `privileged` | custom | custom + `privileged` CNI | **built-in `nonroot-v2`** |
565+
566+
The dividing line is consistent: everything observable or enforceable at the
567+
network boundary survives, and everything needing visibility inside the
568+
workload's namespaces does not. `proxy-pod` suits batch and autonomous agent
569+
workloads that need policy-enforced egress, ship their own long-running
570+
entrypoint, and never need a human on the other end. Operators who want the
571+
interactive workflow *and* low pod privilege should use `cni-sidecar`, which
572+
keeps the full supervisor contract at the cost of a custom SCC and a
573+
node-level DaemonSet. The two are complementary, not competing.
460574

461575
## Implementation plan
462576

0 commit comments

Comments
 (0)