feat: add blockAllOutbound option to block guest-initiated connections #600
+20
−4
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.
Summary
Add new configuration option
blockAllOutboundthat blocks all guest-initiated outbound TCP/UDP connections at the network layer, while preserving host-to-guest port forwarding.Problem
DNS whitelist filtering (#599) blocks domain resolution for unauthorized domains, but guests can still connect to hardcoded IP addresses (e.g.,
curl http://93.184.216.34). This is a security gap for sandboxed environments that require true network isolation.Solution
When
blockAllOutbound: true, the TCP and UDP forwarders reject all guest-initiated outbound connections before they reachnet.Dial(). This provides defense-in-depth alongside DNS filtering.Use Cases
What Still Works vs What's Blocked
blockAllOutbound: falseblockAllOutbound: trueCombined with DNS Filtering (#599)
For maximum isolation, combine both features:
This ensures:
Implementation
pkg/types/configuration.go- AddBlockAllOutbound boolfieldpkg/services/forwarder/tcp.go- Early return when flag is truepkg/services/forwarder/udp.go- Early return when flag is truepkg/virtualnetwork/services.go- Pass flag to forwardersTest Plan
Forwardsconfig🤖 Generated with Claude Code