mirror of
https://github.com/juanfont/headscale.git
synced 2026-01-11 20:00:28 +01:00
No support for "autogroup:" in ACL rules #280
Closed
opened 2025-12-29 01:25:53 +01:00 by adam
·
29 comments
No Branch/Tag Specified
main
update_flake_lock_action
gh-pages
kradalby/release-v0.27.2
dependabot/go_modules/golang.org/x/crypto-0.45.0
dependabot/go_modules/github.com/opencontainers/runc-1.3.3
copilot/investigate-headscale-issue-2788
copilot/investigate-visibility-issue-2788
copilot/investigate-issue-2833
copilot/debug-issue-2846
copilot/fix-issue-2847
dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.4.0
dependabot/go_modules/github.com/docker/docker-28.3.3incompatible
kradalby/cli-experiement3
doc/0.26.1
doc/0.25.1
doc/0.25.0
doc/0.24.3
doc/0.24.2
doc/0.24.1
doc/0.24.0
kradalby/build-docker-on-pr
topic/docu-versioning
topic/docker-kos
juanfont/fix-crash-node-id
juanfont/better-disclaimer
update-contributors
topic/prettier
revert-1893-add-test-stage-to-docs
add-test-stage-to-docs
remove-node-check-interval
fix-empty-prefix
fix-ephemeral-reusable
bug_report-debuginfo
autogroups
logs-to-stderr
revert-1414-topic/fix_unix_socket
rename-machine-node
port-embedded-derp-tests-v2
port-derp-tests
duplicate-word-linter
update-tailscale-1.36
warn-against-apache
ko-fi-link
more-acl-tests
fix-typo-standalone
parallel-nolint
tparallel-fix
rerouting
ssh-changelog-docs
oidc-cleanup
web-auth-flow-tests
kradalby-gh-runner
fix-proto-lint
remove-funding-links
go-1.19
enable-1.30-in-tests
0.16.x
cosmetic-changes-integration
tmp-fix-integration-docker
fix-integration-docker
configurable-update-interval
show-nodes-online
hs2021
acl-syntax-fixes
ts2021-implementation
fix-spurious-updates
unstable-integration-tests
mandatory-stun
embedded-derp
prtemplate-fix
v0.28.0-beta.1
v0.27.2-rc.1
v0.27.1
v0.27.0
v0.27.0-beta.2
v0.27.0-beta.1
v0.26.1
v0.26.0
v0.26.0-beta.2
v0.26.0-beta.1
v0.25.1
v0.25.0
v0.25.0-beta.2
v0.24.3
v0.25.0-beta.1
v0.24.2
v0.24.1
v0.24.0
v0.24.0-beta.2
v0.24.0-beta.1
v0.23.0
v0.23.0-rc.1
v0.23.0-beta.5
v0.23.0-beta.4
v0.23.0-beta3
v0.23.0-beta2
v0.23.0-beta1
v0.23.0-alpha12
v0.23.0-alpha11
v0.23.0-alpha10
v0.23.0-alpha9
v0.23.0-alpha8
v0.23.0-alpha7
v0.23.0-alpha6
v0.23.0-alpha5
v0.23.0-alpha4
v0.23.0-alpha4-docker-ko-test9
v0.23.0-alpha4-docker-ko-test8
v0.23.0-alpha4-docker-ko-test7
v0.23.0-alpha4-docker-ko-test6
v0.23.0-alpha4-docker-ko-test5
v0.23.0-alpha-docker-release-test-debug2
v0.23.0-alpha-docker-release-test-debug
v0.23.0-alpha4-docker-ko-test4
v0.23.0-alpha4-docker-ko-test3
v0.23.0-alpha4-docker-ko-test2
v0.23.0-alpha4-docker-ko-test
v0.23.0-alpha3
v0.23.0-alpha2
v0.23.0-alpha1
v0.22.3
v0.22.2
v0.23.0-alpha-docker-release-test
v0.22.1
v0.22.0
v0.22.0-alpha3
v0.22.0-alpha2
v0.22.0-alpha1
v0.22.0-nfpmtest
v0.21.0
v0.20.0
v0.19.0
v0.19.0-beta2
v0.19.0-beta1
v0.18.0
v0.18.0-beta4
v0.18.0-beta3
v0.18.0-beta2
v0.18.0-beta1
v0.17.1
v0.17.0
v0.17.0-beta5
v0.17.0-beta4
v0.17.0-beta3
v0.17.0-beta2
v0.17.0-beta1
v0.17.0-alpha4
v0.17.0-alpha3
v0.17.0-alpha2
v0.17.0-alpha1
v0.16.4
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.16.0-beta7
v0.16.0-beta6
v0.16.0-beta5
v0.16.0-beta4
v0.16.0-beta3
v0.16.0-beta2
v0.16.0-beta1
v0.15.0
v0.15.0-beta6
v0.15.0-beta5
v0.15.0-beta4
v0.15.0-beta3
v0.15.0-beta2
v0.15.0-beta1
v0.14.0
v0.14.0-beta2
v0.14.0-beta1
v0.13.0
v0.13.0-beta3
v0.13.0-beta2
v0.13.0-beta1
upstream/v0.12.4
v0.12.4
v0.12.3
v0.12.2
v0.12.2-beta1
v0.12.1
v0.12.0-beta2
v0.12.0-beta1
v0.11.0
v0.10.8
v0.10.7
v0.10.6
v0.10.5
v0.10.4
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.1
v0.8.0
v0.7.1
v0.7.0
v0.6.1
v0.6.0
v0.5.2
v0.5.1
v0.5.0
v0.4.0
v0.3.6
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.2
v0.2.1
v0.2.0
v0.1.1
v0.1.0
Labels
Clear labels
CLI
DERP
DNS
Nix
OIDC
SSH
bug
database
documentation
duplicate
enhancement
faq
good first issue
grants
help wanted
might-come
needs design doc
needs investigation
no-stale-bot
out of scope
performance
policy 📝
pull-request
question
regression
routes
stale
tags
tailscale-feature-gap
well described ❤️
wontfix
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/headscale#280
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nicka101 on GitHub (Jun 20, 2022).
Bug description
The 2 recent beta releases for 0.16.0 reference the tailscale ACL documentation here, however headscale doesn't support the autogroup:members and autogroup:self functionality referenced there. I would guess it additionally doesn't support the autogroup:internet or autogroup:shared functionality, but I havent tested those
To Reproduce
Attempt to use similar rules to those in the example policy file in the tailscale's ACL documentation or use the recommended initial ACL from tailscale's ACL samples
Observe that headscale constantly logs:
WRN No IPs found with the alias autogroup:membersWRN No IPs found with the alias autogroup:selfAnd also that with the recommended initial ACL, no devices can see or access each other
Context info
@Patralos commented on GitHub (Jun 25, 2022):
Support for
autogroup:internetwould be great +1@mirkosemler commented on GitHub (Jun 27, 2022):
As i am currently also testing this:
The ACL System on Tailscale is for commercial reasons centered around payable named user nodes to manage Tags and Group-Memberships including binding non-named users with autogroup:members to the least privileged group, maybe Users.
for correct headcale acls see:
https://github.com/juanfont/headscale/blob/main/docs/acls.md
for tailscale see:
https://tailscale.com/kb/1018/acls/
given:
autogroup:members # unique namespaces/users
autogroup:internet # unique nodes who export route 0/0
autogroup:self # user self reference
autogroup:shared # foreign user
my result:
things could be done with a serverside toolset to resolve:
autogroup:internet expands to 1 rule per node who provides the route 0/0
autogroup:self expands to 1 rule per user having himself in src and dest.
therefore they are not easy to derive from headscale shell commands.
go serverside autogroup. lets not have this feature with bash scaping and cron.
@restanrm commented on GitHub (Aug 4, 2022):
For
autogroup:membersandautogroup:sharedI think that this have currently no possible meaning in headscale. Since we cannot federate headscale instances. When/if we do this we would implement this feature.For
autogroup:selfit has some sense that should even simplify the documentation since we added each user their own name to access their devices. For this feature, it doesn't seem as easy as adding the username but close to it.For
autogroup:internetsome hacks has been presented on discord based on https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator/. Should we build a list of excluded network that cannot be a private network or routed through headscale in this section ? For IPv4 I can propose the following list of disallowed networks:For IPv6, the list of disallowed networks could be :
These 2 lists have been built based on https://en.wikipedia.org/wiki/Reserved_IP_addresses
Is this the best way to handle outgoing traffic ?
@kradalby, @juanfont any thoughts on this ?
@mirkosemler commented on GitHub (Aug 9, 2022):
I disagree on the federation. the oidc section has allowed domains, allowed users and a domain hint. if we have a list of member domains the oidc system (i.e. keycloak ) cloud provide access for a defined list of joinable domains and headscale could distinguish them according to the list of member domains, the rest would default to being shared access.
the user federation on keycloak implies the consumption of ldap or AD, besides also providing the ability to derive login grants from multiple identity providers to one source, in my case headscale. have skipped the part where i connect my google account, because its already implemented in the adroid client, so i know it works, but it strongly seems to me that headscale does not care about multiple origins providing oidc scopes (address, email, phone, profile, ...) it accepts the 4 default values defined in config.yml.
keyclaok should be able to do the federation.
if headscale is able to provide autogroup:shared and autogroup:member by definition of a member domain list for use with full username@domain.tld list we approach feature parity with tailscale ACLs by having a more powerful (less text) definition of access rules. headscale already provides a great feature set for identity aware distributed firewalling towards zero trust by deriving its namespaces from oidc. distinguishing the domains in the namespaces by shared/member list is a premium feature and it should be fairly easy.
please consider.
@restanrm commented on GitHub (Aug 11, 2022):
I guess that we have different views on federation. For me it means merging 2 different instances of headscale. I have this definition because currently an headscale network is the equivalent of a tailnet. You cannot have 2 different sets of ACL's on a single headscale instance.
Although I'm not ok with the definition of the federation and do not fully understand what you mean because I don't know keycloak (and oidc) well, I can see something interesting. If I understand what you mean (@mirkosemler) the
allowed_domainswould not refuse users from other domains in this kind of configuration but just handle them as shared users ?Improving on this we could also use the OIDC groups to be mapped in the ACL's in order to reduce the “text definition” and have dynamic configuration base on the authentication provider. This is something that I would like very much, it's quite painful to edit the ACL's each time we want to add (or remove) someone to a team.
@TakahashiAmaki commented on GitHub (Sep 9, 2022):
currently, we cloud not use api to update acl rules online, so i thought
autogroup:members/autogroup:selffor each new namespace could see their own devices is necessary@linsomniac commented on GitHub (Feb 26, 2023):
What I'm looking for is "src: group:devs; dst: autogroup:self", where in this case "autogroup:self" means "the same user (used to be namespace) as the src". Meaning: Users in group "devs" are connecting to their own boxes. IOW, If have have alice, bob, and charlie in devs, the rule would match src=alice;dst=alice, src=bob;dst=bob, etc...
@linsomniac commented on GitHub (Feb 26, 2023):
TL;DR: I propose a definition of "autogroup:self" and ask for review of proposed solution. @kradalby and @juanfont are likely reviewers.
I've taken a look at the code, and I think it's becoming a little clearer for me.
Aside: After some research I believe that "autogroup:members" is the equivalent of a group with all users in it, but with all tagged nodes removed. I'm not dealing with that here however. BUT, I do believe it means that headscale needs to not consider tagged nodes a member of any group. I believe headscale does this as well.
First, we need to define what "autogroup:self:ports" means in the dst. I'm going to propose, after a shockingly large amount of time thinking it over, that it follows these rules:
Yes, this could lead to some nonsensical rules, in particular if a host is listed in the source. Note: It doesn't look like subnets can be listed in the source. That seems reasonable.
A reasonable question is: Does this match tailscale's definition? I have no idea, I can't find it well documented. Do we have to match their implementation? Not necessarily. It's hard to match it when I can't find it documented. We could take a stab at it and fix it when discrepancies are found, though that would break some users. We could call it something else ("autogroup:reflect"? "autogroup:reverseuno"?). The only examples I've seen are of it being used with "autogroup:members", so I have no idea if it's usable with anything else.
I believe, to implement "autogroup:self", this is what needs to happen:
To clarify:
@anuragbhatia commented on GitHub (May 23, 2023):
autogroup:internet will be good to have. I don't see a way to "deny" traffic. Tried both action "action": "reject" and "action": "deny" but syntax does not support it.
The problem this creates is similar to use case described here: I want to give access to exit nodes for internet to some users without exposing internal IPs.
In regular firewall I will do something like:
rule1: deny traffic to RFC1918 private IPs for tag: family
rule2: allow traffic to 0.0.0.0/0, ::/0 to tag:family
but since rule1 is not possible, I am using following as workaround:
The list of IPs is certainly long and ugly. Plus don't see it supporting IPv6 in this syntax.
@RUzOfuz5m commented on GitHub (May 26, 2023):
@anuragbhatia Thank you for that!
Your dest has "64.0.0.0/2:*" which includes 100.64.X.X. This gave access to all my nodes as I kept the default range (100.64.0.0). I changed mine to exclude this range and that fixed the problem.
I used the following commands to exclude some popular internal ranges.
@julianq commented on GitHub (Jun 30, 2023):
@anuragbhatia @RUzOfuz5m
Amazing. GOAT status for both of you.
@wernerhoffman commented on GitHub (Jul 8, 2023):
Hey, thanks for the effort!
Could anyone please explain to me how those
netmaskcommands are used?I know this is not a support forum, but discord won't allow me an account.
As I am understanding their output can be used in place of
autogroup:internet(which is quite handy because this is only supported by tailscale, not headscale).Because this is crucial to my network's functionality I would like to be sure I understand those commands correctly, so why do you use the commands you use?
How to I instruct
netmask (1)to generate all ranges except for some (RFC1918) IPs?@wernerhoffman commented on GitHub (Jul 9, 2023):
Ah, I understood the structure of the command. Here an explanation for all those that come after me:
Starting with
0.0.0.0you givenetmaska range until the network you want to exclude starts. In this case we givenetmaskthe range0.0.0.0:9.255.255.255because 9.255.255.255 is the last IP coming before being in10.0.0.0/8which is the first network we want to exclude.The first IP after
10.0.0.0/8network is11.0.0.0. This is why the next range starts with that.From there it's the same procedure for each network we want to exclude.
From 223.255.255.255 forward all IPs are reserved.
@github-actions[bot] commented on GitHub (Dec 21, 2023):
This issue is stale because it has been open for 90 days with no activity.
@comminutus commented on GitHub (Dec 27, 2023):
how's this coming?
@almereyda commented on GitHub (Mar 27, 2024):
Additionally to the
autogroup:*items used inacls, we also find anautogroup:nonrootinssh, which does not seem to be respected in v0.23.0-alpha5, despite it is used inacls-test.go.The current workaround to specify the accepted user names manually.
@Hypnotist1148 commented on GitHub (Jun 10, 2024):
Any plans to have
autogroups:selfandautogroup:memberimplemented?Would be useful to define a rule like this
{ "action": "accept", "src": ["autogroup:member"], "dst": ["autogroup:self:*"] }to have each user automatically have access to their own clients.Edit: Here the source of the snipped I've provided: https://tailscale.com/kb/1192/acl-samples#starter-plan-acl
@aradng commented on GitHub (Aug 17, 2024):
jst fyi, autogroup:nonroot is still not supported in 0.23.0-beta1
@vinhjaxt commented on GitHub (Sep 8, 2024):
I added acl autogroup self and autogroup member into headscale.
https://github.com/juanfont/headscale/compare/main...vinhjaxt:headscale:main
My manual test just works
@Snuupy commented on GitHub (Sep 12, 2024):
@vinhjaxt could you submit a PR for it please? 🙏
@Haarolean commented on GitHub (Oct 16, 2024):
@vinhjaxt would you please submit a PR to the upstream repo with the patch you mentioned? I bet many of us would benefit from it without a need to build a custom image ourselves :-)
@kradalby commented on GitHub (Oct 16, 2024):
While I have not looked too closely at @vinhjaxt code, we are positive to accepting it, but it will require rigorous testing.
@shokeen12 commented on GitHub (Feb 4, 2025):
I'm encountering two issues while using the autogroup patch by @vinhjaxt
When isolating each user with the following ACL, it works correctly in restricting access. However, exit nodes belonging to other users are still displayed, even though they are not accessible.
Expected behavior: Each user's exit node should only be visible to their own devices and not to other users.
When using a file instead of the API for ACL rules, the system fails to parse the ACL policy correctly.
The policy I am using:
{
"acls": [
{ "action": "accept", "src": ["autogroup:self"], "dst": ["autogroup:self:"] },
{ "action": "accept", "src": ["autogroup:self"], "dst": ["autogroup:internet:"] }
],
"autoApprovers": {
"exitNode": ["autogroup:self"]
}
}
@HybridRCG commented on GitHub (Feb 28, 2025):
How is the
Hi
@SuperSandro2000 commented on GitHub (Mar 1, 2025):
Maybe we can implement this bit by bit and start with some easy steps like autogroup:self ?
@kradalby commented on GitHub (Mar 2, 2025):
I think that make sense, I have a tracking bug for my current goal of reimplementing the policy (as v2) #2416, currently, I consider it out of scope to add new ones, but when it is in, I dont see why we cant start looking at it.
@adipierro commented on GitHub (Mar 3, 2025):
Unfortunately, implementing
autogroup:selfis not that easy, and I consider proper and efficient implementation as a quite complicated process, especially whilepolicyis in its current state -- it might require a lot of CPU time in large environments.@kradalby commented on GitHub (Mar 3, 2025):
Luckily we can start with a naive and working one as headscale is targeted small environments, so we don’t have to do premature optimalisations
@kradalby commented on GitHub (May 21, 2025):
I wrote up an overview for this feature in https://github.com/juanfont/headscale/issues/2618 with the current state and I will close this issue as part of letting that take over. As I see it, after @vdovhanych implemented
memberandtaggedas part of the new policy based on @gabe565 and @vinhjaxt code. The only remaining isautogroup:self.