headscale
headscale copied to clipboard
Add support for host aliases when using MagicDNS?
Feature request
Expose a way to map multiple hostnames to an existing device, assuming they all belong to the same namespace. I'm only asking for the ability to map hostnames that would be inside the tailnet, to other names that are inside the tailnet.
This is effectively DNS CNAME
records, but I would like to configure them in Headscale. I would consider it more usable if I didn't have to rely on another DNS resolver providing the CNAME resolution for things inside my tailnet.
For example:
webhost-1.machines.<tailnet> -> server.machines.<tailnet>
webhost-2.machines.<tailnet> -> server.machines.<tailnet>
webhost-3.machines.<tailnet> -> server.machines.<tailnet>
But I would not want to support:
google.com. -> server.machines.<tailnet>
test.machines.<tailnet> -> duckduckgo.com.
I'm not asking cross namespace support (eg: some.machine.<tailnet> -> other.namespace.<tailnet>
) but I can see uses for it, so others may chime in to request it.
Tailscale is building support for tailcfg.DNSConfig.ExtraRecords
: a way to pass around extra DNS records for use with MagicDNS. It appears that it currently supports A
and AAAA
records, but based on filed issues, it may grow to support CNAME
(in some limited capacity).
I would like to request that once possible CNAME
records are added to the Headscale configuration. But perhaps in the meantime, this could be implemented via A
and AAAA
records?
I currently have a system with multiple web services configured using a reverse proxy to route traffic. I'd like to expose it as a single tailscale node, rather than splitting each service out and creating more tailscale nodes, and mapping multiple hostnames keeps the reverse proxy functioning.
Collection of related Tailscale issues:
- https://github.com/tailscale/tailscale/issues/1152
- https://github.com/tailscale/tailscale/issues/1543
- https://github.com/tailscale/tailscale/issues/4457
- https://github.com/tailscale/tailscale/issues/5033
I have a patch that allows setting DNS extra_records in the headscale config that I've been using since December, it works pretty well for my use case.
https://github.com/madjam002/headscale/commit/b9f05fca8d7fcc246b44a0495587b9de1582049c
You can then add to your headscale config.yaml
dns_config:
extra_records:
- { name: "xxx.yyy.zzz", type: "A", value: "100.x.x.x" }
I haven't opened a PR with this because I think there's a better way of doing it for more complex setups. E.g a lambda function could be passed in config that takes the Tailscale node as an argument and could then return a specialised set of extra_records depending on the node that it's being sent to.
Thanks! That would work perfectly for what I have in mind.
I haven't opened a PR with this because I think there's a better way of doing it for more complex setups.
That makes sense. I hadn't thought of more complicated cases. I was trying to restrict my request to something that wouldn't be controversial to implement, and probably not have behaviour interesting enough to have security implications.
This is now merged.