[PR #2248] [MERGED] config: loosen up BaseDomain and ServerURL checks #2569

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

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2248
Author: @motiejus
Created: 11/21/2024
Status: Merged
Merged: 11/22/2024
Merged by: @kradalby

Base: mainHead: server-url-base-domain


📝 Commits (4)

  • c4ac626 config: loosen up BaseDomain and ServerURL checks
  • e834017 server_url and base_domain: re-word error message, fix a one-off bug and add a test case for the bug.
  • ddb1370 lint
  • c0c3833 lint again

📊 Changes

4 files changed (+103 additions, -9 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 hscontrol/types/config.go (+38 -7)
📝 hscontrol/types/config_test.go (+63 -1)
📝 hscontrol/types/testdata/base-domain-in-server-url.yaml (+1 -1)

📄 Description

Requirements here:

OK:
server_url: headscale.com, base: clients.headscale.com
server_url: headscale.com, base: headscale.net

Not OK:
server_url: server.headscale.com, base: headscale.com

Essentially we have to prevent the possibility where the headscale
server has a URL which can also be assigned to a node.

So for the Not OK scenario:

if the server is: server.headscale.com, and a node joins with the name
server, it will be assigned server.headscale.com and that will break
the connection for nodes which will now try to connect to that node
instead of the headscale server.

Fixes https://github.com/juanfont/headscale/issues/2210

  • have read the CONTRIBUTING.md file
  • 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/2248 **Author:** [@motiejus](https://github.com/motiejus) **Created:** 11/21/2024 **Status:** ✅ Merged **Merged:** 11/22/2024 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `server-url-base-domain` --- ### 📝 Commits (4) - [`c4ac626`](https://github.com/juanfont/headscale/commit/c4ac626298a2503ec4ec5dfbf465c2004dad5a8d) config: loosen up BaseDomain and ServerURL checks - [`e834017`](https://github.com/juanfont/headscale/commit/e83401731429975b1f32066b9047f919c1a8ff66) server_url and base_domain: re-word error message, fix a one-off bug and add a test case for the bug. - [`ddb1370`](https://github.com/juanfont/headscale/commit/ddb1370c734629bae3b55f652f5aadf0a0581308) lint - [`c0c3833`](https://github.com/juanfont/headscale/commit/c0c383359fa255030c609a857e307c5c30f875a5) lint again ### 📊 Changes **4 files changed** (+103 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `hscontrol/types/config.go` (+38 -7) 📝 `hscontrol/types/config_test.go` (+63 -1) 📝 `hscontrol/types/testdata/base-domain-in-server-url.yaml` (+1 -1) </details> ### 📄 Description Requirements [here][1]: > OK: > server_url: headscale.com, base: clients.headscale.com > server_url: headscale.com, base: headscale.net > > Not OK: > server_url: server.headscale.com, base: headscale.com > > Essentially we have to prevent the possibility where the headscale > server has a URL which can also be assigned to a node. > > So for the Not OK scenario: > > if the server is: server.headscale.com, and a node joins with the name > server, it will be assigned server.headscale.com and that will break > the connection for nodes which will now try to connect to that node > instead of the headscale server. Fixes https://github.com/juanfont/headscale/issues/2210 [1]: https://github.com/juanfont/headscale/issues/2210#issuecomment-2488165187 <!-- 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] have read the [CONTRIBUTING.md](./CONTRIBUTING.md) file - [x] raised a GitHub issue or discussed it on the projects chat beforehand - [x] added unit tests - [ ] added integration tests - [ ] updated documentation if needed - [x] updated CHANGELOG.md --- <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:21:50 +01:00
adam closed this issue 2025-12-29 03:21:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2569