Skip to content

feat(network): support independent bind-tcp restrictions with outbound access - #66

Open
AdamMagued wants to merge 1 commit into
Zouuup:mainfrom
AdamMagued:feat-issue-59-separate-bind-connect-restrictions
Open

AdamMagued wants to merge 1 commit into
Zouuup:mainfrom
AdamMagued:feat-issue-59-separate-bind-connect-restrictions

Conversation

@AdamMagued

Copy link
Copy Markdown

Closes #59

Summary

Decouple LANDLOCK_ACCESS_NET_BIND_TCP from LANDLOCK_ACCESS_NET_CONNECT_TCP when --unrestricted-network is combined with TCP bind restrictions.

Changes

  • Configure Landlock with AccessNetBindTCP only when UnrestrictedNetwork is enabled alongside BindTCPPorts or RestrictBindTCP, leaving AccessNetConnectTCP unhandled so outbound connections remain permitted.
  • Add --restrict-bind-tcp flag to deny all TCP bind attempts when --unrestricted-network is active without specific allowed ports.
  • Add --unrestricted-egress as an alias for --unrestricted-network.
  • Extract BuildLandlockConfig in internal/sandbox and parseSandboxConfig in cmd/landrun for unit testing.
  • Validate TCP port bounds (0-65535) prior to rule construction.

Verification

  • Added unit tests in cmd/landrun/main_test.go and internal/sandbox/sandbox_test.go covering decoupled bind restrictions, explicit bind denials, unrestricted egress, and port range validation.
  • Added integration test cases in test.sh verifying allowed binds, denied binds, and permitted outbound connections under --unrestricted-network.
  • Executed go test ./... -v and go vet ./... in Linux container sandbox.

@Zouuup

Zouuup commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thanks @AdamMagued , happy to merge when conflicts are resolved.

@AdamMagued
AdamMagued force-pushed the feat-issue-59-separate-bind-connect-restrictions branch from fc3296c to 7f54342 Compare October 18, 2026 11:54
@AdamMagued

Copy link
Copy Markdown
Author

Rebased onto main and resolved merge conflicts. Sandbox tests and vet pass cleanly.

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.

Enable bind-tcp network restriction while enabling outgoing network acess

2 participants