headscale icon indicating copy to clipboard operation
headscale copied to clipboard

Add support for autoApprovers ACL

Open tsujamin opened this issue 2 years ago • 3 comments

  • [X] read the CONTRIBUTING guidelines
  • [x] raised a GitHub issue or discussed it on the projects chat beforehand
  • [X] added unit tests
  • [ ] added integration tests
  • [ ] updated documentation if needed
  • [ ] updated CHANGELOG.md

I've patched in support for AutoApprovers for exit nodes and subnets per https://tailscale.com/blog/auto-approvers/

The behaviour of the code is (currently)

  • Support auto-approving nodes that advertise subnets or exit status by tag, group or namespace
  • Advertised routes can be auto-approved by a overarching autoApproved route (e.g. advertised route 10.10.0.0/16 would be enabled if the node matched autoApproved route 10.0.0.0/8)
  • EnableAutoApprovedRoutes is called in protocol_common_poll.go!handlePollCommon, although I'm not 100% sure if this is the appropriate place within headscale

Let me know what you think, happy to tweak as far as my limited go skills allow

tsujamin avatar Aug 24 '22 12:08 tsujamin

@tsujamin can you update the PR to fix the conflict and replace inet.af/netaddr with net/netip?

juanfont avatar Sep 04 '22 13:09 juanfont

merged and refactored

tsujamin avatar Sep 06 '22 10:09 tsujamin

linting issues fixed

tsujamin avatar Sep 07 '22 11:09 tsujamin

awesome - I can add a test like that but since the underlying logic relied on the same expandAlias logic I ommited it for now.

do you want me to do the change-log or is that something the maintainers do as a rollup?

tsujamin avatar Sep 23 '22 07:09 tsujamin

awesome - I can add a test like that but since the underlying logic relied on the same expandAlias logic I ommited it for now.

do you want me to do the change-log or is that something the maintainers do as a rollup?

You can add the changelog.

kradalby avatar Sep 23 '22 07:09 kradalby

I've added the changelog - just noting though that there's a merge conflict between this and #767 so #767 would need to be merged first, then I can make the small change to a failing test here

tsujamin avatar Sep 23 '22 08:09 tsujamin