Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Support] Kilrah/Cloudflare-DDNS-config

Featured Replies

[Template only, I am not the container author/maintainer]

 

Template: https://github.com/kilrah/unraid-docker-templates/blob/main/templates/cloudflare-ddns-config.xml

Source container: https://github.com/timothymiller/cloudflare-ddns

Registry: https://hub.docker.com/r/timothyjmiller/cloudflare-ddns

 

I've moved my DNS to Cloudflare, and found out that ddclient which I was using before just does not work anymore with Cloudflare's current API. There are already a few Cloudflare-DDNS containers in CA but they all have you enter settings as template variables, which makes it either impossible or impractical to enter multiple zones and a large number of subdomains. Looked for something more suitable to my situation and found timothymiller's container that works off a JSON config file that is a lot more manageable in such cases.

 

Important:

As this container uses a file mount for the config file before installing/running it you need to preload a sample config, in Unraid's terminal:

mkdir /mnt/user/appdata/cloudflare-ddns-config

wget -qO /mnt/user/appdata/cloudflare-ddns-config/config.json https://github.com/timothymiller/cloudflare-ddns/raw/master/config-example.json

 

And obviously edit it to your needs.

 

If you started the container without doing that first Docker will create a folder, you have to stop the container, delete the folder and get the file before restarting.

 

 

Edited by Kilrah

  • Replies 55
  • Views 12.5k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • semaj4712
    semaj4712

    Just thought I would add some context here for those looking at this thread.  I came here to see example configs and the above examples seem to imply that the Zone ID is the url IE: `google.com` when

  • You basically duplicate the whole thing inside the "cloudflare" block, based on the author's sample:   { "cloudflare": [ { "authentication": { "api_token": "api_token_here"

  • Well no because it says "before running the container" precisely so that wrong folder doesn't get created.

Posted Images

how did you get the container to auto run to update ?

  • Author

It should be left running in the background and it will check IP/update if necessary every 5 minutes.

 

EDIT: Looks like the container got an update a few hours ago to fix an issue with the root domains but got broken in the process.

EDIT2: Was fixed a couple of days later.

Edited by Kilrah

Hi Friends,

Thank you for maintaining this container.

I'm a noob so my question might seem obvious to programmers, but can someone, please, share an example of the config-example.json file that includes info for two different domains?

I saw the sample example-config.json file listed in the OP, but from what I understand it only includes info for 1 domain, so I'm not sure how to add the info of a second domain.

Hope someone can help 🙏

 

  • Author

You basically duplicate the whole thing inside the "cloudflare" block, based on the author's sample:

 

{
  "cloudflare": [
    {
      "authentication": {
        "api_token": "api_token_here",
        "api_key": {
          "api_key": "api_key_here",
          "account_email": "your_email_here"
        }
      },
      "zone_id": "your_zone_id_here",
      "subdomains": [
        {
          "name": "",
          "proxied": false
        },
        {
          "name": "remove_or_replace_with_your_subdomain",
          "proxied": false
        }
      ]
    },
    {
      "authentication": {
        "api_token": "2nd_api_token_here",
        "api_key": {
          "api_key": "2nd_api_key_here",
          "account_email": "your_email_here"
        }
      },
      "zone_id": "your_2nd_zone_id_here",
      "subdomains": [
        {
          "name": "",
          "proxied": false
        },
        {
          "name": "remove_or_replace_with_your_subdomain",
          "proxied": false
        },
        {
          "name": "remove_or_replace_with_another_subdomain",
          "proxied": true
        }
      ]
    }
  ],
  "a": true,
  "aaaa": true,
  "purgeUnknownRecords": false
}

You'll typically only use one of the 2 authentication methods, remove the other one

Edited by Kilrah

Thank you very much! @Kilrah. I will try to setup the container based on your example.

The app installation created two folders for the container.

Main folder: cloudflare-ddns-config.

Subfolder: config.json

Should I save the config.json file inside the config.json folder? 

  • Author

You didn't read the "important" note from the template/first post. Stop the container, delete the config.json folder and download the sample file.

10 minutes ago, Kilrah said:

You didn't read the "important" note from the template/first post. Stop the container, delete the config.json folder and download the sample file.

Thanks for the clarification 🙏

The "important" note in the OP actually doesn't say to delete the folder. That's why I asked :)

  • Author

Well no because it says "before running the container" precisely so that wrong folder doesn't get created.

5 minutes ago, Kilrah said:

Well no because it says "before running the container" precisely so that wrong folder doesn't get created.

If I'm not mistaken, UnRAID automatically tries to start new docker containers once their installation process is finished. 

I assume that's why the folder was already there, when I tried to follow the important note directions.

Because I didn't ran the container.

 

Edit: Ohhhhhhhh now I see you meant that we need to run the important note commands even *before installing* the container.

I thought I needed to run the important note commands after installation but before running the container.

My bad. Sorry for missing this 🙏🙏

Edited by mjeshurun

  • Author
6 minutes ago, mjeshurun said:

If I'm not mistaken, UnRAID automatically tries to start new docker containers once their installation process is finished. 

Yes, hence 

 

On 7/26/2022 at 12:32 PM, Kilrah said:

before installing/running it you need to preload a sample config

 

1 minute ago, Kilrah said:

Yes, hence 

 

 

My bad. Sorry for missing this 🙏🙏

I'm seeing an error message in the container log:

error reading config.json

 

Did I make a mistake filling my info?

 

{
  "cloudflare": [
    {
      "authentication": {
        "api_token": "***************",
      },
      "zone_id": "eatingheads.com",
      "subdomains": [
        {
          "name": "",
          "proxied": true
        },
        {
          "name": "www",
          "proxied": true
        }
      ],
    },
    {
      "authentication": {
        "api_token": "******************",
      },
      "zone_id": "vicktoriasmirnoff.com",
      "subdomains": [
        {
          "name": "",
          "proxied": true
        },
        {
          "name": "www",
          "proxied": true
        }
      ],
    },
  ],
  "a": true,
  "aaaa": false,
  "purgeUnknownRecords": false
}

 

  • Author

There are a few stray commas, basically the last element in a block must not have one. Try this...

 

{
  "cloudflare": [
    {
      "authentication": {
        "api_token": "***************",
      },
      "zone_id": "eatingheads.com",
      "subdomains": [
        {
          "name": "",
          "proxied": true
        },
        {
          "name": "www",
          "proxied": true
        }
      ]
    },
    {
      "authentication": {
        "api_token": "******************",
      },
      "zone_id": "vicktoriasmirnoff.com",
      "subdomains": [
        {
          "name": "",
          "proxied": true
        },
        {
          "name": "www",
          "proxied": true
        }
      ]
    }
  ],
  "a": true,
  "aaaa": false,
  "purgeUnknownRecords": false
}

 

Thank you.

I tried to copy/paste the file info you just sent me and added my api tokens, but I'm still seeing the error message in the container log :(

Edited by mjeshurun

  • 3 months later...

If i may suggest everyone will start it first and will have the same problem, you could have saved some ppl some time and just write to it, "if you startet it before creating, remove folder." ;-)

 

Its very unusual that you need to do it before installing.

 

Could also be automatic be done?

 

and just btw, your provided config is (still) not working. you cant leave out the api key. but still twith that, it wont work. (i didnt found a working solu tion for multiple domains, and even the documentation doesnt show an example...)

Edited by nuhll

Ha i found it

 

{
  "cloudflare": [
    {
      "authentication": {
        "api_token": "XXXXXX",
        "api_key": {
          "api_key": "api_key_here",
          "account_email": "your_email_here"
        }
      },
      "zone_id": "XXX",
      "subdomains": [
        {
          "name": "",
          "proxied": true
        },
        {
          "name": "www",
          "proxied": true
        },
		{
          "name": "forum",
          "proxied": true
        }
      ],
	  "zone_id": "XXXXXX",
      "subdomains": [
        {
          "name": "",
          "proxied": true
        },
        {
          "name": "www",
          "proxied": true
        }
      ]
    }
  ],
  "a": true,
  "aaaa": true,
  "purgeUnknownRecords": false,
  "ttl": 300
}

 

just for the lolz, this config works that way that it wont complain about it, but it also will only update the first.... my head cant understand why you publish such a tool without proper guide and or... i opend a issue, for now i just create 22 different dockers xDxDxDxDxD xD

  • Author

I have one "authentication" section for each zone and it's fine. 

 

{
  "cloudflare": [
    {
      "authentication": {
          "api_token": "auth1"
      },
      "zone_id": "zone1",
      "subdomains": [
        {
            "name": "",
            "proxied": false
        },
        {
            "name": "sub1",
            "proxied": false
        }
      ]
    },
    {
      "authentication": {
          "api_token": "auth2"
      },
      "zone_id": "zone2",
      "subdomains": [
        {
            "name": "",
            "proxied": false
        },
        {
            "name": "sub1",
            "proxied": false
        },
        {
            "name": "sub2",
            "proxied": false
        }
      ]
    },
    {
      "authentication": {
          "api_token": "auth3"
      },
      "zone_id": "zone3",
      "subdomains": [
        {
            "name": "",
            "proxied": false
        },
        {
            "name": "sub1",
            "proxied": false
        }
      ]
    }
  ],
  "a": true,
  "aaaa": false,
  "purgeUnknownRecords": false,
  "ttl": 300
}

 

Edited by Kilrah

1 minute ago, Kilrah said:

I have one "authentication" section for each zone and it's fine. 

Can you please share an example of your config file? 🙏

  • Author

Just edited the post above

On 2/13/2023 at 2:39 PM, Kilrah said:

I have one "authentication" section for each zone and it's fine. 

 

{
  "cloudflare": [
    {
      "authentication": {
          "api_token": "auth1"
      },
      "zone_id": "zone1",
      "subdomains": [
        {
            "name": "",
            "proxied": false
        },
        {
            "name": "sub1",
            "proxied": false
        }
      ]
    },
    {
      "authentication": {
          "api_token": "auth2"
      },
      "zone_id": "zone2",
      "subdomains": [
        {
            "name": "",
            "proxied": false
        },
        {
            "name": "sub1",
            "proxied": false
        },
        {
            "name": "sub2",
            "proxied": false
        }
      ]
    },
    {
      "authentication": {
          "api_token": "auth3"
      },
      "zone_id": "zone3",
      "subdomains": [
        {
            "name": "",
            "proxied": false
        },
        {
            "name": "sub1",
            "proxied": false
        }
      ]
    }
  ],
  "a": true,
  "aaaa": false,
  "purgeUnknownRecords": false,
  "ttl": 300
}

 

 

Hi @Kilrah, thank you for posting an example of your config file.

I'm seeing the following error message repeatedly in the container's log, when I try to build my config file based on yours. Obviously, I used my own api-token and zone address.

For the sake of privacy I change the actual zone address in the log error quote to "********.com".

😡 Error sending 'GET' request to 'https://api.cloudflare.com/client/v4/zones/********.com':
{"result":null,"success":false,"errors":[{"code":7003,"message":"Could not route to /client/v4/zones/********.com, perhaps your object identifier is invalid?"}],"messages":[]}

 

Do you have any idea why this error is happening?

  • Author

I do get some occaisional Service Unavailable and other 404 and errors in the logs, seems the CF service isn't extremely reliable... 

See if it gets better with time. Of courrse check your zone id/token and that the token has the correct permissions on the zone.

8 hours ago, Kilrah said:

I do get some occaisional Service Unavailable and other 404 and errors in the logs, seems the CF service isn't extremely reliable... 

See if it gets better with time. Of courrse check your zone id/token and that the token has the correct permissions on the zone.

 

I've double checked my zone_id and the api_token password and they are correct.

Are these the correct token permissions I should set?

Zone Settings:Read, Zone:Read, DNS:Edit

 

  • Author

I've made 3 tokens that only have the DNS Edit, one for each zone:

 

sdfv.png.dbfda3cd145b32ae61bf9ebf4a130587.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.