-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Bug] testing for server_url containing base_domain is too restrictive #2210
Comments
I assume that using a second-level domain in dns.base_domain, may cause conflicts, for example, when using Example 1: Example 2:
Add a node with the name With the current implementation it seems logical to allocate a separate subdomain for the HeadScale network |
I stumbled upon the same issue while testing an upgrade to NixOS 24.11. Here is my config: server_url = "https://vpn.jakstys.lt";
dns_config.base_domain = "jakst"; I don't care about the |
Yes, its only added at runtime, no database involved. |
I agree that it is a bit conservative. I am happy for a contribution relaxing it to
Edit: parsing the full URL and comparing only the domain should probably be a good place to start. |
Started implementing this. Do I understand correctly that the Host parts of |
did not test samba and headscale yet juanfont/headscale#2210 (comment)
OK: Not OK: 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 |
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. [1]: juanfont#2210 (comment)
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)
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)
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)
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)
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
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
Is this a support request?
Is there an existing issue for this?
Current Behavior
I have
server_url: https://homer.example.com
anddns.base_domain: h
. This does not work, headscale complains withserver_url cannot contain the base_domain [..]
.@mtoohey31 recently noted the same issue in a comment to #2034:
Expected Behavior
I don't want to be overly and unnecessarily restricted about the choice of
base_domain
.I think that what should not be allowed are the following:
base_domain
that is a prefix ofserver_url
's hostnamebase_domain
equal toserver_url
's hostnameserver_url
's hostname that is a prefix ofbase_domain
?Possible plain prefix comparison is not suitable, but dot-separated parts needs to be taken into consideration separately? All this needs some more thinking through. Any ideas?
Steps To Reproduce
I have
server_url: https://homer.example.com
anddns.base_domain: h
. This does not work, headscale complains withserver_url cannot contain the base_domain [..]
.Environment
Runtime environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: