juanfont / headscale

An open source, self-hosted implementation of the Tailscale control server
BSD 3-Clause "New" or "Revised" License
23.5k stars 1.29k forks source link

Cloned VM with existing connection is not registered but has access/cannot deregister. #2186

Closed plummo closed 1 month ago

plummo commented 1 month ago

Is this a support request?

Is there an existing issue for this?

Current Behavior

Cloning a VM creates the same mkey and authuorises the device as if they are the same. Only one device appears as connected and removeing the primary device will still allow the other to be connected.

I have a VM running Almalinux which was connected to Headscale server. I cloned that VM and as soon as it started it connected as tailscale was running when I initiated clone. Both instances were provided the same IP by Headscale but only the primary device appears registered. I took down primary VM and it still showed online as the cloned VM was maintaining the same IP and registration details.

I changed the hostname of cloned VM and uninstalled tailscale. I reinstalled and ran a new connection to register. It worked but the above issue was repeated.

I disconnected both VM, uninstalled tailscale from both and removed the register from Headscale.

I reinstalled tailscale and ran a new registration on both and the same mkey was provide and repeated the issue. I assume the mkey is generated by certain machine information that has been cloned.

Expected Behavior

A cloned VM connects and requires a new registration and is provided a new identifier.

Both primary and cloned VM will have unique register.

Steps To Reproduce

  1. Clone a VM
  2. Register primary VM
  3. Register cloned VM
  4. Run headscale nodes list
  5. Observe primary VM and IP, do not observe cloned VM. 6 Run ip -a on cloned vm showing tailscale0 with identical IP as primary. 7 Tailscale down on primary VM 8 Nodes list show primary VM still online and cloned VM can access network.

Environment

- OS: Alamlinux 9.4
- Headscale version: 0.23.0
- Tailscale version: 1.74.1

Runtime environment

Anything else?

No response

juanfont commented 1 month ago

This is completely expected. If you clone the VM it makes sense that it has the same contents as the source VM, including the file that has the machine key.