marc1307 / tailscale-cloudflare-dnssync

Syncs Tailscale/Headscale host IPs to a cloudflare hosted dns zone
MIT License
159 stars 15 forks source link

Replace spaces in hostnames with dashes #8

Closed pschmitt closed 1 year ago

pschmitt commented 1 year ago

Android Devices typically get overly readable hostnames in tailscale which results in invalid DNS hostnames if used verbatim.

For instance my tablet was named "Mi Pad 4". This fixes the DNS entries (-> mi-pad-4).

marc1307 commented 1 year ago

Hi Philipp, thanks for your contribution.

The scripts tries to import two name variables from Tailscale "machine name" and "OS Hostname". The machine name should be a valid DNS record.

Example: [SKIPING]: Galaxy S8+.foo.bar -> 100.125.239.24 -> (Hostname: "Galaxy S8+.foo.bar" is not valid) [FOUND]: galaxy-s8 -> 100.125.239.24 [SKIPING]: Galaxy S8+.foo.bar -> fd7a:115c:a1e0:ab12:4843:cd96:627d:ef18 -> (Hostname: "Galaxy S8+.foo.bar" is not valid) [FOUND]: galaxy-s8 -> fd7a:115c:a1e0:ab12:4843:cd96:627d:ef18

Could you please check in the Tailscale admin interface if your machine has those values populated and if the "maschine name" record gets generated?

pschmitt commented 1 year ago

Indeed, maschine name is a correct DNS name. I might have been thrown off by the error log. Was assuming the entire host was skipped. My bad ;)