-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Random suffix only on hostname collision in namespace. #771
Random suffix only on hostname collision in namespace. #771
Conversation
Do we really want the machines name to be unique per namespace or the all network ? I'd prefer remove completely the namespace from the DNS name. I think the namespace name in DNS name is killing the magicDNS feature, since we often want to communicate with hosts that are in other namespaces or are tagged. Also, the tagged machines should not be tied to the user that created them. |
@restanrm my reasoning is:
The Tailscale docs do a pretty good job of explaining why namespaces are useful here and how they handle hostname collisions here. @juanfont Sorry I didn't realise |
Thanks for your response ! My comment was mainly related to make Headscale closer to Tailscale (in my opinion) because Namespaces are closer to users (in Tailscale) than Tailnet. A Headscale instance should be viewed as a Tailnet as explained here Although I agree that admin should not join 2 machines with the same hostname on a network it can happen. I don't think that Tailscale's DNS embedded system can handle 2 identical hostnames since they don't offer this functionality with the SaaS version. For the leak of the name, yes it's possible to rename one's host until we find a collision. But the ACL's would still not allow to obtain the IP address of the other machine if it's not meant to be. |
I meant from a data security perspective more than a network security one. Like when incremental IDs or unique name slugs are used as IDs in URLs to sniff out other customers, customer or machine counts. The sort or thing (however unlikely). |
I think approaching this in incremental steps would be ideal. I am up for discussing having This allows us to change it later, to only be unique per namespace. It will be way easier to loosen that logic than to go the opposite way. If we check unique for the whole instance, and clear up the test failures, then I am happy to get this in. |
0.16.0 introduced random suffixes to all machine given names (DNS hostnames) regardless of collisions within a namespace. This commit brings Headscale more inline with Tailscale by only adding a suffix if the hostname will collide within the namespace. The suffix generation differs from Tailscale. See https://tailscale.com/kb/1098/machine-names/
2aebd29
to
cd4e2e2
Compare
Signed-off-by: Kristoffer Dalby <[email protected]>
Signed-off-by: Kristoffer Dalby <[email protected]>
cf7bd94
to
d56ad29
Compare
…cale Signed-off-by: Kristoffer Dalby <[email protected]>
Signed-off-by: Kristoffer Dalby <[email protected]>
Regarding the definition of the "collision", is there a potential for a data race here? |
I am not sure if I understand, but the entry in the database should be the same if it reconnects again? So for the cases of lost connection, reboot and connected again, then it should be fine. For reprovisioning, the node will first have to be deleted, which makes sense I think. |
Implements random suffixes only on hostname collision. Resolves #766.
0.16.0 introduced random suffixes to all machine given names (DNS hostnames) regardless of collisions within a namespace. This PR brings Headscale more inline with Tailscale by only adding a suffix if the hostname will collide within the namespace.
The suffix generation differs from Tailscale.
See https://tailscale.com/kb/1098/machine-names/