Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: loosen up BaseDomain and ServerURL checks #2248

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

motiejus
Copy link
Contributor

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 #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

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 juanfont#2210

[1]: juanfont#2210 (comment)

// OK
// server_url: headscale.com, base: clients.headscale.com
// server_url: headscale.com, base: headscale.net
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is said elsewhere that server url must not be a suffix of the base_domain. To me, server is a suffix of base here -- yes, additionally they are equal. Perhaps the wording using "suffix" needs to be adjusted?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are write, it should probably be reformulated since we allow different domains, open to proposals.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See updated error message. I think the new one is more intuitive, see if you like it better


// OK
// server_url: headscale.com, base: clients.headscale.com
// server_url: headscale.com, base: headscale.net
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are write, it should probably be reformulated since we allow different domains, open to proposals.

motiejus added a commit to motiejus/nixpkgs that referenced this pull request Nov 21, 2024
Currently users upgrading from 24.05 to 24.11 may stumble across an
overly-restrictive BaseURL and ServerURL check in headscale[1].

A fix has been merged upstream[2], this is backport, so users can have
it easier upgrading from 24.05 to 24.11.

[1]: juanfont/headscale#2210
[2]: juanfont/headscale#2248
motiejus added a commit to motiejus/nixpkgs that referenced this pull request Nov 21, 2024
Currently users upgrading from 24.05 to 24.11 may stumble across an
overly-restrictive BaseURL and ServerURL check in headscale[1].

A fix has been merged upstream[2], this is backport, so users can have
it easier upgrading from 24.05 to 24.11.

[1]: juanfont/headscale#2210
[2]: juanfont/headscale#2248
@motiejus motiejus requested review from kradalby and quite November 21, 2024 20:03
@kradalby kradalby merged commit c6336ad into juanfont:main Nov 22, 2024
120 of 123 checks passed
@motiejus motiejus deleted the server-url-base-domain branch November 22, 2024 14:25
@motiejus
Copy link
Contributor Author

@kradalby since we're here, I would appreciate if you could stamp my NixOS backport. :) NixOS/nixpkgs#357969

motiejus added a commit to motiejus/nixpkgs that referenced this pull request Nov 22, 2024
Currently users upgrading from 24.05 to 24.11 may stumble across an
overly-restrictive BaseURL and ServerURL check in headscale[1].

A fix has been merged upstream[2], this is backport, so users can have
it easier upgrading from 24.05 to 24.11 or unstable.

The patch does not apply cleanly on v0.23.0, so putting it here instead.

Supersedes NixOS#357969, this will be backported to 24.11 with a tag.

[1]: juanfont/headscale#2210
[2]: juanfont/headscale#2248
wolfgangwalther pushed a commit to NixOS/nixpkgs that referenced this pull request Jan 3, 2025
Currently users upgrading from 24.05 to 24.11 may stumble across an
overly-restrictive BaseURL and ServerURL check in headscale[1].

A fix has been merged upstream[2], this is backport, so users can have
it easier upgrading from 24.05 to 24.11 or unstable.

The patch does not apply cleanly on v0.23.0, so putting it here instead.

Supersedes #357969, this will be backported to 24.11 with a tag.

[1]: juanfont/headscale#2210
[2]: juanfont/headscale#2248
nixpkgs-ci bot pushed a commit to NixOS/nixpkgs that referenced this pull request Jan 3, 2025
Currently users upgrading from 24.05 to 24.11 may stumble across an
overly-restrictive BaseURL and ServerURL check in headscale[1].

A fix has been merged upstream[2], this is backport, so users can have
it easier upgrading from 24.05 to 24.11 or unstable.

The patch does not apply cleanly on v0.23.0, so putting it here instead.

Supersedes #357969, this will be backported to 24.11 with a tag.

[1]: juanfont/headscale#2210
[2]: juanfont/headscale#2248

(cherry picked from commit f1bdc12)
thomasjm pushed a commit to codedownio/nixpkgs that referenced this pull request Jan 5, 2025
Currently users upgrading from 24.05 to 24.11 may stumble across an
overly-restrictive BaseURL and ServerURL check in headscale[1].

A fix has been merged upstream[2], this is backport, so users can have
it easier upgrading from 24.05 to 24.11 or unstable.

The patch does not apply cleanly on v0.23.0, so putting it here instead.

Supersedes NixOS#357969, this will be backported to 24.11 with a tag.

[1]: juanfont/headscale#2210
[2]: juanfont/headscale#2248
@Hypnotist1148
Copy link

I want to set my base_url to example.com and the server_url to entry.example.com, I also have set split dns for entry.example.com to quad9's dns servers as to be still able to contact the headscale node.
Could you implement a overwrite so I am allowed to set this?

@kradalby
Copy link
Collaborator

No, that is a foot gun we don't want to support or carry the issue burden for

@Hypnotist1148
Copy link

Okay, what other options would there be, I don't really want the base domain to be a subdomain, and don't want to use a separate domain for the control plane

@kradalby
Copy link
Collaborator

There are no other options, tailscale was designed in this way, upstream uses two domains, login.tailscale.com for the server and ts.net for basename.

motiejus added a commit to motiejus/nixpkgs that referenced this pull request Jan 17, 2025
server_url check [has been loosened upstream][1] and backported to
NixOS[2]. The new, much looser check, is not practical to be implemented
in Nix (you are welcome to give it a try; I've implemented the original
one).

Since the surface area is much smaller now (and the scenario much less
common), I think we can remove this assertion altogether.

[1]: juanfont/headscale#2248
[2]: NixOS#358255
nixpkgs-ci bot pushed a commit to NixOS/nixpkgs that referenced this pull request Jan 17, 2025
server_url check [has been loosened upstream][1] and backported to
NixOS[2]. The new, much looser check, is not practical to be implemented
in Nix (you are welcome to give it a try; I've implemented the original
one).

Since the surface area is much smaller now (and the scenario much less
common), I think we can remove this assertion altogether.

[1]: juanfont/headscale#2248
[2]: #358255

(cherry picked from commit de0a499)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] testing for server_url containing base_domain is too restrictive
4 participants