[Bug] Tags applied to nodes are not applied in ACL until headscale service is restarted after adding the tag #929

Closed
opened 2025-12-29 02:26:17 +01:00 by adam · 8 comments
Owner

Originally created by @SlackingVeteran on GitHub (Jan 29, 2025).

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When a tag is applied or removed from node, ACL is not applied for the node based on tags until headscale service is restarted

Expected Behavior

When tag is applied or removed from nodes the changes should be reflected on user's account that has access to tag through ACL.

If user has access to the tag and the tag is removed from node then user should no longer have access to the node without restarting headscale service
And if user has access to the tag and the tag is added to the node then user should gain access to the node without restarting headscale service

Steps To Reproduce

I have a tag:shared tag in ACL as follows:

{
  "groups": {
    "group:all-members": [
      "user1@example.com",
      "user2@example.com"
    ]
  },
  "tagOwners": {
    "tag:shared": [
      "group:all-members"
    ]
  },
  "hosts": {},
  "acls": [
    {
      "action": "accept",
      "src": [
        "user1@example.com"
      ],
      "dst": [
        "user1@example.com:*"
      ]
    },
    {
      "action": "accept",
      "src": [
        "user2@example.com"
      ],
      "dst": [
        "user2@example.com:*"
      ]
    },
    {
      "action": "accept",
      "src": [
        "group:all-members"
      ],
      "dst": [
        "tag:shared:*"
      ]
    }
  ],
  "ssh": []
}

Then I applied tag:shared to one of the node owned by user1 with headscale nodes tag --tags tag:shared -i 1 and shows up in headscale nodes list -o json as:

[
        {
                "id": 1,
                "machine_key": "mkey:<redacted>",
                "node_key": "nodekey:<redacted>",
                "disco_key": "discokey:<redacted>",
                "ip_addresses": [
                        "100.64.0.1",
                        "fd7a:115c:a1e0::1"
                ],
                "name": "USER1-DT",
                "user": {
                        "id": 1,
                        "name": "user1",
                        "created_at": {
                                "seconds": 1738102564,
                                "nanos": 803193762
                        },
                        "display_name": "FirstName LastName",
                        "email": "user1@example.com",
                        "provider_id": "<redacted>",
                        "provider": "oidc"
                },
                "last_seen": {
                        "seconds": 1738104866,
                        "nanos": 780535645
                },
                "expiry": {
                        "seconds": 1753654564,
                        "nanos": 797022733
                },
                "created_at": {
                        "seconds": 1738102564,
                        "nanos": 813862893
                },
                "register_method": 3,
                "forced_tags": [
                        "tag:shared"
                ],
                "valid_tags": [
                        "tag:shared"
                ],
                "given_name": "user1-dt",
                "online": true
        },
        {...}
]

The device does not show up for user2 in Tailscale client. Restarting headscale service makes ACL work as expected and USER1-DT appears on user2's list.

Same issue can be noticed when tag is removed from USER1-DT, user2 continues to get access to the device until headscale service is restarted

Environment

- OS: Windows 11
- Headscale version: 0.24.1
- Tailscale version: 1.78.1

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Anything else?

Let me know if any additional info is required

Originally created by @SlackingVeteran on GitHub (Jan 29, 2025). ### Is this a support request? - [x] This is not a support request ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior When a tag is applied or removed from node, ACL is not applied for the node based on tags until headscale service is restarted ### Expected Behavior When tag is applied or removed from nodes the changes should be reflected on user's account that has access to tag through ACL. If user has access to the tag and the tag is removed from node then user should no longer have access to the node without restarting headscale service And if user has access to the tag and the tag is **added** to the node then user should gain access to the node without restarting headscale service ### Steps To Reproduce I have a `tag:shared` tag in ACL as follows: ``` { "groups": { "group:all-members": [ "user1@example.com", "user2@example.com" ] }, "tagOwners": { "tag:shared": [ "group:all-members" ] }, "hosts": {}, "acls": [ { "action": "accept", "src": [ "user1@example.com" ], "dst": [ "user1@example.com:*" ] }, { "action": "accept", "src": [ "user2@example.com" ], "dst": [ "user2@example.com:*" ] }, { "action": "accept", "src": [ "group:all-members" ], "dst": [ "tag:shared:*" ] } ], "ssh": [] } ``` Then I applied `tag:shared` to one of the node owned by `user1` with `headscale nodes tag --tags tag:shared -i 1` and shows up in `headscale nodes list -o json` as: ``` [ { "id": 1, "machine_key": "mkey:<redacted>", "node_key": "nodekey:<redacted>", "disco_key": "discokey:<redacted>", "ip_addresses": [ "100.64.0.1", "fd7a:115c:a1e0::1" ], "name": "USER1-DT", "user": { "id": 1, "name": "user1", "created_at": { "seconds": 1738102564, "nanos": 803193762 }, "display_name": "FirstName LastName", "email": "user1@example.com", "provider_id": "<redacted>", "provider": "oidc" }, "last_seen": { "seconds": 1738104866, "nanos": 780535645 }, "expiry": { "seconds": 1753654564, "nanos": 797022733 }, "created_at": { "seconds": 1738102564, "nanos": 813862893 }, "register_method": 3, "forced_tags": [ "tag:shared" ], "valid_tags": [ "tag:shared" ], "given_name": "user1-dt", "online": true }, {...} ] ``` The device does not show up for user2 in Tailscale client. Restarting headscale service makes ACL work as expected and `USER1-DT` appears on `user2`'s list. Same issue can be noticed when tag is removed from `USER1-DT`, `user2` continues to get access to the device until headscale service is restarted ### Environment ```markdown - OS: Windows 11 - Headscale version: 0.24.1 - Tailscale version: 1.78.1 ``` ### Runtime environment - [x] Headscale is behind a (reverse) proxy - [x] Headscale runs in a container ### Anything else? Let me know if any additional info is required
adam added the bugno-stale-botpolicy 📝tags labels 2025-12-29 02:26:17 +01:00
adam closed this issue 2025-12-29 02:26:17 +01:00
Author
Owner

@DevId-E commented on GitHub (Jan 29, 2025):

https://github.com/juanfont/headscale/issues/2375 could be related or the same

@DevId-E commented on GitHub (Jan 29, 2025): https://github.com/juanfont/headscale/issues/2375 could be related or the same
Author
Owner

@github-actions[bot] commented on GitHub (May 1, 2025):

This issue is stale because it has been open for 90 days with no activity.

@github-actions[bot] commented on GitHub (May 1, 2025): This issue is stale because it has been open for 90 days with no activity.
Author
Owner

@Codelica commented on GitHub (May 1, 2025):

Not stale, we restart headscale multiple times each day for tags. Really hoping this gets fixed as it makes tag based ACLs very confusing if you aren't aware of the bug. (or forget, which happens to my coworker)

@Codelica commented on GitHub (May 1, 2025): Not stale, we restart headscale multiple times each day for tags. Really hoping this gets fixed as it makes tag based ACLs very confusing if you aren't aware of the bug. (or forget, which happens to my coworker)
Author
Owner

@dennisoderwald commented on GitHub (May 2, 2025):

I can confirm the problem, it is also necessary for us.

@dennisoderwald commented on GitHub (May 2, 2025): I can confirm the problem, it is also necessary for us.
Author
Owner

@manhtxops commented on GitHub (May 7, 2025):

I have the same problem, hope the team will fix this problem soon.

@manhtxops commented on GitHub (May 7, 2025): I have the same problem, hope the team will fix this problem soon.
Author
Owner

@kradalby commented on GitHub (May 7, 2025):

While tags has not been focused on in this release, it might have been touched up and I would be grateful to hear feedback if the current beta changed anything for this issue.

@kradalby commented on GitHub (May 7, 2025): While tags has not been focused on in this release, it might have been touched up and I would be grateful to hear feedback if the current beta changed anything for this issue.
Author
Owner

@manhtxops commented on GitHub (May 9, 2025):

While tags has not been focused on in this release, it might have been touched up and I would be grateful to hear feedback if the current beta changed anything for this issue.

I used the current beta version but still have the above error.

@manhtxops commented on GitHub (May 9, 2025): > While tags has not been focused on in this release, it might have been touched up and I would be grateful to hear feedback if the current beta changed anything for this issue. I used the current beta version but still have the above error.
Author
Owner

@helderrscorreia commented on GitHub (Jun 18, 2025):

This error still occurs on our deployment.

@helderrscorreia commented on GitHub (Jun 18, 2025): This error still occurs on our deployment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#929