oznu / docker-cloudflare-ddns

A small amd64/ARM/ARM64 Docker image that allows you to use CloudFlare as a DDNS / DynDNS Provider.
https://hub.docker.com/r/oznu/cloudflare-ddns/
GNU General Public License v3.0
1.08k stars 219 forks source link

cannot update wildcard * A record #80

Closed michael-pellegrini closed 3 years ago

michael-pellegrini commented 3 years ago

Is it possible to update A record with name set as * ?

I can update the root domain example.com without issue. I'm trying to update the wildcard record but unable to, instead a new record is added when I specify subdomain=*

This does not work with cloudflare because the name has to be set as * and not *.example.com

kosmonot commented 3 years ago

For DDNS subdomains you create subdomains with CNAME records (with the domain name in the A record as the target). Then everything changes to the new IP as soon as the A record is updated.

michael-pellegrini commented 3 years ago

I'm using a wildcard A record * to resolve all subdomains. This way I don't have to add a Cname record for every new subdomain. I can not add * as a cname. It has to be an A record.

kosmonot commented 3 years ago

So you would have to either proxy everything or nothing on CloudFlare if you had a wildcard A record?

michael-pellegrini commented 3 years ago

Yes, I'm using a reverse proxy for all subdomains to conserve IP addresses. I only update the proxy when names are changed or added. Having the ability to update the wildcard A record would be beneficial to anyone using a reverse proxy.

favonia commented 3 years ago

@michael-pellegrini Out of curiosity I tried * and it seems to work? I also played with the Cloudflare API directly and nothing seems to be special about the wildcard domains. That is, if your zone is example.com, Cloudflare seems to treat *.example.com and * interchangeably.

michael-pellegrini commented 3 years ago

@favonia Started over with a fresh image and wildcard updates without issue.

michael-pellegrini commented 3 years ago

@favonia With the config below, only the wildcard * A record is updated. I also need the example.com A record to be updated. If I remove the wildcard subdomain, the example.com A record will update. It seems that I cannot update both together.

version: '3.7'
services:
  ddns:
    image: oznu/cloudflare-ddns:latest
    restart: unless-stopped
    environment:
    - API_KEY=***********************************
    - ZONE=example.com
    - SUBDOMAIN=*
    ports:
   - 8080:80
favonia commented 3 years ago

@michael-pellegrini That is a limitation of this tool. See https://github.com/oznu/docker-cloudflare-ddns/issues/60. You have to follow the workaround there or use another tool. BTW, I'm not using this tool as I'm maintaining my own.

michael-pellegrini commented 3 years ago

@favonia Thanks for the update. Work around is run two instances. Since only two records need updated.