Cloudflare DNS Sync

Hi folks,
I’ve a built a bit of code that syncs your private Tailscale IPs to a cloudflare hosted DNS zone.
The main benefit over MagicDNS + Certificate Beta is that you can use your own domain + certbot.
Also, you are not dependent on a being connected to Tailscale for DNS resolution (eg. behind a subnet router)

Cheers,
Marc

6 Likes

Nice script. Great work. How hard would it be to add a postfix to each domain with this? For example, I have a domain I use for homelab stuff and all Tailscale sub-domains are postfixed with -ts. I do this because I use ZeroTier and/or CloudFlare tunnels for various services in addition to Tailscale depending on what it is and how I use it. I have it setup so its standardized as -ts, -zt, or -cf after each domain so its easy to remember. For example, mydomain-ts.domain.com, mydomain-cf.domain.com, and mydomain-zt.domain.com.

Thanks.

Thanks.

Hi, thanks for your feedback.
Shouldn’t be that hard. I’ll try to add it this weekend.

Hi, just added the feature.
Pull the lastest version and add prefix=xyz and/or postfix=xyz to the config file or docker env.

Marc

1 Like

Works great. Thanks for the update. Here’s my working docker compose entry:

  tsdns:
    container_name: tsdns
    image: ghcr.io/marc1307/tailscale-cloudflare-dnssync:main
    restart: unless-stopped
    environment:
      - cf-key=${CFKEY}
      - cf-domain=${CFDOMAIN}
      - ts-key=${TSKEY}
      - ts-tailnet=${TSTAILNET}
      - postfix=-ts

All environment variables are located in a .env file. Did find out quickly they are case sensitive. I originally entered as all caps, since that’s what I was used to (mainly linuxserver containers), but not a big deal.

can it used on synology?