policy: add App Connector support#2987
Conversation
|
@matanbaruch, have you tested the functionality of this patch set? After applying the patches, I tagged an app connector node, enabled the app connector in tailscaled, published a connector domain within my tailscale policy, however |
Implement App Connector functionality for Headscale, allowing nodes to advertise as app connectors and receive domain-based routing configuration from the control plane. This addresses issue juanfont#1651. Changes: - Add `appConnectors` field to Policy struct for defining app connector configurations in ACLs - Parse app connector configuration including name, connectors (tags or "*"), domains (with wildcard support), and optional routes - Add validation for app connector configuration (domains, tags, etc.) - Add `AppConnectorConfigForNode` method to PolicyManager to get matching configurations for nodes advertising as app connectors - Update mapper to add `tailscale.com/app-connectors` capability to CapMap in MapResponse for nodes advertising as app connectors - Add comprehensive unit tests for app connector functionality Example ACL configuration: ```json { "tagOwners": { "tag:connector": ["user@example.com"] }, "appConnectors": [ { "name": "Internal Apps", "connectors": ["tag:connector"], "domains": ["internal.example.com", "*.corp.example.com"], "routes": ["10.0.0.0/8"] } ] } ``` Closes juanfont#1651 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add App Connectors section to docs/ref/acls.md with configuration examples - Add App Connectors to feature list in docs/about/features.md - Add CHANGELOG.md entry for App Connector support - Add integration tests for app connector functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…r tests - Set DOCKER_API_VERSION to 1.44 if not already defined to maintain compatibility with newer Docker daemons. - Update app connector tests to use netip.Prefix for route definitions and improve validation checks for netmap and capability maps. - Refactor assertions in tests for better clarity and consistency. This enhances the reliability of integration tests and ensures proper interaction with Docker APIs.
Hey @m3wt, yes I've tested this locally and the app connector capability is working correctly. Make sure you're using a tagged pre-auth key (not a regular one) - the node must have tag:connector for the policy to match. |
|
@kradalby Is is possible to get this test running? |
- Added tests for App Connector Basic, Non-Matching Tag, and Wildcard Connector to enhance coverage. - Improved assertions in existing tests to ensure proper validation of node capabilities and tags. - Minor formatting adjustments in test files for better readability. These changes aim to strengthen the integration testing framework for app connectors.
|
@kradalby Re-run? :) |
- Added whitespace for better readability in the TestAppConnectorBasic and TestAppConnectorWildcardConnector functions. - These minor formatting adjustments enhance the clarity of the test code without altering functionality.
|
@kradalby I think we are ready. Re-run :) |
|
Seems like it's hanging, you might need to close and reopen |
Implement App Connector functionality for Headscale, allowing nodes to advertise as app connectors and receive domain-based routing configuration from the control plane. This addresses issue #1651.
Changes
Core Implementation
appConnectorsfield to Policy struct for defining app connector configurations in ACLsAppConnectorConfigForNodemethod to PolicyManager to get matching configurations for nodes advertising as app connectorstailscale.com/app-connectorscapability to CapMap in MapResponse for nodes advertising as app connectorsTests
hscontrol/policy/v2/appconnector_test.go)integration/appconnector_test.go):TestAppConnectorBasic: Tests tagged nodes receive app connector configurationTestAppConnectorNonMatchingTag: Tests non-matching tags are excludedTestAppConnectorWildcardConnector: Tests wildcard connector matchingDocumentation
docs/ref/acls.mdwith configuration examplesdocs/about/features.mdExample ACL Configuration
{ "tagOwners": { "tag:connector": ["user@example.com"] }, "appConnectors": [ { "name": "Internal Apps", "connectors": ["tag:connector"], "domains": ["internal.example.com", "*.corp.example.com"], "routes": ["10.0.0.0/8"] } ] }How It Works
tailscale set --advertise-connector) will receive the domain configurationCloses #1651