[PR #1490] [CLOSED] Allow setting ForcedTags using the acls.hujson config file #2147

Closed
opened 2025-12-29 03:19:58 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1490
Author: @networkException
Created: 6/17/2023
Status: Closed

Base: mainHead: declarative-forced-tags


📝 Commits (1)

  • 1dd7f19 Allow setting ForcedTags using the acls.hujson config file

📊 Changes

2 files changed (+77 additions, -0 deletions)

View changed files

📝 hscontrol/acls.go (+73 -0)
📝 hscontrol/acls_types.go (+4 -0)

📄 Description

This pull request introduces a declarative way to set ForcedTags for machines.

If a "forcedTags" field is set in the acls.hujson file, the ForcedTags of machines will be overriden in the database based on the tags defined in the config file.

{
    "hosts": {
        "a": "fd7a:115c:a1e0::1",
        "b": "fd7a:115c:a1e0::2"
    },
    "forcedTags": {
        "tag:some-tag": [
            "a",
            "tag:some-other-tag"
        ],
        "tag:some-other-tag": [
            "b"
        ]
    }
}
  • read the CONTRIBUTING guidelines
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/1490 **Author:** [@networkException](https://github.com/networkException) **Created:** 6/17/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `declarative-forced-tags` --- ### 📝 Commits (1) - [`1dd7f19`](https://github.com/juanfont/headscale/commit/1dd7f193c9426b629db7ea12cfff4d9ad14005c0) Allow setting ForcedTags using the acls.hujson config file ### 📊 Changes **2 files changed** (+77 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `hscontrol/acls.go` (+73 -0) 📝 `hscontrol/acls_types.go` (+4 -0) </details> ### 📄 Description This pull request introduces a declarative way to set ForcedTags for machines. If a "forcedTags" field is set in the acls.hujson file, the ForcedTags of machines will be overriden in the database based on the tags defined in the config file. ```json { "hosts": { "a": "fd7a:115c:a1e0::1", "b": "fd7a:115c:a1e0::2" }, "forcedTags": { "tag:some-tag": [ "a", "tag:some-other-tag" ], "tag:some-other-tag": [ "b" ] } } ``` <!-- Headscale is "Open Source, acknowledged contribution", this means that any contribution will have to be discussed with the Maintainers before being submitted. This model has been chosen to reduce the risk of burnout by limiting the maintenance overhead of reviewing and validating third-party code. Headscale is open to code contributions for bug fixes without discussion. If you find mistakes in the documentation, please submit a fix to the documentation. --> <!-- Please tick if the following things apply. You… --> - [x] read the [CONTRIBUTING guidelines](README.md#contributing) - [x] raised a GitHub issue or discussed it on the projects chat beforehand - [ ] added unit tests - [ ] added integration tests - [ ] updated documentation if needed - [ ] updated CHANGELOG.md <!-- If applicable, please reference the issue using `Fixes #XXX` and add tests to cover your new code. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:19:58 +01:00
adam closed this issue 2025-12-29 03:19:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2147