Skip to content

feat(sockforward): support private guest-owned UDS listeners - #316

Merged
dmcgowan merged 2 commits into
containerd:mainfrom
austinvazquez:feat/private-guest-uds
Oct 23, 2026
Merged

dmcgowan merged 2 commits into
containerd:mainfrom
austinvazquez:feat/private-guest-uds

Conversation

@austinvazquez

@austinvazquez austinvazquez commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Why

A container can forward a host Unix socket into a Nerdbox VM, but a non-root process may not be able to connect to the listener created inside the VM. This prevents workloads such as SSH-agent clients from using the forward without privileged startup steps.

What this changes

  • For a uds mount, callers can opt in with numeric uid and gid options. The shim requests mode 0600 and the guest sets the socket's owner and permissions before publishing the listener and starting the container. The guest rejects unsupported modes or reserved ownership values before binding any sockets.
  • Mounts without requested ownership send mode 0 and retain the existing listener behavior. The shim and guest versions are coupled; this does not add a System.Info capability probe for older guests.
  • The private listener is staged in a protected directory and published with rename. Duplicate-listener preflight, rollback, and identity-aware cleanup protect active or replaced socket paths.
  • Connections continue through Nerdbox's forwarder. The raw host socket is not mounted into the container, and its permissions are unchanged.

Validation

  • Tests cover mount option parsing, mode propagation, private ownership and permissions, legacy mode, invalid requests, stale-socket replacement, rollback, duplicate listeners, and cleanup.
  • Project Checks, unit tests, protobuf, lint, build, fuzz, and integration checks are passing on the PR.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 20:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Reserved UID/GID values can silently leave ownership unchanged while the permission-aware RPC reports success.

1 open issue
2 files not reviewed
  • api/services/socketforward/v1/socketforward.pb.go: Generated file
  • api/services/socketforward/v1/socketforward_ttrpc.pb.go: Generated file
What changed in this PR

Adds private, guest-owned UNIX socket forwarding across the shim and VM boundary.

Changes:

  • Adds UID/GID mount options and a permission-aware RPC.
  • Creates private listeners with ownership, rollback, and cleanup handling.
  • Fixes relay watcher leaks and adds regression tests.
File Description
internal/​vminit/​socketforward/​socketforward.go Implements private listeners and cleanup.
internal/​vminit/​socketforward/​socketforward_test.go Tests permissions, compatibility, and rollback.
internal/​shim/​task/​socketforward.go Parses ownership options, selects RPC, and fixes watcher cleanup.
internal/​shim/​task/​socketforward_test.go Tests ownership options and relay completion.
api/​services/​socketforward/​v1/​socketforward.pb.go Updates generated ownership fields.
api/​services/​socketforward/​v1/​socketforward_ttrpc.pb.go Adds generated permission-aware RPC bindings.
api/​proto/​nerdbox/​services/​socketforward/​v1/​socketforward.proto Defines ownership fields and RPC.
api/​next.txtpb Updates the API descriptor snapshot.

Review effort: Balanced

Comment thread internal/vminit/socketforward/socketforward.go
Copilot AI balanced review requested due to automatic review settings October 20, 2026 20:33
@austinvazquez
austinvazquez force-pushed the feat/private-guest-uds branch from 4475e43 to fe6d43e Compare October 20, 2026 20:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Aliased RPC socket paths can bypass duplicate protection and disrupt an existing forward.

1 open issue
1 resolved since last review
2 files not reviewed
  • api/services/socketforward/v1/socketforward.pb.go: Generated file
  • api/services/socketforward/v1/socketforward_ttrpc.pb.go: Generated file

Review effort: Balanced

Comment thread internal/vminit/socketforward/socketforward.go Outdated
@austinvazquez
austinvazquez force-pushed the feat/private-guest-uds branch from fe6d43e to 0b08d28 Compare October 20, 2026 21:37
Copilot AI balanced review requested due to automatic review settings October 20, 2026 21:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The capability test exceeds macOS Unix-socket path limits, breaking the macOS unit-test job.

1 open issue
1 resolved since last review
2 files not reviewed
  • api/services/socketforward/v1/socketforward.pb.go: Generated file
  • api/services/system/v1/info.pb.go: Generated file

Review effort: Balanced

Comment thread internal/shim/task/socketforward_capability_test.go Outdated
@austinvazquez
austinvazquez force-pushed the feat/private-guest-uds branch from 0b08d28 to 2640dd4 Compare October 21, 2026 00:01
Copilot AI balanced review requested due to automatic review settings October 21, 2026 00:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Privileged socket publication warrants human security review, and the protobuf-copy issue remains unresolved.

1 open issue
1 resolved since last review
2 files not reviewed
  • api/services/socketforward/v1/socketforward.pb.go: Generated file
  • api/services/system/v1/info.pb.go: Generated file

Review effort: Balanced

Comment thread internal/shim/task/socketforward_capability_test.go Outdated
@austinvazquez
austinvazquez force-pushed the feat/private-guest-uds branch from 2640dd4 to ff9bd8f Compare October 21, 2026 00:23
Copilot AI balanced review requested due to automatic review settings October 21, 2026 00:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No blocking issues were identified in ownership handling, compatibility checks, or listener cleanup.

No open issues 🎉

1 resolved since last review
2 files not reviewed
  • api/services/socketforward/v1/socketforward.pb.go: Generated file
  • api/services/system/v1/info.pb.go: Generated file

Review effort: Balanced

@austinvazquez
austinvazquez marked this pull request as ready for review October 21, 2026 00:33
Comment thread internal/shim/task/socketforward.go Outdated
Comment thread api/proto/nerdbox/services/socketforward/v1/socketforward.proto Outdated
Comment thread api/proto/nerdbox/services/system/v1/info.proto Outdated
Comment thread internal/vminit/socketforward/socketforward.go Outdated
Copilot AI balanced review requested due to automatic review settings October 22, 2026 13:36
@austinvazquez
austinvazquez force-pushed the feat/private-guest-uds branch from ff9bd8f to 6ffa472 Compare October 22, 2026 13:36
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
@austinvazquez
austinvazquez force-pushed the feat/private-guest-uds branch from 6ffa472 to fcc4de1 Compare October 22, 2026 13:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Older guests can silently accept private socket requests without applying the requested ownership or permissions.

1 open issue
1 file not reviewed
  • api/services/socketforward/v1/socketforward.pb.go: Generated file

Review effort: Balanced

Comment thread internal/shim/task/socketforward.go
@dmcgowan
dmcgowan merged commit 3ce72d9 into containerd:main Oct 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants